Commit 4f462323 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

widl: Avoid lvalue casts in generated code.

parent 43b21b6e
...@@ -255,9 +255,12 @@ static void write_function_stubs(type_t *iface) ...@@ -255,9 +255,12 @@ static void write_function_stubs(type_t *iface)
indent -= 2; indent -= 2;
fprintf(client, "\n"); fprintf(client, "\n");
print_client("_RetVal = *(("); print_client("_RetVal = *(");
write_type(client, def->type, def, def->tname); 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 */ /* update proc_offset */
......
...@@ -323,9 +323,12 @@ static void marshall_copy_arg( var_t *arg ) ...@@ -323,9 +323,12 @@ static void marshall_copy_arg( var_t *arg )
case RPC_FC_LONG: case RPC_FC_LONG:
case RPC_FC_ULONG: case RPC_FC_ULONG:
case RPC_FC_ENUM32: case RPC_FC_ENUM32:
print_proxy( "*(("); print_proxy( "*(");
write_type(proxy, arg->type, arg, arg->tname); 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; break;
case RPC_FC_STRUCT: case RPC_FC_STRUCT:
...@@ -419,9 +422,12 @@ static void unmarshall_copy_arg( var_t *arg ) ...@@ -419,9 +422,12 @@ static void unmarshall_copy_arg( var_t *arg )
case RPC_FC_LONG: case RPC_FC_LONG:
case RPC_FC_ULONG: case RPC_FC_ULONG:
case RPC_FC_ENUM32: 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 += sizeof(");
write_type(proxy, arg->type, arg, arg->tname); write_type(proxy, arg->type, arg, arg->tname);
fprintf(proxy,"*)_StubMsg.Buffer)++;\n"); fprintf(proxy, ");\n");
break; break;
case RPC_FC_STRUCT: case RPC_FC_STRUCT:
...@@ -595,9 +601,12 @@ static void gen_proxy(type_t *iface, func_t *cur, int idx) ...@@ -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( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n");
print_proxy( "_RetVal = *((" ); print_proxy( "_RetVal = *(" );
write_type(proxy, def->type, def, def->tname); 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--; indent--;
...@@ -798,9 +807,12 @@ static void gen_stub(type_t *iface, func_t *cur, char *cas) ...@@ -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( "_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 += sizeof(");
write_type(proxy, def->type, def, def->tname); write_type(proxy, def->type, def, def->tname);
fprintf(proxy, "*)_StubMsg.Buffer)++ = _RetVal;\n"); fprintf(proxy, ");\n");
} }
indent--; indent--;
......
...@@ -267,9 +267,12 @@ static void write_function_stubs(type_t *iface) ...@@ -267,9 +267,12 @@ static void write_function_stubs(type_t *iface)
print_server("_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;\n"); print_server("_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;\n");
fprintf(server, "\n"); fprintf(server, "\n");
print_server("*(("); print_server("*(");
write_type(server, def->type, def, def->tname); 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--; indent--;
......
...@@ -301,11 +301,14 @@ void marshall_arguments(FILE *file, int indent, func_t *func) ...@@ -301,11 +301,14 @@ void marshall_arguments(FILE *file, int indent, func_t *func)
if (alignment != 0) if (alignment != 0)
print_file(file, indent, "_StubMsg.Buffer += %u;\n", alignment); 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); write_type(file, var->type, var, var->tname);
fprintf(file, " *)_StubMsg.Buffer)++ = "); fprintf(file, " *)_StubMsg.Buffer = ");
write_name(file, var); write_name(file, var);
fprintf(file, ";\n"); fprintf(file, ";\n");
fprintf(file, "_StubMsg.Buffer += sizeof(");
write_type(file, var->type, var, var->tname);
fprintf(file, ");\n");
fprintf(file, "\n"); fprintf(file, "\n");
last_size = size; last_size = size;
...@@ -373,9 +376,12 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func) ...@@ -373,9 +376,12 @@ void unmarshall_arguments(FILE *file, int indent, func_t *func)
print_file(file, indent, ""); print_file(file, indent, "");
write_name(file, var); 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 += sizeof(");
write_type(file, var->type, var, var->tname); write_type(file, var->type, var, var->tname);
fprintf(file, " *)_StubMsg.Buffer)++;\n"); fprintf(file, ");\n");
fprintf(file, "\n"); fprintf(file, "\n");
last_size = size; last_size = size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment