forked from osmocom/wireshark
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>
This commit is contained in:
parent
670ebda4a6
commit
de13887198
2 changed files with 12 additions and 4 deletions
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -2898,13 +2898,11 @@ int
|
|||
drsuapi_dissect_DsGetNCChangesCtr7(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_)
|
||||
{
|
||||
proto_item *item=NULL;
|
||||
proto_tree *tree=NULL;
|
||||
int old_offset;
|
||||
|
||||
old_offset=offset;
|
||||
if(parent_tree){
|
||||
item=proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
|
||||
tree=proto_item_add_subtree(item, ett_drsuapi_DsGetNCChangesCtr7);
|
||||
}
|
||||
|
||||
proto_item_set_len(item, offset-old_offset);
|
||||
|
|
Loading…
Reference in a new issue