shithub: freetype+ttf2subf

Download patch

ref: dc8ad54f1064430115c93ab88dd968c31782ccdd
parent: 60217b7acdab4f3a09469aa2d275cc516e843c31
author: Werner Lemberg <[email protected]>
date: Mon Dec 8 21:12:14 EST 2003

* include/freetype/internal/psaux.h (PS_TableRec): Change type
of `lengths' to FT_PtrDist.
(T1_DecoderRec): Change type of `subrs_len' to FT_PtrDist.
* include/freetype/internal/t1types.h (T1_FontRec): Change type
of `subrs_len' and `charstrings_len' to FT_PtrDist.

* src/base/ftobjs.c (Mac_Read_POST_Resource): Replace `junk'
variable with better solution.
(IsMacResource): Remove unused variable `map_len'.
Replace `junk' variable with better solution.
(FT_Open_Face) [!FT_MACINTOSH]: Add conditional
FT_CONFIG_OPTION_MAC_FONTS.

* src/autohint/ahhint.c (ah_hinter_hint_edges,
ah_hinter_align_strong_points): Add some casts.

* src/base/ftoutln.c (FT_OrientationExtremumRec): Change type
of `pos' to FT_Long.

* src/base/ftobjs.c (Mac_Read_POST_Resource,
Mac_Read_sfnt_Resource): Change type of `len' to FT_Long.

* src/type42/t42parse.c (t42_parse_dict): Add cast for `n_keywords'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2003-12-08  Werner Lemberg  <[email protected]>
+
+	* include/freetype/internal/psaux.h (PS_TableRec): Change type
+	of `lengths' to FT_PtrDist.
+	(T1_DecoderRec): Change type of `subrs_len' to FT_PtrDist.
+	* include/freetype/internal/t1types.h (T1_FontRec): Change type
+	of `subrs_len' and `charstrings_len' to FT_PtrDist.
+
+	* src/base/ftobjs.c (Mac_Read_POST_Resource): Replace `junk'
+	variable with better solution.
+	(IsMacResource): Remove unused variable `map_len'.
+	Replace `junk' variable with better solution.
+	(FT_Open_Face) [!FT_MACINTOSH]: Add conditional
+	FT_CONFIG_OPTION_MAC_FONTS.
+
+2003-12-08  Wolfgang Domr�se  <[email protected]>
+
+	* src/autohint/ahhint.c (ah_hinter_hint_edges,
+	ah_hinter_align_strong_points): Add some casts.
+
+	* src/base/ftoutln.c (FT_OrientationExtremumRec): Change type
+	of `pos' to FT_Long.
+
+	* src/base/ftobjs.c (Mac_Read_POST_Resource,
+	Mac_Read_sfnt_Resource): Change type of `len' to FT_Long.
+
+	* src/type42/t42parse.c (t42_parse_dict): Add cast for `n_keywords'.
+
 2003-12-07  Werner Lemberg  <[email protected]>
 
 	* docs/raster.txt: New file, taken from FreeType 1 and completely
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -124,7 +124,7 @@
     FT_Int             max_elems;
     FT_Int             num_elems;
     FT_Byte**          elements;       /* addresses of table elements */
-    FT_Int*            lengths;        /* lengths of table elements   */
+    FT_PtrDist*        lengths;        /* lengths of table elements   */
 
     FT_Memory          memory;
     PS_Table_FuncsRec  funcs;
@@ -658,7 +658,7 @@
     FT_Int               lenIV;        /* internal for sub routine calls */
     FT_UInt              num_subrs;
     FT_Byte**            subrs;
-    FT_Int*              subrs_len;    /* array of subrs length (optional) */
+    FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */
 
     FT_Matrix            font_matrix;
     FT_Vector            font_offset;
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -102,12 +102,12 @@
 
     FT_Int           num_subrs;
     FT_Byte**        subrs;
-    FT_Int*          subrs_len;
+    FT_PtrDist*      subrs_len;
 
     FT_Int           num_glyphs;
     FT_String**      glyph_names;       /* array of glyph names       */
     FT_Byte**        charstrings;       /* array of glyph charstrings */
-    FT_Int*          charstrings_len;
+    FT_PtrDist*      charstrings_len;
 
     FT_Byte          paint_type;
     FT_Byte          font_type;
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -703,7 +703,7 @@
       /* the third (lowest) stem aligns with the base line; it might end up */
       /* one pixel higher or lower.                                         */
 
