aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-iapp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-10-22 03:52:06 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-10-22 03:52:06 +0000
commita8f4800cbe4a472b51084f7897ee880ad3383e83 (patch)
tree5e7144f62f80828ca8ad538406ca214f4a613fd0 /epan/dissectors/packet-iapp.c
parent6f3f134b8e6566fea28ac7e94e38d76239e3dafd (diff)
Don't roll your own code for showing the usual display of bits in a
bitfield, use the code we already have. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16284 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-iapp.c')
-rw-r--r--epan/dissectors/packet-iapp.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/epan/dissectors/packet-iapp.c b/epan/dissectors/packet-iapp.c
index a81362bafb..6d64e41216 100644
--- a/epan/dissectors/packet-iapp.c
+++ b/epan/dissectors/packet-iapp.c
@@ -184,27 +184,22 @@ static value_string iapp_auth_type_vals[] = {
static void dissect_caps(proto_item *pitem, tvbuff_t *tvb, int offset)
{
proto_tree *captree;
- int bit, val, z, thisbit;
+ int bit, val, thisbit;
const gchar *strval;
- gchar bitval[20];
+ gchar bitval[4+1+4+1]; /* "xxxx xxxx\0" */
captree = proto_item_add_subtree(pitem, ett_iapp_cap);
val = tvb_get_guint8(tvb, offset + 3);
- bitval[8] = '\0';
for (bit = 7; bit >= 0; bit--)
{
- strval = match_strval(1 << bit, iapp_cap_vals);
+ thisbit = 1 << bit;
+ strval = match_strval(thisbit, iapp_cap_vals);
if (strval)
{
- thisbit = (val & (1 << bit)) ? 1 : 0;
- for (z = 0; z < 7; z++)
- if (z == 7 - bit)
- bitval[z] = thisbit + '0';
- else
- bitval[z] = '.';
+ other_decode_bitfield_value(bitval, val, thisbit, 8);
proto_tree_add_text(captree, tvb, offset + 3, 1, "%s %s: %s",
- bitval, strval, thisbit ? "Yes" : "No");
+ bitval, strval, val & thisbit ? "Yes" : "No");
}
}
}