widl: Fix the detection of conformant and pointer structs.

This commit is contained in:
Robert Shearman 2006-01-24 11:11:56 +01:00 committed by Alexandre Julliard
parent 8f1ed85891
commit 362d42e082
3 changed files with 31 additions and 14 deletions

View File

@ -45,4 +45,16 @@ extern void write_library(const char *name, attr_t *attr);
extern void write_user_types(void);
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

View File

@ -1243,7 +1243,7 @@ static int get_struct_type(var_t *field)
int has_conformant_array = 0;
int has_conformant_string = 0;
while (field)
for (; field; field = NEXT_LINK(field))
{
type_t *t = field->type;
@ -1251,6 +1251,24 @@ static int get_struct_type(var_t *field)
while( (t->type == 0) && 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)
{
/*
@ -1329,7 +1347,6 @@ static int get_struct_type(var_t *field)
case RPC_FC_BOGUS_STRUCT:
return RPC_FC_BOGUS_STRUCT;
}
field = NEXT_LINK(field);
}
if( has_conformant_string && has_pointer )

View File

@ -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,
const var_t *var, int is_return, unsigned int *type_offset)
{