Commit c579dc4391f3eec84e463a3be48f35de1b3e7d3a

suzuki toshiya 2009-08-01T00:32:08

cff: Fix some data types mismatching with their sources.

diff --git a/ChangeLog b/ChangeLog
index b969011..28ed08e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
+	cff: Fix some data types mismatching with their sources.
+
+	* src/cff/cffobjs.c (cff_face_init): The type of
+	`scaling' is matched with the scaling parameter
+	in FT_Matrix_Multiply_Scaled() and
+	FT_Vector_Transform_Scaled().
+
+	* src/cff/cffparse.c (cff_parse_real): The type of
+	`power_ten', `scaling', `exponent_add',
+	`integer_length', `fraction_length',
+	`new_fraction_length' and `shift' are matched with
+	the type of `exponent' to avoid unexpected truncation.
+	(cff_parse_fixed_scaled): The type of `scaling' is
+	matched with the `scaling' argument to
+	cff_parse_real().
+	(cff_parse_fixed_dynamic): Ditto.
+	(cff_parse_font_matrix): The type of `scaling' is
+	matched with the `scaling' argument to
+	cff_parse_dynamic().
+
+2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
 	autofit: Fix some data types mismatching with their sources.
 
 	* src/autofit/afglobal.c: Correct the type of
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 555f2b0..e0966e0 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -584,7 +584,7 @@
 
         if ( sub->units_per_em )
         {
-          FT_Int  scaling;
+          FT_Long  scaling;
 
 
           if ( top->units_per_em > 1 && sub->units_per_em > 1 )
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 57cfdc8..947ec9d 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -130,8 +130,8 @@
   static FT_Fixed
   cff_parse_real( FT_Byte*  start,
                   FT_Byte*  limit,
-                  FT_Int    power_ten,
-                  FT_Int*   scaling )
+                  FT_Long   power_ten,
+                  FT_Long*  scaling )
   {
     FT_Byte*  p = start;
     FT_UInt   nib;
@@ -139,7 +139,7 @@
 
     FT_Long   result, number, rest, exponent;
     FT_Int    sign = 0, exponent_sign = 0;
-    FT_Int    exponent_add, integer_length, fraction_length;
+    FT_Long   exponent_add, integer_length, fraction_length;
 
 
     if ( scaling )
@@ -286,7 +286,7 @@
         {
           if ( exponent > 0 )
           {
-            FT_Int  new_fraction_length, shift;
+            FT_Long  new_fraction_length, shift;
 
 
             /* Make `scaling' as small as possible. */
@@ -386,7 +386,7 @@
   /* but return `10^scaling' times the number read in      */
   static FT_Fixed
   cff_parse_fixed_scaled( FT_Byte**  d,
-                          FT_Int     scaling )
+                          FT_Long    scaling )
   {
     return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
                      : ( cff_parse_integer( d[0], d[1] ) *
@@ -399,7 +399,7 @@
   /* the scaling factor (as a power of 10)                     */
   static FT_Fixed
   cff_parse_fixed_dynamic( FT_Byte**  d,
-                           FT_Int*    scaling )
+                           FT_Long*   scaling )
   {
     FT_ASSERT( scaling );
 
@@ -452,7 +452,7 @@
 
     if ( parser->top >= parser->stack + 6 )
     {
-      FT_Int  scaling;
+      FT_Long  scaling;
 
 
       error = CFF_Err_Ok;