Commit 9870d6dacf80bf4d94d5c16724ec42d62d1ce93d

Werner Lemberg 2014-12-07T09:40:47

*/*: Decorate hex constants with `U' and `L' where appropriate.

diff --git a/ChangeLog b/ChangeLog
index 2cf5c88..3d6a0ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-12-07  Werner Lemberg  <wl@gnu.org>
 
+	*/*: Decorate hex constants with `U' and `L' where appropriate.
+
+2014-12-07  Werner Lemberg  <wl@gnu.org>
+
 	[truetype] Prevent memory leak for buggy fonts.
 
 	* src/truetype/ttobjs.c (tt_size_done): Unconditionally call
diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c
index 14f4785..f9a1751 100644
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -435,8 +435,10 @@
   FT_Outline_Get_BBox( FT_Outline*  outline,
                        FT_BBox     *abbox )
   {
-    FT_BBox     cbox = { 0x7FFFFFFF, 0x7FFFFFFF, -0x7FFFFFFF, -0x7FFFFFFF };
-    FT_BBox     bbox = { 0x7FFFFFFF, 0x7FFFFFFF, -0x7FFFFFFF, -0x7FFFFFFF };
+    FT_BBox     cbox = {  0x7FFFFFFFL,  0x7FFFFFFFL,
+                         -0x7FFFFFFFL, -0x7FFFFFFFL };
+    FT_BBox     bbox = {  0x7FFFFFFFL,  0x7FFFFFFFL,
+                         -0x7FFFFFFFL, -0x7FFFFFFFL };
     FT_Vector*  vec;
     FT_UShort   n;
 
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index f3ef8c5..02d256d 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -115,30 +115,31 @@
   FT_BASE_DEF ( FT_Int )
   FT_MSB( FT_UInt32 z )
   {
-    FT_Int shift = 0;
+    FT_Int  shift = 0;
+
 
     /* determine msb bit index in `shift' */
-    if ( z & 0xFFFF0000U )
+    if ( z & 0xFFFF0000UL )
     {
       z     >>= 16;
       shift  += 16;
     }
-    if ( z & 0x0000FF00U )
+    if ( z & 0x0000FF00UL )
     {
       z     >>= 8;
       shift  += 8;
     }
-    if ( z & 0x000000F0U )
+    if ( z & 0x000000F0UL )
     {
       z     >>= 4;
       shift  += 4;
     }
-    if ( z & 0x0000000CU )
+    if ( z & 0x0000000CUL )
     {
       z     >>= 2;
       shift  += 2;
     }
-    if ( z & 0x00000002U )
+    if ( z & 0x00000002UL )
     {
    /* z     >>= 1; */
       shift  += 1;
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index d123e02..5fc41fc 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -834,8 +834,8 @@
     stroker->miter_limit = miter_limit;
 
     /* ensure miter limit has sensible value */
-    if ( stroker->miter_limit < 0x10000 )
-      stroker->miter_limit = 0x10000;
+    if ( stroker->miter_limit < 0x10000L )
+      stroker->miter_limit = 0x10000L;
 
     /* save line join style:                                           */
     /* line join style can be temporarily changed when stroking curves */
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 9b2ccd5..35685a4 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -117,8 +117,8 @@
     /* and CORDIC hypotenuse, so it minimizes the error       */
 
     /* Check carry overflow of lo + 0x40000000 */
-    lo += 0x40000000U;
-    hi += ( lo < 0x40000000U );
+    lo += 0x40000000UL;
+    hi += ( lo < 0x40000000UL );
 
     val  = (FT_Fixed)hi;
 
diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c
index 7816e0b..06598a2 100644
--- a/src/gxvalid/gxvjust.c
+++ b/src/gxvalid/gxvjust.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueTypeGX/AAT just table validation (body).                         */
 /*                                                                         */
-/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */
+/*  Copyright 2005, 2014 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -112,7 +112,7 @@
 #endif
 
     /* According to Apple spec, only 7bits in justClass is used */
-    if ( ( justClass & 0xFFFFFF80 ) != 0 )
+    if ( ( justClass & 0xFFFFFF80UL ) != 0 )
     {
       GXV_TRACE(( "just table includes non-zero value"
                   " in unused justClass higher bits"
@@ -290,7 +290,7 @@
 
     valid->subtable_length = p - table;
 
-    if ( variantsAxis != 0x64756374 ) /* 'duct' */
+    if ( variantsAxis != 0x64756374L ) /* 'duct' */
       GXV_TRACE(( "variantsAxis 0x%08x is non default value",
                    variantsAxis ));
 
diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c
index 95b8ea4..aced818 100644
--- a/src/gxvalid/gxvmorx2.c
+++ b/src/gxvalid/gxvmorx2.c
@@ -198,7 +198,7 @@
                     offset & 0xFFFFU ));
         GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
       }
-      else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL )
+      else if ( ( offset & 0x3FFF0000UL ) == 0x00000000UL )
       { /* positive offset */
         if ( (FT_Long)offset < valid->face->num_glyphs )
           return;
diff --git a/src/tools/test_trig.c b/src/tools/test_trig.c
index 49d927e..99ac1cf 100644
--- a/src/tools/test_trig.c
+++ b/src/tools/test_trig.c
@@ -20,7 +20,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
     {
       FT_Fixed  f1, f2;
       double    d2;
@@ -46,7 +46,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
     {
       FT_Fixed  f1, f2;
       double    d2;
@@ -72,7 +72,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_PI2-0x2000000; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_PI2 - 0x2000000L; i += 0x10000L )
     {
       FT_Fixed  f1, f2;
       double    d2;
@@ -98,7 +98,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
     {
       FT_Fixed  c2, s2;
       double    l, a, c1, s1;
@@ -133,7 +133,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
     {
       FT_Vector  v;
       double     a, c1, s1;
@@ -166,7 +166,7 @@
     int  i;
 
 
-    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+    for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
     {
       FT_Vector  v;
       FT_Fixed   l, l2;
@@ -193,7 +193,7 @@
     int  rotate;
 
 
-    for ( rotate = 0; rotate < FT_ANGLE_2PI; rotate += 0x10000 )
+    for ( rotate = 0; rotate < FT_ANGLE_2PI; rotate += 0x10000L )
     {
       double  ra, cra, sra;
       int     i;
@@ -203,7 +203,7 @@
       cra = cos( ra );
       sra = sin( ra );
 
-      for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 )
+      for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000L )
       {
         FT_Fixed   c2, s2, c4, s4;
         FT_Vector  v;
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 93ac8f9..f2a0913 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -256,89 +256,89 @@
 #define TRICK_SFNT_ID_prep  2
 
       { /* MingLiU 1995 */
-        { 0x05bcf058, 0x000002e4 }, /* cvt  */
-        { 0x28233bf1, 0x000087c4 }, /* fpgm */
-        { 0xa344a1ea, 0x000001e1 }  /* prep */
+        { 0x05bcf058UL, 0x000002e4UL }, /* cvt  */
+        { 0x28233bf1UL, 0x000087c4UL }, /* fpgm */
+        { 0xa344a1eaUL, 0x000001e1UL }  /* prep */
       },
       { /* MingLiU 1996- */
-        { 0x05bcf058, 0x000002e4 }, /* cvt  */
-        { 0x28233bf1, 0x000087c4 }, /* fpgm */
-        { 0xa344a1eb, 0x000001e1 }  /* prep */
+        { 0x05bcf058UL, 0x000002e4UL }, /* cvt  */
+        { 0x28233bf1UL, 0x000087c4UL }, /* fpgm */
+        { 0xa344a1ebUL, 0x000001e1UL }  /* prep */
       },
       { /* DFKaiShu */
-        { 0x11e5ead4, 0x00000350 }, /* cvt  */
-        { 0x5a30ca3b, 0x00009063 }, /* fpgm */
-        { 0x13a42602, 0x0000007e }  /* prep */
+        { 0x11e5ead4UL, 0x00000350UL }, /* cvt  */
+        { 0x5a30ca3bUL, 0x00009063UL }, /* fpgm */
+        { 0x13a42602UL, 0x0000007eUL }  /* prep */
       },
       { /* HuaTianKaiTi */
-        { 0xfffbfffc, 0x00000008 }, /* cvt  */
-        { 0x9c9e48b8, 0x0000bea2 }, /* fpgm */
-        { 0x70020112, 0x00000008 }  /* prep */
+        { 0xfffbfffcUL, 0x00000008UL }, /* cvt  */
+        { 0x9c9e48b8UL, 0x0000bea2UL }, /* fpgm */
+        { 0x70020112UL, 0x00000008UL }  /* prep */
       },
       { /* HuaTianSongTi */
-        { 0xfffbfffc, 0x00000008 }, /* cvt  */
-        { 0x0a5a0483, 0x00017c39 }, /* fpgm */
-        { 0x70020112, 0x00000008 }  /* prep */
+        { 0xfffbfffcUL, 0x00000008UL }, /* cvt  */
+        { 0x0a5a0483UL, 0x00017c39UL }, /* fpgm */
+        { 0x70020112UL, 0x00000008UL }  /* prep */
       },
       { /* NEC fadpop7.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x40c92555, 0x000000e5 }, /* fpgm */
-        { 0xa39b58e3, 0x0000117c }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x40c92555UL, 0x000000e5UL }, /* fpgm */
+        { 0xa39b58e3UL, 0x0000117cUL }  /* prep */
       },
       { /* NEC fadrei5.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x33c41652, 0x000000e5 }, /* fpgm */
-        { 0x26d6c52a, 0x00000f6a }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x33c41652UL, 0x000000e5UL }, /* fpgm */
+        { 0x26d6c52aUL, 0x00000f6aUL }  /* prep */
       },
       { /* NEC fangot7.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x6db1651d, 0x0000019d }, /* fpgm */
-        { 0x6c6e4b03, 0x00002492 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x6db1651dUL, 0x0000019dUL }, /* fpgm */
+        { 0x6c6e4b03UL, 0x00002492UL }  /* prep */
       },
       { /* NEC fangyo5.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x40c92555, 0x000000e5 }, /* fpgm */
-        { 0xde51fad0, 0x0000117c }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x40c92555UL, 0x000000e5UL }, /* fpgm */
+        { 0xde51fad0UL, 0x0000117cUL }  /* prep */
       },
       { /* NEC fankyo5.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x85e47664, 0x000000e5 }, /* fpgm */
-        { 0xa6c62831, 0x00001caa }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x85e47664UL, 0x000000e5UL }, /* fpgm */
+        { 0xa6c62831UL, 0x00001caaUL }  /* prep */
       },
       { /* NEC fanrgo5.ttf */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x2d891cfd, 0x0000019d }, /* fpgm */
-        { 0xa0604633, 0x00001de8 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x2d891cfdUL, 0x0000019dUL }, /* fpgm */
+        { 0xa0604633UL, 0x00001de8UL }  /* prep */
       },
       { /* NEC fangot5.ttc */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x40aa774c, 0x000001cb }, /* fpgm */
-        { 0x9b5caa96, 0x00001f9a }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x40aa774cUL, 0x000001cbUL }, /* fpgm */
+        { 0x9b5caa96UL, 0x00001f9aUL }  /* prep */
       },
       { /* NEC fanmin3.ttc */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x0d3de9cb, 0x00000141 }, /* fpgm */
-        { 0xd4127766, 0x00002280 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x0d3de9cbUL, 0x00000141UL }, /* fpgm */
+        { 0xd4127766UL, 0x00002280UL }  /* prep */
       },
       { /* NEC FA-Gothic, 1996 */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x4a692698, 0x000001f0 }, /* fpgm */
