[PATCH inputproto] XI2.h: Fix off-by-one error in the XIMaskLen definition.

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 13 19:34:50 PDT 2011


On Tue, Apr 12, 2011 at 10:39:25PM +0200, Alexandre Julliard wrote:
> The previous definition would give the wrong result for events that are
> a multiple of 8.
> 
> Signed-off-by: Alexandre Julliard <julliard at winehq.org>
> ---
>  XI2.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/XI2.h b/XI2.h
> index 6ba1377..3c39946 100644
> --- a/XI2.h
> +++ b/XI2.h
> @@ -127,7 +127,7 @@
>  #define XISetMask(ptr, event)   (((unsigned char*)(ptr))[(event)>>3] |=  (1 << ((event) & 7)))
>  #define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
>  #define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &   (1 << ((event) & 7)))
> -#define XIMaskLen(event)        (((event + 7) >> 3))
> +#define XIMaskLen(event)        (((event) >> 3) + 1)

oops. merged, thanks.

Cheers,
  Peter

>  
>  /* Fake device ID's for event selection */
>  #define XIAllDevices                            0
> -- 
> 1.7.4.1


More information about the xorg-devel mailing list