[2/2] widl: Make structures with FC_ENUM16 fields complex.

Dan Hipschman dsh at linux.ucla.edu
Thu Mar 20 18:06:14 CDT 2008


Structures containing enum fields without the v1_enum attribute must be
treated as complex because of the range check and memory/wire size
differences.  This includes a test which didn't pass before and now
passes on Wine and Windows.

---
 dlls/rpcrt4/tests/server.c   |   10 ++++++++++
 dlls/rpcrt4/tests/server.idl |    6 ++++++
 tools/widl/parser.y          |    2 +-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index 20176a4..41f3bb2 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -333,6 +333,12 @@ s_square_encu(encu_t *eu)
   }
 }
 
+void
+s_check_se2(se_t *s)
+{
+  ok(s->f == E2, "check_se2\n");
+}
+
 int
 s_sum_parr(int *a[3])
 {
@@ -705,6 +711,7 @@ basic_tests(void)
   str_struct_t ss = {string};
   wstr_struct_t ws = {wstring};
   str_t str;
+  se_t se;
 
   ok(int_return() == INT_CODE, "RPC int_return\n");
 
@@ -774,6 +781,9 @@ basic_tests(void)
   ok(enum_ord(E3) == 3, "RPC enum_ord\n");
   ok(enum_ord(E4) == 4, "RPC enum_ord\n");
 
+  se.f = E2;
+  check_se2(&se);
+
   memset(&aligns, 0, sizeof(aligns));
   aligns.c = 3;
   aligns.i = 4;
diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl
index 7736e14..33e3a48 100644
--- a/dlls/rpcrt4/tests/server.idl
+++ b/dlls/rpcrt4/tests/server.idl
@@ -209,11 +209,17 @@ cpp_quote("#endif")
   case E2: float f2;
   } encue_t;
 
+  typedef struct
+  {
+    e_t f;
+  } se_t;
+
   double square_encu(encu_t *eu);
   int sum_parr(int *a[3]);
   int sum_pcarr([size_is(n)] int *a[], int n);
   int enum_ord(e_t e);
   double square_encue(encue_t *eue);
+  void check_se2(se_t *s);
 
   int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
   int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index aff7c4c..3a89723 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1856,7 +1856,6 @@ static int get_struct_type(var_list_t *fields)
     case RPC_FC_FLOAT:
     case RPC_FC_DOUBLE:
     case RPC_FC_STRUCT:
-    case RPC_FC_ENUM16:
     case RPC_FC_ENUM32:
       break;
 
@@ -1907,6 +1906,7 @@ static int get_struct_type(var_list_t *fields)
     case RPC_FC_ENCAPSULATED_UNION:
     case RPC_FC_NON_ENCAPSULATED_UNION:
     case RPC_FC_BOGUS_STRUCT:
+    case RPC_FC_ENUM16:
       return RPC_FC_BOGUS_STRUCT;
     }
   }



More information about the wine-patches mailing list