shithub: freetype+ttf2subf

Download patch

ref: 259568cf68448a98dce1fb70e356b3994c512650
parent: 75d56e5d7986659ec6b6ad6cf42cc2c6f6a76ae2
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:32:13 EDT 2009

psaux: Handle the string length by FT_Offset variables.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-07-31  suzuki toshiya <[email protected]>
 
+	psaux: Handle the string length by FT_Offset variables.
+
+	* src/psaux/afmparse.c (afm_parser_next_key,
+	afm_tokenize, afm_parse_track_kern,
+	afm_parse_kern_pairs, afm_parse_kern_data,
+	afm_parser_skip_section, afm_parser_parse):
+	The length of key is handled by FT_Offset,
+	instead of FT_UInt.  Although the length of
+	PostScript strings or name object is 16-bit,
+	AFM_STREAM_KEY_LEN() calculates the length
+	from the pointer difference.
+
+	* src/psaux/afmparse.h (afm_parser_next_key):
+	Ditto.
+
+2009-07-31  suzuki toshiya <[email protected]>
+
 	pcf: Fix some data types mismatching with their sources.
 
 	* src/pcf/pcfread.c (pcf_get_bitmaps): The types
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -440,7 +440,7 @@
   FT_LOCAL_DEF( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
-                       FT_UInt*    len )
+                       FT_Offset*  len )
   {
     AFM_Stream  stream = parser->stream;
     char*       key    = 0;  /* make stupid compiler happy */
@@ -488,7 +488,7 @@
     }
 
     if ( len )
-      *len = ( key ) ? AFM_STREAM_KEY_LEN( stream, key )
+      *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key )
                      : 0;
 
     return key;
@@ -497,7 +497,7 @@
 
   static AFM_Token
   afm_tokenize( const char*  key,
-                FT_UInt      len )
+                FT_Offset    len )
   {
     int  n;
 
@@ -585,7 +585,7 @@
     AFM_FontInfo   fi = parser->FontInfo;
     AFM_TrackKern  tk;
     char*          key;
-    FT_UInt        len;
+    FT_Offset      len;
     int            n = -1;
 
 
@@ -686,7 +686,7 @@
     AFM_FontInfo  fi = parser->FontInfo;
     AFM_KernPair  kp;
     char*         key;
-    FT_UInt       len;
+    FT_Offset     len;
     int           n = -1;
 
 
@@ -774,9 +774,9 @@
   static FT_Error
   afm_parse_kern_data( AFM_Parser  parser )
   {
-    FT_Error  error;
-    char*     key;
-    FT_UInt   len;
+    FT_Error   error;
+    char*      key;
+    FT_Offset  len;
 
 
     while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
@@ -818,8 +818,8 @@
                            FT_UInt     n,
                            AFM_Token   end_section )
   {
-    char*    key;
-    FT_UInt  len;
+    char*      key;
+    FT_Offset  len;
 
 
     while ( n-- > 0 )
@@ -850,7 +850,7 @@
     AFM_FontInfo  fi     = parser->FontInfo;
     FT_Error      error  = PSaux_Err_Syntax_Error;
     char*         key;
-    FT_UInt       len;
+    FT_Offset     len;
     FT_Int        metrics_sets = 0;
 
 
--- a/src/psaux/afmparse.h
+++ b/src/psaux/afmparse.h
@@ -77,7 +77,7 @@
   FT_LOCAL( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
-                       FT_UInt*    len );
+                       FT_Offset*  len );
 
 FT_END_HEADER