Commit 073a0e2901e931d457f205d870ee77eb0ed763cb

Werner Lemberg 2013-05-05T10:41:20

[raster] Fix clang issues. Fix suggested by <octoploid@yandex.com>. * src/raster/ftraster.c (ULong): New typedef. (SCALED): Add proper cast.

diff --git a/ChangeLog b/ChangeLog
index 80913fe..97bc8a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-05-05  Werner Lemberg  <wl@gnu.org>
+
+	[raster] Fix clang issues.
+
+	Fix suggested by <octoploid@yandex.com>.
+
+	* src/raster/ftraster.c (ULong): New typedef.
+	(SCALED): Add proper cast.
+
 2013-05-04  Werner Lemberg  <wl@gnu.org>
 
 	Fix clang fixes.
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index d44629c..01c1a7e 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -310,6 +310,7 @@
   typedef short           Short;
   typedef unsigned short  UShort, *PUShort;
   typedef long            Long, *PLong;
+  typedef unsigned long   ULong;
 
   typedef unsigned char   Byte, *PByte;
   typedef char            Bool;
@@ -448,9 +449,9 @@
 
 #define FLOOR( x )    ( (x) & -ras.precision )
 #define CEILING( x )  ( ( (x) + ras.precision - 1 ) & -ras.precision )
-#define TRUNC( x )    ( (signed long)(x) >> ras.precision_bits )
+#define TRUNC( x )    ( (Long)(x) >> ras.precision_bits )
 #define FRAC( x )     ( (x) & ( ras.precision - 1 ) )
-#define SCALED( x )   ( ( (x) << ras.scale_shift ) - ras.precision_half )
+#define SCALED( x )   ( ( (ULong)(x) << ras.scale_shift ) - ras.precision_half )
 
 #define IS_BOTTOM_OVERSHOOT( x )  ( CEILING( x ) - x >= ras.precision_half )
 #define IS_TOP_OVERSHOOT( x )     ( x - FLOOR( x ) >= ras.precision_half )