Commit c4ca32bb authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: The implicit_handle attribute is allowed with a handle explicitly…

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.)
parent 15612e60
......@@ -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;
context_handle_var = get_context_handle_var(func);
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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment