[PATCH 5/7] widl: Fix type_memsize to follow aliases so that the correct size is calculated.

Dan Hipschman dsh at linux.ucla.edu
Mon Jun 23 18:28:49 CDT 2008


On Mon, Jun 23, 2008 at 10:29:11PM +0100, Rob Shearman wrote:
> diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
> index 1f8695a..84115fd 100644
> --- a/tools/widl/typegen.c
> +++ b/tools/widl/typegen.c
> @@ -809,7 +809,9 @@ size_t type_memsize(const type_t *t, unsigned int *align)
>  {
>      size_t size = 0;
>  
> -    if (t->declarray && is_conformant_array(t))
> +    if (t->kind == TKIND_ALIAS)
> +        size = type_memsize(t->orig, align);
> +    else if (t->declarray && is_conformant_array(t))
>      {
>          type_memsize(t->ref, align);
>          size = 0;

What type of thing is this needed for?  A typedef'd type should have all
the same fields as the original except for the attributes, so for most
cases in type_memsize it shouldn't be necessary to check whether the
type is an alias.  For anything that needs to check attributes, I would
think it would be better to fix the predicates (such as
is_conformant_array, etc.) if they do not detect that correctly 100% of
the time.



More information about the wine-devel mailing list