diff options
author | Gerald Combs <gerald@wireshark.org> | 2023-09-22 13:42:49 -0700 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2023-09-24 19:05:10 +0000 |
commit | 8285a9775ff6b5a7ef853dadffa1363b380b0399 (patch) | |
tree | ef77e8b2059712538f1b84480896cb684a36a319 /wsutil/unicode-utils.c | |
parent | c8a725e54e0f426879c238401cae82b4dfc6918e (diff) |
Convert wsutil to C99 types
Ping #19116
Diffstat (limited to 'wsutil/unicode-utils.c')
-rw-r--r-- | wsutil/unicode-utils.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/wsutil/unicode-utils.c b/wsutil/unicode-utils.c index 10c13a62d9..4ed4b32639 100644 --- a/wsutil/unicode-utils.c +++ b/wsutil/unicode-utils.c @@ -43,10 +43,10 @@ int ws_utf8_seqlen[256] = { * are replaced with one REPLACMENT CHARACTER.) */ static inline size_t -utf_8_validate(const guint8 *start, ssize_t length, const guint8 **end) +utf_8_validate(const uint8_t *start, ssize_t length, const uint8_t **end) { - const guint8 *ptr = start; - guint8 ch; + const uint8_t *ptr = start; + uint8_t ch; size_t unichar_len, valid_bytes = 0; while (length > 0) { @@ -180,7 +180,7 @@ utf_8_validate(const guint8 *start, ssize_t length, const guint8 **end) * REPLACEMENT CHARACTER, whereas the Glib function replaces each byte of the * sequence with its own (3 octet) REPLACEMENT CHARACTER. * - * XXX: length should probably be a size_t instead of a gint in all + * XXX: length should probably be a size_t instead of a int in all * these encoding functions * XXX: the buffer returned can be of different length than the input, * and can have internal NULs as well (so that strlen doesn't give its @@ -190,7 +190,7 @@ utf_8_validate(const guint8 *start, ssize_t length, const guint8 **end) * REPLACEMENT CHARACTER was used.) */ wmem_strbuf_t * -ws_utf8_make_valid_strbuf(wmem_allocator_t *scope, const guint8 *ptr, ssize_t length) +ws_utf8_make_valid_strbuf(wmem_allocator_t *scope, const uint8_t *ptr, ssize_t length) { wmem_strbuf_t *str; @@ -202,7 +202,7 @@ ws_utf8_make_valid_strbuf(wmem_allocator_t *scope, const guint8 *ptr, ssize_t le * U+FFFD Substitution of Maximal Subparts. */ while (length > 0) { - const guint8 *prev = ptr; + const uint8_t *prev = ptr; size_t valid_bytes = utf_8_validate(prev, length, &ptr); if (valid_bytes) { @@ -218,8 +218,8 @@ ws_utf8_make_valid_strbuf(wmem_allocator_t *scope, const guint8 *ptr, ssize_t le return str; } -guint8 * -ws_utf8_make_valid(wmem_allocator_t *scope, const guint8 *ptr, ssize_t length) +uint8_t * +ws_utf8_make_valid(wmem_allocator_t *scope, const uint8_t *ptr, ssize_t length) { wmem_strbuf_t *str = ws_utf8_make_valid_strbuf(scope, ptr, length); return wmem_strbuf_finalize(str); @@ -286,10 +286,10 @@ utf_8to16(const char *utf8str) } void -utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt, ...) +utf_8to16_snprintf(TCHAR *utf16buf, int utf16buf_len, const char* fmt, ...) { va_list ap; - gchar* dst; + char* dst; va_start(ap,fmt); dst = ws_strdup_vprintf(fmt, ap); @@ -301,10 +301,10 @@ utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt, ...) } /* Convert from UTF-16 to UTF-8. */ -gchar * +char * utf_16to8(const wchar_t *utf16str) { - static gchar *utf8buf[3]; + static char *utf8buf[3]; static int utf8buf_len[3]; static int idx; |