summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorFerry Huberts <ferry.huberts@pelagic.nl>2010-11-30 19:06:55 +0100
committerKeith Packard <keithp@keithp.com>2010-11-30 13:25:47 -0800
commitb16964910d29c0bd039e8bb48bcf1199d709fe3e (patch)
treececbe1689d1b04fc3d82e3b8d273f7798e8ce59f /dix
parent5f34853d6f936e8a1a317a59972b07e3f191d1ab (diff)
dix: do not use bit-wise operators on the boolean result of BitIsOn
Performing bit-wise operations on a boolean amounts to mixing types, is confusing and basically incorrect; one should only perform logical operations on booleans. Performing such operations relies on the implementation detail that a boolean is in fact an integer and that its value FALSE is implemented as zero. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/getevents.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index f09d31caf..25889de46 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -112,12 +112,12 @@ set_button_up(DeviceIntPtr pDev, int button, int type)
Bool
button_is_down(DeviceIntPtr pDev, int button, int type)
{
- int ret = 0;
+ Bool ret = FALSE;
if (type & BUTTON_PROCESSED)
- ret |= BitIsOn(pDev->button->down, button);
+ ret = ret || BitIsOn(pDev->button->down, button);
if (type & BUTTON_POSTED)
- ret |= BitIsOn(pDev->button->postdown, button);
+ ret = ret || BitIsOn(pDev->button->postdown, button);
return ret;
}
@@ -143,12 +143,12 @@ set_key_up(DeviceIntPtr pDev, int key_code, int type)
Bool
key_is_down(DeviceIntPtr pDev, int key_code, int type)
{
- int ret = 0;
+ Bool ret = FALSE;
if (type & KEY_PROCESSED)
- ret |= BitIsOn(pDev->key->down, key_code);
+ ret = ret || BitIsOn(pDev->key->down, key_code);
if (type & KEY_POSTED)
- ret |= BitIsOn(pDev->key->postdown, key_code);
+ ret = ret || BitIsOn(pDev->key->postdown, key_code);
return ret;
}