diff options
author | Michael Mann <mmann78@netscape.net> | 2016-12-13 14:26:27 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-12-13 22:56:50 +0000 |
commit | b7f4e250599d7ea0452711d388c161fd4ef61c60 (patch) | |
tree | 0eb636cef1c72912cef640148b680d8ddabbed2d /epan/dissectors/packet-nbt.c | |
parent | a869ec6f55160622a90bc437517dee91d57f85d5 (diff) |
Adjust proto_tree_add_uint_format_value calls to use unit string
Several calls to proto_tree_add_uint_format_value could be better served
using BASE_UNIT_STRING with a "unit string" in hf_ field. There also
a few cases where proto_tree_add_uint_format_value could just be
proto_tree_add_uint.
Added a few more "common" unit string values to unit_strings.[ch]
Change-Id: Iaedff82c515269c9c31ab9100dff19f5563c932d
Reviewed-on: https://code.wireshark.org/review/19242
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-nbt.c')
-rw-r--r-- | epan/dissectors/packet-nbt.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c index d4df6f8a76..3ddc935e2b 100644 --- a/epan/dissectors/packet-nbt.c +++ b/epan/dissectors/packet-nbt.c @@ -1244,20 +1244,14 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U case NBDS_DIRECT_UNIQUE: case NBDS_DIRECT_GROUP: case NBDS_BROADCAST: - if (tree) { - header.dgm_length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(nbdgm_tree, hf_nbdgm_datagram_length, - tvb, offset, 2, header.dgm_length, - "%u bytes", header.dgm_length); - } + header.dgm_length = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(nbdgm_tree, hf_nbdgm_datagram_length, + tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - if (tree) { - header.pkt_offset = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(nbdgm_tree, hf_nbdgm_packet_offset, - tvb, offset, 2, header.pkt_offset, - "%u bytes", header.pkt_offset); - } + header.pkt_offset = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(nbdgm_tree, hf_nbdgm_packet_offset, + tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN); @@ -1969,11 +1963,11 @@ proto_register_nbt(void) NULL, HFILL }}, { &hf_nbdgm_datagram_length, { "Datagram length", "nbdgm.dgram_len", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_nbdgm_packet_offset, { "Packet offset", "nbdgm.pkt_offset", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_nbdgm_error_code, { "Error code", "nbdgm.error_code", |