[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new modules uniconv/u{8,16,32}-conv-to-enc
From: |
Bruno Haible |
Subject: |
new modules uniconv/u{8,16,32}-conv-to-enc |
Date: |
Sat, 9 Jun 2007 23:54:32 +0200 |
User-agent: |
KMail/1.5.4 |
The uniconv.h file was lacking a conversion function from not NUL terminated
Unicode strings to given encodings. This adds them.
2007-06-09 Bruno Haible <address@hidden>
* modules/uniconv/u32-conv-to-enc: New file.
* lib/uniconv/u32-conv-to-enc.c: New file.
* modules/uniconv/u32-conv-to-enc-tests: New file.
* tests/uniconv/test-u32-conv-to-enc.c: New file.
* modules/uniconv/u16-conv-to-enc: New file.
* lib/uniconv/u16-conv-to-enc.c: New file.
* lib/uniconv/u-conv-to-enc.h: New file.
* modules/uniconv/u16-conv-to-enc-tests: New file.
* tests/uniconv/test-u16-conv-to-enc.c: New file.
* modules/uniconv/u8-conv-to-enc: New file.
* lib/uniconv/u8-conv-to-enc.c: New file.
* modules/uniconv/u8-conv-to-enc-tests: New file.
* tests/uniconv/test-u8-conv-to-enc.c: New file.
* lib/uniconv.h (u8_conv_to_encoding, u16_conv_to_encoding,
u32_conv_to_encoding): New declarations.
*** lib/uniconv.h 27 Jan 2007 00:39:07 -0000 1.1
--- lib/uniconv.h 9 Jun 2007 21:44:49 -0000
***************
*** 76,81 ****
--- 76,118 ----
size_t *offsets,
uint32_t **resultp, size_t *lengthp);
+ /* Converts an entire Unicode string, possibly including NUL units, from a
+ Unicode encoding to a given encoding.
+ Converts a memory region to encoding TOCODE. TOCODE is as for
+ iconv_open(3).
+ The input is in the memory region between SRC (inclusive) and SRC + SRCLEN
+ (exclusive).
+ 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.
+ Return value: 0 if successful, otherwise -1 and errno set.
+ If successful: The resulting string is stored in *RESULTP and its length
+ in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is
+ unchanged if no dynamic memory allocation was necessary.
+ Particular errno values: EINVAL, EILSEQ, ENOMEM. */
+ extern int
+ u8_conv_to_encoding (const char *tocode,
+ enum iconv_ilseq_handler handler,
+ const uint8_t *src, size_t srclen,
+ size_t *offsets,
+ char **resultp, size_t *lengthp);
+ extern int
+ u16_conv_to_encoding (const char *tocode,
+ enum iconv_ilseq_handler handler,
+ const uint16_t *src, size_t srclen,
+ size_t *offsets,
+ char **resultp, size_t *lengthp);
+ extern int
+ u32_conv_to_encoding (const char *tocode,
+ enum iconv_ilseq_handler handler,
+ const uint32_t *src, size_t srclen,
+ size_t *offsets,
+ char **resultp, size_t *lengthp);
+
/* Converts a NUL terminated string from a given encoding.
The result is malloc allocated, or NULL (with errno set) in case of error.
Particular errno values: EILSEQ, ENOMEM. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- new modules uniconv/u{8,16,32}-conv-to-enc,
Bruno Haible <=