diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-04-12 15:26:34 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-04-12 22:27:22 +0000 |
commit | cb16dff992c3844936bf5829f19e5a5247458503 (patch) | |
tree | 901b7be3379f5b94f150de71d1c0f3e2fa2d12e4 /ui/decode_as_utils.c | |
parent | ef8a0a2ce172810d48371eb65c73b1bd4a6303ca (diff) |
Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it. Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.
Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.
Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/decode_as_utils.c')
-rw-r--r-- | ui/decode_as_utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/decode_as_utils.c b/ui/decode_as_utils.c index 1463af7a72..7f5405a403 100644 --- a/ui/decode_as_utils.c +++ b/ui/decode_as_utils.c @@ -130,7 +130,7 @@ read_set_decode_as_entries(gchar *key, const gchar *value, } if (is_valid) { - if (selector_type == FT_STRING || selector_type == FT_STRINGZ) { + if (IS_FT_STRING(selector_type)) { dissector_change_string(values[0], values[1], lookup.handle); } else { dissector_change_uint(values[0], atoi(values[1]), lookup.handle); @@ -191,6 +191,8 @@ decode_build_reset_list (const gchar *table_name, ftenum_t selector_type, case FT_STRING: case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: item->ddi_selector.sel_string = (char *)key; break; @@ -223,6 +225,8 @@ decode_clear_all(void) case FT_STRING: case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: dissector_reset_string(item->ddi_table_name, item->ddi_selector.sel_string); break; |