[PATCH v2] dix: silence compiler warning comparing CARD32 to -1

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 30 21:10:17 PDT 2014


window.c:3246:36: warning: comparison of constant -1 with expression of type
'CARD32' (aka 'unsigned int') is always true
[-Wtautological-constant-out-of-range-compare]
    if (optional->backingBitPlanes != ~0L)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- use ~0U instead of the (CARD32) cast

~0UL causes another warning for shortening long to int.

 dix/window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dix/window.c b/dix/window.c
index d43ef03..22e9e49 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3243,7 +3243,7 @@ CheckWindowOptionalNeed(WindowPtr w)
         return;
     if (optional->userProps != NULL)
         return;
-    if (optional->backingBitPlanes != ~0L)
+    if (optional->backingBitPlanes != ~0U)
         return;
     if (optional->backingPixel != 0)
         return;
-- 
2.1.0



More information about the xorg-devel mailing list