[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.
This commit is contained in:
Werner Lemberg 2015-02-20 08:37:35 +01:00
parent 3a8d0537b5
commit eb05bfbe09
7 changed files with 34 additions and 25 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -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 )

View File

@ -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 ) )

View File

@ -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 */

View File

@ -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,

View File

@ -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 )

View File

@ -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;