diff options
author | Gerasimos Dimitriadis <dimeg@intracom.gr> | 2009-12-28 21:20:27 +0000 |
---|---|---|
committer | Gerasimos Dimitriadis <dimeg@intracom.gr> | 2009-12-28 21:20:27 +0000 |
commit | 88835212b13ccfb7fc9fea2c3c5aac4daa0a0bae (patch) | |
tree | f3f270304e989fb8b7be4bb04d7d2b20d1d4cfdf /epan/proto.c | |
parent | 5ae2550311a92996aff66aaaf465245a8267ad58 (diff) |
Use true/false strings instead of actual numeric values when adding a boolean
field as a bits item and no custom strings are defined.
svn path=/trunk/; revision=31375
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/epan/proto.c b/epan/proto.c index 53c3ce4d46..d62144def2 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -6391,6 +6391,7 @@ proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint guint64 value = 0; int bit; int i; + const true_false_string *tfstring; /* We can't fake it just yet. We have to fill in the 'return_value' parameter */ PROTO_REGISTRAR_GET_NTH(hf_index, hf_field); @@ -6479,19 +6480,13 @@ proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint switch(hf_field->type){ case FT_BOOLEAN: /* Boolean field */ - if (hf_field->strings) { - const true_false_string *tfstring = - (const true_false_string *) hf_field->strings; - return proto_tree_add_boolean_format(tree, hf_index, tvb, offset, length, (guint32)value, - "%s: %s", - str, - (guint32)value ? tfstring->true_string : tfstring->false_string); - }else{ - return proto_tree_add_boolean_format(tree, hf_index, tvb, offset, length, (guint32)value, - "%s: %u", - str, - (guint32)value); - } + tfstring = (const true_false_string *) &tfs_true_false; + if (hf_field->strings) + tfstring = (const true_false_string *) hf_field->strings; + return proto_tree_add_boolean_format(tree, hf_index, tvb, offset, length, (guint32)value, + "%s: %s", + str, + (guint32)value ? tfstring->true_string : tfstring->false_string); break; case FT_UINT8: |