diff options
author | Michael Mann <mmann78@netscape.net> | 2013-09-15 01:48:30 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-09-15 01:48:30 +0000 |
commit | b38ee917b1953104c615056481d6df008ae94b53 (patch) | |
tree | 55024f9c53f083dc056540b6d887fc4550064008 /epan/dissectors/packet-sna.c | |
parent | a17cf67635c6e190c174bc131707804edca5c8f4 (diff) |
Convert proto_tree_add_uint_format to proto_tree_add_uint_format_value if hf_ field name is the first part of the formatted string. This was done with a perl script on the dissectors directory (packet-*.c), followed by manual inspection of the output. The manual inspection yielded a few cases that really should have been proto_tree_add_uint or proto_tree_add_item, so I updated them accordingly.
The script didn't catch as many as I would have liked, but it's a start.
The most common (ab)use of proto_tree_add_uint_format was for appending strings to CRC/checksum values to note good or bad CRC/checksum.
svn path=/trunk/; revision=52045
Diffstat (limited to 'epan/dissectors/packet-sna.c')
-rw-r--r-- | epan/dissectors/packet-sna.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index ca821808e7..694d8cc16d 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -1776,7 +1776,7 @@ dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { proto_tree *bf_tree; proto_item *bf_item; - guint8 th_0=0, daf=0, oaf=0; + guint8 th_0; const guint8 *ptr; unsigned int mpf, id; @@ -1786,26 +1786,22 @@ dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, mpf = mpf_value(th_0); if (tree) { - daf = tvb_get_guint8(tvb, 2); - oaf = tvb_get_guint8(tvb, 3); /* Byte 0 */ - bf_item = proto_tree_add_uint(tree, hf_sna_th_0, tvb, 0, 1, - th_0); + bf_item = proto_tree_add_item(tree, hf_sna_th_0, tvb, 0, 1, ENC_NA); bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); - proto_tree_add_uint(bf_tree, hf_sna_th_fid, tvb, 0, 1, th_0); - proto_tree_add_uint(bf_tree, hf_sna_th_mpf, tvb, 0, 1, th_0); - proto_tree_add_uint(bf_tree, hf_sna_th_odai,tvb, 0, 1, th_0); - proto_tree_add_uint(bf_tree, hf_sna_th_efi, tvb, 0, 1, th_0); + proto_tree_add_item(bf_tree, hf_sna_th_fid, tvb, 0, 1, ENC_NA); + proto_tree_add_item(bf_tree, hf_sna_th_mpf, tvb, 0, 1, ENC_NA); + proto_tree_add_item(bf_tree, hf_sna_th_odai,tvb, 0, 1, ENC_NA); + proto_tree_add_item(bf_tree, hf_sna_th_efi, tvb, 0, 1, ENC_NA); /* Byte 1 */ proto_tree_add_text(tree, tvb, 1, 1, "Reserved"); /* Byte 2 */ - proto_tree_add_uint_format(tree, hf_sna_th_daf, tvb, 2, 1, daf, - "Destination Address Field: 0x%02x", daf); + proto_tree_add_item(tree, hf_sna_th_daf, tvb, 2, 1, ENC_NA); } /* Set DST addr */ @@ -1813,11 +1809,8 @@ dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr); SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID2_ADDR_LEN, ptr); - if (tree) { - /* Byte 3 */ - proto_tree_add_uint_format(tree, hf_sna_th_oaf, tvb, 3, 1, oaf, - "Origin Address Field: 0x%02x", oaf); - } + /* Byte 3 */ + proto_tree_add_item(tree, hf_sna_th_oaf, tvb, 3, 1, ENC_NA); /* Set SRC addr */ ptr = tvb_get_ptr(tvb, 3, SNA_FID2_ADDR_LEN); @@ -1825,17 +1818,16 @@ dissect_fid2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID2_ADDR_LEN, ptr); id = tvb_get_ntohs(tvb, 4); - if (tree) - proto_tree_add_uint(tree, hf_sna_th_snf, tvb, 4, 2, id); + proto_tree_add_item(tree, hf_sna_th_snf, tvb, 4, 2, ENC_BIG_ENDIAN); if (mpf != MPF_WHOLE_BIU && !sna_defragment) { if (mpf == MPF_FIRST_SEGMENT) { *continue_dissecting = rh_only; - } else { + } else { *continue_dissecting = stop_here; - } + } - } + } else if (sna_defragment) { *rh_tvb_ptr = defragment_by_sequence(pinfo, tvb, bytes_in_header, mpf, id); |