[3/6] widl: Avoid generating negative offsets for conformant arrays.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Apr 1 03:14:35 CDT 2014
This matches midl output and avoids crashes in the string array tests
under Windows. It appears that 32-bit rpcrt4 doesn't support negative
offsets in the array descriptions and crashes in the unmarshalling phase,
while 64-bit rpcrt4 handles negative offsets just fine in all cases.
I decided to generate same output for both 32-bit and 64-bit code and
follow what midl does in this case.
---
tools/widl/typegen.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 881f161..e05886b 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -3581,12 +3581,23 @@ static unsigned int write_type_tfs(FILE *file, int indent,
case TGT_POINTER:
{
enum type_context ref_context;
+ type_t *ref = type_pointer_get_ref(type);
+
if (context == TYPE_CONTEXT_TOPLEVELPARAM)
ref_context = TYPE_CONTEXT_PARAM;
else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
ref_context = TYPE_CONTEXT_CONTAINER;
else
ref_context = context;
+
+ if (is_conformant_array(ref))
+ {
+ if (context != TYPE_CONTEXT_CONTAINER_NO_POINTERS)
+ write_pointer_tfs(file, attrs, type, *typeformat_offset + 4, context, typeformat_offset);
+
+ return write_type_tfs(file, indent, attrs, ref, name, ref_context, typeformat_offset);
+ }
+
offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name,
ref_context, typeformat_offset);
if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
--
1.9.1
More information about the wine-patches
mailing list