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

Alexandre Julliard julliard at winehq.org
Tue Apr 12 13:39:25 PDT 2011


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)
 
 /* Fake device ID's for event selection */
 #define XIAllDevices                            0
-- 
1.7.4.1


More information about the xorg-devel mailing list