xserver: Branch 'server-1.9-branch' - 5 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Dec 2 15:54:09 PST 2010


 dix/getevents.c                |   12 ++++++------
 hw/xfree86/common/xf86Xinput.c |    2 +-
 include/inputstr.h             |    2 +-
 render/render.c                |    4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 806790bd9194b60419281442b1ae4fc5fff802aa
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Nov 2 20:10:32 2010 +0100

    render: Fix byteswapping of gradient stops
    
    The function swapStops repeatedly swaps the color components as
    CARD16, but incorrectly steps over them as if they were CARD32.
    
    This causes half of the stops not to be swapped at all and some
    unrelated data be swapped instead.
    
    Signed-off-by: Andrea Canciani <ranma42 at gmail.com>
    Reviewed-by: Soren Sandmann <sandmann at daimi.au.dk>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit dab064fa5e0b1f5c67222562ad5367005832cba1)

diff --git a/render/render.c b/render/render.c
index 00241f9..85a4392 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2552,8 +2552,8 @@ static void swapStops(void *stuff, int num)
     }
     colors = (CARD16 *)(stops);
     for (i = 0; i < 4*num; ++i) {
-        swaps(stops, n);
-        ++stops;
+        swaps(colors, n);
+        ++colors;
     }
 }
 
commit d0157229e89c6d8ffc491ca600cd933d8951fa76
Author: Ferry Huberts <ferry.huberts at pelagic.nl>
Date:   Tue Nov 30 19:06:55 2010 +0100

    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 at pelagic.nl>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b16964910d29c0bd039e8bb48bcf1199d709fe3e)

diff --git a/dix/getevents.c b/dix/getevents.c
index c09972f..8c64f1d 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;
 }
commit fb84f8b5c78cbbcbf32df56d2573e8b93c4eaa49
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Nov 26 10:00:49 2010 +1000

    dix: remove now unnecessary !! before BitIsOn()
    
    The macro has been changed to do this already, no need for double
    not-not-ing.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 23e3d1f23318ce69623f91908f888a09f8b74ac2)

diff --git a/dix/getevents.c b/dix/getevents.c
index b23deaa..c09972f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -114,9 +114,9 @@ button_is_down(DeviceIntPtr pDev, int button, int type)
     int ret = 0;
 
     if (type & BUTTON_PROCESSED)
-        ret |= !!BitIsOn(pDev->button->down, button);
+        ret |= BitIsOn(pDev->button->down, button);
     if (type & BUTTON_POSTED)
-        ret |= !!BitIsOn(pDev->button->postdown, button);
+        ret |= BitIsOn(pDev->button->postdown, button);
 
     return ret;
 }
@@ -145,9 +145,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
     int ret = 0;
 
     if (type & KEY_PROCESSED)
-        ret |= !!BitIsOn(pDev->key->down, key_code);
+        ret |= BitIsOn(pDev->key->down, key_code);
     if (type & KEY_POSTED)
-        ret |= !!BitIsOn(pDev->key->postdown, key_code);
+        ret |= BitIsOn(pDev->key->postdown, key_code);
 
     return ret;
 }
commit 1f1c1ae85600c058f1971e981da9a31eadb71dec
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Dec 2 15:50:28 2010 -0800

    include: let BitIsOn() return a boolean value.
    
    Simply returning the mask bit breaks checks like
        BitIsOn(mask, 0) != BitIsOn(mask, 1);
    as used in 048e93593e3f7a99a7d2a219e1ce2bdc9d407807.
    
    The naming of this macro suggests that it should return boolean values
    anyway. This patch also adds a few simple tests for these macros to make
    sure they don't accidentally break in the future.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Pat Kane <pekane52 at gmail.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 42dc91e32a02b6b21ff5c45f465f3349e5822615)

diff --git a/include/inputstr.h b/include/inputstr.h
index 1b504e9..df67210 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -57,7 +57,7 @@ SOFTWARE.
 #include "geext.h"
 #include "privates.h"
 
-#define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
+#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
 #define SetBit(ptr, bit)  (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
 
commit 444e180ad12baf9d84ff96f68ec9c16b39fac322
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Nov 22 15:14:02 2010 +1000

    xfree86: add missing linebreak in error message.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Magnus Kessler <Magnus.Kessler at gmx.net>
    (cherry picked from commit b31df0439fe336a43a2355e2f1fb223d86045a05)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 877eb03..116d8a4 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1265,7 +1265,7 @@ xf86ScaleAxis(int	Cx,
     }
     else {
 	X = 0;
-	ErrorF ("Divide by Zero in xf86ScaleAxis");
+	ErrorF ("Divide by Zero in xf86ScaleAxis\n");
     }
     
     if (X > Sxhigh)


More information about the xorg-commit mailing list