diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2017-08-23 21:53:42 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-08-24 00:02:45 +0000 |
commit | 9dbfa6a1ea5a12bbb899a2e1ada032e227289677 (patch) | |
tree | 527665cadd1880546e1af2402c2ced6012a534f5 /epan | |
parent | af180cc7d050e821825f3f4a2e96607b67704a39 (diff) |
rpc: remove some unnecessary NULL checks
Change-Id: I956f0dbbd6b3cdbf8c0e4b9d81e0bd6408874b5b
Reviewed-on: https://code.wireshark.org/review/23185
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-rpc.c | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 6e9d104b3d..111c0b7e7b 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -815,12 +815,11 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, string_buffer_print=RPC_STRING_EMPTY; } - if (tree) { - /* string_item_offset = offset; */ - string_tree = proto_tree_add_subtree_format(tree, tvb,offset, -1, - ett_rpc_string, &string_item, "%s: %s", proto_registrar_get_name(hfindex), - string_buffer_print); - } + /* string_item_offset = offset; */ + string_tree = proto_tree_add_subtree_format(tree, tvb,offset, -1, + ett_rpc_string, &string_item, "%s: %s", proto_registrar_get_name(hfindex), + string_buffer_print); + if (!fixed_length) { proto_tree_add_uint(string_tree, hf_rpc_opaque_length, tvb,offset, 4, string_length); offset += 4; @@ -843,21 +842,18 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, offset += string_length_copy; if (fill_length) { - if (string_tree) { - if (fill_truncated) { - proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, - offset, fill_length_copy, NULL, "opaque data<TRUNCATED>"); - } - else { - proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, - offset, fill_length_copy, NULL, "opaque data"); - } + if (fill_truncated) { + proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, + offset, fill_length_copy, NULL, "opaque data<TRUNCATED>"); + } + else { + proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, + offset, fill_length_copy, NULL, "opaque data"); } offset += fill_length_copy; } - if (string_item) - proto_item_set_end(string_item, tvb, offset); + proto_item_set_end(string_item, tvb, offset); if (string_buffer_ret != NULL) *string_buffer_ret = string_buffer_print; @@ -1862,10 +1858,7 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return offset; } - if ( tree ) - { - proto_tree_add_item(tree, hf_rpc_argument_length, tvb, offset, 4, ENC_BIG_ENDIAN); - } + proto_tree_add_item(tree, hf_rpc_argument_length, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Dissect the arguments */ @@ -1991,11 +1984,9 @@ dissect_rpc_continuation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "RPC"); col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); - if (tree) { - rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0, -1, ENC_NA); - rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc); - proto_tree_add_item(rpc_tree, hf_rpc_continuation_data, tvb, 0, -1, ENC_NA); - } + rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0, -1, ENC_NA); + rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc); + proto_tree_add_item(rpc_tree, hf_rpc_continuation_data, tvb, 0, -1, ENC_NA); } @@ -2434,11 +2425,9 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } - if (rpc_tree) { - proto_tree_add_uint_format_value(rpc_tree, + proto_tree_add_uint_format_value(rpc_tree, hf_rpc_procedure, tvb, offset+12, 4, proc, "%s (%u)", procname, proc); - } /* Print the program version, procedure name, and message type (call or reply). */ if (first_pdu) @@ -2628,10 +2617,8 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } reply_state = tvb_get_ntohl(tvb,offset); - if (rpc_tree) { - proto_tree_add_uint(rpc_tree, hf_rpc_state_reply, tvb, + proto_tree_add_uint(rpc_tree, hf_rpc_state_reply, tvb, offset, 4, reply_state); - } offset += 4; /* Indicate the frame to which this is a reply. */ |