aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-openwire.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
committerBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
commit1b17369504e600fbddc53c67d634039ba37ac6b7 (patch)
tree3bf66240055157786e65245a2966939bf0d571c7 /epan/dissectors/packet-openwire.c
parent5b53b81835a64b5219236922c7c91e7d9c3c1efb (diff)
Fix: code under 'if(tree)' (in)directly calls sub-dissector/col_...()/expert...() fcns
svn path=/trunk/; revision=43226
Diffstat (limited to 'epan/dissectors/packet-openwire.c')
-rw-r--r--epan/dissectors/packet-openwire.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c
index 66954d6286..bf5a8e7071 100644
--- a/epan/dissectors/packet-openwire.c
+++ b/epan/dissectors/packet-openwire.c
@@ -1308,9 +1308,11 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
static void
dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- gint offset = 0;
- guint8 iCommand;
- proto_tree *openwireroot_tree = NULL;
+ gint offset = 0;
+ guint8 iCommand;
+ proto_tree *openwireroot_tree = NULL;
+ proto_item *ti;
+ gboolean caching;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OpenWire");
@@ -1327,39 +1329,32 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
detect_protocol_options(tvb, pinfo, offset, iCommand);
- if (tree)
- {
- proto_item *ti;
- gboolean caching;
+ ti = proto_tree_add_item(tree, proto_openwire, tvb, offset, -1, ENC_NA);
+ proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
+ openwireroot_tree = proto_item_add_subtree(ti, ett_openwire);
- ti = proto_tree_add_item(tree, proto_openwire, tvb, offset, -1, ENC_NA);
- proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
- openwireroot_tree = proto_item_add_subtree(ti, ett_openwire);
+ proto_tree_add_item(openwireroot_tree, hf_openwire_length, tvb, offset + 0, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(openwireroot_tree, hf_openwire_length, tvb, offset + 0, 4, ENC_BIG_ENDIAN);
-
- /* Abort dissection if tight encoding is enabled*/
- if (iCommand != OPENWIRE_WIREFORMAT_INFO && retrieve_tight(pinfo) == TRUE)
- {
- proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
- expert_add_info_format(pinfo, openwireroot_tree, PI_UNDECODED, PI_NOTE,
- "OpenWire tight encoding not supported by Wireshark, use wireFormat.tightEncodingEnabled=false");
- return;
- }
-
- caching = retrieve_caching(pinfo);
- if (caching)
- {
- proto_tree_add_boolean(openwireroot_tree, hf_openwire_cached_enabled, tvb, offset, 0, caching);
- }
+ /* Abort dissection if tight encoding is enabled*/
+ if (iCommand != OPENWIRE_WIREFORMAT_INFO && retrieve_tight(pinfo) == TRUE)
+ {
+ proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
+ expert_add_info_format(pinfo, openwireroot_tree, PI_UNDECODED, PI_NOTE,
+ "OpenWire tight encoding not supported by Wireshark, use wireFormat.tightEncodingEnabled=false");
+ return;
+ }
- offset += 4;
- offset += dissect_openwire_command(tvb, pinfo, openwireroot_tree, offset, iCommand);
- if (tvb_length_remaining(tvb, offset) > 0)
- {
- expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_NOTE, "OpenWire command fields unknown to Wireshark: %d", iCommand);
- }
+ caching = retrieve_caching(pinfo);
+ if (caching)
+ {
+ proto_tree_add_boolean(openwireroot_tree, hf_openwire_cached_enabled, tvb, offset, 0, caching);
+ }
+ offset += 4;
+ offset += dissect_openwire_command(tvb, pinfo, openwireroot_tree, offset, iCommand);
+ if (tvb_length_remaining(tvb, offset) > 0)
+ {
+ expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_NOTE, "OpenWire command fields unknown to Wireshark: %d", iCommand);
}
}
}