widl [4/4]: Handle user marshalled types

Dan Hipschman dsh at linux.ucla.edu
Tue Aug 15 20:35:01 CDT 2006


This handles user marshalled types.  It fixes a ton of warnings (in fact all
at the default warning level) that were due to bad generated code when
compiling widl's oaidl_p.idl with gcc 4.0.2.  The widl generated oaidl_p.c
is starting to match up slightly better with the MIDL version.

ChangeLog:
* Generate proxy code for user marshalled types
---
 tools/widl/proxy.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index f060a23..1943b22 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -232,6 +232,34 @@ int cant_be_null(var_t *v)
   return 1;                             /* Default is RPC_FC_RP.  */
 }
 
+static int is_user_derived(var_t *v)
+{
+  const attr_t *attrs = v->attrs;
+  const type_t *type = v->type;
+
+  if (! attrs && type)
+  {
+    attrs = type->attrs;
+    type = type->ref;
+  }
+
+  while (attrs)
+  {
+    if (is_attr(attrs, ATTR_WIREMARSHAL))
+      return 1;
+
+    if (type)
+    {
+      attrs = type->attrs;
+      type = type->ref;
+    }
+    else
+      attrs = NULL;
+  }
+
+  return 0;
+}
+
 static void proxy_check_pointers( var_t *arg )
 {
   END_OF_LIST(arg);
@@ -263,6 +291,13 @@ static void marshall_size_arg( var_t *ar
     return;
   }
 
+  if (is_user_derived(arg))
+  {
+    print_proxy("NdrUserMarshalBufferSize( &_StubMsg, (unsigned char*)%s, ", arg->name);
+    fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d] );\n", index);
+    return;
+  }
+
   switch( type->type )
   {
   case RPC_FC_BYTE:
@@ -355,6 +390,13 @@ static void marshall_copy_arg( var_t *ar
     return;
   }
 
+  if (is_user_derived(arg))
+  {
+    print_proxy("NdrUserMarshalMarshall( &_StubMsg, (unsigned char*)%s, ", arg->name);
+    fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d] );\n", index);
+    return;
+  }
+
   switch( type->type )
   {
   case RPC_FC_BYTE:
@@ -454,6 +496,13 @@ static void unmarshall_copy_arg( var_t *
     return;
   }
 
+  if (is_user_derived(arg))
+  {
+    print_proxy("NdrUserMarshalUnmarshall( &_StubMsg, (unsigned char**)&%s, ", arg->name);
+    fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], 0 );\n", index);
+    return;
+  }
+
   switch( type->type )
   {
   case RPC_FC_BYTE:



More information about the wine-patches mailing list