Commit 259568cf68448a98dce1fb70e356b3994c512650

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

psaux: Handle the string length by FT_Offset variables.

diff --git a/ChangeLog b/ChangeLog
index f76bb51..19a0d28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
+	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 <mpsuzuki@hiroshima-u.ac.jp>
+
 	pcf: Fix some data types mismatching with their sources.
 
 	* src/pcf/pcfread.c (pcf_get_bitmaps): The types
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 44fe42f..91a17e2 100644
--- 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;
 
 
diff --git a/src/psaux/afmparse.h b/src/psaux/afmparse.h
index 7772dc7..de2a530 100644
--- a/src/psaux/afmparse.h
+++ b/src/psaux/afmparse.h
@@ -77,7 +77,7 @@ FT_BEGIN_HEADER
   FT_LOCAL( char* )
   afm_parser_next_key( AFM_Parser  parser,
                        FT_Bool     line,
-                       FT_UInt*    len );
+                       FT_Offset*  len );
 
 FT_END_HEADER