From 7576da1c3efd7d4c6471acb5be5caba161da6990 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Mon, 11 Sep 2017 19:23:14 +0900 Subject: [PATCH] [cff] internal API is changed incompatibly for 16bit & ILP64 systems. bias calculation is expected to be ILP32, LP64 or LLP64 systems (int = 32bit). Some internal variables and internal APIs are extended to use 32bit type for 16bit systems. Using long type is too large on LP64 systems, and induces the incompatible change of the internal API for 32bit systems, it should be avoided. --- src/cff/cffgload.c | 10 +++++----- src/cff/cffgload.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 20f3a2c28..b461d0a22 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -342,11 +342,11 @@ /* */ /* */ /* The bias value. */ - static FT_Int + static FT_Int32 cff_compute_bias( FT_Int in_charstring_type, FT_UInt num_subrs ) { - FT_Int result; + FT_Int32 result; if ( in_charstring_type == 1 ) @@ -2326,7 +2326,7 @@ end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS ); if ( idx < end ) - decoder->buildchar[idx] = 1 << 16; + decoder->buildchar[idx] = (FT_Fixed)1 << 16; for ( i = idx + 1; i < end; i++ ) decoder->buildchar[i] = 0; @@ -2526,7 +2526,7 @@ case cff_op_callsubr: { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + FT_UInt32 idx = (FT_UInt32)( ( args[0] >> 16 ) + decoder->locals_bias ); @@ -2570,7 +2570,7 @@ case cff_op_callgsubr: { - FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + FT_UInt32 idx = (FT_UInt32)( ( args[0] >> 16 ) + decoder->globals_bias ); diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 0fa93b439..dfa1f75ba 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -183,8 +183,8 @@ FT_BEGIN_HEADER FT_UInt num_locals; FT_UInt num_globals; - FT_Int locals_bias; - FT_Int globals_bias; + FT_Int32 locals_bias; + FT_Int32 globals_bias; FT_Byte** locals; FT_Byte** globals;