From d0157229e89c6d8ffc491ca600cd933d8951fa76 Mon Sep 17 00:00:00 2001 From: Ferry Huberts Date: Tue, 30 Nov 2010 19:06:55 +0100 Subject: 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 Reviewed-by: Matt Turner Reviewed-by: Keith Packard Signed-off-by: Keith Packard (cherry picked from commit b16964910d29c0bd039e8bb48bcf1199d709fe3e) --- dix/getevents.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index c09972f9c..8c64f1d59 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -111,12 +111,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; } @@ -142,12 +142,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; } -- cgit v1.2.3