summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-iapp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-10-22 03:52:06 +0000
committerGuy Harris <guy@alum.mit.edu>2005-10-22 03:52:06 +0000
commita24b71271aab5380e237d4378b16e1195584e57b (patch)
tree5e7144f62f80828ca8ad538406ca214f4a613fd0 /epan/dissectors/packet-iapp.c
parent097f75dd7a7c05d2459adde55cf0b1167671cb24 (diff)
downloadwireshark-a24b71271aab5380e237d4378b16e1195584e57b.tar.gz
Don't roll your own code for showing the usual display of bits in a
bitfield, use the code we already have. svn path=/trunk/; revision=16284
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");
}
}
}