blob: ba819a12dd55c3e2c2be3622646b37627405bba6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* ****************************************************************************
* Generic Conversion Interface.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey
* ************************************************************************* */
#include <cdefs.h>
#include <stddef.h>
/* This conversion interface converts from one character encoding to an other,
* using a handle and buffers.
*
* `iconv_t` is the conversion descriptor.
* Input and output encodings are defined once, while you're opening the
* conversion descriptor. If you want to change encodings, you will have to
* define a new conversion descriptor.
*
* If `iconv_open` fails, it returns (iconv_t)-1 and sets errno with the
* correct error code. */
typedef const void *iconv_t;
extern iconv_t iconv_open
_OF((const char *__tocode, const char *__fromcode));
extern int iconv_close
_OF((iconv_t __cd));
/* Here is the main conversion function.
* `inbuf` is a double pointer so that you know where the error occurred
* if there is one, and to progress further.
*
* Returns the number of output bytes, or (size_t)-1 if an error has
* occurred. */
extern size_t iconv
_OF((iconv_t __cd,
char **__inbuf, size_t *__inbytesleft,
char **__outbuf, size_t *__outbytesleft));
|