-      n_edges = edge_limit - edges;
+      n_edges = (FT_Int)( edge_limit - edges );
       if ( !dimension && ( n_edges == 6 || n_edges == 12 ) )
       {
         AH_EdgeRec  *edge1, *edge2, *edge3;
@@ -943,7 +943,7 @@
 
             /* find enclosing edges */
             min = 0;
-            max = edge_limit - edges;
+            max = (FT_UInt)( edge_limit - edges );
 
             while ( min < max )
             {
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1135,9 +1135,10 @@
     FT_Error   error  = FT_Err_Cannot_Open_Resource;
     FT_Memory  memory = library->memory;
     FT_Byte*   pfb_data;
-    int        i, type, flags, len;
+    int        i, type, flags;
+    FT_Long    len;
     FT_Long    pfb_len, pfb_pos, pfb_lenpos;
-    FT_Long    rlen, junk, temp;
+    FT_Long    rlen, temp;
     FT_Long   *offsets;
 
 
@@ -1156,12 +1157,11 @@
     /* Find all the POST resource offsets */
     for ( i = 0; i < resource_cnt; ++i )
     {
-      (void)FT_READ_USHORT( junk ); /* resource id */
-      (void)FT_READ_USHORT( junk ); /* rsource name */
+      (void)FT_STREAM_SKIP( 4 );    /* resource id and resource name */
       if ( FT_READ_LONG( temp ) )
         goto Exit;
       offsets[i] = resource_data + ( temp & 0xFFFFFFL );
-      (void)FT_READ_LONG( junk );   /* mbz */
+      (void)FT_STREAM_SKIP( 4 );    /* mbz */
     }
 
     /* Find the length of all the POST resources, concatenated.  Assume */
@@ -1273,7 +1273,7 @@
     FT_Error   error;
     int        i;
     FT_Long    flag_offset= 0xFFFFFFL;
-    FT_Long    rlen, junk;
+    FT_Long    rlen;
     int        is_cff;
 
 
@@ -1288,12 +1288,11 @@
 
     for ( i = 0; i <= face_index; ++i )
     {
-      (void)FT_READ_USHORT( junk );     /* resource id */
-      (void)FT_READ_USHORT( junk );     /* rsource name */
+      (void)FT_STREAM_SKIP( 4 );    /* resource id and resource name */
       if ( FT_READ_LONG( flag_offset ) )
         goto Exit;
       flag_offset &= 0xFFFFFFL;
-      (void)FT_READ_LONG( junk );       /* mbz */
+      (void)FT_STREAM_SKIP( 4 );    /* mbz */
     }
 
     if ( flag_offset == 0xFFFFFFL )
@@ -1344,9 +1343,9 @@
   {
     FT_Error       error;
     unsigned char  head[16], head2[16];
-    FT_Long        rdata_pos, map_pos, rdata_len, map_len;
+    FT_Long        rdata_pos, map_pos, rdata_len;
     int            allzeros, allmatch, i, cnt, subcnt;
-    FT_Long        type_list, rpos, junk;
+    FT_Long        type_list, rpos;
     FT_ULong       tag;
 
 
@@ -1369,10 +1368,7 @@
                 ( head[ 9] << 16 ) |
                 ( head[10] <<  8 ) |
                   head[11];
-    map_len   = ( head[12] << 24 ) |
-                ( head[13] << 16 ) |
-                ( head[14] <<  8 ) |
-                  head[15];
+    /* map_len = head[12] .. head[15] */
 
     if ( rdata_pos + rdata_len != map_pos || map_pos == resource_offset )
       return FT_Err_Unknown_File_Format;
@@ -1402,9 +1398,9 @@
     /* If we've gotten this far then it's probably a mac resource file. */
     /* Now, does it contain any interesting resources?                  */
 
-    (void)FT_READ_LONG( junk );    /* skip handle to next resource map */
-    (void)FT_READ_USHORT( junk );  /* skip file resource number */
-    (void)FT_READ_USHORT( junk );  /* skip attributes */
+    /* Skip handle to next resource map, the file resource number, and  */
+    /* attributes.                                                      */
+    (void)FT_STREAM_SKIP( 4 + 2 + 2 );
 
     if ( FT_READ_USHORT( type_list ) )
       goto Exit;
@@ -1675,7 +1671,7 @@
          FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )
       goto Fail2;
 
-#ifndef FT_MACINTOSH
+#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
     error = load_mac_face( library, stream, face_index, aface, args );
     if ( !error )
     {
@@ -1690,7 +1686,7 @@
 
     if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
       goto Fail2;
-#endif  /* !FT_MACINTOSH */
+#endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
 
       /* no driver is able to handle this format */
       error = FT_Err_Unknown_File_Format;
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -658,10 +658,10 @@
 
   typedef struct  FT_OrientationExtremumRec_
   {
-    FT_Int  index;
-    FT_Int  pos;
-    FT_Int  first;
-    FT_Int  last;
+    FT_Int   index;
+    FT_Long  pos;
+    FT_Int   first;
+    FT_Int   last;
   
   } FT_OrientationExtremumRec;
 
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -142,7 +142,7 @@
   /*    table  :: The target table.                                        */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    idx  :: The index of the object in the table.                      */
+  /*    idx    :: The index of the object in the table.                    */
   /*                                                                       */
   /*    object :: The address of the object to copy in memory.             */
   /*                                                                       */
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -964,8 +964,8 @@
   {
     T42_Parser  parser     = &loader->parser;
     FT_Byte*    limit;
-    int         n_keywords = sizeof ( t42_keywords ) /
-                               sizeof ( t42_keywords[0] );
+    FT_Int      n_keywords = (FT_Int)( sizeof ( t42_keywords ) /
+                                         sizeof ( t42_keywords[0] ) );
 
 
     parser->root.cursor = base;