diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-04-25 01:31:08 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-04-25 08:32:06 +0000 |
commit | 6a9c924460c96ac722c3a05e12206a626cdace38 (patch) | |
tree | 28105519bfcf0152c99f3dd059c1e2f1372a2bcb /epan/charsets.h | |
parent | a4ff0bc5d2d9296b958ca195e2ecb373c70866fa (diff) |
Move the XXX-to-UTF-8 loops to routines in epan/charsets.c.
This moves a bunch of character set knowledge into epan/charsets.c.
Change-Id: Ieb79dcaac9753c77703af756b666ad2ca9385d9e
Reviewed-on: https://code.wireshark.org/review/1339
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/charsets.h')
-rw-r--r-- | epan/charsets.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/epan/charsets.h b/epan/charsets.h index 40ec9d9034..ff7ea0856a 100644 --- a/epan/charsets.h +++ b/epan/charsets.h @@ -37,12 +37,6 @@ void EBCDIC_to_ASCII(guint8 *buf, guint bytes); WS_DLL_PUBLIC guint8 EBCDIC_to_ASCII1(guint8 c); -WS_DLL_PUBLIC gunichar -GSM_to_UNICHAR(guint8 c); - -WS_DLL_PUBLIC gunichar -GSMext_to_UNICHAR(guint8 c); - /* * Translation tables that map the upper 128 code points in single-byte * "extended ASCII" character encodings to Unicode code points in the @@ -74,6 +68,41 @@ extern const gunichar2 charset_table_mac_roman[0x80]; /* Tables for DOS code pages */ extern const gunichar2 charset_table_cp437[0x80]; +/* + * Given a wmem scope, a pointer, and a length, treat the string of bytes + * referred to by the pointer and length as an ASCII string, with all bytes + * with the high-order bit set being invalid, and return a pointer to a + * UTF-8 string, allocated using the wmem scope. + * + * Octets with the highest bit set will be converted to the Unicode + * REPLACEMENT CHARACTER. + */ +WS_DLL_PUBLIC guint8 * +get_ascii_string(wmem_allocator_t *scope, const guint8 *ptr, gint length); + +WS_DLL_PUBLIC guint8 * +get_8859_1_string(wmem_allocator_t *scope, const guint8 *ptr, gint length); + +WS_DLL_PUBLIC guint8 * +get_unichar2_string(wmem_allocator_t *scope, const guint8 *ptr, gint length, const gunichar2 table[0x80]); + +WS_DLL_PUBLIC guint8 * +get_ucs_2_string(wmem_allocator_t *scope, const guint8 *ptr, gint length, const guint encoding); + +WS_DLL_PUBLIC guint8 * +get_utf_16_string(wmem_allocator_t *scope, const guint8 *ptr, gint length, const guint encoding); + +WS_DLL_PUBLIC guint8 * +get_ucs_4_string(wmem_allocator_t *scope, const guint8 *ptr, gint length, const guint encoding); + +WS_DLL_PUBLIC guint8 * +get_ts_23_038_7bits_string(wmem_allocator_t *scope, const guint8 *ptr, + const gint bit_offset, gint no_of_chars); + +WS_DLL_PUBLIC guint8 * +get_ascii_7bits_string(wmem_allocator_t *scope, const guint8 *ptr, + const gint bit_offset, gint no_of_chars); + #ifdef __cplusplus } #endif /* __cplusplus */ |