diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-04-12 01:53:33 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-04-12 08:54:06 +0000 |
commit | ae127f23fad7ad085793b1a8cbe931e6c6c82626 (patch) | |
tree | 055f3ad9c39276dd5c611a06e97295917034c6df | |
parent | 538429cc758f04653da080c8d654ab0cc30e92c1 (diff) |
Add Mac Roman and DOS CP437.
Change-Id: Ib96f2cf4ea71cd0cc2c703d58b9d254bf4c1248a
Reviewed-on: https://code.wireshark.org/review/1077
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/charsets.c | 40 | ||||
-rw-r--r-- | epan/charsets.h | 6 | ||||
-rw-r--r-- | epan/proto.h | 2 | ||||
-rw-r--r-- | epan/tvbuff.c | 16 |
4 files changed, 64 insertions, 0 deletions
diff --git a/epan/charsets.c b/epan/charsets.c index 70cb7b4348..9774404c0b 100644 --- a/epan/charsets.c +++ b/epan/charsets.c @@ -475,6 +475,46 @@ const gunichar2 charset_table_cp1250[0x80] = { 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, /* - 0xFF */ }; +/* generated by ./make_charset_table MACROMAN */ +/* That's "MacRoman", not "Macro Man" (faster than a speeding recursive expansion!) */ +const gunichar2 charset_table_mac_roman[0x80] = { + 0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1, /* 0x80 - */ + 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8, /* - 0x8F */ + 0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3, /* 0x90 - */ + 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc, /* - 0x9F */ + 0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df, /* 0xA0 - */ + 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8, /* - 0xAF */ + 0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211, /* 0xB0 - */ + 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x00e6, 0x00f8, /* - 0xBF */ + 0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab, /* 0xC0 - */ + 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153, /* - 0xCF */ + 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca, /* 0xD0 - */ + 0x00ff, 0x0178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02, /* - 0xDF */ + 0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1, /* 0xE0 - */ + 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4, /* - 0xEF */ + 0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc, /* 0xF0 - */ + 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7, /* - 0xFF */ +}; + +/* generated by ./make_charset_table CP437 */ +const gunichar2 charset_table_cp437[0x80] = { + 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, /* 0x80 - */ + 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, /* - 0x8F */ + 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, /* 0x90 - */ + 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, /* - 0x9F */ + 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, /* 0xA0 - */ + 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, /* - 0xAF */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 - */ + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, /* - 0xBF */ + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, /* 0xC0 - */ + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, /* - 0xCF */ + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, /* 0xD0 - */ + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, /* - 0xDF */ + 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, /* 0xE0 - */ + 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, /* - 0xEF */ + 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, /* 0xF0 - */ + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0, /* - 0xFF */ +}; /* * Editor modelines - http://www.wireshark.org/tools/modelines.html diff --git a/epan/charsets.h b/epan/charsets.h index 69b3fb3940..8b6f752b8b 100644 --- a/epan/charsets.h +++ b/epan/charsets.h @@ -62,6 +62,12 @@ extern const gunichar2 charset_table_iso_8859_14[0x80]; extern const gunichar2 charset_table_iso_8859_15[0x80]; extern const gunichar2 charset_table_iso_8859_16[0x80]; +/* Tables for Mac character sets */ +extern const gunichar2 charset_table_mac_roman[0x80]; + +/* Tables for DOS code pages */ +extern const gunichar2 charset_table_cp437[0x80]; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/epan/proto.h b/epan/proto.h index 00126baa67..b34443a2c7 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -307,6 +307,8 @@ WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *messa #define ENC_WINDOWS_1250 0x0000002A #define ENC_3GPP_TS_23_038_7BITS 0x0000002C #define ENC_EBCDIC 0x0000002E +#define ENC_MAC_ROMAN 0x00000030 +#define ENC_CP437 0x00000032 /* * TODO: diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 21c9f8f3c5..91e2202be2 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -2497,6 +2497,14 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, strbuf = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp1250); break; + case ENC_MAC_ROMAN: + strbuf = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_mac_roman); + break; + + case ENC_CP437: + strbuf = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp437); + break; + case ENC_3GPP_TS_23_038_7BITS: { gint bit_offset = offset << 3; @@ -2796,6 +2804,14 @@ tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, g strptr = tvb_get_stringz_unichar2(scope, tvb, offset, lengthp, charset_table_cp1250); break; + case ENC_MAC_ROMAN: + strptr = tvb_get_stringz_unichar2(scope, tvb, offset, lengthp, charset_table_mac_roman); + break; + + case ENC_CP437: + strptr = tvb_get_stringz_unichar2(scope, tvb, offset, lengthp, charset_table_cp437); + break; + case ENC_3GPP_TS_23_038_7BITS: REPORT_DISSECTOR_BUG("TS 23.038 7bits has no null character and doesn't support null-terminated strings"); break; |