Rob Shearman : widl: Use typegen_detect_type to determine which types should be written for the pointer description in write_struct_tfs .
Alexandre Julliard
julliard at winehq.org
Tue Mar 16 11:49:14 CDT 2010
Module: wine
Branch: master
Commit: 1d1d49b6abe7fd86b171346d4bd3ff30735a8268
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d1d49b6abe7fd86b171346d4bd3ff30735a8268
Author: Rob Shearman <robertshearman at gmail.com>
Date: Mon Mar 15 19:30:02 2010 +0000
widl: Use typegen_detect_type to determine which types should be written for the pointer description in write_struct_tfs.
Otherwise extra pointers for user types could be written.
---
tools/widl/typegen.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 7827e14..4f56bda 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2417,27 +2417,33 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
if (fields) LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry)
{
type_t *ft = f->type;
- if (is_ptr(ft))
+ switch (typegen_detect_type(ft, f->attrs, TDT_IGNORE_STRINGS))
{
+ case TGT_POINTER:
if (is_string_type(f->attrs, ft))
write_string_tfs(file, f->attrs, ft, FALSE, f->name, tfsoff);
else
write_pointer_tfs(file, f->attrs, ft,
type_pointer_get_ref(ft)->typestring_offset,
FALSE, tfsoff);
- }
- else if (type_get_type(ft) == TYPE_ARRAY && type_array_is_decl_as_ptr(ft))
- {
- unsigned int offset;
+ break;
+ case TGT_ARRAY:
+ if (type_array_is_decl_as_ptr(ft))
+ {
+ unsigned int offset;
- print_file(file, 0, "/* %d */\n", *tfsoff);
+ print_file(file, 0, "/* %d */\n", *tfsoff);
- offset = ft->typestring_offset;
- /* skip over the pointer that is written for strings, since a
- * pointer has to be written in-place here */
- if (is_string_type(f->attrs, ft))
- offset += 4;
- write_nonsimple_pointer(file, f->attrs, ft, FALSE, offset, tfsoff);
+ offset = ft->typestring_offset;
+ /* skip over the pointer that is written for strings, since a
+ * pointer has to be written in-place here */
+ if (is_string_type(f->attrs, ft))
+ offset += 4;
+ write_nonsimple_pointer(file, f->attrs, ft, FALSE, offset, tfsoff);
+ }
+ break;
+ default:
+ break;
}
}
if (type->ptrdesc == *tfsoff)
More information about the wine-cvs
mailing list