From Alexey Neyman:
Fix proto_tree_add_*_format_value() operation on bitfields. svn path=/trunk/; revision=25888
This commit is contained in:
parent
fea73c637c
commit
baf9959afa
|
@ -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,
|
||||
|
|
20
epan/proto.c
20
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';
|
||||
|
|
Loading…
Reference in New Issue