widl: Fix a write_parameters_init bug.

This commit is contained in:
Dan Hipschman 2007-06-14 18:30:26 -07:00 committed by Alexandre Julliard
parent e36981e116
commit 58dea5c9a8
4 changed files with 23 additions and 25 deletions

View File

@ -367,7 +367,7 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
print_proxy("NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
fprintf(proxy, "\n");
write_parameters_init(cur);
write_parameters_init(proxy, indent, cur);
print_proxy("RpcTryFinally\n");
print_proxy("{\n");

View File

@ -54,28 +54,6 @@ static void print_server(const char *format, ...)
va_end(va);
}
void write_parameters_init(const func_t *func)
{
const var_t *var;
if (!func->args)
return;
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
const type_t *t = var->type;
const char *n = var->name;
if (decl_indirect(t))
print_server("MIDL_memset(&%s, 0, sizeof %s);\n", n, n);
else if (is_ptr(t) || is_array(t))
print_server("%s = 0;\n", n);
}
fprintf(server, "\n");
}
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
@ -137,7 +115,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent--;
fprintf(server, "\n");
write_parameters_init(func);
write_parameters_init(server, indent, func);
if (explicit_handle_var)
{

View File

@ -273,6 +273,26 @@ void print(FILE *file, int indent, const char *format, va_list va)
}
}
void write_parameters_init(FILE *file, int indent, const func_t *func)
{
const var_t *var;
if (!func->args)
return;
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
{
const type_t *t = var->type;
const char *n = var->name;
if (decl_indirect(t))
print_file(file, indent, "MIDL_memset(&%s, 0, sizeof %s);\n", n, n);
else if (is_ptr(t) || is_array(t))
print_file(file, indent, "%s = 0;\n", n);
}
fprintf(file, "\n");
}
static void write_formatdesc(FILE *f, int indent, const char *str)
{
print_file(f, indent, "typedef struct _MIDL_%s_FORMAT_STRING\n", str);

View File

@ -53,5 +53,5 @@ void write_user_quad_list(FILE *file);
void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
size_t type_memsize(const type_t *t, unsigned int *align);
int decl_indirect(const type_t *t);
void write_parameters_init(const func_t *func);
void write_parameters_init(FILE *file, int indent, const func_t *func);
void print(FILE *file, int indent, const char *format, va_list ap);