[cff] Signedness fixes for new engine. * src/cff/cf2arrst.c, src/cff/cf2fixed.h, src/cff/cf2ft.c, src/cff/cf2ft.h, src/cff/cf2hints.c, src/cff/cf2intrp.c: Apply.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
diff --git a/ChangeLog b/ChangeLog
index f064cad..4cab1b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2015-02-20 Werner Lemberg <wl@gnu.org>
+ [cff] Signedness fixes for new engine.
+
+ * src/cff/cf2arrst.c, src/cff/cf2fixed.h, src/cff/cf2ft.c,
+ src/cff/cf2ft.h, src/cff/cf2hints.c, src/cff/cf2intrp.c: Apply.
+
+2015-02-20 Werner Lemberg <wl@gnu.org>
+
[cff] Signedness fixes for basic infrastructure and old engine.
* include/internal/pshints.h, src/cff/cffdrivr.c,
diff --git a/src/cff/cf2arrst.c b/src/cff/cf2arrst.c
index c8d6f13..528b1fa 100644
--- a/src/cff/cf2arrst.c
+++ b/src/cff/cf2arrst.c
@@ -101,7 +101,7 @@
FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
- FT_Long newSize = (FT_Long)( numElements * arrstack->sizeItem );
+ size_t newSize = numElements * arrstack->sizeItem;
if ( numElements > LONG_MAX / arrstack->sizeItem )
diff --git a/src/cff/cf2fixed.h b/src/cff/cf2fixed.h
index ed1452a..d6d9faf 100644
--- a/src/cff/cf2fixed.h
+++ b/src/cff/cf2fixed.h
@@ -57,22 +57,22 @@ FT_BEGIN_HEADER
/* in C 89, left and right shift of negative numbers is */
/* implementation specific behaviour in the general case */
-#define cf2_intToFixed( i ) \
+#define cf2_intToFixed( i ) \
( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
-#define cf2_fixedToInt( x ) \
+#define cf2_fixedToInt( x ) \
( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
-#define cf2_fixedRound( x ) \
- ( (CF2_Fixed)( ( (x) + 0x8000 ) & 0xFFFF0000L ) )
-#define cf2_floatToFixed( f ) \
+#define cf2_fixedRound( x ) \
+ ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
+#define cf2_floatToFixed( f ) \
( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
-#define cf2_fixedAbs( x ) \
+#define cf2_fixedAbs( x ) \
( (x) < 0 ? -(x) : (x) )
-#define cf2_fixedFloor( x ) \
- ( (CF2_Fixed)( (x) & 0xFFFF0000L ) )
-#define cf2_fixedFraction( x ) \
+#define cf2_fixedFloor( x ) \
+ ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
+#define cf2_fixedFraction( x ) \
( (x) - cf2_fixedFloor( x ) )
-#define cf2_fracToFixed( x ) \
- ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
+#define cf2_fracToFixed( x ) \
+ ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
: ( ( (x) + 0x2000 ) >> 14 ) )
diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c
index ebba469..2c91394 100644
--- a/src/cff/cf2ft.c
+++ b/src/cff/cf2ft.c
@@ -569,7 +569,7 @@
/* used for seac component */
FT_LOCAL_DEF( FT_Error )
cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_UInt code,
+ CF2_Int code,
CF2_Buffer buf )
{
CF2_Int gid;
@@ -587,7 +587,7 @@
return FT_THROW( Invalid_Glyph_Format );
error = cff_get_glyph_data( decoder->builder.face,
- gid,
+ (CF2_UInt)gid,
&charstring,
&len );
/* TODO: for now, just pass the FreeType error through */
diff --git a/src/cff/cf2ft.h b/src/cff/cf2ft.h
index 731da3c..3073df3 100644
--- a/src/cff/cf2ft.h
+++ b/src/cff/cf2ft.h
@@ -103,7 +103,7 @@ FT_BEGIN_HEADER
CF2_Buffer buf );
FT_LOCAL( FT_Error )
cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_UInt code,
+ CF2_Int code,
CF2_Buffer buf );
FT_LOCAL( void )
cf2_freeSeacComponent( CFF_Decoder* decoder,
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index 040d193..0e27000 100644
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -697,10 +697,10 @@
/* make room to insert */
{
- CF2_Int iSrc = hintmap->count - 1;
- CF2_Int iDst = isPair ? hintmap->count + 1 : hintmap->count;
+ CF2_UInt iSrc = hintmap->count - 1;
+ CF2_UInt iDst = isPair ? hintmap->count + 1 : hintmap->count;
- CF2_Int count = hintmap->count - indexInsert;
+ CF2_UInt count = hintmap->count - indexInsert;
if ( iDst >= CF2_MAX_HINT_EDGES )
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index a269606..462c5e7 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -760,11 +760,12 @@
/* push our current CFF charstring region on subrStack */
charstring = (CF2_Buffer)
- cf2_arrstack_getPointer( &subrStack,
- charstringIndex + 1 );
+ cf2_arrstack_getPointer(
+ &subrStack,
+ (size_t)charstringIndex + 1 );
/* set up the new CFF region and pointer */
- subrIndex = cf2_stack_popInt( opStack );
+ subrIndex = (CF2_UInt)cf2_stack_popInt( opStack );
switch ( op1 )
{
@@ -809,8 +810,9 @@
/* restore position in previous charstring */
charstring = (CF2_Buffer)
- cf2_arrstack_getPointer( &subrStack,
- --charstringIndex );
+ cf2_arrstack_getPointer(
+ &subrStack,
+ (CF2_UInt)--charstringIndex );
continue; /* do not clear the stack */
case cf2_cmdESC:
@@ -1088,8 +1090,8 @@
/* must be either 4 or 5 -- */
/* this is a (deprecated) implied `seac' operator */
- CF2_UInt achar;
- CF2_UInt bchar;
+ CF2_Int achar;
+ CF2_Int bchar;
CF2_BufferRec component;
CF2_Fixed dummyWidth; /* ignore component width */
FT_Error error2;