widl: Avoid lvalue casts in generated code.

oldstable
Hans Leidekker 2005-12-19 21:20:14 +01:00 committed by Alexandre Julliard
parent 43b21b6e86
commit 4f46232368
4 changed files with 40 additions and 16 deletions

View File

@ -255,9 +255,12 @@ static void write_function_stubs(type_t *iface)
indent -= 2;
fprintf(client, "\n");
print_client("_RetVal = *((");
print_client("_RetVal = *(");
write_type(client, def->type, def, def->tname);
fprintf(client, " *)_StubMsg.Buffer)++;\n");
fprintf(client, " *)_StubMsg.Buffer;\n");
fprintf(client, "_StubMsg.Buffer += sizeof(");
write_type(client, def->type, def, def->tname);
fprintf(client, ");\n");
}
/* update proc_offset */

View File

@ -323,9 +323,12 @@ static void marshall_copy_arg( var_t *arg )
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ENUM32:
print_proxy( "*((");
print_proxy( "*(");
write_type(proxy, arg->type, arg, arg->tname);
fprintf(proxy,"*)_StubMsg.Buffer)++ = %s;\n", arg->name );
fprintf(proxy, " *)_StubMsg.Buffer = %s;\n", arg->name );
fprintf(proxy, "_StubMsg.Buffer += sizeof(");
write_type(proxy, arg->type, arg, arg->tname);
fprintf(proxy, ");\n");
break;
case RPC_FC_STRUCT:
@ -419,9 +422,12 @@ static void unmarshall_copy_arg( var_t *arg )
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ENUM32:
print_proxy( "%s = *((", arg->name );
print_proxy( "%s = *(", arg->name );
write_type(proxy, arg->type, arg, arg->tname);
fprintf(proxy,"*)_StubMsg.Buffer)++;\n");
fprintf(proxy," *)_StubMsg.Buffer;\n");
fprintf(proxy, "_StubMsg.Buffer += sizeof(");
write_type(proxy, arg->type, arg, arg->tname);
fprintf(proxy, ");\n");
break;
case RPC_FC_STRUCT:
@ -595,9 +601,12 @@ static void gen_proxy(type_t *iface, func_t *cur, int idx)
*/
print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n");
print_proxy( "_RetVal = *((" );
print_proxy( "_RetVal = *(" );
write_type(proxy, def->type, def, def->tname);
fprintf(proxy, "*)_StubMsg.Buffer)++;\n");
fprintf(proxy, " *)_StubMsg.Buffer;\n");
fprintf(proxy, "_StubMsg.Buffer += sizeof(");
write_type(proxy, def->type, def, def->tname);
fprintf(proxy, ");\n");
}
indent--;
@ -798,9 +807,12 @@ static void gen_stub(type_t *iface, func_t *cur, char *cas)
*/
print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n");
print_proxy( "*((" );
print_proxy( "*(" );
write_type(proxy, def->type, def, def->tname);
fprintf(proxy, "*)_StubMsg.Buffer)++ = _RetVal;\n");
fprintf(proxy, " *)_StubMsg.Buffer = _RetVal;\n");
fprintf(proxy, "_StubMsg.Buffer += sizeof(");
write_type(proxy, def->type, def, def->tname);
fprintf(proxy, ");\n");
}
indent--;

View File

@ -267,9 +267,12 @@ static void write_function_stubs(type_t *iface)
print_server("_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;\n");
fprintf(server, "\n");
print_server("*((");
print_server("*(");
write_type(server, def->type, def, def->tname);
fprintf(server, " *)_StubMsg.Buffer)++ = _RetVal;\n");
fprintf(server, " *)_StubMsg.Buffer = _RetVal;\n");
fprintf(server, "_StubMsg.Buffer += sizeof(");
write_type(server, def->type, def, def->tname);
fprintf(server, ");\n");
}
indent--;

View File

@ -301,11 +301,14 @@ void marshall_arguments(FILE *file, int indent, func_t *func)
if (alignment != 0)
print_file(file, indent, "_StubMsg.Buffer += %u;\n", alignment);
print_file(file, indent, "*((");
print_file(file, indent, "*(");
write_type(file, var->type, var, var->tname);
fprintf(file, " *)_StubMsg.Buffer)++ = ");
fprintf(file, " *)_StubMsg.Buffer = ");
write_name(file, var);
fprintf(file, ";\n");
fprintf(file, "_StubMsg.Buffer += sizeof(");
write_type(file, var->type, var, var->tname);
fprintf(file, ");\n");
fprintf(file, "\n");
last_size = size;
@ -373,9 +376,12 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func)
print_file(file, indent, "");
write_name(file, var);
fprintf(file, " = *((");
fprintf(file, " = *(");
write_type(file, var->type, var, var->tname);
fprintf(file, " *)_StubMsg.Buffer)++;\n");
fprintf(file, " *)_StubMsg.Buffer;\n");
fprintf(file, "_StubMsg.Buffer += sizeof(");
write_type(file, var->type, var, var->tname);
fprintf(file, ");\n");
fprintf(file, "\n");
last_size = size;