[ros-diffs] [cwittich] 38601: - Rob Shearman <robertshearman at gmail.com> Sun Nov 30 widl: Fix optimisation for writing out ref pointers to simple structs and base types.

cwittich at svn.reactos.org cwittich at svn.reactos.org
Tue Jan 6 08:09:08 CET 2009


Author: cwittich
Date: Tue Jan  6 01:09:07 2009
New Revision: 38601

URL: http://svn.reactos.org/svn/reactos?rev=38601&view=rev
Log:
- Rob Shearman <robertshearman at gmail.com> Sun Nov 30
widl: Fix optimisation for writing out ref pointers to simple structs and base types.

Modified:
    trunk/reactos/tools/widl/typegen.c

Modified: trunk/reactos/tools/widl/typegen.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=38601&r1=38600&r2=38601&view=diff
==============================================================================
--- trunk/reactos/tools/widl/typegen.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/typegen.c [iso-8859-1] Tue Jan  6 01:09:07 2009
@@ -2713,7 +2713,7 @@
     }
 
     print_file(file, indent, "_StubMsg.Buffer += sizeof(");
-    write_type_decl(file, var->type, NULL);
+    write_type_decl(file, is_ptr(type) ? type->ref : type, NULL);
     fprintf(file, ");\n");
 }
 
@@ -2964,47 +2964,29 @@
         case RPC_FC_BOGUS_STRUCT:
             print_phase_function(file, indent, "ComplexStruct", phase, var, start_offset);
             break;
-        case RPC_FC_RP:
-            if (is_base_type( var->type->ref->type ))
-            {
-                print_phase_basetype(file, indent, phase, pass, var, var->name);
-            }
-            else if (var->type->ref->type == RPC_FC_STRUCT)
-            {
-                if (phase != PHASE_BUFFERSIZE && phase != PHASE_FREE)
-                    print_phase_function(file, indent, "SimpleStruct", phase, var, start_offset + 4);
-            }
-            else
-            {
-                expr_t *iid;
-                if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
-                {
-                    print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
-                    write_expr( file, iid, 1, 1, NULL, NULL );
-                    fprintf( file, ";\n\n" );
-                }
-                print_phase_function(file, indent, "Pointer", phase, var, start_offset);
-            }
-            break;
         default:
             error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, rtype);
         }
     }
     else
     {
-        if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && is_base_type(rtype))
+        const type_t *ref = type->ref;
+        if (type->type == RPC_FC_RP && is_base_type(ref->type))
         {
             if (phase != PHASE_FREE)
                 print_phase_basetype(file, indent, phase, pass, var, var->name);
         }
-        else if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && (rtype == RPC_FC_STRUCT))
+        else if (type->type == RPC_FC_RP && ref->type == RPC_FC_STRUCT &&
+                 !is_user_type(ref))
         {
             if (phase != PHASE_BUFFERSIZE && phase != PHASE_FREE)
-                print_phase_function(file, indent, "SimpleStruct", phase, var, start_offset + 4);
+                print_phase_function(file, indent, "SimpleStruct",
+                                     phase, var,
+                                     ref->typestring_offset);
         }
         else
         {
-            if (var->type->ref->type == RPC_FC_IP)
+            if (ref->type == RPC_FC_IP)
                 print_phase_function(file, indent, "InterfacePointer", phase, var, start_offset);
             else
                 print_phase_function(file, indent, "Pointer", phase, var, start_offset);



More information about the Ros-diffs mailing list