WIDL: output code to clear OUT variables in proxy code

Mike McCormack mike at codeweavers.com
Thu Sep 2 07:01:56 CDT 2004


ChangeLog:
* output code to clear OUT variables in proxy code
-------------- next part --------------
Index: tools/widl/proxy.c
===================================================================
RCS file: /home/wine/wine/tools/widl/proxy.c,v
retrieving revision 1.9
diff -u -r1.9 proxy.c
--- tools/widl/proxy.c	7 Jan 2004 04:21:27 -0000	1.9
+++ tools/widl/proxy.c	2 Sep 2004 10:31:56 -0000
@@ -62,6 +62,23 @@
   write_stubdesc();
 }
 
+static void clear_output_vars( var_t *arg )
+{
+  if (arg) {
+    while (NEXT_LINK(arg))
+      arg = NEXT_LINK(arg);
+  }
+  while (arg) {
+    if (is_attr(arg->attrs, ATTR_OUT)) {
+      fprintf( proxy, "    if(%s)\n", arg->name );
+      fprintf( proxy, "        MIDL_memset( %s, 0, sizeof( ", arg->name );
+      write_type(proxy, arg->type, arg, arg->tname);
+      fprintf( proxy, " ));\n" );
+    }
+    arg = PREV_LINK(arg);
+  }
+}
+
 static void gen_proxy(type_t *iface, func_t *cur, int idx)
 {
   var_t *def = cur->def;
@@ -85,7 +102,7 @@
   fprintf(proxy, "\n");
 
   /* FIXME: trace */
-  /* FIXME: clear output vars? */
+  clear_output_vars( cur->args );
 
   fprintf(proxy, "    NdrProxyInitialize(This, &_Msg, &_StubMsg, &Object_StubDesc, %d);\n", idx);
 


More information about the wine-patches mailing list