Robert Shearman : widl: Fix detection of conformant varying structs.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 24 06:45:18 CST 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Jan 24 11:14:15 2006 +0100

widl: Fix detection of conformant varying structs.
Rename has_conformant_array to has_conformance, add a new variable
has_variance and map has_conformant_string to has_conformance and
has_variance.
A conformant varying struct should be returned if just variance is
present and even if no pointers are present.

---

 tools/widl/parser.y |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8585218..bbce165 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1240,8 +1240,8 @@ static type_t *get_typev(unsigned char t
 static int get_struct_type(var_t *field)
 {
   int has_pointer = 0;
-  int has_conformant_array = 0;
-  int has_conformant_string = 0;
+  int has_conformance = 0;
+  int has_variance = 0;
 
   for (; field; field = NEXT_LINK(field))
   {
@@ -1253,14 +1253,15 @@ static int get_struct_type(var_t *field)
 
     if (is_string_type(field->attrs, field->ptr_level, field->array))
     {
-        has_conformant_string = 1;
+        has_conformance = 1;
+        has_variance = 1;
         continue;
     }
 
     if (is_array_type(field->attrs, field->ptr_level, field->array) &&
         field->array && !field->array->is_const)
     {
-        has_conformant_array = 1;
+        has_conformance = 1;
         if (PREV_LINK(field))
             yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
                     field->name);
@@ -1306,14 +1307,15 @@ static int get_struct_type(var_t *field)
       has_pointer = 1;
       break;
     case RPC_FC_CARRAY:
-      has_conformant_array = 1;
+      has_conformance = 1;
       if (PREV_LINK(field))
           yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
                   field->name);
       break;
     case RPC_FC_C_CSTRING:
     case RPC_FC_C_WSTRING:
-      has_conformant_string = 1;
+      has_conformance = 1;
+      has_variance = 1;
       break;
 
     /*
@@ -1321,12 +1323,13 @@ static int get_struct_type(var_t *field)
      *  a struct should be at least as complex as its member
      */
     case RPC_FC_CVSTRUCT:
-      has_conformant_string = 1;
+      has_conformance = 1;
+      has_variance = 1;
       has_pointer = 1;
       break;
 
     case RPC_FC_CPSTRUCT:
-      has_conformant_array = 1;
+      has_conformance = 1;
       if (PREV_LINK(field))
           yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
                   field->name);
@@ -1334,7 +1337,7 @@ static int get_struct_type(var_t *field)
       break;
 
     case RPC_FC_CSTRUCT:
-      has_conformant_array = 1;
+      has_conformance = 1;
       if (PREV_LINK(field))
           yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
                   field->name);
@@ -1362,11 +1365,11 @@ static int get_struct_type(var_t *field)
     }
   }
 
-  if( has_conformant_string && has_pointer )
+  if( has_variance )
     return RPC_FC_CVSTRUCT;
-  if( has_conformant_array && has_pointer )
+  if( has_conformance && has_pointer )
     return RPC_FC_CPSTRUCT;
-  if( has_conformant_array )
+  if( has_conformance )
     return RPC_FC_CSTRUCT;
   if( has_pointer )
     return RPC_FC_PSTRUCT;




More information about the wine-cvs mailing list