widl: Avoid generating negative offsets for conformant arrays of strings.

This commit is contained in:
Dmitry Timoshkov 2014-04-02 18:37:37 +09:00 committed by Alexandre Julliard
parent 1845d10c3e
commit bde38bebe9
1 changed files with 14 additions and 0 deletions

View File

@ -3581,12 +3581,26 @@ static unsigned int write_type_tfs(FILE *file, int indent,
case TGT_POINTER: case TGT_POINTER:
{ {
enum type_context ref_context; enum type_context ref_context;
type_t *ref = type_pointer_get_ref(type);
if (context == TYPE_CONTEXT_TOPLEVELPARAM) if (context == TYPE_CONTEXT_TOPLEVELPARAM)
ref_context = TYPE_CONTEXT_PARAM; ref_context = TYPE_CONTEXT_PARAM;
else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
ref_context = TYPE_CONTEXT_CONTAINER; ref_context = TYPE_CONTEXT_CONTAINER;
else else
ref_context = context; ref_context = context;
if (is_string_type(attrs, type) && is_conformant_array(ref))
{
if (context != TYPE_CONTEXT_CONTAINER_NO_POINTERS)
write_pointer_tfs(file, attrs, type, *typeformat_offset + 4, context, typeformat_offset);
offset = write_type_tfs(file, indent, attrs, ref, name, ref_context, typeformat_offset);
if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)
return 0;
return offset;
}
offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name, offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name,
ref_context, typeformat_offset); ref_context, typeformat_offset);
if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS)