shithub: freetype+ttf2subf

Download patch

ref: 3f0f2e462bcbb3d5f9b26ccbc351a3049c22b4b0
parent: 25dba9cfa8418b77f2af7ee5165f0d97dff98f0b
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:32:09 EDT 2009

XXX_cmap_encoding_char_next() return FT_UInt32 values.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,41 @@
 2009-07-31  suzuki toshiya <[email protected]>
 
+	XXX_cmap_encoding_char_next() return FT_UInt32 values.
+
+	* include/freetype/internal/services/svpscmap.h:
+	The size of the charcode value returned by
+	the function typed PS_Unicodes_CharNextFunc is
+	matched with its input charcode value.
+
+	* src/cff/cffmap.c (cff_cmap_encoding_char_next,
+	cff_cmap_unicode_char_next): Ditto.
+
+	* src/pfr/pfrmap.c (pfr_cmap_encoding_char_next):
+	Ditto.
+
+	* src/psaux/t1cmap.c (t1_cmap_std_char_next,
+	t1_cmap_custom_char_next, t1_cmap_unicode_char_next):
+	Ditto.
+
+	* src/psnames/psmodule.c (ps_unicodes_char_next):
+	Ditto.
+
+	* src/winfonts/winfnt.c (fnt_cmap_char_next):
+	Ditto.
+
+	* src/sfnt/ttcmap.c (tt_cmap0_char_next,
+	tt_cmap2_char_next, tt_cmap4_char_next,
+	tt_cmap6_char_next, tt_cmap10_char_next,
+	tt_cmap12_char_next, tt_cmap13_char_next): Ditto.
+	(tt_cmap14_char_variants): Handle base unicode
+	codepoint by FT_UInt32 variable to avoid overflow
+	on 16-bit platforms.
+	(tt_cmap14_ensure): The type of `num_results' is
+	extend to FT_UInt32, to cover unsigned 32-bit
+	`numVarSelectorRecords' in cmap14 table header.
+
+2009-07-31  suzuki toshiya <[email protected]>
+
 	truetype: Extend TT_Face->num_locations for broken TTFs.
 
 	* include/freetype/internal/tttypes.h:
--- a/include/freetype/internal/services/svpscmap.h
+++ b/include/freetype/internal/services/svpscmap.h
@@ -98,7 +98,7 @@
   (*PS_Unicodes_CharIndexFunc)( PS_Unicodes  unicodes,
                                 FT_UInt32    unicode );
 
-  typedef FT_ULong
+  typedef FT_UInt32
   (*PS_Unicodes_CharNextFunc)( PS_Unicodes  unicodes,
                                FT_UInt32   *unicode );
 
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -65,7 +65,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   cff_cmap_encoding_char_next( CFF_CMapStd   cmap,
                                FT_UInt32    *pchar_code )
   {
@@ -192,7 +192,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   cff_cmap_unicode_char_next( PS_Unicodes  unicodes,
                               FT_UInt32   *pchar_code )
   {
--- a/src/pfr/pfrcmap.c
+++ b/src/pfr/pfrcmap.c
@@ -88,7 +88,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   pfr_cmap_char_next( PFR_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -95,7 +95,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_std_char_next( T1_CMapStd   cmap,
                          FT_UInt32   *pchar_code )
   {
@@ -213,7 +213,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_custom_char_next( T1_CMapCustom  cmap,
                             FT_UInt32     *pchar_code )
   {
@@ -312,7 +312,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   t1_cmap_unicode_char_next( PS_Unicodes  unicodes,
                              FT_UInt32   *pchar_code )
   {
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -437,7 +437,7 @@
   }
 
 
-  static FT_ULong
+  static FT_UInt32
   ps_unicodes_char_next( PS_Unicodes  table,
                          FT_UInt32   *unicode )
   {
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -125,7 +125,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap0_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
@@ -460,7 +460,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap2_char_next( TT_CMap     cmap,
                       FT_UInt32  *pcharcode )
   {
@@ -737,7 +737,7 @@
     if ( cmap->cur_charcode >= 0xFFFFUL )
       goto Fail;
 
-    charcode = cmap->cur_charcode + 1;
+    charcode = (FT_UInt)cmap->cur_charcode + 1;
 
     if ( charcode < cmap->cur_start )
       charcode = cmap->cur_start;
@@ -1088,7 +1088,7 @@
     FT_UInt   num_segs2, start, end, offset;
     FT_Int    delta;
     FT_UInt   max, min, mid, num_segs;
-    FT_UInt   charcode = *pcharcode;
+    FT_UInt   charcode = (FT_UInt)*pcharcode;
     FT_UInt   gindex   = 0;
     FT_Byte*  p;
 
@@ -1330,7 +1330,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap4_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
@@ -1481,7 +1481,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap6_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
@@ -1734,7 +1734,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap8_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
@@ -1892,7 +1892,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap10_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
@@ -2210,7 +2210,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap12_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
@@ -2526,7 +2526,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap13_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
@@ -2664,7 +2664,7 @@
      * cmap 14 query functions.  The data is overwritten
      * on each call to these functions.
      */
-    FT_UInt     max_results;
+    FT_UInt32   max_results;
     FT_UInt32*  results;
     FT_Memory   memory;
 
@@ -2685,10 +2685,10 @@
 
   static FT_Error
   tt_cmap14_ensure( TT_CMap14  cmap,
-                    FT_UInt    num_results,
+                    FT_UInt32  num_results,
                     FT_Memory  memory )
   {
-    FT_UInt   old_max = cmap->max_results;
+    FT_UInt32 old_max = cmap->max_results;
     FT_Error  error   = 0;
 
 
@@ -2834,7 +2834,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt )
+  FT_CALLBACK_DEF( FT_UInt32 )
   tt_cmap14_char_next( TT_CMap     cmap,
                        FT_UInt32  *pchar_code )
   {
@@ -3027,10 +3027,10 @@
                       FT_Memory  memory )
   {
     TT_CMap14   cmap14 = (TT_CMap14)cmap;
-    FT_UInt     count  = cmap14->num_selectors;
+    FT_UInt32   count  = cmap14->num_selectors;
     FT_Byte*    p      = cmap->data + 10;
     FT_UInt32*  result;
-    FT_UInt     i;
+    FT_UInt32   i;
 
 
     if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
@@ -3054,7 +3054,7 @@
                            FT_ULong   charCode )
   {
     TT_CMap14   cmap14 = (TT_CMap14)  cmap;
-    FT_UInt     count  = cmap14->num_selectors;
+    FT_UInt32   count  = cmap14->num_selectors;
     FT_Byte*    p      = cmap->data + 10;
     FT_UInt32*  q;
 
@@ -3123,7 +3123,7 @@
 
     for ( q = cmap14->results; numRanges > 0; --numRanges )
     {
-      FT_UInt  uni = TT_NEXT_UINT24( p );
+      FT_UInt32 uni = TT_NEXT_UINT24( p );
 
 
       cnt = FT_NEXT_BYTE( p ) + 1;
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -619,7 +619,7 @@
   }
 
 
-  static FT_UInt
+  static FT_UInt32
   fnt_cmap_char_next( FNT_CMap    cmap,
                       FT_UInt32  *pchar_code )
   {