aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2008-08-01 10:16:52 +0000
committerAnders Broman <anders.broman@ericsson.com>2008-08-01 10:16:52 +0000
commitbaf9959afae4e29c303546c5a4d63ec0ecd3c6ae (patch)
tree606a1f0b9dec5330d4e283834e4e7adf8f043c3d
parentfea73c637c6257c58f8953c1e96a92616c71e32a (diff)
From Alexey Neyman:
Fix proto_tree_add_*_format_value() operation on bitfields. svn path=/trunk/; revision=25888
-rw-r--r--epan/dissectors/packet-bvlc.c2
-rw-r--r--epan/proto.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c
index e6b3375036..1cc45ab518 100644
--- a/epan/dissectors/packet-bvlc.c
+++ b/epan/dissectors/packet-bvlc.c
@@ -342,7 +342,7 @@ proto_register_bvlc(void)
* packet to dissect */
{ &hf_bvlc_result,
{ "Result", "bvlc.result",
- FT_UINT16, BASE_HEX, NULL, 0xffff,
+ FT_UINT16, BASE_HEX, NULL, 0,
"Result Code", HFILL }
},
{ &hf_bvlc_bdt_ip,
diff --git a/epan/proto.c b/epan/proto.c
index abde3e7134..743c016aff 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -3022,14 +3022,28 @@ proto_tree_set_representation_value(proto_item *pi, const char *format, va_list
int ret; /*tmp return value */
int replen;
field_info *fi = PITEM_FINFO(pi);
+ header_field_info *hf = fi->hfinfo;
if (!PROTO_ITEM_IS_HIDDEN(pi)) {
ITEM_LABEL_NEW(fi->rep);
replen = 0;
+ if (hf->bitmask && (hf->type == FT_BOOLEAN || IS_FT_UINT(hf->type))) {
+ char tmpbuf[64];
+ guint32 val;
- /* put in the hf name */
- ret = g_snprintf(fi->rep->representation, ITEM_LABEL_LENGTH,
- "%s: ", fi->hfinfo->name);
+ val = fvalue_get_uinteger(&fi->value);
+ if (hf->bitshift > 0) {
+ val <<= hf->bitshift;
+ }
+ decode_bitfield_value(tmpbuf, val, hf->bitmask, hfinfo_bitwidth(hf));
+ /* put in the hf name */
+ ret = g_snprintf(fi->rep->representation, ITEM_LABEL_LENGTH,
+ "%s%s: ", tmpbuf, fi->hfinfo->name);
+ } else {
+ /* put in the hf name */
+ ret = g_snprintf(fi->rep->representation, ITEM_LABEL_LENGTH,
+ "%s: ", fi->hfinfo->name);
+ }
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH)) {
/* That's all we can put in the representation. */
fi->rep->representation[ITEM_LABEL_LENGTH - 1] = '\0';