Robert Shearman : widl: Fix the writing of arrays with size specified in the array

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 31 11:23:30 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 5764d5518da4faa80834035997414a19f1afeb74
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=5764d5518da4faa80834035997414a19f1afeb74

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Jan 31 18:07:45 2006 +0100

widl: Fix the writing of arrays with size specified in the array
expression instead of the size_is expression.

---

 tools/widl/typegen.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 8649252..d4dc13e 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -634,7 +634,7 @@ static size_t write_array_tfs(FILE *file
     const expr_t *length_is = get_attrp(attrs, ATTR_LENGTHIS);
     const expr_t *size_is = get_attrp(attrs, ATTR_SIZEIS);
     int has_length = length_is && (length_is->type != EXPR_VOID);
-    int has_size = size_is && (size_is->type != EXPR_VOID) && !array->is_const;
+    int has_size = (size_is && (size_is->type != EXPR_VOID)) || !array->is_const;
     size_t start_offset = *typestring_offset;
 
     /* FIXME: need to analyse type for pointers */
@@ -735,7 +735,8 @@ static size_t write_array_tfs(FILE *file
             *typestring_offset += 4;
 
             *typestring_offset += write_conf_or_var_desc(file, current_func,
-                                                         current_structure, size_is);
+                                                         current_structure,
+                                                         size_is ? size_is : array);
 
             /* FIXME: write out pointer descriptor if necessary */
 
@@ -758,7 +759,8 @@ static size_t write_array_tfs(FILE *file
             *typestring_offset += 4;
 
             *typestring_offset += write_conf_or_var_desc(file, current_func,
-                                                         current_structure, size_is);
+                                                         current_structure,
+                                                         size_is ? size_is : array);
             *typestring_offset += write_conf_or_var_desc(file, current_func,
                                                          current_structure,
                                                          length_is);
@@ -1159,7 +1161,7 @@ void marshall_arguments(FILE *file, int 
             const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
             const char *array_type;
             int has_length = length_is && (length_is->type != EXPR_VOID);
-            int has_size = size_is && (size_is->type != EXPR_VOID) && !var->array->is_const;
+            int has_size = (size_is && (size_is->type != EXPR_VOID)) || !var->array->is_const;
 
             if (NEXT_LINK(var->array)) /* multi-dimensional array */
                 array_type = "ComplexArray";
@@ -1353,7 +1355,7 @@ void unmarshall_arguments(FILE *file, in
             const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
             const char *array_type;
             int has_length = length_is && (length_is->type != EXPR_VOID);
-            int has_size = size_is && (size_is->type != EXPR_VOID) && !var->array->is_const;
+            int has_size = (size_is && (size_is->type != EXPR_VOID)) || !var->array->is_const;
 
             if (NEXT_LINK(var->array)) /* multi-dimensional array */
                 array_type = "ComplexArray";




More information about the wine-cvs mailing list