widl: Respect pointer attributes better.

This commit is contained in:
Dan Hipschman 2007-09-19 17:04:49 -07:00 committed by Alexandre Julliard
parent 33da66d6c8
commit dbfabf68a2
3 changed files with 28 additions and 0 deletions

View File

@ -362,6 +362,12 @@ s_sum_bogus(bogus_t *b)
return *b->h.p1 + *b->p2 + *b->p3 + b->c;
}
void
s_check_null(int *null)
{
ok(!null, "RPC check_null\n");
}
void
s_stop(void)
{
@ -504,6 +510,8 @@ basic_tests(void)
bogus.p3 = &i3;
bogus.c = 9;
ok(sum_bogus(&bogus) == 12, "RPC sum_bogus\n");
check_null(NULL);
}
static void

View File

@ -223,6 +223,7 @@ interface IServer
} bogus_t;
int sum_bogus(bogus_t *b);
void check_null([unique] int *null);
void stop(void);
}

View File

@ -1266,6 +1266,7 @@ static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr)
{
expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
expr_list_t *lengs = get_attrp(v->attrs, ATTR_LENGTHIS);
int ptr_type = get_attrv(v->attrs, ATTR_POINTERTYPE);
int sizeless, has_varconf;
expr_t *dim;
type_t *atype, **ptype;
@ -1273,7 +1274,25 @@ static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr)
v->type = type;
for ( ; 0 < ptr_level; --ptr_level)
{
v->type = make_type(RPC_FC_RP, v->type);
if (ptr_level == 1 && ptr_type && !arr)
{
v->type->type = ptr_type;
ptr_type = 0;
}
}
if (ptr_type)
{
if (is_ptr(v->type))
{
v->type = duptype(v->type, 1);
v->type->type = ptr_type;
}
else if (!arr)
error("%s: pointer attribute applied to non-pointer type", v->name);
}
sizeless = FALSE;
if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)