widl: Introduce type_array_{get,set}_ptr_tfsoff().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-08-14 21:45:48 -05:00 committed by Alexandre Julliard
parent c5ab9d01be
commit 07c131f0f4
2 changed files with 23 additions and 8 deletions

View File

@ -1011,8 +1011,9 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
break;
case TGT_ARRAY:
*flags |= MustFree;
if (type_array_is_decl_as_ptr(var->declspec.type) && var->declspec.type->details.array.ptr_tfsoff &&
get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
if (type_array_is_decl_as_ptr(var->declspec.type)
&& type_array_get_ptr_tfsoff(var->declspec.type)
&& get_pointer_fc(var->declspec.type, var->attrs, !is_return) == FC_RP)
{
*typestring_offset = var->declspec.type->typestring_offset;
*flags |= IsSimpleRef;
@ -1228,9 +1229,9 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
{
unsigned short offset = var->typestring_offset;
if (!is_interpreted && is_array(var->declspec.type) &&
type_array_is_decl_as_ptr(var->declspec.type) &&
var->declspec.type->details.array.ptr_tfsoff)
if (!is_interpreted && is_array(var->declspec.type)
&& type_array_is_decl_as_ptr(var->declspec.type)
&& type_array_get_ptr_tfsoff(var->declspec.type))
offset = var->declspec.type->typestring_offset;
if (is_return)
@ -3621,7 +3622,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs,
if (ptr_type != FC_RP) update_tfsoff( type, off, file );
*typeformat_offset += 4;
}
type->details.array.ptr_tfsoff = off;
type_array_set_ptr_tfsoff(type, off);
}
return off;
}
@ -4350,10 +4351,10 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
((tc == FC_SMVARRAY || tc == FC_LGVARRAY) && in_attr) ||
(tc == FC_CARRAY && !in_attr))
{
if (type_array_is_decl_as_ptr(type) && type->details.array.ptr_tfsoff)
if (type_array_is_decl_as_ptr(type) && type_array_get_ptr_tfsoff(type))
{
print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var,
type->details.array.ptr_tfsoff);
type_array_get_ptr_tfsoff(type));
break;
}
print_phase_function(file, indent, array_type, local_var_prefix, phase, var, start_offset);

View File

@ -257,6 +257,20 @@ static inline expr_t *type_array_get_variance(const type_t *type)
return type->details.array.length_is;
}
static inline unsigned short type_array_get_ptr_tfsoff(const type_t *type)
{
type = type_get_real_type(type);
assert(type_get_type(type) == TYPE_ARRAY);
return type->details.array.ptr_tfsoff;
}
static inline void type_array_set_ptr_tfsoff(type_t *type, unsigned short ptr_tfsoff)
{
type = type_get_real_type(type);
assert(type_get_type(type) == TYPE_ARRAY);
type->details.array.ptr_tfsoff = ptr_tfsoff;
}
static inline const decl_spec_t *type_array_get_element(const type_t *type)
{
type = type_get_real_type(type);