- Rob Shearman <robertshearman at gmail.com> Sun Nov 30

widl: Fix optimisation for writing out ref pointers to simple structs and base types.

svn path=/trunk/; revision=38601
This commit is contained in:
Christoph von Wittich 2009-01-06 07:09:07 +00:00
parent 2a6585478f
commit 6e92d826f0

View file

@ -2713,7 +2713,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
}
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 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
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);