widl: The implicit_handle attribute is allowed with a handle explicitly specified in the function parameters.

In that case, that handle is used instead of the implicit handle.

Fix the check for the explicit_handle attribute being specified without
a handle being specified in the function parameters, even though issuing
an error is wrong. (Thanks to Marcus Meissner & Coverity for spotting
that the check didn't do what it was supposed to do.)
This commit is contained in:
Rob Shearman 2008-04-20 22:15:24 +01:00 committed by Alexandre Julliard
parent 15612e60fd
commit c4ca32bbda
3 changed files with 10 additions and 58 deletions

View File

@ -110,22 +110,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{
explicit_generic_handle_var = get_explicit_generic_handle_var(func);
if (!explicit_generic_handle_var)
{
context_handle_var = get_context_handle_var(func);
}
if (explicit_handle)
{
if (!explicit_handle_var || !explicit_generic_handle_var || !context_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
}
}
else if (implicit_handle)
{
if (explicit_handle_var)
{
error("%s() must not define a binding handle!\n", def->name);
return;
if (!context_handle_var && explicit_handle)
/* FIXME: should use automatically added IDL_handle parameter */
error("explicit_handle attribute specified and %s() does not define an explicit binding handle - not implemented yet\n", def->name);
}
}
@ -196,12 +185,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf(client, ");\n\n");
}
if (implicit_handle)
{
print_client("_Handle = %s;\n", implicit_handle);
fprintf(client, "\n");
}
else if (explicit_handle_var)
if (explicit_handle_var)
{
print_client("_Handle = %s;\n", explicit_handle_var->name);
fprintf(client, "\n");
@ -225,6 +209,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent--;
fprintf(client, "\n");
}
else if (implicit_handle)
{
print_client("_Handle = %s;\n", implicit_handle);
fprintf(client, "\n");
}
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE);

View File

@ -896,31 +896,12 @@ static void write_function_proto(const type_t *iface, const func_t *fun, const c
static void write_function_protos(const type_t *iface)
{
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
const var_t* explicit_handle_var;
const func_t *cur;
int prefixes_differ = strcmp(prefix_client, prefix_server);
if (!iface->funcs) return;
LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
{
var_t *def = cur->def;
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(cur);
if (explicit_handle) {
if (!explicit_handle_var) {
error("%s() does not define an explicit binding handle!\n", def->name);
return;
}
} else if (implicit_handle) {
if (explicit_handle_var) {
error("%s() must not define a binding handle!\n", def->name);
return;
}
}
if (prefixes_differ) {
fprintf(header, "/* client prototype */\n");
write_function_proto(iface, cur, prefix_client);

View File

@ -50,8 +50,6 @@ static void print_server(const char *format, ...)
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
const func_t *func;
const var_t *var;
const var_t* explicit_handle_var;
@ -64,22 +62,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
if (explicit_handle)
{
if (!explicit_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
}
}
else if (implicit_handle)
{
if (explicit_handle_var)
{
error("%s() must not define a binding handle!\n", def->name);
return;
}
}
fprintf(server, "void __RPC_STUB\n");
fprintf(server, "%s_", iface->name);