diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2016-07-17 18:24:45 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-07-20 03:00:52 +0000 |
commit | 29a98d1c7f09cba3a1e20ae6bfce76cf13e134fe (patch) | |
tree | 6a7c5af0efefddbcb8beb45aeac793dd30d54059 /epan/proto.c | |
parent | 83174a207994c5d30c24e7907fffdc3644a52557 (diff) |
Allow BASE_NONE (with strings conversion) for integral values again.
This mostly reverts SVN rev 43412 (3fa645481f82e32d5ad01ebce9c482c4edae31ae)
with the addition of documenting that FT_*INT*'s with BASE_NONE and a
FIELDCONVERT tells the Wireshark core that the field's numeric value is
meaningless and should not be shown to the user.
Use BASE_NONE again with the expert info group and severity fields. This
(finally) resolves the complaint from:
https://www.wireshark.org/lists/wireshark-dev/201206/msg00188.html
(yes, this mail's been sitting in my "todo" pile since then! <sigh>)
Change-Id: I1c6dd2864e7a2e959c97c409f277853af74a8d93
Reviewed-on: https://code.wireshark.org/review/16518
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c index aa457649b3..268e443221 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -6526,12 +6526,16 @@ tmp_fld_check_assert(header_field_info *hfinfo) wmem_free(NULL, tmp_str); break; } + /* Require integral types (other than frame number, * which is always displayed in decimal) to have a * number base. - * If there is a strings value then this base is not - * normally used except when constructing a display - * filter for a value not found in the strings lookup. + * + * If the display value is BASE_NONE and there is a + * strings conversion then the dissector writer is + * telling us that the field's numerical value is + * meaningless; we'll avoid showing the value to the + * user. */ switch (hfinfo->display & FIELD_DISPLAY_E_MASK) { case BASE_DEC: @@ -6541,6 +6545,14 @@ tmp_fld_check_assert(header_field_info *hfinfo) case BASE_HEX_DEC: case BASE_CUSTOM: /* hfinfo_numeric_value_format() treats this as decimal */ break; + case BASE_NONE: + if (hfinfo->strings == NULL) + g_error("Field '%s' (%s) is an integral value (%s)" + " but is being displayed as BASE_NONE but" + " without a strings conversion", + hfinfo->name, hfinfo->abbrev, + ftype_name(hfinfo->type)); + break; default: tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)"); g_error("Field '%s' (%s) is an integral value (%s)" |