~ubuntu-branches/ubuntu/raring/flac/raring

« back to all changes in this revision

Viewing changes to src/share/utf8/iconvert.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-12-06 16:57:20 UTC
  • mto: (8.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20071206165720-4przr8grn6ha3e3a
Tags: upstream-1.2.1
ImportĀ upstreamĀ versionĀ 1.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
 
3
 * 
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 * 
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 */
 
18
 
 
19
#if HAVE_CONFIG_H
 
20
#  include <config.h>
 
21
#endif
 
22
 
 
23
#ifdef HAVE_ICONV
 
24
 
 
25
/*
 
26
 * Convert data from one encoding to another. Return:
 
27
 *
 
28
 *  -2 : memory allocation failed
 
29
 *  -1 : unknown encoding
 
30
 *   0 : data was converted exactly
 
31
 *   1 : data was converted inexactly
 
32
 *   2 : data was invalid (but still converted)
 
33
 *
 
34
 * We convert in two steps, via UTF-8, as this is the only
 
35
 * reliable way of distinguishing between invalid input
 
36
 * and valid input which iconv refuses to transliterate.
 
37
 * We convert from UTF-8 twice, because we have no way of
 
38
 * knowing whether the conversion was exact if iconv returns
 
39
 * E2BIG (due to a bug in the specification of iconv).
 
40
 * An alternative approach is to assume that the output of
 
41
 * iconv is never more than 4 times as long as the input,
 
42
 * but I prefer to avoid that assumption if possible.
 
43
 */
 
44
 
 
45
int iconvert(const char *fromcode, const char *tocode,
 
46
             const char *from, size_t fromlen,
 
47
             char **to, size_t *tolen) ;
 
48
 
 
49
#endif /* HAVE_ICONV */