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,21 +403,21 @@ static void write_formatdesc( const char *str )
|
|||
|
||||
static void write_formatstringsdecl(type_t *iface)
|
||||
{
|
||||
func_t *func;
|
||||
var_t *var;
|
||||
int byte_count = 1;
|
||||
|
||||
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
||||
|
||||
/* determine the proc format string size */
|
||||
func = iface->funcs;
|
||||
if (iface->funcs)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
{
|
||||
/* argument list size */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
var_t *var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
|
@ -430,6 +430,7 @@ static void write_formatstringsdecl(type_t *iface)
|
|||
byte_count += 2; /* FIXME: determine real size */
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
}
|
||||
print_client("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
||||
|
||||
fprintf(client, "\n");
|
||||
|
@ -492,6 +493,8 @@ void write_client(ifref_t *ifaces)
|
|||
fprintf(client, " */\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
write_formatstringsdecl(iface->iface);
|
||||
write_implicithandledecl(iface->iface);
|
||||
|
||||
|
@ -501,6 +504,7 @@ void write_client(ifref_t *ifaces)
|
|||
|
||||
write_function_stubs(iface->iface);
|
||||
write_stubdescriptor(iface->iface);
|
||||
}
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
|
|
|
@ -428,21 +428,21 @@ static void write_formatdesc( const char *str )
|
|||
|
||||
static void write_formatstringsdecl(type_t *iface)
|
||||
{
|
||||
func_t *func;
|
||||
var_t *var;
|
||||
int byte_count = 1;
|
||||
|
||||
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n", 3); /* FIXME */
|
||||
|
||||
/* determine the proc format string size */
|
||||
func = iface->funcs;
|
||||
if (iface->funcs)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
{
|
||||
/* argument list size */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
var_t *var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
|
@ -455,6 +455,7 @@ static void write_formatstringsdecl(type_t *iface)
|
|||
byte_count += 2; /* FIXME: determine real size */
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
}
|
||||
print_server("#define PROC_FORMAT_STRING_SIZE %d\n", byte_count);
|
||||
|
||||
fprintf(server, "\n");
|
||||
|
@ -503,6 +504,8 @@ void write_server(ifref_t *ifaces)
|
|||
fprintf(server, " */\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
write_formatstringsdecl(iface->iface);
|
||||
write_serverinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
|
@ -511,6 +514,7 @@ void write_server(ifref_t *ifaces)
|
|||
|
||||
write_stubdescriptor(iface->iface);
|
||||
write_dispatchtable(iface->iface);
|
||||
}
|
||||
|
||||
print_server("#if !defined(__RPC_WIN32__)\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)
|
||||
{
|
||||
int indent = 0;
|
||||
func_t *func = iface->funcs;
|
||||
var_t *var;
|
||||
unsigned int type_offset = 2;
|
||||
|
||||
|
@ -130,8 +129,11 @@ void write_procformatstring(FILE *file, type_t *iface)
|
|||
print_file(file, indent, "{\n");
|
||||
indent++;
|
||||
|
||||
if (iface->funcs)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
for (; func; func = PREV_LINK(func))
|
||||
{
|
||||
/* emit argument data */
|
||||
if (func->args)
|
||||
|
@ -154,8 +156,7 @@ void write_procformatstring(FILE *file, type_t *iface)
|
|||
}
|
||||
else
|
||||
write_procformatstring_var(file, indent, var, TRUE, &type_offset);
|
||||
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int indent = 0;
|
||||
func_t *func = iface->funcs;
|
||||
var_t *var;
|
||||
|
||||
print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
|
||||
|
@ -225,8 +225,11 @@ void write_typeformatstring(FILE *file, type_t *iface)
|
|||
indent++;
|
||||
print_file(file, indent, "NdrFcShort(0x0),\n");
|
||||
|
||||
if (iface->funcs)
|
||||
{
|
||||
func_t *func = iface->funcs;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
for (; func; func = PREV_LINK(func))
|
||||
{
|
||||
if (func->args)
|
||||
{
|
||||
|
@ -238,7 +241,7 @@ void write_typeformatstring(FILE *file, type_t *iface)
|
|||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
}
|
||||
|
||||
print_file(file, indent, "0x0\n");
|
||||
|
|
Loading…
Reference in New Issue