From 07c131f0f4d227a9a6a2e703e9fb738853202694 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 14 Aug 2019 21:45:48 -0500 Subject: [PATCH] widl: Introduce type_array_{get,set}_ptr_tfsoff(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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 47d12f59d17..e21aa5703c8 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 4eb0a0a57f9..07179a06b43 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);