[2/6] widl: Pass type attributes from write_array_tfs to write_array_element_type.

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


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

This patch also limits write_array_tfs() to pass attributes to
write_array_element_type() only for strings and avoids unwanted
changes to other pointer types.
---
 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 889d8c5..881f161 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2316,7 +2316,7 @@ static void write_member_type(FILE *file, const type_t *cont,
         error("Unsupported member type %d\n", type_get_type(type));
 }
 
-static void write_array_element_type(FILE *file, const type_t *type,
+static void write_array_element_type(FILE *file, const attr_list_t *attrs, const type_t *type,
                                      int cont_is_complex, unsigned int *tfsoff)
 {
     type_t *elem = type_array_get_element(type);
@@ -2331,7 +2331,7 @@ static void write_array_element_type(FILE *file, const type_t *type,
                                     ref->typestring_offset, tfsoff);
             return;
         }
-        if (cont_is_complex && is_string_type(NULL, elem))
+        if (cont_is_complex && is_string_type(attrs, elem))
         {
             write_string_tfs(file, NULL, elem, TYPE_CONTEXT_CONTAINER, NULL, tfsoff);
             return;
@@ -2967,7 +2967,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
             *typestring_offset += 1;
         }
 
-        write_array_element_type(file, type, FALSE, typestring_offset);
+        write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, FALSE, typestring_offset);
         write_end(file, typestring_offset);
     }
     else
@@ -2982,7 +2982,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
             += write_conf_or_var_desc(file, current_structure, baseoff,
                                       type, length_is);
 
-        write_array_element_type(file, type, TRUE, typestring_offset);
+        write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, TRUE, typestring_offset);
         write_end(file, typestring_offset);
     }
 
-- 
1.9.1




More information about the wine-patches mailing list