utils: convert to uin32 before doing |
authorWim Taymans <wtaymans@redhat.com>
Wed, 17 Sep 2014 13:19:46 +0000 (15:19 +0200)
committerWim Taymans <wtaymans@redhat.com>
Wed, 17 Sep 2014 13:19:46 +0000 (15:19 +0200)
In ORC_READ_UINT32_LE, convert each byte to uint32 before or-ing them
together. This avoids | with signed ints.

orc/orcutils.h

index c10b1c2..31420f3 100644 (file)
@@ -139,11 +139,10 @@ typedef unsigned int orc_bool;
 #endif
 
 #define ORC_READ_UINT32_LE(ptr) \
-  ((orc_uint32)( \
-    ((orc_uint8 *)(ptr))[0] | \
-    (((orc_uint8 *)(ptr))[1]<<8) | \
-    (((orc_uint8 *)(ptr))[2]<<16) | \
-    (((orc_uint8 *)(ptr))[3]<<24)))
+  (((orc_uint32)((orc_uint8 *)(ptr))[0]) | \
+   ((orc_uint32)(((orc_uint8 *)(ptr))[1])<<8) | \
+   ((orc_uint32)(((orc_uint8 *)(ptr))[2])<<16) | \
+   ((orc_uint32)(((orc_uint8 *)(ptr))[3])<<24))
 
 #define ORC_WRITE_UINT32_LE(ptr,val) \
   do { \