From 9aad1447552173d2bbe07021c859907e344e54a3 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 15 Mar 2010 19:30:37 +0000 Subject: [PATCH] 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 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 7e7a85180b..b7982b04d5 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, ""); -- 2.32.0.93.g670b81a890