From d2540090d30effc6961bf713625baf521c6123f0 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 15 Dec 2019 18:21:11 +0100 Subject: [PATCH] [WIDL] Fix type offset calculation for toplevel pointers to non-basetypes. WIDL used the wrong type information when a pointer to a non-basetype is used as a functions parameter. For example, a 'wchar_t**' would be treated as a 'wchar_t*'. This patch will be sent upstream. --- sdk/tools/widl/typegen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/tools/widl/typegen.c b/sdk/tools/widl/typegen.c index 0bca062ab4b..4a791465821 100644 --- a/sdk/tools/widl/typegen.c +++ b/sdk/tools/widl/typegen.c @@ -3639,6 +3639,7 @@ static unsigned int write_type_tfs(FILE *file, int indent, case TGT_POINTER: { enum type_context ref_context; + unsigned int toplevel_offset = *typeformat_offset; type_t *ref = type_pointer_get_ref(type); if (context == TYPE_CONTEXT_TOPLEVELPARAM) @@ -3656,7 +3657,7 @@ static unsigned int write_type_tfs(FILE *file, int indent, offset = write_type_tfs(file, indent, attrs, ref, name, ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) return 0; - return offset; + return (context == TYPE_CONTEXT_TOPLEVELPARAM) ? toplevel_offset : offset; } offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name,