From: Eric Kohl Date: Wed, 19 Nov 2008 21:01:47 +0000 (+0000) Subject: Sync to wine-1.1.1 (Patch 2 of 10): X-Git-Tag: backups/the-real-msvc@60644^2~117 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=df50518f1ebe15abec244f5dd18e9530a0ad4dd3 Sync to wine-1.1.1 (Patch 2 of 10): - Rob Shearman Tue, 1 Jul 2008 widl: Increment the buffer offset by 8 for embedded pointers inside varying arrays in varying structures. The 8 bytes are for the variance and offset and are added just before the array, as seen in the marshalling code in rpcrt4. No offset needs to be added for non-varying structures since the buffer mark is set after the conformance in marshalled or unmarshalled. svn path=/trunk/; revision=37467 --- diff --git a/reactos/tools/widl/typegen.c b/reactos/tools/widl/typegen.c index 4581929c66e..70036a4f910 100644 --- a/reactos/tools/widl/typegen.c +++ b/reactos/tools/widl/typegen.c @@ -1437,6 +1437,14 @@ static int write_varying_array_pointer_descriptions( if (offset_in_memory && offset_in_buffer) { size_t padding; + + if (is_array(v->type) && v->type->length_is) + { + *offset_in_buffer = ROUND_SIZE(*offset_in_buffer, 4); + /* skip over variance and offset in buffer */ + *offset_in_buffer += 8; + } + align = 0; type_memsize(v->type, &align); padding = ROUNDING(*offset_in_memory, align); @@ -1470,19 +1478,13 @@ static void write_pointer_description(FILE *file, type_t *type, { size_t offset_in_buffer; size_t offset_in_memory; - size_t conformance = 0; - - if (type->type == RPC_FC_CVSTRUCT) - conformance = 8; - else if (type->type == RPC_FC_CSTRUCT || type->type == RPC_FC_CPSTRUCT) - conformance = 4; /* pass 1: search for single instance of a pointer (i.e. don't descend * into arrays) */ if (!is_array(type)) { offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_no_repeat_pointer_descriptions( file, type, &offset_in_memory, &offset_in_buffer, typestring_offset); @@ -1490,7 +1492,7 @@ static void write_pointer_description(FILE *file, type_t *type, /* pass 2: search for pointers in fixed arrays */ offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_fixed_array_pointer_descriptions( file, NULL, type, &offset_in_memory, &offset_in_buffer, typestring_offset); @@ -1512,7 +1514,7 @@ static void write_pointer_description(FILE *file, type_t *type, /* pass 4: search for pointers in varying arrays */ offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_varying_array_pointer_descriptions( file, NULL, type, &offset_in_memory, &offset_in_buffer, typestring_offset);