Libparserutils
|
UTF-16 manipulation functions (implementation). More...
Go to the source code of this file.
Functions | |
parserutils_error | parserutils_charset_utf16_to_ucs4 (const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen) |
Convert a UTF-16 sequence into a single UCS-4 character. | |
parserutils_error | parserutils_charset_utf16_from_ucs4 (uint32_t ucs4, uint8_t *s, size_t *len) |
Convert a single UCS-4 character into a UTF-16 sequence. | |
parserutils_error | parserutils_charset_utf16_length (const uint8_t *s, size_t max, size_t *len) |
Calculate the length (in characters) of a bounded UTF-16 string. | |
parserutils_error | parserutils_charset_utf16_char_byte_length (const uint8_t *s, size_t *len) |
Calculate the length (in bytes) of a UTF-16 character. | |
parserutils_error | parserutils_charset_utf16_prev (const uint8_t *s, uint32_t off, uint32_t *prevoff) |
Find previous legal UTF-16 char in string. | |
parserutils_error | parserutils_charset_utf16_next (const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) |
Find next legal UTF-16 char in string. | |
parserutils_error | parserutils_charset_utf16_next_paranoid (const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) |
Find next legal UTF-16 char in string. |
UTF-16 manipulation functions (implementation).
Definition in file utf16.c.
parserutils_error parserutils_charset_utf16_char_byte_length | ( | const uint8_t * | s, |
size_t * | len ) |
Calculate the length (in bytes) of a UTF-16 character.
s | Pointer to start of character |
len | Pointer to location to receive length |
Definition at line 133 of file utf16.c.
References len, PARSERUTILS_BADPARM, and PARSERUTILS_OK.
parserutils_error parserutils_charset_utf16_from_ucs4 | ( | uint32_t | ucs4, |
uint8_t * | s, | ||
size_t * | len ) |
Convert a single UCS-4 character into a UTF-16 sequence.
ucs4 | The character to process (0 <= c <= 0x7FFFFFFF) (host endian) |
s | Pointer to 4 byte long output buffer |
len | Pointer to location to receive length of multibyte sequence |
Definition at line 70 of file utf16.c.
References len, PARSERUTILS_BADPARM, PARSERUTILS_INVALID, and PARSERUTILS_OK.
Referenced by charset_utf16_codec_encode().
parserutils_error parserutils_charset_utf16_length | ( | const uint8_t * | s, |
size_t | max, | ||
size_t * | len ) |
Calculate the length (in characters) of a bounded UTF-16 string.
s | The string |
max | Maximum length |
len | Pointer to location to receive length of string |
Definition at line 102 of file utf16.c.
References len, max, PARSERUTILS_BADPARM, and PARSERUTILS_OK.
parserutils_error parserutils_charset_utf16_next | ( | const uint8_t * | s, |
uint32_t | len, | ||
uint32_t | off, | ||
uint32_t * | nextoff ) |
Find next legal UTF-16 char in string.
s | The string (assumed valid) |
len | Maximum offset in string |
off | Offset in the string to start at |
nextoff | Pointer to location to receive offset of first byte of next legal character |
Definition at line 186 of file utf16.c.
References len, PARSERUTILS_BADPARM, and PARSERUTILS_OK.
parserutils_error parserutils_charset_utf16_next_paranoid | ( | const uint8_t * | s, |
uint32_t | len, | ||
uint32_t | off, | ||
uint32_t * | nextoff ) |
Find next legal UTF-16 char in string.
s | The string (assumed to be of dubious validity) |
len | Maximum offset in string |
off | Offset in the string to start at |
nextoff | Pointer to location to receive offset of first byte of next legal character |
Definition at line 214 of file utf16.c.
References len, PARSERUTILS_BADPARM, PARSERUTILS_NEEDDATA, and PARSERUTILS_OK.
Referenced by charset_utf16_codec_read_char().
parserutils_error parserutils_charset_utf16_prev | ( | const uint8_t * | s, |
uint32_t | off, | ||
uint32_t * | prevoff ) |
Find previous legal UTF-16 char in string.
s | The string |
off | Offset in the string to start at |
prevoff | Pointer to location to receive offset of first byte of previous legal character |
Definition at line 158 of file utf16.c.
References PARSERUTILS_BADPARM, and PARSERUTILS_OK.
parserutils_error parserutils_charset_utf16_to_ucs4 | ( | const uint8_t * | s, |
size_t | len, | ||
uint32_t * | ucs4, | ||
size_t * | clen ) |
Convert a UTF-16 sequence into a single UCS-4 character.
s | The sequence to process |
len | Length of sequence in bytes |
ucs4 | Pointer to location to receive UCS-4 character (host endian) |
clen | Pointer to location to receive byte length of UTF-16 sequence |
Definition at line 27 of file utf16.c.
References len, PARSERUTILS_BADPARM, PARSERUTILS_INVALID, PARSERUTILS_NEEDDATA, and PARSERUTILS_OK.
Referenced by charset_utf16_codec_read_char().