widl: Don't rely on type_memsize to return 0 for all conformant arrays.

oldstable
Dan Hipschman 2007-11-05 17:23:26 -08:00 committed by Alexandre Julliard
parent 21f5afa6ad
commit a0ac63961d
3 changed files with 14 additions and 3 deletions

View File

@ -487,6 +487,16 @@ s_sum_pcarr2(int n, int **pa)
return s_sum_conf_array(*pa, n);
}
int
s_sum_L1_norms(int n, vector_t *vs)
{
int i;
int sum = 0;
for (i = 0; i < n; ++i)
sum += abs(vs[i].x) + abs(vs[i].y) + abs(vs[i].z);
return sum;
}
void
s_stop(void)
{
@ -983,6 +993,8 @@ array_tests(void)
make_pyramid_doub_carr(4, &dc);
ok(check_pyramid_doub_carr(dc), "RPC make_pyramid_doub_carr\n");
free_pyramid_doub_carr(dc);
ok(sum_L1_norms(2, vs) == 21, "RPC sum_L1_norms\n");
}
static void

View File

@ -298,6 +298,7 @@ cpp_quote("#endif")
void get_name([in,out] name_t *name);
int sum_pcarr2(int n, [size_is(, n)] int **pa);
int sum_L1_norms(int n, [size_is(n)] vector_t *vs);
void stop(void);
}

View File

@ -1535,9 +1535,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type
has_pointer = TRUE;
align = 0;
size = type_memsize(type, &align);
if (size == 0) /* conformant array */
size = type_memsize(type->ref, &align);
size = type_memsize((is_conformant_array(type) ? type->ref : type), &align);
start_offset = *typestring_offset;
update_tfsoff(type, start_offset, file);