[3/4] widl: Declare fixed-size array args as pointers to arrays (can be applied alone)

Dan Hipschman dsh at linux.ucla.edu
Wed Apr 25 20:20:56 CDT 2007


This patch makes it so widl can generate stubs for functions that take a
fixed-size array as an argument.  Currently, the generated code won't
compile because it tries to initialize an array to zero:

	int a[5];
	a = 0;

This makes widl declare the argument as a pointer to the array:

	int (*a)[5];

which is what midl does.  This patch shouldn't depend on the previous
patches, although the line numbers might be off, it should still apply.
I've sent the testcase for it (the next patch) seperately so this could
be applied even of the other patches aren't.

---
 tools/widl/proxy.c   |    2 ++
 tools/widl/server.c  |    2 ++
 tools/widl/typegen.c |    7 ++++++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index e07d2af..2d6b75b 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -416,6 +416,8 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
       LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
       {
           fprintf(proxy, ", ");
+          if (arg->array)
+              fprintf(proxy, "*");
           write_name(proxy, arg);
       }
   }
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 6f95b09..a51a69c 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -211,6 +211,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
                 else
                     fprintf(server, ",\n");
                 print_server("");
+                if (var->array)
+                    fprintf(server, "*");
                 write_name(server, var);
             }
             fprintf(server, ");\n");
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index f169f82..d63c49a 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2302,7 +2302,12 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
         print_file(file, indent, "");
         write_type(file, var->type, var, var->tname);
         fprintf(file, " ");
-        write_name(file, var);
+        if (var->array) {
+            fprintf(file, "( *");
+            write_name(file, var);
+            fprintf(file, " )");
+        } else
+            write_name(file, var);
         write_array(file, var->array, 0);
         fprintf(file, ";\n");
     }



More information about the wine-patches mailing list