From b38ee917b1953104c615056481d6df008ae94b53 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 15 Sep 2013 01:48:30 +0000 Subject: 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 --- epan/dissectors/packet-dnp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'epan/dissectors/packet-dnp.c') diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 9c1c548ee1..6d8bdce4a2 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -2943,8 +2943,8 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; /* Add Control Byte Subtree */ - tc = proto_tree_add_uint_format(dl_tree, hf_dnp3_ctl, tvb, offset, 1, dl_ctl, - "Control: 0x%02x (", dl_ctl); + tc = proto_tree_add_uint_format_value(dl_tree, hf_dnp3_ctl, tvb, offset, 1, dl_ctl, + "0x%02x (", dl_ctl); /* Add Text to Control Byte Subtree Header */ if (dl_prm) { if (dl_ctl & DNP3_CTL_DIR) proto_item_append_text(tc, "DIR, "); @@ -2987,16 +2987,16 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dl_crc = tvb_get_letohs(tvb, offset); calc_dl_crc = calculateCRC(tvb_get_ptr(tvb, 0, DNP_HDR_LEN - 2), DNP_HDR_LEN - 2); if (dl_crc == calc_dl_crc) - proto_tree_add_uint_format(dl_tree, hf_dnp_hdr_CRC, tvb, offset, 2, - dl_crc, "CRC: 0x%04x [correct]", dl_crc); + proto_tree_add_uint_format_value(dl_tree, hf_dnp_hdr_CRC, tvb, offset, 2, + dl_crc, "0x%04x [correct]", dl_crc); else { proto_item *hidden_item; hidden_item = proto_tree_add_boolean(dl_tree, hf_dnp_hdr_CRC_bad, tvb, offset, 2, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_uint_format(dl_tree, hf_dnp_hdr_CRC, tvb, offset, 2, - dl_crc, "CRC: 0x%04x [incorrect, should be 0x%04x]", + proto_tree_add_uint_format_value(dl_tree, hf_dnp_hdr_CRC, tvb, offset, 2, + dl_crc, "0x%04x [incorrect, should be 0x%04x]", dl_crc, calc_dl_crc); } offset += 2; -- cgit v1.2.3