diff options
author | Michael Mann <mmann78@netscape.net> | 2014-12-01 00:18:41 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-12-01 12:18:44 +0000 |
commit | e77507b0eac903e74389ef1bf2dfa51d4cf00aad (patch) | |
tree | d9a99ae5315842fd1d3cc957c8adac50a779e5ed /epan/dissectors/packet-q2931.c | |
parent | 542439e64aef746512a5a8d3835e49805087c706 (diff) |
Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 3 of many, but this concludes the strict conversion to proto_tree_add_bitmask. Patches to follow with use proto_tree_add_bitmask_xxx (some functions still need to be written)
Change-Id: Ic2435667c6a7f1d40602124e5044954d2a296180
Reviewed-on: https://code.wireshark.org/review/5553
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-q2931.c')
-rw-r--r-- | epan/dissectors/packet-q2931.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c index 541b5000e9..0a7e3e132e 100644 --- a/epan/dissectors/packet-q2931.c +++ b/epan/dissectors/packet-q2931.c @@ -1888,7 +1888,6 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int offset = 0; proto_tree *q2931_tree = NULL; proto_item *ti; - proto_tree *ext_tree; guint8 call_ref_len; guint8 call_ref[15]; guint8 message_type; @@ -1901,6 +1900,15 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int codeset; gboolean non_locking_shift; #endif + static const int * ext_flags[] = { + &hf_q2931_message_flag, + NULL + }; + static const int * ext_flags_follow_inst[] = { + &hf_q2931_message_flag, + &hf_q2931_message_action_indicator, + NULL + }; col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.2931"); @@ -1918,12 +1926,10 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (call_ref_len != 0) { tvb_memcpy(tvb, call_ref, offset, call_ref_len); - if (q2931_tree != NULL) { - proto_tree_add_boolean(q2931_tree, hf_q2931_call_ref_flag, - tvb, offset, 1, (call_ref[0] & 0x80) != 0); - call_ref[0] &= 0x7F; - proto_tree_add_bytes(q2931_tree, hf_q2931_call_ref, tvb, offset, call_ref_len, call_ref); - } + proto_tree_add_boolean(q2931_tree, hf_q2931_call_ref_flag, + tvb, offset, 1, (call_ref[0] & 0x80) != 0); + call_ref[0] &= 0x7F; + proto_tree_add_bytes(q2931_tree, hf_q2931_call_ref, tvb, offset, call_ref_len, call_ref); offset += call_ref_len; } message_type = tvb_get_guint8(tvb, offset); @@ -1931,21 +1937,14 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str_ext(message_type, &q2931_message_type_vals_ext, "Unknown message type (0x%02X)")); - if (q2931_tree != NULL) - proto_tree_add_uint(q2931_tree, hf_q2931_message_type, tvb, offset, 1, message_type); + proto_tree_add_uint(q2931_tree, hf_q2931_message_type, tvb, offset, 1, message_type); offset += 1; message_type_ext = tvb_get_guint8(tvb, offset); - if (q2931_tree != NULL) { - ti = proto_tree_add_uint(q2931_tree, hf_q2931_message_type_ext, tvb, - offset, 1, message_type_ext); - ext_tree = proto_item_add_subtree(ti, ett_q2931_ext); - proto_tree_add_boolean(ext_tree, hf_q2931_message_flag, tvb, - offset, 1, message_type_ext); - if (message_type_ext & Q2931_MSG_TYPE_EXT_FOLLOW_INST) { - proto_tree_add_uint(ext_tree, hf_q2931_message_action_indicator, tvb, - offset, 1, message_type_ext); - } + if (message_type_ext & Q2931_MSG_TYPE_EXT_FOLLOW_INST) { + proto_tree_add_bitmask(q2931_tree, tvb, offset, hf_q2931_message_type_ext, ett_q2931_ext, ext_flags_follow_inst, ENC_NA); + } else { + proto_tree_add_bitmask(q2931_tree, tvb, offset, hf_q2931_message_type_ext, ett_q2931_ext, ext_flags, ENC_NA); } offset += 1; |