Commit 27c32227 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

widl: Re-use print_phase_basetype for generating return value marshaling and unmarshaling code.

parent 3e065ab3
......@@ -272,15 +272,7 @@ static void write_function_stubs(type_t *iface)
/* unmarshal return value */
if (!is_void(def->type, NULL))
{
fprintf(client, "\n");
print_client("_RetVal = *(");
write_type(client, def->type, def, def->tname);
fprintf(client, " *)_StubMsg.Buffer;\n");
print_client("_StubMsg.Buffer += sizeof(");
write_type(client, def->type, def, def->tname);
fprintf(client, ");\n");
}
print_phase_basetype(client, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
/* update proc_offset */
if (func->args)
......
......@@ -388,18 +388,7 @@ static void write_function_stubs(type_t *iface)
/* marshall the return value */
if (!is_void(def->type, NULL))
{
unsigned int alignment;
unsigned int size = get_required_buffer_size(def, &alignment);
print_server("_StubMsg.Buffer += (unsigned char *)(((long)_StubMsg.Buffer + %u) & ~0x%x);\n",
size - 1, size - 1);
print_server("*(");
write_type(server, def->type, def, def->tname);
fprintf(server, " *)_StubMsg.Buffer = _RetVal;\n");
print_server("_StubMsg.Buffer += sizeof(");
write_type(server, def->type, def, def->tname);
fprintf(server, ");\n");
}
print_phase_basetype(server, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal");
indent--;
print_server("}\n");
......
......@@ -39,6 +39,7 @@ void write_procformatstring(FILE *file, type_t *iface);
void write_typeformatstring(FILE *file, type_t *iface);
size_t get_type_memsize(const type_t *type);
unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment);
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
void write_remoting_arguments(FILE *file, int indent, const func_t *func, unsigned int *type_offset, enum pass pass, enum remoting_phase phase);
size_t get_size_procformatstring_var(const var_t *var);
size_t get_size_typeformatstring_var(const var_t *var);
......
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