summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Young <jyoung@gsu.edu>2017-05-28 01:11:46 -0500
committerMichael Mann <mmann78@netscape.net>2017-05-28 15:15:18 +0000
commit24d991dab493d249167e913c652ef463cfcd5245 (patch)
tree6e20b1178dd9e06e381e6f1039b45637ea9febda
parent827cb68298032a3e3970fbaf9c3378822c43bd00 (diff)
downloadwireshark-24d991dab493d249167e913c652ef463cfcd5245.tar.gz
Fixup support of BASE_UNIT_STRING for 64 bit based integer fields
proto.c’s proto_custom_set() was missing a test for BASE_UNIT_STRING under the 64 bit based integer case. Any custom columns sourced from a field stored in a 64 bit integer and having the BASE_UNIT_STRING attribute would only display the units but not the actual number. With this patch 64 bit based integer fields having the BASE_UNIT_STRING attribute will now properly display both their value and units when added to the packet list as a custom column. Change-Id: Icb9532771eb2f4098891dedd82886fd6223ce7a6 Reviewed-on: https://code.wireshark.org/review/21771 Petri-Dish: Jim Young <jim.young.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/proto.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/epan/proto.c b/epan/proto.c
index c14110f7e5..913e540879 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -5512,13 +5512,19 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
fmtfunc64(tmp, number64);
offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
} else if (hfinfo->strings) {
- number_out = hf_str_val = hf_try_val64_to_str(number64, hfinfo);
-
- if (!number_out)
- number_out = hfinfo_number_value_format_display64(hfinfo, hfinfo->display, number_buf, number64);
+ if (hfinfo->display & BASE_UNIT_STRING) {
+ number_out = hfinfo_numeric_value_format64(hfinfo, number_buf, number64);
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ hf_str_val = hf_try_val64_to_str(number64, hfinfo);
+ offset_r += protoo_strlcpy(result+offset_r, hf_str_val, size-offset_r);
+ } else {
+ number_out = hf_str_val = hf_try_val64_to_str(number64, hfinfo);
- offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ if (!number_out)
+ number_out = hfinfo_number_value_format_display64(hfinfo, hfinfo->display, number_buf, number64);
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ }
} else {
number_out = hfinfo_number_value_format64(hfinfo, number_buf, number64);