libtranscript
|
This interface allows very limited control over the conversion and is only provided for systems without an iconv library. More...
Data Structures | |
struct | transcript_iconv_t |
An opaque handle representing the transcript_iconv state. More... | |
Functions | |
size_t | transcript_iconv (transcript_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
Perform conversion (iconv compatibility interface). More... | |
int | transcript_iconv_close (transcript_iconv_t cd) |
Close a converter (iconv compatibility interface). More... | |
transcript_iconv_t | transcript_iconv_open (const char *tocode, const char *fromcode) |
Open a converter (iconv compatibility interface). More... | |
This interface allows very limited control over the conversion and is only provided for systems without an iconv library.
To make the interface available, define TRANSCRIPT_ICONV_API
before including the transcript.h
header. If you want the interface to be available without the cc_
prefix, as well, define TRANSCRIPT_ICONV
instead.
size_t transcript_iconv | ( | transcript_iconv_t | cd, |
char ** | inbuf, | ||
size_t * | inbytesleft, | ||
char ** | outbuf, | ||
size_t * | outbytesleft | ||
) |
Perform conversion (iconv compatibility interface).
cd | The conversion state handle to use. |
inbuf | A double pointer to the input buffer. |
inbytesleft | A pointer to the number of bytes left in the input buffer. |
outbuf | A double pointer to the output buffer. |
outbytesleft | A pointer to the number of bytes left in the output buffer. |
(size_t) -1
on failure in which case it sets errno
.When inbuf is not NULL
, this function tries to convert the bytes in the input buffer. For each character converted, it updates inbuf, inbytesleft, outbuf and outbytesleft. errno
may be set to E2BIG
if there is not enough space in outbuf to convert all the bytes, EILSEQ
if an illegal sequence is encoutered in inbuf, or EINVAL
if the buffer ends with an incomplete sequence.
If inbuf is NULL
, the converter is reset to its initial state. If outbuf is not NULL
in this case, the converter writes the finishing bytes to the output to ensure a complete and legal conversion.
int transcript_iconv_close | ( | transcript_iconv_t | cd | ) |
Close a converter (iconv compatibility interface).
cd | The conversion state handle to clean up. |
0
on success, -1
on failure (sets errno
). transcript_iconv_t transcript_iconv_open | ( | const char * | tocode, |
const char * | fromcode | ||
) |
Open a converter (iconv compatibility interface).
tocode | Name of the character set to convert to. |
fromcode | Name of the character set to convert from. |
(transcript_iconv_t) -1
on error. On error, errno
is set appropriately.