diff options
author | Keith Packard <keithp@keithp.com> | 2011-12-22 09:35:51 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-12-22 09:35:51 -0800 |
commit | e7df42ab68e30588a5e32ed543b0711821daf009 (patch) | |
tree | 28e1f8be0a9bd558349a848a91b590b64f6b5f76 | |
parent | f75bdf7fbe757f4603e39139acc3c90538a45e15 (diff) |
test/xi2: Fix infinite loop in test_convert_XITouchOwnershipEvent
The touchid test was using a loop like:
for(i = 1; i < 0xffffffff; i <<= 1)
When 'i' is a 32-bit variable, this infinite loops as it goes from
0x80000000 to 0. 'i' is declared as 'long', which is 32-bit in 32-bit mode.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index 9872b793a..faa9f407a 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -1001,10 +1001,12 @@ test_convert_XITouchOwnershipEvent(void) test_XITouchOwnershipEvent(&in); } - for (i = 1; i <= 0xFFFFFFFF; i <<= 1) + for (i = 1; ; i <<= 1) { in.touchid = i; test_XITouchOwnershipEvent(&in); + if (i == (1 << 31)) + break; } } |