From: Hans Leidekker <hans(a)codeweavers.com> --- tools/widl/metadata.c | 6 +++++- tools/widl/typetree.c | 14 ++++++++++++++ tools/widl/widltypes.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/widl/metadata.c b/tools/widl/metadata.c index 16fb015f50e..7863f6c6fb5 100644 --- a/tools/widl/metadata.c +++ b/tools/widl/metadata.c @@ -1495,7 +1495,11 @@ static void create_typeref( type_t *type ) return; } - base_type->md.name = add_string( base_type->name ); + if (base_type->winmd_short_name) + base_type->md.name = add_string( base_type->winmd_short_name ); + else + base_type->md.name = add_string( base_type->name ); + namespace_str = format_namespace( base_type->namespace, "", ".", NULL, NULL ); base_type->md.namespace = add_string( namespace_str ); diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index c77efbc834f..8f5e885c4e2 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -55,6 +55,7 @@ type_t *make_type(enum type_type type) t->impl_name = NULL; t->param_name = NULL; t->short_name = NULL; + t->winmd_short_name = NULL; memset(&t->details, 0, sizeof(t->details)); memset(&t->md, 0, sizeof(t->md)); t->typestring_offset = 0; @@ -697,6 +698,18 @@ static char *format_parameterized_type_impl_name(type_t *type, typeref_list_t *p return str.buf; } +static char *format_parameterized_type_winmd_short_name(type_t *type, typeref_list_t *params) +{ + struct strbuf str = {0}; + unsigned int count = 0; + + strappend(&str, "%s", type->name); + if (params) count = list_count(params); + if (count) strappend(&str, "`%u", count); + + return str.buf; +} + type_t *type_new_function(var_list_t *args) { var_t *arg; @@ -1530,6 +1543,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, typeref_list_t new_type->c_name = format_parameterized_type_c_name(type, params, "", "_C"); new_type->short_name = format_parameterized_type_short_name(type, params, ""); new_type->param_name = format_parameterized_type_c_name(type, params, "", "__C"); + new_type->winmd_short_name = format_parameterized_type_winmd_short_name(type, params); if (new_type->type_type == TYPE_DELEGATE) { diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index d1ca36877f5..03b4daf2aa9 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -546,6 +546,7 @@ struct _type_t { const char *impl_name; /* C++ parameterized types impl base class name */ const char *param_name; /* used to build c_name of a parameterized type, when used as a parameter */ const char *short_name; /* widl specific short name */ + const char *winmd_short_name; /* metadata short name for parameterized type */ unsigned int typestring_offset; unsigned int ptrdesc; /* used for complex structs */ int typelib_idx; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9527