Signed-off-by: Zebediah Figura z.figura12@gmail.com --- tools/widl/typegen.c | 17 +++++++++-------- tools/widl/typetree.h | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 47d12f59d1..e21aa5703c 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -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); diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 4eb0a0a57f..07179a06b4 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -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);