Alexandre Julliard : widl: Store the type format offset for function parameters in the variable object .

Alexandre Julliard julliard at winehq.org
Mon Sep 19 13:48:41 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Sep 19 12:23:01 2011 +0200

widl: Store the type format offset for function parameters in the variable object.

---

 tools/widl/proxy.c     |    2 +-
 tools/widl/typegen.c   |   31 +++++++++++++++++--------------
 tools/widl/widltypes.h |    1 +
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 5d6b669..e0690e4 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -148,7 +148,7 @@ static int need_delegation_indirect(const type_t *iface)
 
 static void free_variable( const var_t *arg, const char *local_var_prefix )
 {
-  unsigned int type_offset = arg->type->typestring_offset;
+  unsigned int type_offset = arg->typestring_offset;
   type_t *type = arg->type;
 
   write_parameter_conf_or_var_exprs(proxy, indent, local_var_prefix, PHASE_FREE, arg, FALSE);
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 14734cf..cadbef2 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -966,7 +966,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
 
     *flags = 0;
     *stack_size = get_stack_size( var, &is_byval );
-    *typestring_offset = var->type->typestring_offset;
+    *typestring_offset = var->typestring_offset;
 
     if (is_in)     *flags |= IsIn;
     if (is_out)    *flags |= IsOut;
@@ -1005,7 +1005,10 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
         *flags |= MustFree;
         if (type_array_is_decl_as_ptr(var->type) && var->type->details.array.ptr_tfsoff &&
             get_pointer_fc( var->type, var->attrs, !is_return ) == RPC_FC_RP)
+        {
+            *typestring_offset = var->type->typestring_offset;
             *flags |= IsSimpleRef;
+        }
         break;
     case TGT_STRING:
         *flags |= MustFree;
@@ -1207,12 +1210,12 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
     }
     else
     {
-        unsigned short offset = var->type->typestring_offset;
+        unsigned short offset = var->typestring_offset;
 
-        if (is_interpreted && is_array(var->type) &&
+        if (!is_interpreted && is_array(var->type) &&
             type_array_is_decl_as_ptr(var->type) &&
             var->type->details.array.ptr_tfsoff)
-            offset = var->type->details.array.ptr_tfsoff;
+            offset = var->type->typestring_offset;
 
         if (is_return)
             print_file(file, indent, "0x52,    /* FC_RETURN_PARAM */\n");
@@ -3611,7 +3614,7 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty
 static unsigned int process_tfs_stmts(FILE *file, const statement_list_t *stmts,
                                       type_pred_t pred, unsigned int *typeformat_offset)
 {
-    const var_t *var;
+    var_t *var;
     const statement_t *stmt;
 
     if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
@@ -3633,16 +3636,16 @@ static unsigned int process_tfs_stmts(FILE *file, const statement_list_t *stmts,
             current_func = func;
             if (is_local(func->attrs)) continue;
 
-            if (!is_void(type_function_get_rettype(func->type)))
-            {
-                write_type_tfs( file, 2, func->attrs, type_function_get_rettype(func->type),
-                                func->name, TYPE_CONTEXT_PARAM, typeformat_offset);
-            }
+            var = type_function_get_retval(func->type);
+            if (!is_void(var->type))
+                var->typestring_offset = write_type_tfs( file, 2, func->attrs, var->type, func->name,
+                                                         TYPE_CONTEXT_PARAM, typeformat_offset);
 
             if (type_get_function_args(func->type))
-                LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
-                    write_type_tfs( file, 2, var->attrs, var->type, var->name,
-                                    TYPE_CONTEXT_TOPLEVELPARAM, typeformat_offset );
+                LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), var_t, entry )
+                    var->typestring_offset = write_type_tfs( file, 2, var->attrs, var->type, var->name,
+                                                             TYPE_CONTEXT_TOPLEVELPARAM,
+                                                             typeformat_offset );
         }
     }
 
@@ -4606,7 +4609,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
                 fprintf(file, " = NdrContextHandleInitialize(\n");
                 print_file(file, indent + 1, "&__frame->_StubMsg,\n");
                 print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n",
-                           var->type->typestring_offset);
+                           var->typestring_offset);
                 break;
             case TGT_ARRAY:
                 if (type_array_has_conformance(var->type))
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 0e8bfeb..84e4467 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -436,6 +436,7 @@ struct _var_t {
   expr_t *eval;
   enum storage_class stgclass;
   unsigned int procstring_offset;
+  unsigned int typestring_offset;
 
   struct _loc_info_t loc_info;
 




More information about the wine-cvs mailing list