summaryrefslogtreecommitdiff
path: root/epan/dissectors/dcerpc
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2014-10-05 12:59:11 +0200
committerEvan Huus <eapache@gmail.com>2014-10-07 01:12:22 +0000
commitde138871982a7072397b3c8f5ad0b46f43c027a2 (patch)
tree17728e5f0fbb62184232280c563e3817e004c24a /epan/dissectors/dcerpc
parent670ebda4a6af0d30e033b0af48cfd15ce52c10eb (diff)
downloadwireshark-de138871982a7072397b3c8f5ad0b46f43c027a2.tar.gz
idl2wrs (DCERPC DRSUAPI): Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
Add a check if the struct is not empty budb and butc are also regenerate but no change Change-Id: I0d8cfc827f5451f1cdbd924628a263af9d483a7b Reviewed-on: https://code.wireshark.org/review/4473 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/dcerpc')
-rw-r--r--epan/dissectors/dcerpc/idl2wrs.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/epan/dissectors/dcerpc/idl2wrs.c b/epan/dissectors/dcerpc/idl2wrs.c
index eb50d8ec9e..3991490ba8 100644
--- a/epan/dissectors/dcerpc/idl2wrs.c
+++ b/epan/dissectors/dcerpc/idl2wrs.c
@@ -1447,6 +1447,7 @@ static void parsetypedefstruct(int pass)
char *field_name;
int fixed_array_size;
int is_array_of_pointers;
+ int empty_struct = 0;
ti=token_list;
if(strcmp(ti->str, "typedef")){
@@ -1478,6 +1479,11 @@ static void parsetypedefstruct(int pass)
}
ti=ti->next;
+ /* Check if the struct is empty (search if there is no end bracket) */
+ if(strcmp(ti->str, "}") == 0){
+ empty_struct = 1;
+ }
+
/* search forward until the '}' so we can find the name of the struct */
for(tmpti=ti,level=0;tmpti;tmpti=tmpti->next){
if(!strcmp(tmpti->str, "{")){
@@ -1525,7 +1531,9 @@ static void parsetypedefstruct(int pass)
FPRINTF(eth_code, "%s(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *parent_tree, dcerpc_info *di _U_, guint8 *drep _U_, int hf_index, guint32 param _U_)\n", dissectorname);
FPRINTF(eth_code, "{\n");
FPRINTF(eth_code, " proto_item *item=NULL;\n");
- FPRINTF(eth_code, " proto_tree *tree=NULL;\n");
+ if(!empty_struct){
+ FPRINTF(eth_code, " proto_tree *tree=NULL;\n");
+ }
FPRINTF(eth_code, " int old_offset;\n");
FPRINTF(eth_code, "\n");
switch(alignment){
@@ -1550,7 +1558,9 @@ static void parsetypedefstruct(int pass)
FPRINTF(eth_code, " old_offset=offset;\n");
FPRINTF(eth_code, " if(parent_tree){\n");
FPRINTF(eth_code, " item=proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);\n");
- FPRINTF(eth_code, " tree=proto_item_add_subtree(item, ett_%s_%s);\n", ifname, struct_name);
+ if(!empty_struct){
+ FPRINTF(eth_code, " tree=proto_item_add_subtree(item, ett_%s_%s);\n", ifname, struct_name);
+ }
FPRINTF(eth_code, " }\n");
FPRINTF(eth_code, "\n");
}