From 0be9d2595dd10eed12ad97c836f14cb7278a045f Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Thu, 5 Mar 2009 08:21:42 +0000 Subject: [PATCH] widl: Fix get_explicit_generic_handle_type and is_context_handle to detect attributes set on typedefs other than the first. Change get_explicit_handle_var to use accessors for the type structure. --- tools/widl/header.c | 12 +++++++++--- tools/widl/header.h | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index e1c76a0536e..410a8579712 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -548,8 +548,11 @@ const var_t* get_explicit_handle_var(const var_t *func) return NULL; LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - if (var->type->type == RPC_FC_BIND_PRIMITIVE) + { + const type_t *type = var->type; + if (type_get_type(type) == TYPE_BASIC && type_basic_get_fc(type) == RPC_FC_BIND_PRIMITIVE) return var; + } return NULL; } @@ -557,8 +560,11 @@ const var_t* get_explicit_handle_var(const var_t *func) const type_t* get_explicit_generic_handle_type(const var_t* var) { const type_t *t; - for (t = var->type; is_ptr(t); t = type_pointer_get_ref(t)) - if (t->type != RPC_FC_BIND_PRIMITIVE && is_attr(t->attrs, ATTR_HANDLE)) + for (t = var->type; + is_ptr(t) || type_is_alias(t); + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) + if ((type_get_type_detect_alias(t) != TYPE_BASIC || type_basic_get_fc(t) != RPC_FC_BIND_PRIMITIVE) && + is_attr(t->attrs, ATTR_HANDLE)) return t; return NULL; } diff --git a/tools/widl/header.h b/tools/widl/header.h index 0c0c0a43ff4..d4b3b88f32e 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -75,7 +75,9 @@ static inline int is_string_type(const attr_list_t *attrs, const type_t *type) static inline int is_context_handle(const type_t *type) { const type_t *t; - for (t = type; is_ptr(t); t = type_pointer_get_ref(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)) if (is_attr(t->attrs, ATTR_CONTEXTHANDLE)) return 1; return 0;