Huw Davies : widl: Initialise [out] only conformant arrays.

Alexandre Julliard julliard at winehq.org
Thu Apr 7 07:36:52 CDT 2011


Module: wine
Branch: stable
Commit: 97675d453537e3430c96248e7a58701479e11c85
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=97675d453537e3430c96248e7a58701479e11c85

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Mar  2 11:14:36 2011 +0000

widl: Initialise [out] only conformant arrays.

This isn't strictly what midl does, however VB relies on the array in
IEnumVARIANT_Next() being zero initialised.  Native uses stubless
proxies, where the initialisation is performed in NdrStubCall2().
(cherry picked from commit 09dd285d8c6458643a5eb6eb5dfa999368a46c74)

---

 tools/widl/typegen.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index c4e51cd..26f3d26 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -4017,10 +4017,22 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
                 if (type_array_has_conformance(var->type))
                 {
                     unsigned int size;
-                    type_t *type = var->type;
+                    type_t *type;
 
                     fprintf(file, " = NdrAllocate(&__frame->_StubMsg, ");
-                    for ( ;
+                    for (type = var->type;
+                         is_array(type) && type_array_has_conformance(type);
+                         type = type_array_get_element(type))
+                    {
+                        write_expr(file, type_array_get_conformance(type), TRUE,
+                                   TRUE, NULL, NULL, local_var_prefix);
+                        fprintf(file, " * ");
+                    }
+                    size = type_memsize(type);
+                    fprintf(file, "%u);\n", size);
+
+                    print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name);
+                    for (type = var->type;
                          is_array(type) && type_array_has_conformance(type);
                          type = type_array_get_element(type))
                     {




More information about the wine-cvs mailing list