widl: Fix detection of non-pointer context handles.

is_ptr cannot be used because it follows the chain of types into the 
type which has the context_handle attribute, which is typically "void *" 
and so causes these context handles to be incorrectly detected as 
context handles. Instead, we can use is_aliaschain_ptr to follow the 
chain of aliases without following pointers and the absence of the 
context_handle attribute indicates that it must be present on a type 
after following a pointer.
This commit is contained in:
Rob Shearman 2008-03-27 14:03:23 +00:00 committed by Alexandre Julliard
parent 59556de0c1
commit f4a9619364
3 changed files with 16 additions and 4 deletions

View File

@ -203,9 +203,13 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
}
else if (context_handle_var)
{
print_client("if (%s%s != 0)\n", is_ptr(context_handle_var->type) ? "*" : "", context_handle_var->name);
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
int is_ch_ptr = is_aliaschain_attr(context_handle_var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", context_handle_var->name);
indent++;
print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ptr(context_handle_var->type) ? "*" : "", context_handle_var->name);
print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ch_ptr ? "*" : "", context_handle_var->name);
indent--;
fprintf(client, "\n");
}

View File

@ -184,9 +184,13 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf(server, ",\n");
if (is_context_handle(var->type))
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_server("(");
write_type_decl_left(server, var->type);
fprintf(server, ")%sNDRSContextValue(%s)", is_ptr(var->type) ? "" : "*", var->name);
fprintf(server, ")%sNDRSContextValue(%s)", is_ch_ptr ? "" : "*", var->name);
}
else
{

View File

@ -2778,9 +2778,13 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
{
if (pass == PASS_IN)
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
int is_ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_file(file, indent, "NdrClientContextMarshall(\n");
print_file(file, indent + 1, "&_StubMsg,\n");
print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ptr(type) ? "*" : "", var->name);
print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ch_ptr ? "*" : "", var->name);
print_file(file, indent + 1, "%s);\n", in_attr && out_attr ? "1" : "0");
}
else