diff options
author | Michael Mann <mmann78@netscape.net> | 2013-09-16 10:39:06 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-09-16 10:39:06 +0000 |
commit | 346f803d42ac477109e02df2578eb8c86ccf4c4f (patch) | |
tree | 4277e1e48aeb6d492ceb835af645460070fb04ec /epan/dissectors/packet-ip.c | |
parent | 58e4750ecbf593fb678c713da398979b7fb2ed5d (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 all manual inspection and most cases were either:
1. Case sensitivity differences between hf_ field name and formatted string.
2. Unnecessary whitespace between hf_ field name and colon in formatted string
There are cases where the hf_ field name doesn't quite match the proto_tree_add_uint_format, but it's close enough that one of them should be "right", I'm just not sure which is, I just know the string in proto_tree_add_uint_format is the one displayed.
svn path=/trunk/; revision=52098
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r-- | epan/dissectors/packet-ip.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 280e1af39b..9f3d5407d5 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1978,16 +1978,15 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) "Bogus IP header length (%u, must be at least %u)", hlen, IPH_MIN_LEN); if (tree) { - proto_tree_add_uint_format(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen, - "Header length: %u bytes (bogus, must be " - "at least %u)", hlen, IPH_MIN_LEN); + proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen, + "%u bytes (bogus, must be at least %u)", hlen, IPH_MIN_LEN); } return; } if (tree) { - proto_tree_add_uint_format(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen, - "Header length: %u bytes", hlen); + proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen, + "%u bytes", hlen); } iph->ip_tos = tvb_get_guint8(tvb, offset + 1); @@ -1998,9 +1997,8 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (tree) { if (g_ip_dscp_actif) { - tf = proto_tree_add_uint_format(ip_tree, hf_ip_dsfield, tvb, offset + 1, - 1, iph->ip_tos, "Differentiated Services Field: 0x%02x " - "(DSCP 0x%02x: %s; ECN: 0x%02x: %s)", iph->ip_tos, + tf = proto_tree_add_uint_format_value(ip_tree, hf_ip_dsfield, tvb, offset + 1, + 1, iph->ip_tos, "0x%02x (DSCP 0x%02x: %s; ECN: 0x%02x: %s)", iph->ip_tos, IPDSFIELD_DSCP(iph->ip_tos), val_to_str_ext_const(IPDSFIELD_DSCP(iph->ip_tos), &dscp_vals_ext, "Unknown DSCP"), IPDSFIELD_ECN(iph->ip_tos), val_to_str_const(IPDSFIELD_ECN(iph->ip_tos), @@ -2010,9 +2008,9 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_item(field_tree, hf_ip_dsfield_dscp, tvb, offset + 1, 1, ENC_NA); proto_tree_add_item(field_tree, hf_ip_dsfield_ecn, tvb, offset + 1, 1, ENC_NA); } else { - tf = proto_tree_add_uint_format(ip_tree, hf_ip_tos, tvb, offset + 1, 1, + tf = proto_tree_add_uint_format_value(ip_tree, hf_ip_tos, tvb, offset + 1, 1, iph->ip_tos, - "Type of service: 0x%02x (%s)", + "0x%02x (%s)", iph->ip_tos, val_to_str_const(IPTOS_TOS(iph->ip_tos), iptos_vals, "Unknown")); @@ -2053,13 +2051,10 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) col_add_fstr(pinfo->cinfo, COL_INFO, "Bogus IP length (%u, less than header length %u)", iph->ip_len, hlen); - tf = NULL; - if (tree) { - tf = proto_tree_add_uint_format(ip_tree, hf_ip_len, tvb, offset + 2, 2, + tf = proto_tree_add_uint_format_value(ip_tree, hf_ip_len, tvb, offset + 2, 2, iph->ip_len, - "Total length: %u bytes (bogus, less than header length %u)", + "%u bytes (bogus, less than header length %u)", iph->ip_len, hlen); - } expert_add_info(pinfo, tf, &ei_ip_bogus_ip_length); /* Can't dissect any further */ return; @@ -2536,7 +2531,7 @@ proto_register_ip(void) NULL, 0x0, NULL, HFILL }}, { &hf_ip_dsfield, - { "Differentiated Services field", "ip.dsfield", FT_UINT8, BASE_DEC, + { "Differentiated Services Field", "ip.dsfield", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ip_dsfield_dscp, |