[1/6] widl: Pass type attributes from write_array_tfs to write_pointer_description. Resend.

Dmitry Timoshkov dmitry at baikal.ru
Wed Apr 2 04:37:27 CDT 2014


This allows to differentiate strings and write appropriate rpc type
(FC_C_C[W]STRING instead of FC_[W]CHAR).

This version of the patch limits write_array_tfs() to pass attributes
to write_pointer_description() only for strings and avoids unwanted
changes to other pointer types.

In order to test changes in the widl generated code under Windows
and make sure that widl generates the correctly working code I had
to compile widl with PSDK tools. This way I was able to test both
32-bit and 64-bit generated code. All the patches in this sequence
have been tested under Windows as well as under Wine in both 32-bit
and 64-bit builds of the rpcrt4 Wine tests.
---
 tools/widl/typegen.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 37d18f5..889d8c5 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2728,7 +2728,7 @@ static int write_varying_array_pointer_descriptions(
     return pointer_count;
 }
 
-static void write_pointer_description(FILE *file, type_t *type,
+static void write_pointer_description(FILE *file, const attr_list_t *attrs, type_t *type,
                                       unsigned int *typestring_offset)
 {
     unsigned int offset_in_buffer;
@@ -2757,7 +2757,7 @@ static void write_pointer_description(FILE *file, type_t *type,
     if (is_conformant_array(type) &&
         (type_array_is_decl_as_ptr(type) || !current_structure))
         write_conformant_array_pointer_descriptions(
-            file, NULL, type, 0, typestring_offset);
+            file, attrs, type, 0, typestring_offset);
     else if (type_get_type(type) == TYPE_STRUCT &&
              get_struct_fc(type) == RPC_FC_CPSTRUCT)
     {
@@ -2962,7 +2962,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
             print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP);
             print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
             *typestring_offset += 2;
-            write_pointer_description(file, type, typestring_offset);
+            write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset);
             print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END);
             *typestring_offset += 1;
         }
@@ -3149,7 +3149,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
         print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP);
         print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
         *tfsoff += 2;
-        write_pointer_description(file, type, tfsoff);
+        write_pointer_description(file, NULL, type, tfsoff);
         print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END);
         *tfsoff += 1;
     }
-- 
1.9.1




More information about the wine-patches mailing list