Rob Shearman : widl: Fix the writing of expressions in un-typedef' d structures by using write_type_left to write out the type, which adds the "struct ..." if necessary.

Alexandre Julliard julliard at winehq.org
Tue Mar 16 11:49:14 CDT 2010


Module: wine
Branch: master
Commit: 9aad1447552173d2bbe07021c859907e344e54a3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9aad1447552173d2bbe07021c859907e344e54a3

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Mon Mar 15 19:30:37 2010 +0000

widl: Fix the writing of expressions in un-typedef'd structures by using write_type_left to write out the type, which adds the "struct ..." if necessary.

Also improve the type comparison code to not crash on unnamed
structures (although further changes need to be made to fix the output
in this case) and make it more efficient by first doing a comparison
on the values of the type pointers.

---

 tools/widl/typegen.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 7e7a851..b7982b0 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1118,8 +1118,10 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure,
 
         LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry)
         {
-            if (!strcmp (eval->structure->name, structure->name)
-                && !compare_expr (eval->expr, expr))
+            if (eval->structure == structure ||
+                (eval->structure->name && structure->name &&
+                 !strcmp(eval->structure->name, structure->name) &&
+                 !compare_expr(eval->expr, expr)))
             {
                 found = 1;
                 break;
@@ -3957,8 +3959,11 @@ int write_expr_eval_routines(FILE *file, const char *iface)
         print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",
                    iface, name, callback_offset);
         print_file(file, 0, "{\n");
-        print_file (file, 1, "%s *%s = (%s *)(pStubMsg->StackTop - %u);\n",
-                    name, var_name, name, eval->baseoff);
+        print_file(file, 1, "%s", "");
+        write_type_left(file, (type_t *)eval->structure, TRUE);
+        fprintf(file, " *%s = (", var_name);
+        write_type_left(file, (type_t *)eval->structure, TRUE);
+        fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff);
         print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
         print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)");
         write_expr(file, eval->expr, 1, 1, var_name_expr, eval->structure, "");




More information about the wine-cvs mailing list