Module: wine Branch: refs/heads/master Commit: 362d42e0826dd2907418ec78bb9da5717e491a72 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=362d42e0826dd2907418ec78...
Author: Robert Shearman rob@codeweavers.com Date: Tue Jan 24 11:11:56 2006 +0100
widl: Fix the detection of conformant and pointer structs.
---
tools/widl/header.h | 12 ++++++++++++ tools/widl/parser.y | 21 +++++++++++++++++++-- tools/widl/typegen.c | 12 ------------ 3 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/tools/widl/header.h b/tools/widl/header.h index 1a767c7..a29502d 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -45,4 +45,16 @@ extern void write_library(const char *na 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 diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 7c32944..e4ee9ff 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -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 ) diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index b54ad11..2a395c9 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -91,18 +91,6 @@ static inline int is_base_type(unsigned } }
-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) {