diff options
author | Michael Mann <mmann78@netscape.net> | 2015-06-03 23:18:42 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-06-04 06:23:54 +0000 |
commit | 8ccf65bfb2444ce1cb3c4d0819d9657fface9fe9 (patch) | |
tree | 2b3277d154d739930d6e7aace00f776d28a1761c /epan/dissectors/packet-ber.c | |
parent | 524ed1df6e6126cd63ba419ccb82c83636d77ee4 (diff) |
Eliminate proto_tree_add_text from a few dissectors.
Change-Id: Ia6b62fae76ae76a2859ec47229e1c299bddb5a31
Reviewed-on: https://code.wireshark.org/review/8749
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r-- | epan/dissectors/packet-ber.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index f4f53c5914..a6533c66c4 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -125,6 +125,7 @@ static gint hf_ber_arbitrary = -1; /* BIT_STRING */ /* Generated from convert_proto_tree_add_text.pl */ static int hf_ber_seq_of_eoc = -1; +static int hf_ber_64bit_uint_as_bytes = -1; static int hf_ber_choice_eoc = -1; static int hf_ber_seq_field_eoc = -1; static int hf_ber_seq_eoc = -1; @@ -1884,21 +1885,14 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im /* we can't handle integers > 64 bits */ /* take into account the use case of a 64bits unsigned integer: you will have a 9th byte set to 0 */ if ((len > 9) || ((len == 9) && (first != 0))) { - header_field_info *hfinfo; - proto_item *pi = NULL; - if (hf_id >= 0) { - hfinfo = proto_registrar_get_nth(hf_id); - pi = proto_tree_add_text(tree, tvb, offset, len, "%s : 0x", hfinfo->name); - } - if (pi) { - for (i=0; i<len; i++) { - proto_item_append_text(pi, "%02x", tvb_get_guint8(tvb, offset)); - offset++; - } - } else { - offset += len; + header_field_info *hfinfo = proto_registrar_get_nth(hf_id); + + proto_tree_add_bytes_format(tree, hf_ber_64bit_uint_as_bytes, tvb, offset, len, + "%s : 0x%s", hfinfo->name, tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, len)); } + + offset += len; return offset; } @@ -4409,6 +4403,7 @@ proto_register_ber(void) { &hf_ber_set_eoc, { "SET EOC", "ber.set_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ber_choice_eoc, { "CHOICE EOC", "ber.choice_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ber_seq_of_eoc, { "SEQ OF EOC", "ber.seq_of_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ber_64bit_uint_as_bytes, { "64bits unsigned integer", "ber.64bit_uint_as_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; |