[PATCH libXi v2] Fix duplicate sizeof in copy_classes

Jeremy Huddleston jeremyhu at apple.com
Sat Nov 12 16:48:00 PST 2011


Yep, that looks right (re-rev-by me).

On Nov 11, 2011, at 23:43, Peter Hutterer wrote:

> sizeof(bla * sizeof()) is'nt right.
> 
> Plus add some () to the next_block call too to emphasise that *nclasses is
> the multiplicator.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
> ---
> Good catch, I must have read over this 50 times. I guess Jeremy's rev-by
> still stands so I left the tag in, I suspect he just read over this as well.
> 
> src/XExtInt.c |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/XExtInt.c b/src/XExtInt.c
> index d74a8d4..82f5bf3 100644
> --- a/src/XExtInt.c
> +++ b/src/XExtInt.c
> @@ -1481,8 +1481,8 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
> 
>     ptr_wire = (char*)from;
>     ptr_lib = to->classes;
> -    to->classes = next_block(&ptr_lib, *nclasses * sizeof(XIAnyClassInfo*));
> -    memset(to->classes, 0, sizeof(*nclasses * sizeof(XIAnyClassInfo*)));
> +    to->classes = next_block(&ptr_lib, (*nclasses) * sizeof(XIAnyClassInfo*));
> +    memset(to->classes, 0, (*nclasses) * sizeof(XIAnyClassInfo*));
>     len = 0; /* count wire length */
> 
>     for (i = 0; i < *nclasses; i++)
> -- 
> 1.7.7.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list