aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pim.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-09-15 01:48:30 +0000
committerMichael Mann <mmann78@netscape.net>2013-09-15 01:48:30 +0000
commitb38ee917b1953104c615056481d6df008ae94b53 (patch)
tree55024f9c53f083dc056540b6d887fc4550064008 /epan/dissectors/packet-pim.c
parenta17cf67635c6e190c174bc131707804edca5c8f4 (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-pim.c')
-rw-r--r--epan/dissectors/packet-pim.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c
index 0113e4aa86..38c555d9c5 100644
--- a/epan/dissectors/packet-pim.c
+++ b/epan/dissectors/packet-pim.c
@@ -247,14 +247,14 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
cksum_vec[0].len = pim_length;
computed_cksum = in_cksum(&cksum_vec[0], 1);
if (computed_cksum == 0) {
- proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb,
+ proto_tree_add_uint_format_value(pim_tree, hf_pim_cksum, tvb,
offset, 2, pim_cksum,
- "Checksum: 0x%04x [correct]",
+ "0x%04x [correct]",
pim_cksum);
} else {
- proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb,
+ proto_tree_add_uint_format_value(pim_tree, hf_pim_cksum, tvb,
offset, 2, pim_cksum,
- "Checksum: 0x%04x [incorrect, should be 0x%04x]",
+ "0x%04x [incorrect, should be 0x%04x]",
pim_cksum, in_cksum_shouldbe(pim_cksum, computed_cksum));
}
} else {
@@ -464,7 +464,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case 5: /* assert */
{
- guint32 pref;
proto_tree_add_item(pimopt_tree, hf_pim_group_address_ip4, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
@@ -473,10 +472,8 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4;
proto_tree_add_item(pimopt_tree, hf_pim_rpt, tvb, offset, 1, ENC_BIG_ENDIAN);
- pref = tvb_get_ntohl(tvb, offset) & 0x7fffffff;
- proto_tree_add_uint_format(pimopt_tree, hf_pim_metric_pref, tvb,
- offset, 4, pref,
- "Metric Preference: %u", pref);
+ proto_tree_add_item(pimopt_tree, hf_pim_metric_pref, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pimopt_tree, hf_pim_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -780,14 +777,14 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
}
if (computed_cksum == 0) {
- proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb,
+ proto_tree_add_uint_format_value(pim_tree, hf_pim_cksum, tvb,
offset + 2, 2, pim_cksum,
- "Checksum: 0x%04x [correct]",
+ "0x%04x [correct]",
pim_cksum);
} else {
- proto_tree_add_uint_format(pim_tree, hf_pim_cksum, tvb,
+ proto_tree_add_uint_format_value(pim_tree, hf_pim_cksum, tvb,
offset + 2, 2, pim_cksum,
- "Checksum: 0x%04x [incorrect, should be 0x%04x]",
+ "0x%04x [incorrect, should be 0x%04x]",
pim_cksum, in_cksum_shouldbe(pim_cksum, computed_cksum));
}
} else {
@@ -1115,7 +1112,6 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
case 5: /* assert */
{
int advance;
- guint32 pref;
if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group,
NULL, NULL,
@@ -1130,10 +1126,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
offset += advance;
proto_tree_add_item(pimopt_tree, hf_pim_rpt, tvb, offset, 1, ENC_BIG_ENDIAN);
- pref = tvb_get_ntohl(tvb, offset) & 0x7fffffff;
- proto_tree_add_uint_format(pimopt_tree, hf_pim_metric_pref, tvb,
- offset, 4, pref,
- "Metric Preference: %u", pref);
+ proto_tree_add_item(pimopt_tree, hf_pim_metric_pref, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pimopt_tree, hf_pim_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -1180,7 +1174,6 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
case 9: /* State-Refresh */
{
int advance;
- guint32 pref;
if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group,
NULL, NULL,
@@ -1201,10 +1194,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
offset += advance;
proto_tree_add_item(pimopt_tree, hf_pim_rpt, tvb, offset, 1, ENC_BIG_ENDIAN);
- pref = tvb_get_ntohl(tvb, offset) & 0x7fffffff;
- proto_tree_add_uint_format(pimopt_tree, hf_pim_metric_pref, tvb,
- offset, 4, pref,
- "Metric Preference: %u", pref);
+ proto_tree_add_item(pimopt_tree, hf_pim_metric_pref, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pimopt_tree, hf_pim_metric, tvb, offset, 4, ENC_BIG_ENDIAN);