widl: Re-use print_phase_basetype for generating return value marshaling and unmarshaling code.
This commit is contained in:
parent
3e065ab342
commit
27c3222715
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue