- Rob Shearman <robertshearman@gmail.com> 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
if (offset_in_memory && offset_in_buffer)
{
size_t padding;
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);
align = 0;
type_memsize(v->type, &align);
padding = ROUNDING(*offset_in_memory, align);
{
size_t offset_in_buffer;
size_t offset_in_memory;
{
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;
/* 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;
write_no_repeat_pointer_descriptions(
file, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
write_no_repeat_pointer_descriptions(
file, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
/* pass 2: search for pointers in fixed arrays */
offset_in_memory = 0;
/* pass 2: search for pointers in fixed arrays */
offset_in_memory = 0;
- offset_in_buffer = conformance;
write_fixed_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
write_fixed_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
/* pass 4: search for pointers in varying arrays */
offset_in_memory = 0;
/* pass 4: search for pointers in varying arrays */
offset_in_memory = 0;
- offset_in_buffer = conformance;
write_varying_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
write_varying_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);