widl: Fix the detection of conformant and pointer structs.
This commit is contained in:
parent
8f1ed85891
commit
362d42e082
@ -45,4 +45,16 @@ extern void write_library(const char *name, attr_t *attr);
|
|||||||
extern void write_user_types(void);
|
extern void write_user_types(void);
|
||||||
extern var_t* get_explicit_handle_var(func_t* func);
|
extern var_t* get_explicit_handle_var(func_t* func);
|
||||||
|
|
||||||
|
static inline int is_string_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
||||||
|
{
|
||||||
|
return (is_attr(attrs, ATTR_STRING) &&
|
||||||
|
((ptr_level == 1 && !array) || (ptr_level == 0 && array)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int is_array_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
||||||
|
{
|
||||||
|
return ((ptr_level == 1 && !array && is_attr(attrs, ATTR_SIZEIS)) ||
|
||||||
|
(ptr_level == 0 && array));
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1243,7 +1243,7 @@ static int get_struct_type(var_t *field)
|
|||||||
int has_conformant_array = 0;
|
int has_conformant_array = 0;
|
||||||
int has_conformant_string = 0;
|
int has_conformant_string = 0;
|
||||||
|
|
||||||
while (field)
|
for (; field; field = NEXT_LINK(field))
|
||||||
{
|
{
|
||||||
type_t *t = field->type;
|
type_t *t = field->type;
|
||||||
|
|
||||||
@ -1251,6 +1251,24 @@ static int get_struct_type(var_t *field)
|
|||||||
while( (t->type == 0) && t->ref )
|
while( (t->type == 0) && t->ref )
|
||||||
t = t->ref;
|
t = t->ref;
|
||||||
|
|
||||||
|
if (is_string_type(field->attrs, field->ptr_level, field->array))
|
||||||
|
{
|
||||||
|
has_conformant_string = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array_type(field->attrs, field->ptr_level, field->array))
|
||||||
|
{
|
||||||
|
has_conformant_array = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field->ptr_level > 0)
|
||||||
|
{
|
||||||
|
has_pointer = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (t->type)
|
switch (t->type)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1329,7 +1347,6 @@ static int get_struct_type(var_t *field)
|
|||||||
case RPC_FC_BOGUS_STRUCT:
|
case RPC_FC_BOGUS_STRUCT:
|
||||||
return RPC_FC_BOGUS_STRUCT;
|
return RPC_FC_BOGUS_STRUCT;
|
||||||
}
|
}
|
||||||
field = NEXT_LINK(field);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( has_conformant_string && has_pointer )
|
if( has_conformant_string && has_pointer )
|
||||||
|
@ -91,18 +91,6 @@ static inline int is_base_type(unsigned char type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_string_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
|
||||||
{
|
|
||||||
return (is_attr(attrs, ATTR_STRING) &&
|
|
||||||
((ptr_level == 1 && !array) || (ptr_level == 0 && array)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int is_array_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
|
||||||
{
|
|
||||||
return ((ptr_level == 1 && !array && is_attr(attrs, ATTR_SIZEIS)) ||
|
|
||||||
(ptr_level == 0 && array));
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t write_procformatstring_var(FILE *file, int indent,
|
static size_t write_procformatstring_var(FILE *file, int indent,
|
||||||
const var_t *var, int is_return, unsigned int *type_offset)
|
const var_t *var, int is_return, unsigned int *type_offset)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user