aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-19 14:26:54 -0700
committerGuy Harris <guy@alum.mit.edu>2015-04-19 21:27:20 +0000
commit1edbd5a875af00d1972eb24c43d94f2b6c5220f9 (patch)
tree16037bc60109384ea59d2a563d2dfdac659711b9 /epan/proto.c
parent9194aab0abce23003137825d0f4e31e2240d10d5 (diff)
Don't use proto_tree_add_uint() to add FT_BOOLEAN values.
In proto_item_add_bitmask_tree(), if use_value is true, base the routine we use to add the item to the tree on the type of the field being added. Also, use DISSECTOR_ASSERT_NOT_REACHED(), not g_assert_not_reached(), to catch types that aren't integral or Boolean. Change-Id: I6ff9867bddcae16ddf8b689b48fdc93c6f949105 Reviewed-on: https://code.wireshark.org/review/8127 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index ddad3a7eeb..5cb226f967 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -8100,10 +8100,37 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
if (use_value)
{
- if (len <= 4)
+ switch (hf->type) {
+ case FT_INT8:
+ case FT_UINT8:
+ case FT_INT16:
+ case FT_UINT16:
+ case FT_INT24:
+ case FT_UINT24:
+ case FT_INT32:
+ case FT_UINT32:
proto_tree_add_uint(tree, **fields, tvb, offset, len, (guint32)value);
- else
+ break;
+
+ case FT_INT40:
+ case FT_UINT40:
+ case FT_INT48:
+ case FT_UINT48:
+ case FT_INT56:
+ case FT_UINT56:
+ case FT_INT64:
+ case FT_UINT64:
proto_tree_add_uint64(tree, **fields, tvb, offset, len, value);
+ break;
+
+ case FT_BOOLEAN:
+ proto_tree_add_boolean(tree, **fields, tvb, offset, len, (guint32)value);
+ break;
+
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
+ }
}
else
{
@@ -8184,7 +8211,8 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
}
break;
default:
- g_assert_not_reached();
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
}
fields++;