27 #include <unicode/ustring.h>
28 #include <unicode/uchar.h>
39 buf8->
utf8 = (uint8_t *)
xmalloc(
sizeof(uint8_t) * capacity);
40 buf8->
utf8[0] = (uint8_t) 0;
51 buf8->
utf8[0] = (uint8_t) 0;
63 buf8->
utf8 = (uint8_t *)
xmalloc(
sizeof(uint8_t) * capacity);
66 = (uint8_t *)
xrealloc(buf8->
utf8,
sizeof(uint8_t) * capacity);
84 return (
const char *) src8->
utf8;
98 size_t src8cstr_len = 0;
99 int32_t utf16_len = 0;
101 *status = U_ZERO_ERROR;
102 src8cstr_len = strlen(src8cstr);
106 src8cstr, src8cstr_len, status);
109 if (*status == U_BUFFER_OVERFLOW_ERROR)
112 *status = U_ZERO_ERROR;
115 src8cstr, src8cstr_len, status);
118 if (U_SUCCESS(*status) && utf16_len <= dest16->utf16_cap)
137 if (*status == U_BUFFER_OVERFLOW_ERROR)
140 *status = U_ZERO_ERROR;
146 if (U_SUCCESS(*status) && utf8_len <= dest8->
utf8_cap)
Internal header for ICU utilities.
void icu_buf_utf8_destroy(struct icu_buf_utf8 *buf8)
struct icu_buf_utf16 * icu_buf_utf16_clear(struct icu_buf_utf16 *buf16)
UErrorCode icu_utf16_from_utf8_cstr(struct icu_buf_utf16 *dest16, const char *src8cstr, UErrorCode *status)
const char * icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8)
struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 *buf8, size_t capacity)
struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity)
struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 *buf16, size_t capacity)
UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 *dest8, const struct icu_buf_utf16 *src16, UErrorCode *status)
struct icu_buf_utf8 * icu_buf_utf8_clear(struct icu_buf_utf8 *buf8)
Header for memory handling functions.
#define xfree(x)
utility macro which calls xfree_f
#define xrealloc(o, x)
utility macro which calls xrealloc_f
#define xmalloc(x)
utility macro which calls malloc_f