Module Name:    xsrc
Committed By:   apb
Date:           Fri Nov  2 07:33:47 UTC 2012

Modified Files:
        xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa: xaaPCache.c

Log Message:
Add parentheses in code that attempts to convert 3 bytes to a 24-bit value.
"+" has higher precedence than "<<", so the old code would have given
incorrect results.  Found using clang -Wshift-op-parentheses.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c:1.2 xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c:1.3
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c:1.2	Tue Nov 30 11:09:01 2010
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/xaaPCache.c	Fri Nov  2 07:33:47 2012
@@ -1198,10 +1198,10 @@ load_24bits(void *where)
     }
 
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
-    return bytes[2] << 16 + bytes[1] << 8 + bytes[0];
+    return (bytes[2] << 16) + (bytes[1] << 8) + bytes[0];
 #endif
 #if X_BYTE_ORDER == X_BIG_ENDIAN
-    return bytes[0] << 16 + bytes[1] << 8 + bytes[2];
+    return (bytes[0] << 16) + (bytes[1] << 8) + bytes[2];
 #endif
 }
 

Reply via email to