widl: Fix SEGVs with client and server code generation when an
interface has no methods.
This commit is contained in:
parent
73a25d316d
commit
86c3a2e76a
|
@ -403,32 +403,33 @@ static void write_formatdesc( const char *str )
|
||||||
|
|
||||||
static void write_formatstringsdecl(type_t *iface)
|
static void write_formatstringsdecl(type_t *iface)
|
||||||
{
|
{
|
||||||
func_t *func;
|
|
||||||
var_t *var;
|
|
||||||
int byte_count = 1;
|
int byte_count = 1;
|
||||||
|
|
||||||
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
||||||
|
|
||||||
/* determine the proc format string size */
|
/* determine the proc format string size */
|
||||||
func = iface->funcs;
|
if (iface->funcs)
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
|
||||||
while (func)
|
|
||||||
{
|
{
|
||||||
/* argument list size */
|
func_t *func = iface->funcs;
|
||||||
if (func->args)
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
while (func)
|
||||||
{
|
{
|
||||||
var = func->args;
|
/* argument list size */
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
if (func->args)
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
byte_count += 2; /* FIXME: determine real size */
|
var_t *var = func->args;
|
||||||
var = PREV_LINK(var);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
byte_count += 2; /* FIXME: determine real size */
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* return value size */
|
/* return value size */
|
||||||
byte_count += 2; /* FIXME: determine real size */
|
byte_count += 2; /* FIXME: determine real size */
|
||||||
func = PREV_LINK(func);
|
func = PREV_LINK(func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print_client("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
print_client("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
||||||
|
|
||||||
|
@ -492,15 +493,18 @@ void write_client(ifref_t *ifaces)
|
||||||
fprintf(client, " */\n");
|
fprintf(client, " */\n");
|
||||||
fprintf(client, "\n");
|
fprintf(client, "\n");
|
||||||
|
|
||||||
write_formatstringsdecl(iface->iface);
|
if (iface->iface->funcs)
|
||||||
write_implicithandledecl(iface->iface);
|
{
|
||||||
|
write_formatstringsdecl(iface->iface);
|
||||||
|
write_implicithandledecl(iface->iface);
|
||||||
|
|
||||||
write_clientinterfacedecl(iface->iface);
|
write_clientinterfacedecl(iface->iface);
|
||||||
write_stubdescdecl(iface->iface);
|
write_stubdescdecl(iface->iface);
|
||||||
write_bindinghandledecl(iface->iface);
|
write_bindinghandledecl(iface->iface);
|
||||||
|
|
||||||
write_function_stubs(iface->iface);
|
write_function_stubs(iface->iface);
|
||||||
write_stubdescriptor(iface->iface);
|
write_stubdescriptor(iface->iface);
|
||||||
|
}
|
||||||
|
|
||||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||||
print_client("#error Invalid build platform for this stub.\n");
|
print_client("#error Invalid build platform for this stub.\n");
|
||||||
|
|
|
@ -428,32 +428,33 @@ static void write_formatdesc( const char *str )
|
||||||
|
|
||||||
static void write_formatstringsdecl(type_t *iface)
|
static void write_formatstringsdecl(type_t *iface)
|
||||||
{
|
{
|
||||||
func_t *func;
|
|
||||||
var_t *var;
|
|
||||||
int byte_count = 1;
|
int byte_count = 1;
|
||||||
|
|
||||||
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
||||||
|
|
||||||
/* determine the proc format string size */
|
/* determine the proc format string size */
|
||||||
func = iface->funcs;
|
if (iface->funcs)
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
|
||||||
while (func)
|
|
||||||
{
|
{
|
||||||
/* argument list size */
|
func_t *func = iface->funcs;
|
||||||
if (func->args)
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
while (func)
|
||||||
{
|
{
|
||||||
var = func->args;
|
/* argument list size */
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
if (func->args)
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
byte_count += 2; /* FIXME: determine real size */
|
var_t *var = func->args;
|
||||||
var = PREV_LINK(var);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
byte_count += 2; /* FIXME: determine real size */
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* return value size */
|
/* return value size */
|
||||||
byte_count += 2; /* FIXME: determine real size */
|
byte_count += 2; /* FIXME: determine real size */
|
||||||
func = PREV_LINK(func);
|
func = PREV_LINK(func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print_server("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
print_server("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
||||||
|
|
||||||
|
@ -503,14 +504,17 @@ void write_server(ifref_t *ifaces)
|
||||||
fprintf(server, " */\n");
|
fprintf(server, " */\n");
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
|
|
||||||
write_formatstringsdecl(iface->iface);
|
if (iface->iface->funcs)
|
||||||
write_serverinterfacedecl(iface->iface);
|
{
|
||||||
write_stubdescdecl(iface->iface);
|
write_formatstringsdecl(iface->iface);
|
||||||
|
write_serverinterfacedecl(iface->iface);
|
||||||
|
write_stubdescdecl(iface->iface);
|
||||||
|
|
||||||
write_function_stubs(iface->iface);
|
write_function_stubs(iface->iface);
|
||||||
|
|
||||||
write_stubdescriptor(iface->iface);
|
write_stubdescriptor(iface->iface);
|
||||||
write_dispatchtable(iface->iface);
|
write_dispatchtable(iface->iface);
|
||||||
|
}
|
||||||
|
|
||||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||||
print_server("#error Invalid build platform for this stub.\n");
|
print_server("#error Invalid build platform for this stub.\n");
|
||||||
|
|
|
@ -119,7 +119,6 @@ static size_t write_procformatstring_var(FILE *file, int indent, var_t *var, int
|
||||||
void write_procformatstring(FILE *file, type_t *iface)
|
void write_procformatstring(FILE *file, type_t *iface)
|
||||||
{
|
{
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
func_t *func = iface->funcs;
|
|
||||||
var_t *var;
|
var_t *var;
|
||||||
unsigned int type_offset = 2;
|
unsigned int type_offset = 2;
|
||||||
|
|
||||||
|
@ -130,32 +129,34 @@ void write_procformatstring(FILE *file, type_t *iface)
|
||||||
print_file(file, indent, "{\n");
|
print_file(file, indent, "{\n");
|
||||||
indent++;
|
indent++;
|
||||||
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
if (iface->funcs)
|
||||||
while (func)
|
|
||||||
{
|
{
|
||||||
/* emit argument data */
|
func_t *func = iface->funcs;
|
||||||
if (func->args)
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
for (; func; func = PREV_LINK(func))
|
||||||
{
|
{
|
||||||
var = func->args;
|
/* emit argument data */
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
if (func->args)
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
write_procformatstring_var(file, indent, var, FALSE, &type_offset);
|
var = func->args;
|
||||||
var = PREV_LINK(var);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
write_procformatstring_var(file, indent, var, FALSE, &type_offset);
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* emit return value data */
|
/* emit return value data */
|
||||||
var = func->def;
|
var = func->def;
|
||||||
if (is_void(var->type, NULL))
|
if (is_void(var->type, NULL))
|
||||||
{
|
{
|
||||||
print_file(file, indent, "0x5b, /* FC_END */\n");
|
print_file(file, indent, "0x5b, /* FC_END */\n");
|
||||||
print_file(file, indent, "0x5c, /* FC_PAD */\n");
|
print_file(file, indent, "0x5c, /* FC_PAD */\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
write_procformatstring_var(file, indent, var, TRUE, &type_offset);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
write_procformatstring_var(file, indent, var, TRUE, &type_offset);
|
|
||||||
|
|
||||||
func = PREV_LINK(func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_file(file, indent, "0x0\n");
|
print_file(file, indent, "0x0\n");
|
||||||
|
@ -214,7 +215,6 @@ static size_t write_typeformatstring_var(FILE *file, int indent, var_t *var)
|
||||||
void write_typeformatstring(FILE *file, type_t *iface)
|
void write_typeformatstring(FILE *file, type_t *iface)
|
||||||
{
|
{
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
func_t *func = iface->funcs;
|
|
||||||
var_t *var;
|
var_t *var;
|
||||||
|
|
||||||
print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
||||||
|
@ -225,20 +225,23 @@ void write_typeformatstring(FILE *file, type_t *iface)
|
||||||
indent++;
|
indent++;
|
||||||
print_file(file, indent, "NdrFcShort(0x0),\n");
|
print_file(file, indent, "NdrFcShort(0x0),\n");
|
||||||
|
|
||||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
if (iface->funcs)
|
||||||
while (func)
|
|
||||||
{
|
{
|
||||||
if (func->args)
|
func_t *func = iface->funcs;
|
||||||
|
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||||
|
for (; func; func = PREV_LINK(func))
|
||||||
{
|
{
|
||||||
var = func->args;
|
if (func->args)
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
write_typeformatstring_var(file, indent, var);
|
var = func->args;
|
||||||
var = PREV_LINK(var);
|
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
write_typeformatstring_var(file, indent, var);
|
||||||
|
var = PREV_LINK(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func = PREV_LINK(func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_file(file, indent, "0x0\n");
|
print_file(file, indent, "0x0\n");
|
||||||
|
|
Loading…
Reference in New Issue