aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcsb3.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-06-25 22:59:50 -0400
committerMichael Mann <mmann78@netscape.net>2014-06-26 11:41:10 +0000
commitf7987091bab94f2403024c34702e9d5007a5d790 (patch)
treea56b8dfd1c87a789563ffa3b8a7277c4bd127afe /epan/dissectors/packet-fcsb3.c
parent732656c6f3636ba7e0672a9d8fc878255f0f8d3f (diff)
convert to proto_tree_add_subtree[_format]
Change-Id: I525ac2aae2bdbfd5f3a2f3b35f1bf10dde053f66 Reviewed-on: https://code.wireshark.org/review/2667 Tested-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-fcsb3.c')
-rw-r--r--epan/dissectors/packet-fcsb3.c114
1 files changed, 46 insertions, 68 deletions
diff --git a/epan/dissectors/packet-fcsb3.c b/epan/dissectors/packet-fcsb3.c
index 1b4e5a019e..fe6e94fab8 100644
--- a/epan/dissectors/packet-fcsb3.c
+++ b/epan/dissectors/packet-fcsb3.c
@@ -251,14 +251,12 @@ static const value_string fc_sbccs_dib_lrj_errcode_val[] = {
static void
dissect_iui_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_iui,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_iui);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_iui,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_iui);
proto_tree_add_boolean(tree, hf_sbccs_iui_as, tvb, offset, 1, flags);
if (flags & 0x10) {
@@ -280,14 +278,12 @@ dissect_iui_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 f
static void
dissect_linkctlinfo (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_linkctlinfo,
- tvb, offset, 2, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_linkctlinfo);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_linkctlinfo,
+ tvb, offset, 2, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_linkctlinfo);
proto_tree_add_boolean(tree, hf_sbccs_dib_linkctlinfo_ctcconn, tvb, offset, 2, flags);
if (flags & 0x80) {
@@ -306,14 +302,12 @@ dissect_linkctlinfo (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16
static void
dissect_dh_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dhflags,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dhflags);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dhflags,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dhflags);
proto_tree_add_boolean(tree, hf_sbccs_dhflags_end, tvb, offset, 1, flags);
if (flags & 0x80) {
@@ -344,14 +338,12 @@ dissect_dh_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 fl
static void
dissect_ccw_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ccw_flags,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_ccw_flags);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ccw_flags,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_ccw_flags);
proto_tree_add_boolean(tree, hf_sbccs_dib_ccw_flags_cd, tvb, offset, 1, flags);
if (flags & 0x80) {
@@ -382,14 +374,12 @@ dissect_ccw_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 fl
static void
dissect_cmd_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_cmdflags,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_cmdflags);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_cmdflags,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_cmdflags);
proto_tree_add_boolean(tree, hf_sbccs_dib_cmdflags_du, tvb, offset, 1, flags);
if (flags & 0x10) {
@@ -433,15 +423,12 @@ static const value_string status_ffc_val[] = {
static void
dissect_status_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_statusflags,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_statusflags);
- }
+ proto_item *item;
+ proto_tree *tree;
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_statusflags,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_statusflags);
proto_tree_add_item (tree, hf_sbccs_dib_statusflags_ffc, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_item_append_text(item, "%s", val_to_str ((flags>>5) & 0x07, status_ffc_val, "Reserved:0x%x"));
@@ -477,15 +464,12 @@ dissect_status_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8
static void
dissect_status (packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_status,
- tvb, offset, 1, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_status);
- }
+ proto_item *item;
+ proto_tree *tree;
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_status,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_status);
proto_tree_add_boolean(tree, hf_sbccs_dib_status_attention, tvb, offset, 1, flags);
if (flags & 0x80) {
@@ -549,14 +533,12 @@ dissect_status (packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int
static void
dissect_sel_rst_param (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint32 flags)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_item *item;
+ proto_tree *tree;
- if (parent_tree) {
- item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ctlparam,
- tvb, offset, 3, flags);
- tree=proto_item_add_subtree(item, ett_sbccs_dib_ctlparam);
- }
+ item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_ctlparam,
+ tvb, offset, 3, flags);
+ tree=proto_item_add_subtree(item, ett_sbccs_dib_ctlparam);
proto_tree_add_boolean(tree, hf_sbccs_dib_ctlparam_rc, tvb, offset, 3, flags);
if (flags & 0x80) {
@@ -594,7 +576,6 @@ static void
dissect_fc_sbccs_sb3_iu_hdr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset)
{
- proto_item *subti;
proto_tree *sb3hdr_tree;
proto_tree *iuhdr_tree;
guint8 iui, dhflags;
@@ -608,18 +589,16 @@ dissect_fc_sbccs_sb3_iu_hdr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
if (tree) {
/* Dissect SB3 header first */
- subti = proto_tree_add_text (tree, tvb, offset, FC_SBCCS_SB3_HDR_SIZE,
- "SB-3 Header");
- sb3hdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);
+ sb3hdr_tree = proto_tree_add_subtree(tree, tvb, offset, FC_SBCCS_SB3_HDR_SIZE,
+ ett_fc_sbccs, NULL, "SB-3 Header");
proto_tree_add_item (sb3hdr_tree, hf_sbccs_chid, tvb, offset+1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (sb3hdr_tree, hf_sbccs_cuid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item (sb3hdr_tree, hf_sbccs_devaddr, tvb, offset+4, 2, ENC_BIG_ENDIAN);
/* Dissect IU Header */
- subti = proto_tree_add_text (tree, tvb, offset + FC_SBCCS_SB3_HDR_SIZE,
- FC_SBCCS_IU_HDR_SIZE, "IU Header");
- iuhdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);
+ iuhdr_tree = proto_tree_add_subtree(tree, tvb, offset + FC_SBCCS_SB3_HDR_SIZE,
+ FC_SBCCS_IU_HDR_SIZE, ett_fc_sbccs, NULL, "IU Header");
offset += FC_SBCCS_SB3_HDR_SIZE;
iui = tvb_get_guint8 (tvb, offset);
@@ -888,9 +867,8 @@ static void dissect_fc_sbccs (tvbuff_t *tvb, packet_info *pinfo,
dissect_fc_sbccs_sb3_iu_hdr (tvb, pinfo, sb3_tree, offset);
offset += (FC_SBCCS_SB3_HDR_SIZE + FC_SBCCS_IU_HDR_SIZE);
- ti = proto_tree_add_text (sb3_tree, tvb, offset,
- FC_SBCCS_DIB_LRC_HDR_SIZE, "DIB Header");
- dib_tree = proto_item_add_subtree (ti, ett_fc_sbccs);
+ dib_tree = proto_tree_add_subtree(sb3_tree, tvb, offset,
+ FC_SBCCS_DIB_LRC_HDR_SIZE, ett_fc_sbccs, NULL, "DIB Header");
}
else {
offset += (FC_SBCCS_SB3_HDR_SIZE + FC_SBCCS_IU_HDR_SIZE);