Module: wine Branch: master Commit: c4ca32bbdafb87a01ca6047ca033bde32859f8de URL: http://source.winehq.org/git/wine.git/?a=commit;h=c4ca32bbdafb87a01ca6047ca0...
Author: Rob Shearman rob@codeweavers.com Date: Sun Apr 20 22:15:24 2008 +0100
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.)
---
tools/widl/client.c | 31 ++++++++++--------------------- tools/widl/header.c | 19 ------------------- tools/widl/server.c | 18 ------------------ 3 files changed, 10 insertions(+), 58 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c index eb1ade2..b3f89a7 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -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);
diff --git a/tools/widl/header.c b/tools/widl/header.c index dcc3480..8668ce9 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -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); diff --git a/tools/widl/server.c b/tools/widl/server.c index 2efb712..bb16c54 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -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);