widl: Clear out more types of parameters in the proxy error handlers.

This commit is contained in:
Alexandre Julliard 2011-07-27 16:04:22 +02:00
parent 8b73720d4e
commit 0d76bb7ec3
3 changed files with 18 additions and 34 deletions

View File

@ -147,20 +147,9 @@ static int need_delegation_indirect(const type_t *iface)
static void free_variable( const var_t *arg, const char *local_var_prefix )
{
unsigned int type_offset = arg->type->typestring_offset;
expr_t *iid;
type_t *type = arg->type;
expr_t *size = get_size_is_expr(type, arg->name);
if (size)
{
print_proxy( "__frame->_StubMsg.MaxCount = " );
write_expr(proxy, size, 0, 1, NULL, NULL, local_var_prefix);
fprintf(proxy, ";\n\n");
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void*)%s );\n", arg->name );
return;
}
write_parameter_conf_or_var_exprs(proxy, indent, local_var_prefix, PHASE_FREE, arg, FALSE);
switch (typegen_detect_type(type, arg->attrs, TDT_IGNORE_STRINGS))
{
@ -174,23 +163,11 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
break;
case TGT_IFACE_POINTER:
iid = get_attrp( arg->attrs, ATTR_IIDIS );
if( iid )
{
print_proxy( "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix);
print_proxy( ";\n\n" );
}
/* fall through */
case TGT_POINTER:
if (get_pointer_fc(type, arg->attrs, TRUE) == RPC_FC_FP)
{
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void*)%s );\n", arg->name );
}
else
print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) );
case TGT_ARRAY:
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
fprintf(proxy, "(void *)%s );\n", arg->name );
break;
default:

View File

@ -4035,8 +4035,8 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
return x;
}
static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix,
enum remoting_phase phase, const var_t *var)
void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix,
enum remoting_phase phase, const var_t *var, int valid_variance)
{
const type_t *type = var->type;
/* get fundamental type for the argument */
@ -4057,9 +4057,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
if (type_array_has_variance(type))
{
print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */
print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)");
write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix);
fprintf(file, ";\n\n");
if (valid_variance)
{
print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)");
write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix);
fprintf(file, ";\n\n");
}
else
print_file(file, indent, "__frame->_StubMsg.ActualCount = __frame->_StubMsg.MaxCount;\n\n");
}
}
break;
@ -4135,7 +4140,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
if (phase == PHASE_BUFFERSIZE && get_required_buffer_size( var, &alignment, pass )) return;
write_parameter_conf_or_var_exprs(file, indent, local_var_prefix, phase, var);
write_parameter_conf_or_var_exprs(file, indent, local_var_prefix, phase, var, TRUE);
switch (typegen_detect_type(type, var->attrs, TDT_ALL_TYPES))
{

View File

@ -68,6 +68,8 @@ void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred
void write_procformatstring_offsets( FILE *file, const type_t *iface );
void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase,
enum pass pass, const var_t *var, const char *varname);
void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix,
enum remoting_phase phase, const var_t *var, int valid_variance);
void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix,
enum pass pass, enum remoting_phase phase);
unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *func);