Commit 82b7eecf authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Use the correct type offset when freeing proxy variables.

parent 936455ed
...@@ -191,10 +191,9 @@ static void proxy_check_pointers( const var_list_t *args ) ...@@ -191,10 +191,9 @@ static void proxy_check_pointers( const var_list_t *args )
} }
} }
static void free_variable( const var_t *arg ) static void free_variable( const var_t *arg, unsigned int type_offset )
{ {
var_t *constraint; var_t *constraint;
int index = 0; /* FIXME */
type_t *type; type_t *type;
expr_list_t *expr; expr_list_t *expr;
...@@ -202,11 +201,11 @@ static void free_variable( const var_t *arg ) ...@@ -202,11 +201,11 @@ static void free_variable( const var_t *arg )
if (expr) if (expr)
{ {
const expr_t *size = LIST_ENTRY( list_head(expr), const expr_t, entry ); const expr_t *size = LIST_ENTRY( list_head(expr), const expr_t, entry );
print_proxy( "_StubMsg.MaxCount = ", arg->name ); print_proxy( "_StubMsg.MaxCount = " );
write_expr(proxy, size, 0); write_expr(proxy, size, 0);
fprintf(proxy, ";\n\n"); fprintf(proxy, ";\n\n");
print_proxy( "NdrClearOutParameters( &_StubMsg, "); print_proxy( "NdrClearOutParameters( &_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], ", index ); fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void*)%s );\n", arg->name ); fprintf(proxy, "(void*)%s );\n", arg->name );
return; return;
} }
...@@ -232,7 +231,7 @@ static void free_variable( const var_t *arg ) ...@@ -232,7 +231,7 @@ static void free_variable( const var_t *arg )
if( constraint ) if( constraint )
print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name); print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name);
print_proxy( "NdrClearOutParameters( &_StubMsg, "); print_proxy( "NdrClearOutParameters( &_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], ", index ); fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void*)%s );\n", arg->name ); fprintf(proxy, "(void*)%s );\n", arg->name );
break; break;
...@@ -241,7 +240,7 @@ static void free_variable( const var_t *arg ) ...@@ -241,7 +240,7 @@ static void free_variable( const var_t *arg )
} }
} }
static void proxy_free_variables( var_list_t *args ) static void proxy_free_variables( var_list_t *args, unsigned int type_offset )
{ {
const var_t *arg; const var_t *arg;
...@@ -250,9 +249,10 @@ static void proxy_free_variables( var_list_t *args ) ...@@ -250,9 +249,10 @@ static void proxy_free_variables( var_list_t *args )
{ {
if (is_attr(arg->attrs, ATTR_OUT)) if (is_attr(arg->attrs, ATTR_OUT))
{ {
free_variable( arg ); free_variable( arg, type_offset );
fprintf(proxy, "\n"); fprintf(proxy, "\n");
} }
type_offset += get_size_typeformatstring_var(arg);
} }
} }
...@@ -301,7 +301,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, ...@@ -301,7 +301,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" ); print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
offset = *type_offset; offset = *type_offset;
write_remoting_arguments(proxy, indent, cur, type_offset, PASS_IN, PHASE_MARSHAL); write_remoting_arguments(proxy, indent, cur, &offset, PASS_IN, PHASE_MARSHAL);
print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" ); print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" );
fprintf(proxy, "\n"); fprintf(proxy, "\n");
...@@ -314,7 +314,8 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, ...@@ -314,7 +314,8 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
indent--; indent--;
fprintf(proxy, "\n"); fprintf(proxy, "\n");
write_remoting_arguments(proxy, indent, cur, &offset, PASS_OUT, PHASE_UNMARSHAL); offset = *type_offset;
write_remoting_arguments(proxy, indent, cur, type_offset, PASS_OUT, PHASE_UNMARSHAL);
if (has_ret) if (has_ret)
print_phase_basetype(proxy, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal"); print_phase_basetype(proxy, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
...@@ -334,7 +335,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, ...@@ -334,7 +335,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
print_proxy( "{\n" ); print_proxy( "{\n" );
if (has_ret) { if (has_ret) {
indent++; indent++;
proxy_free_variables( cur->args ); proxy_free_variables( cur->args, offset );
print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" ); print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
indent--; indent--;
} }
......
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