From 69849bd2ee7bd2f180f3a9199fccf2a2c76d9751 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 27 Mar 2024 11:26:10 +0100 Subject: [PATCH] widl: Don't skip a pointer level for pointers to pointers to strings. --- dlls/rpcrt4/tests/server.c | 12 ------------ tools/widl/typegen.c | 19 +++++-------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 09b2d351a1d..f92ed401a69 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -249,12 +249,8 @@ static void (__cdecl *test_I_RpcBindingInqLocalClientPID)(unsigned int protseq, /* type check statements generated in header file */ fnprintf *p_printf = printf; -static BOOL is_interp; - static void set_interp_interface(void) { - is_interp = TRUE; - #define X(name) name = interp_##name; SERVER_FUNCTIONS #undef X @@ -262,8 +258,6 @@ static void set_interp_interface(void) static void set_mixed_interface(void) { - is_interp = FALSE; - #define X(name) name = mixed_##name; SERVER_FUNCTIONS #undef X @@ -1396,11 +1390,9 @@ basic_tests(void) check_null(NULL); - if (!is_interp || sizeof(void*) != 8) { /* broken in widl for win64 */ str = get_filename(); ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__); midl_user_free(str); - } x = echo_ranged_int(0,0,0); ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x); @@ -1678,7 +1670,6 @@ pointer_tests(void) ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name); free(name.name); - if (!is_interp) { /* broken in widl */ n = -1; names = NULL; get_names(&n, &names); @@ -1698,13 +1689,10 @@ pointer_tests(void) MIDL_user_free(namesw[0]); MIDL_user_free(namesw[1]); MIDL_user_free(namesw); - } } - if (!is_interp) { /* broken in widl */ pa2 = a; ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n"); - } s123 = get_s123(); ok(s123->f1 == 1 && s123->f2 == 2 && s123->f3 == 3, "RPC get_s123\n"); diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 7abc9905069..14d8906173b 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2944,7 +2944,10 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, 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); + { + write_array_tfs(file, attrs, type, name, typestring_offset); + return start_offset; + } if (type_get_type(elem_type) != TYPE_BASIC) { @@ -3730,19 +3733,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, else ref_context = context; - if (is_string_type(attrs, ref)) - { - if (context != TYPE_CONTEXT_CONTAINER_NO_POINTERS) - write_pointer_tfs(file, attrs, type, *typeformat_offset + 4, context, typeformat_offset); - - offset = write_type_tfs(file, attrs, ref, name, ref_context, typeformat_offset); - if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) - return 0; - return offset; - } - - offset = write_type_tfs( file, attrs, type_pointer_get_ref_type(type), name, - ref_context, typeformat_offset); + offset = write_type_tfs( file, attrs, ref, name, ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) return 0; return write_pointer_tfs(file, attrs, type, offset, context, typeformat_offset);