-        { 0x340d4346, 0x00001fca }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x4a692698UL, 0x000001f0UL }, /* fpgm */
+        { 0x340d4346UL, 0x00001fcaUL }  /* prep */
       },
       { /* NEC FA-Minchou, 1996 */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0xcd34c604, 0x00000166 }, /* fpgm */
-        { 0x6cf31046, 0x000022b0 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0xcd34c604UL, 0x00000166UL }, /* fpgm */
+        { 0x6cf31046UL, 0x000022b0UL }  /* prep */
       },
       { /* NEC FA-RoundGothicB, 1996 */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0x5da75315, 0x0000019d }, /* fpgm */
-        { 0x40745a5f, 0x000022e0 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0x5da75315UL, 0x0000019dUL }, /* fpgm */
+        { 0x40745a5fUL, 0x000022e0UL }  /* prep */
       },
       { /* NEC FA-RoundGothicM, 1996 */
-        { 0x00000000, 0x00000000 }, /* cvt  */
-        { 0xf055fc48, 0x000001c2 }, /* fpgm */
-        { 0x3900ded3, 0x00001e18 }  /* prep */
+        { 0x00000000UL, 0x00000000UL }, /* cvt  */
+        { 0xf055fc48UL, 0x000001c2UL }, /* fpgm */
+        { 0x3900ded3UL, 0x00001e18UL }  /* prep */
       }
     };
 
@@ -1116,6 +1116,7 @@
     TT_Size   size  = (TT_Size)ttsize;
     FT_Error  error = FT_Err_Ok;
 
+
 #ifdef TT_USE_BYTECODE_INTERPRETER
     size->bytecode_ready = -1;
     size->cvt_ready      = -1;