Signed-off-by: Richard Pospesel richard@torproject.org --- tools/widl/expr.c | 2 +- tools/widl/header.c | 20 +++++++-------- tools/widl/header.h | 4 +-- tools/widl/parser.y | 28 ++++++++++----------- tools/widl/proxy.c | 4 +-- tools/widl/typegen.c | 54 ++++++++++++++++++++--------------------- tools/widl/typelib.c | 2 +- tools/widl/typetree.c | 2 +- tools/widl/typetree.h | 9 +++++-- tools/widl/widltypes.h | 3 +-- tools/widl/write_msft.c | 10 ++++---- 11 files changed, 71 insertions(+), 67 deletions(-)
diff --git a/tools/widl/expr.c b/tools/widl/expr.c index 55efc694dd..85ba4639e1 100644 --- a/tools/widl/expr.c +++ b/tools/widl/expr.c @@ -580,7 +580,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc case EXPR_PPTR: result = resolve_expression(expr_loc, cont_type, e->ref); if (result.type && is_ptr(result.type)) - result.type = type_pointer_get_ref(result.type); + result.type = type_pointer_get_ref_type(result.type); else if(result.type && is_array(result.type) && type_array_is_decl_as_ptr(result.type)) result.type = type_array_get_element_type(result.type); diff --git a/tools/widl/header.c b/tools/widl/header.c index c10b149d89..8c07564751 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -77,7 +77,7 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t) else if (type_is_alias(type)) type = type_alias_get_aliasee(type); else if (is_ptr(type)) - type = type_pointer_get_ref(type); + type = type_pointer_get_ref_type(type); else return 0; } } @@ -351,8 +351,8 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly) break; case TYPE_POINTER: { - write_type_left(h, type_pointer_get_ref(t), name_type, declonly); - write_pointer_left(h, type_pointer_get_ref(t)); + write_type_left(h, type_pointer_get_ref_type(t), name_type, declonly); + write_pointer_left(h, type_pointer_get_ref_type(t)); if (is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const "); break; } @@ -461,7 +461,7 @@ void write_type_right(FILE *h, type_t *t, int is_field) } case TYPE_POINTER: { - type_t *ref = type_pointer_get_ref(t); + type_t *ref = type_pointer_get_ref_type(t); if (!type_is_alias(ref) && is_array(ref) && !type_array_is_decl_as_ptr(ref)) fprintf(h, ")"); write_type_right(h, ref, FALSE); @@ -493,7 +493,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c if (!h) return;
if (t) { - for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++) + for (pt = t; is_ptr(pt); pt = type_pointer_get_ref_type(pt), ptr_level++) ;
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) { @@ -603,7 +603,7 @@ unsigned int get_context_handle_offset( const type_t *type ) while (!is_attr( type->attrs, ATTR_CONTEXTHANDLE )) { if (type_is_alias( type )) type = type_alias_get_aliasee( type ); - else if (is_ptr( type )) type = type_pointer_get_ref( type ); + else if (is_ptr( type )) type = type_pointer_get_ref_type( type ); else error( "internal error: %s is not a context handle\n", type->name ); } LIST_FOR_EACH_ENTRY( ch, &context_handle_list, context_handle_t, entry ) @@ -623,7 +623,7 @@ unsigned int get_generic_handle_offset( const type_t *type ) while (!is_attr( type->attrs, ATTR_HANDLE )) { if (type_is_alias( type )) type = type_alias_get_aliasee( type ); - else if (is_ptr( type )) type = type_pointer_get_ref( type ); + else if (is_ptr( type )) type = type_pointer_get_ref_type( type ); else error( "internal error: %s is not a generic handle\n", type->name ); } LIST_FOR_EACH_ENTRY( gh, &generic_handle_list, generic_handle_t, entry ) @@ -703,7 +703,7 @@ void check_for_additional_prototype_types(type_t *type) if (type_is_alias(type)) type = type_alias_get_aliasee(type); else if (is_ptr(type)) - type = type_pointer_get_ref(type); + type = type_pointer_get_ref_type(type); else if (is_array(type)) type = type_array_get_element_type(type); else @@ -805,7 +805,7 @@ int is_const_decl(const var_t *var) if (is_attr(t->attrs, ATTR_CONST)) return TRUE; else if (is_ptr(t)) - t = type_pointer_get_ref(t); + t = type_pointer_get_ref_type(t); else break; } return FALSE; @@ -852,7 +852,7 @@ const type_t* get_explicit_generic_handle_type(const var_t* var) const type_t *t; for (t = var->declspec.type; is_ptr(t) || type_is_alias(t); - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref_type(t)) if ((type_get_type_detect_alias(t) != TYPE_BASIC || type_basic_get_type(t) != TYPE_BASIC_HANDLE) && is_attr(t->attrs, ATTR_HANDLE)) return t; diff --git a/tools/widl/header.h b/tools/widl/header.h index e4aa0f0088..eb98125b25 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -83,7 +83,7 @@ static inline int is_conformant_array(const type_t *t)
static inline int last_ptr(const type_t *type) { - return is_ptr(type) && !is_declptr(type_pointer_get_ref(type)); + return is_ptr(type) && !is_declptr(type_pointer_get_ref_type(type)); }
static inline int last_array(const type_t *type) @@ -102,7 +102,7 @@ static inline int is_context_handle(const type_t *type) const type_t *t; for (t = type; is_ptr(t) || type_is_alias(t); - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref_type(t)) if (is_attr(t->attrs, ATTR_CONTEXTHANDLE)) return 1; return 0; diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 6075d231f6..ff867655fa 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1467,7 +1467,7 @@ static int is_allowed_range_type(const type_t *type) static type_t *get_array_or_ptr_ref(type_t *type) { if (is_ptr(type)) - return type_pointer_get_ref(type); + return type_pointer_get_ref_type(type); else if (is_array(type)) return type_array_get_element_type(type); return NULL; @@ -1483,7 +1483,7 @@ static type_t *append_chain_type(type_t *chain, type_t *type) ;
if (is_ptr(chain_type)) - chain_type->details.pointer.ref = type; + chain_type->details.pointer.ref.type = type; else if (is_array(chain_type)) chain_type->details.array.elem.type = type; else @@ -1526,7 +1526,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl { type_t *t; /* move inline attribute from return type node to function node */ - for (t = func_type; is_ptr(t); t = type_pointer_get_ref(t)) + for (t = func_type; is_ptr(t); t = type_pointer_get_ref_type(t)) ; t->attrs = move_attr(t->attrs, type->attrs, ATTR_INLINE); } @@ -1557,7 +1557,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl if (is_ptr(ptr)) { if (ptr_attr && ptr_attr != FC_UP && - type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE) + type_get_type(type_pointer_get_ref_type(ptr)) == TYPE_INTERFACE) warning_loc_info(&v->loc_info, "%s: pointer attribute applied to interface " "pointer type has no effect\n", v->name); @@ -1585,7 +1585,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl for (;;) { if (is_ptr(t)) - t = type_pointer_get_ref(t); + t = type_pointer_get_ref_type(t); else if (is_array(t)) t = type_array_get_element_type(t); else @@ -1628,14 +1628,14 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl 0, dim, NULL, FC_RP); } else if (is_ptr(*ptype)) - *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE, + *ptype = type_new_array((*ptype)->name, type_pointer_get_ref_type(*ptype), TRUE, 0, dim, NULL, pointer_default); else error_loc("%s: size_is attribute applied to illegal type\n", v->name); }
if (is_ptr(*ptype)) - ptype = &(*ptype)->details.pointer.ref; + ptype = &(*ptype)->details.pointer.ref.type; else if (is_array(*ptype)) ptype = &(*ptype)->details.array.elem.type; else @@ -1661,7 +1661,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl }
if (is_ptr(*ptype)) - ptype = &(*ptype)->details.pointer.ref; + ptype = &(*ptype)->details.pointer.ref.type; else if (is_array(*ptype)) ptype = &(*ptype)->details.array.elem.type; else @@ -1676,20 +1676,20 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl type_t *ft, *t; type_t *return_type = v->declspec.type; v->declspec.type = func_type; - for (ft = v->declspec.type; is_ptr(ft); ft = type_pointer_get_ref(ft)) + for (ft = v->declspec.type; is_ptr(ft); ft = type_pointer_get_ref_type(ft)) ; assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION); ft->details.function->retval = make_var(xstrdup("_RetVal")); ft->details.function->retval->declspec.type = return_type; /* move calling convention attribute, if present, from pointer nodes to * function node */ - for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref(t)) + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t)) ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV); } else { type_t *t; - for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref(t)) + for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref_type(t)) if (is_attr(t->attrs, ATTR_CALLCONV)) error_loc("calling convention applied to non-function-pointer type\n"); } @@ -2484,7 +2484,7 @@ static int is_ptr_guid_type(const type_t *type)
/* second, make sure it is a pointer to something of size sizeof(GUID), * i.e. 16 bytes */ - return (type_memsize(type_pointer_get_ref(type)) == 16); + return (type_memsize(type_pointer_get_ref_type(type)) == 16); }
static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list) @@ -2638,13 +2638,13 @@ static void check_field_common(const type_t *container_type, { const type_t *t = type; while (is_ptr(t)) - t = type_pointer_get_ref(t); + t = type_pointer_get_ref_type(t); if (is_aliaschain_attr(t, ATTR_RANGE)) warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name); break; } case TGT_POINTER: - type = type_pointer_get_ref(type); + type = type_pointer_get_ref_type(type); more_to_do = TRUE; break; case TGT_ARRAY: diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 0b37cc9758..8f65e8aa7b 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -107,8 +107,8 @@ static void clear_output_vars( const var_list_t *args ) if (!is_attr(arg->attrs, ATTR_OUT)) continue; if (is_ptr(arg->declspec.type)) { - if (type_get_type(type_pointer_get_ref(arg->declspec.type)) == TYPE_BASIC) continue; - if (type_get_type(type_pointer_get_ref(arg->declspec.type)) == TYPE_ENUM) continue; + if (type_get_type(type_pointer_get_ref_type(arg->declspec.type)) == TYPE_BASIC) continue; + if (type_get_type(type_pointer_get_ref_type(arg->declspec.type)) == TYPE_ENUM) continue; } print_proxy( "if (%s) MIDL_memset( %s, 0, ", arg->name, arg->name ); if (is_array(arg->declspec.type) && type_array_has_conformance(arg->declspec.type)) diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 19255ec850..f901f83d1e 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -351,10 +351,10 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att return TGT_RANGE; return TGT_ENUM; case TYPE_POINTER: - if (type_get_type(type_pointer_get_ref(type)) == TYPE_INTERFACE || - (type_get_type(type_pointer_get_ref(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS))) + if (type_get_type(type_pointer_get_ref_type(type)) == TYPE_INTERFACE || + (type_get_type(type_pointer_get_ref_type(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS))) return TGT_IFACE_POINTER; - else if (is_aliaschain_attr(type_pointer_get_ref(type), ATTR_CONTEXTHANDLE)) + else if (is_aliaschain_attr(type_pointer_get_ref_type(type), ATTR_CONTEXTHANDLE)) return TGT_CTXT_HANDLE_POINTER; else return TGT_POINTER; @@ -857,7 +857,7 @@ static const char *get_context_handle_type_name(const type_t *type) const type_t *t; for (t = type; is_ptr(t) || type_is_alias(t); - t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref_type(t)) if (is_attr(t->attrs, ATTR_CONTEXTHANDLE)) return t->name; assert(0); @@ -1038,7 +1038,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned case TGT_POINTER: if (get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP) { - const type_t *ref = type_pointer_get_ref( var->declspec.type ); + const type_t *ref = type_pointer_get_ref_type( var->declspec.type );
if (!is_string_type( var->attrs, ref )) buffer_size = get_required_buffer_size_type( ref, NULL, NULL, TRUE, &alignment ); @@ -2127,7 +2127,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs { if (context == TYPE_CONTEXT_TOPLEVELPARAM && is_ptr(type) && pointer_type == FC_RP) { - switch (typegen_detect_type(type_pointer_get_ref(type), NULL, TDT_ALL_TYPES)) + switch (typegen_detect_type(type_pointer_get_ref_type(type), NULL, TDT_ALL_TYPES)) { case TGT_STRING: case TGT_POINTER: @@ -2148,7 +2148,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
if (is_ptr(type)) { - type_t *ref = type_pointer_get_ref(type); + type_t *ref = type_pointer_get_ref_type(type); if(is_declptr(ref) && !is_user_type(ref)) flags |= FC_POINTER_DEREF; } @@ -2189,7 +2189,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
pointer_fc = get_pointer_fc_context(type, attrs, context);
- ref = type_pointer_get_ref(type); + ref = type_pointer_get_ref_type(type); if (type_get_type(ref) == TYPE_ENUM) fc = get_enum_fc(ref); else @@ -2227,7 +2227,7 @@ static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, unsigned int *typestring_offset) { unsigned int offset = *typestring_offset; - type_t *ref = type_pointer_get_ref(type); + type_t *ref = type_pointer_get_ref_type(type);
print_start_tfs_comment(file, type, offset); update_tfsoff(type, offset, file); @@ -2382,7 +2382,7 @@ static void write_array_element_type(FILE *file, const attr_list_t *attrs, const
if (!is_embedded_complex(elem) && is_ptr(elem)) { - type_t *ref = type_pointer_get_ref(elem); + type_t *ref = type_pointer_get_ref_type(elem);
if (processed(ref)) { @@ -2453,7 +2453,7 @@ static int write_pointer_description_offsets( { int written = 0;
- if ((is_ptr(type) && type_get_type(type_pointer_get_ref(type)) != TYPE_INTERFACE) || + if ((is_ptr(type) && type_get_type(type_pointer_get_ref_type(type)) != TYPE_INTERFACE) || (is_array(type) && type_array_is_decl_as_ptr(type))) { if (offset_in_memory && offset_in_buffer) @@ -2478,7 +2478,7 @@ static int write_pointer_description_offsets(
if (is_ptr(type)) { - type_t *ref = type_pointer_get_ref(type); + type_t *ref = type_pointer_get_ref_type(type);
if (is_string_type(attrs, type)) write_string_tfs(file, attrs, type, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset); @@ -2866,7 +2866,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, if (is_array(type)) elem_type = type_array_get_element_type(type); else - elem_type = type_pointer_get_ref(type); + elem_type = type_pointer_get_ref_type(type);
if (type_get_type(elem_type) == TYPE_POINTER && is_array(type)) return write_array_tfs(file, attrs, type, name, typestring_offset); @@ -3231,7 +3231,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, write_string_tfs(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, f->name, tfsoff); else write_pointer_tfs(file, f->attrs, ft, - type_pointer_get_ref(ft)->typestring_offset, + type_pointer_get_ref_type(ft)->typestring_offset, TYPE_CONTEXT_CONTAINER, tfsoff); break; case TGT_ARRAY: @@ -3479,7 +3479,7 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t } else { - const type_t *base = is_ptr(type) ? type_pointer_get_ref(type) : type; + const type_t *base = is_ptr(type) ? type_pointer_get_ref_type(type) : type; const UUID *uuid = get_attrp(base->attrs, ATTR_UUID);
if (! uuid) @@ -3645,7 +3645,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, case TGT_POINTER: { enum type_context ref_context; - type_t *ref = type_pointer_get_ref(type); + type_t *ref = type_pointer_get_ref_type(type);
if (context == TYPE_CONTEXT_TOPLEVELPARAM) ref_context = TYPE_CONTEXT_PARAM; @@ -3665,7 +3665,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, return offset; }
- offset = write_type_tfs( file, attrs, type_pointer_get_ref(type), name, + offset = write_type_tfs( file, attrs, type_pointer_get_ref_type(type), name, ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) return 0; @@ -3848,7 +3848,7 @@ static unsigned int get_required_buffer_size_type( case TGT_POINTER: { unsigned int size, align; - const type_t *ref = type_pointer_get_ref(type); + const type_t *ref = type_pointer_get_ref_type(type); if (is_string_type( attrs, ref )) break; if (!(size = get_required_buffer_size_type( ref, name, NULL, FALSE, &align ))) break; if (get_pointer_fc(type, attrs, toplevel_param) != FC_RP) @@ -4005,7 +4005,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, } else { - const type_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : type; + const type_t *ref = is_ptr(type) ? type_pointer_get_ref_type(type) : type; switch (get_basic_fc(ref)) { case FC_BYTE: @@ -4054,7 +4054,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, if (phase == PHASE_MARSHAL) { print_file(file, indent, "*("); - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL); + write_type_decl(file, is_ptr(type) ? type_pointer_get_ref_type(type) : type, NULL); if (is_ptr(type)) fprintf(file, " *)__frame->_StubMsg.Buffer = *"); else @@ -4065,7 +4065,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, else if (phase == PHASE_UNMARSHAL) { print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof("); - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL); + write_type_decl(file, is_ptr(type) ? type_pointer_get_ref_type(type) : type, NULL); fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n"); print_file(file, indent, "{\n"); print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); @@ -4077,12 +4077,12 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, fprintf(file, " = ("); else fprintf(file, " = *("); - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL); + write_type_decl(file, is_ptr(type) ? type_pointer_get_ref_type(type) : type, NULL); fprintf(file, " *)__frame->_StubMsg.Buffer;\n"); }
print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof("); - write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL); + write_type_decl(file, is_ptr(type) ? type_pointer_get_ref_type(type) : type, NULL); fprintf(file, ");\n"); } } @@ -4168,7 +4168,7 @@ void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local break; } case TGT_POINTER: - type = type_pointer_get_ref(type); + type = type_pointer_get_ref_type(type); continue; case TGT_INVALID: case TGT_USER_TYPE: @@ -4435,7 +4435,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const } case TGT_POINTER: { - const type_t *ref = type_pointer_get_ref(type); + const type_t *ref = type_pointer_get_ref_type(type); if (pointer_type == FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES)) { case TGT_BASIC: @@ -4642,7 +4642,7 @@ void declare_stub_args( FILE *file, int indent, const var_t *func ) !type_array_is_decl_as_ptr(var->declspec.type)) type_to_print = var->declspec.type; else - type_to_print = type_pointer_get_ref(var->declspec.type); + type_to_print = type_pointer_get_ref_type(var->declspec.type); sprintf(name, "_W%u", i++); write_type_decl(file, type_to_print, name); fprintf(file, ";\n"); @@ -4730,7 +4730,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char break; case TGT_POINTER: fprintf(file, " = &%s_W%u;\n", local_var_prefix, i); - ref = type_pointer_get_ref(var->declspec.type); + ref = type_pointer_get_ref_type(var->declspec.type); switch (typegen_detect_type(ref, var->attrs, TDT_IGNORE_STRINGS)) { case TGT_BASIC: diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c index bf667a9a23..4f6b4fc38a 100644 --- a/tools/widl/typelib.c +++ b/tools/widl/typelib.c @@ -99,7 +99,7 @@ static unsigned short builtin_vt(const type_t *t) if (is_array(t)) elem_type = type_array_get_element_type(t); else - elem_type = type_pointer_get_ref(t); + elem_type = type_pointer_get_ref_type(t); if (type_get_type(elem_type) == TYPE_BASIC) { switch (type_basic_get_type(elem_type)) diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 51e54d2a9f..0a8ae0f3b2 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -182,7 +182,7 @@ type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t { type_t *t = make_type(TYPE_POINTER); t->details.pointer.def_fc = pointer_default; - t->details.pointer.ref = ref; + t->details.pointer.ref.type = ref; t->attrs = attrs; return t; } diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 3205d58450..22232fc0a7 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -294,11 +294,16 @@ static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type) return type->details.coclass.ifaces; }
-static inline type_t *type_pointer_get_ref(const type_t *type) +static inline const decl_spec_t *type_pointer_get_ref(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_POINTER); - return type->details.pointer.ref; + return &type->details.pointer.ref; +} + +static inline type_t *type_pointer_get_ref_type(const type_t *type) +{ + return type_pointer_get_ref(type)->type; }
static inline unsigned char type_pointer_get_default_fc(const type_t *type) diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 6ab419b30e..bd727f70b6 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -384,7 +384,7 @@ struct basic_details
struct pointer_details { - struct _type_t *ref; + struct _decl_spec_t ref; unsigned char def_fc; };
@@ -458,7 +458,6 @@ struct _type_t { struct _var_t { char *name; decl_spec_t declspec; - attr_list_t *attrs; expr_t *eval; unsigned int procstring_offset; diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index ff3a63bf46..9a3edf7291 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -862,8 +862,8 @@ static int encode_type( case VT_PTR: { int next_vt; - for(next_vt = 0; is_ptr(type); type = type_pointer_get_ref(type)) { - next_vt = get_type_vt(type_pointer_get_ref(type)); + for(next_vt = 0; is_ptr(type); type = type_pointer_get_ref_type(type)) { + next_vt = get_type_vt(type_pointer_get_ref_type(type)); if (next_vt != 0) break; } @@ -871,7 +871,7 @@ static int encode_type( if (next_vt == 0) next_vt = VT_VOID;
- encode_type(typelib, next_vt, type_pointer_get_ref(type), + encode_type(typelib, next_vt, type_pointer_get_ref_type(type), &target_type, &child_size); /* these types already have an implicit pointer, so we don't need to * add another */ @@ -1093,7 +1093,7 @@ static int encode_var( vt = get_type_vt(type); if (vt == VT_PTR) { type_t *ref = is_ptr(type) ? - type_pointer_get_ref(type) : type_array_get_element_type(type); + type_pointer_get_ref_type(type) : type_array_get_element_type(type); int skip_ptr = encode_var(typelib, ref, var, &target_type, &child_size);
if(skip_ptr == 2) { @@ -1204,7 +1204,7 @@ static void write_default_value(msft_typelib_t *typelib, type_t *type, expr_t *e if (type_get_type(type) == TYPE_ENUM) { vt = VT_I4; } else if (is_ptr(type)) { - vt = get_type_vt(type_pointer_get_ref(type)); + vt = get_type_vt(type_pointer_get_ref_type(type)); if (vt == VT_USERDEFINED) vt = VT_I4; if (expr->cval)