X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstriconveh.h;h=97a377a6538cb12f8a52ff7733e15e7921a6d0d8;hb=5d0b385594bc914e6233988bfb6bc1b92a2184b5;hp=3dc153955b908c217363d9e78828093515f0fa17;hpb=826fd3d7e36c3538595e9eacad8517040812b99b;p=gnulib.git diff --git a/lib/striconveh.h b/lib/striconveh.h index 3dc153955..97a377a65 100644 --- a/lib/striconveh.h +++ b/lib/striconveh.h @@ -42,11 +42,16 @@ enum iconv_ilseq_handler /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. - The conversion descriptor from FROMCODE to TOCODE is passed as CD. + CD is the conversion descriptor from FROMCODE to TOCODE, or (iconv_t)(-1) if + the system does not support a direct conversion from FROMCODE to TOCODE. CD1 is the conversion descriptor from FROM_CODESET to UTF-8 (or (iconv_t)(-1) if FROM_CODESET is UTF-8). CD2 is the conversion descriptor from UTF-8 to TO_CODESET (or (iconv_t)(-1) if TO_CODESET is UTF-8). + If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this + array is filled with offsets into the result, i.e. the character starting + at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], + and other offsets are set to (size_t)(-1). *RESULTP and *LENGTH should initially be a scratch buffer and its size, or *RESULTP can initially be NULL. May erase the contents of the memory at *RESULTP. @@ -58,13 +63,15 @@ extern int mem_cd_iconveh (const char *src, size_t srclen, iconv_t cd, iconv_t cd1, iconv_t cd2, enum iconv_ilseq_handler handler, + size_t *offsets, char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. The original string is the NUL-terminated string starting at SRC. - The conversion descriptor is passed as CD. Both the "from" and the "to" - encoding must use a single NUL byte at the end of the string (i.e. not - UCS-2, UCS-4, UTF-16, UTF-32). + CD is the conversion descriptor from FROMCODE to TOCODE, or (iconv_t)(-1) if + the system does not support a direct conversion from FROMCODE to TOCODE. + Both the "from" and the "to" encoding must use a single NUL byte at the end + of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). CD1 is the conversion descriptor from FROM_CODESET to UTF-8 (or (iconv_t)(-1) if FROM_CODESET is UTF-8). CD2 is the conversion descriptor from UTF-8 to TO_CODESET (or (iconv_t)(-1) @@ -81,8 +88,10 @@ extern char * /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. - Both the "from" and the "to" encoding must use a single NUL byte at the - end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). + If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this + array is filled with offsets into the result, i.e. the character starting + at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], + and other offsets are set to (size_t)(-1). *RESULTP and *LENGTH should initially be a scratch buffer and its size, or *RESULTP can initially be NULL. May erase the contents of the memory at *RESULTP. @@ -94,6 +103,7 @@ extern int mem_iconveh (const char *src, size_t srclen, const char *from_codeset, const char *to_codeset, enum iconv_ilseq_handler handler, + size_t *offsets, char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv.