shithub: freetype+ttf2subf

Download patch

ref: 914b289f1623b1030b66537d3b3ce4b652e4606c
parent: 7124a8e59c763bda7c62efa947d30c497bad45f5
author: Werner Lemberg <[email protected]>
date: Sat Mar 10 12:07:42 EST 2001

* src/*/*.c: Added many casts to make code more 64bit-safe.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-03-10  Henrik Grubbstr�m <[email protected]>
+
+	* src/*/*.c: Added many casts to make code more 64bit-safe.
+
 2001-03-07  Werner Lemberg  <[email protected]>
 
 	* INSTALL, docs/BUILD: We need GNU make 3.78 or newer.
--- a/src/autohint/ahglobal.c
+++ b/src/autohint/ahglobal.c
@@ -157,7 +157,7 @@
         /* segment; we first need to find in which contour the extremum */
         /* lies, then see its previous and next points                  */
         {
-          FT_Int  index = extremum - points;
+          FT_Int  index = (FT_Int)( extremum - points );
           FT_Int  n;
           FT_Int  first, last, prev, next, end;
           FT_Pos  dist;
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -1109,7 +1109,7 @@
         }
       }
 
-      *p_num_edges = edge_limit - edges;
+      *p_num_edges = (FT_Int)( edge_limit - edges );
 
 
       /*********************************************************************/
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -300,7 +300,7 @@
     if ( !error )
     {
       /* good, now set the set index within the set object */
-      cset->cset_index = node - lru->nodes;
+      cset->cset_index = (FT_UInt)( node - lru->nodes );
       node->root.data  = cset;
     }
 
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -327,7 +327,7 @@
     if ( !error )
     {
       /* good, now set the gset index within the gset object */
-      gset->gset_index = node - lru->nodes;
+      gset->gset_index = (FT_UInt)( node - lru->nodes );
       node->root.data  = gset;
     }
 
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -332,7 +332,7 @@
           while ( cur2 < limit && is_alpha( *cur2 ) )
             cur2++;
 
-          len = cur2 - cur;
+          len = (FT_Int)( cur2 - cur );
           if ( len > 0 && len < 22 )
           {
             /* now compare the immediate name to the keyword table */
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -109,7 +109,7 @@
         if ( p[0] == 'S' && strncmp( (char*)p, "StartData", 9 ) == 0 )
         {
           /* save offset of binary data after `StartData' */
-          offset = top_position - ( limit - p ) + 10;
+          offset = (FT_ULong)( top_position - ( limit - p ) + 10 );
           goto Found;
         }
       }
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -84,7 +84,7 @@
   void  shift_elements( PS_Table*  table,
                         FT_Byte*   old_base )
   {
-    FT_Long    delta  = table->block - old_base;
+    FT_Long    delta  = (FT_Long)( table->block - old_base );
     FT_Byte**  offset = table->elements;
     FT_Byte**  limit  = offset + table->max_elems;
 
@@ -412,7 +412,7 @@
         cur++;
       }
 
-      *pnum_tokens = cur - tokens;
+      *pnum_tokens = (FT_Int)( cur - tokens );
 
       parser->cursor = old_cursor;
       parser->limit  = old_limit;
@@ -847,7 +847,7 @@
       case t1_field_string:
         {
           FT_Memory  memory = parser->memory;
-          FT_UInt    len    = limit-cur;
+          FT_UInt    len    = (FT_UInt)( limit - cur );
 
 
           if ( *(FT_String**)q )
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -100,7 +100,7 @@
       while ( *p && *p != '.' )
         p++;
 
-      len = p - glyph_name;
+      len = (int)( p - glyph_name );
 
       if ( *p && len < 64 )
       {
@@ -181,7 +181,7 @@
       }
 
       /* now, compress the table a bit */
-      count = map - table->maps;
+      count = (FT_UInt)( map - table->maps );
 
       if ( count > 0 && REALLOC( table->maps,
                                  num_glyphs * sizeof ( PS_UniMap ),
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -620,7 +620,7 @@
     PProfile  oldProfile;
 
 
-    h = ras.top - ras.cProfile->offset;
+    h = (Long)( ras.top - ras.cProfile->offset );
 
     if ( h < 0 )
     {
@@ -1102,7 +1102,7 @@
     else
     {
       e  = CEILING( y1 );
-      f1 = FRAC( y1 );
+      f1 = (Short)( FRAC( y1 ) );
       e0 = e;
 
       if ( f1 == 0 )
@@ -2189,7 +2189,7 @@
           e1 = TRUNC( e1 );
 
           c1 = (Short)( e1 >> 3 );
-          f1 = e1 &  7;
+          f1 = (Short)( e1 &  7 );
 
           if ( e1 >= 0 && e1 < ras.bWidth                      &&
                ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
@@ -2215,7 +2215,7 @@
     if ( e1 >= 0 && e1 < ras.bWidth )
     {
       c1 = (Short)( e1 >> 3 );
-      f1 = e1 & 7;
+      f1 = (Short)( e1 & 7 );
 
       if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
       if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
@@ -2677,7 +2677,7 @@
       Q = P->link;
 
       bottom = (Short)P->start;
-      top    = (Short)P->start + P->height - 1;
+      top    = (Short)( P->start + P->height - 1 );
 
       if ( min_Y > bottom ) min_Y = bottom;
       if ( max_Y < top    ) max_Y = top;
@@ -2705,7 +2705,7 @@
 
     while ( P )
     {
-      P->countL = P->start - min_Y;
+      P->countL = (UShort)( P->start - min_Y );
       P = P->link;
     }
 
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -97,7 +97,7 @@
     error = TT_Get_PS_Name( face, glyph_index, &gname );
     if ( !error && buffer_max > 0 )
     {
-      FT_UInt  len = strlen( gname );
+      FT_UInt  len = (FT_UInt)( strlen( gname ) );
 
 
       if ( len >= buffer_max )
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -493,10 +493,10 @@
     else
     {
       /* otherwise, we must use the glyphIdArray to do it */
-      index1 = seg4->idRangeOffset / 2
-               + ( charCode - seg4->startCount )
-               + ( seg4 - cmap4->segments )
-               - segCount;
+      index1 = (FT_UInt)( seg4->idRangeOffset / 2
+                          + ( charCode - seg4->startCount )
+                          + ( seg4 - cmap4->segments )
+                          - segCount );
 
       if ( index1 < (FT_UInt)cmap4->numGlyphId       &&
            cmap4->glyphIdArray[index1] != 0 )
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1037,7 +1037,7 @@
 
     for (;;)
     {
-      int    len = limit - base;
+      int    len = (int)( limit - base );
       PCell  i, j, pivot;
 
 
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -494,7 +494,8 @@
       /* composite instructions, if we find some.               */
       /* we will process them later...                          */
       /*                                                        */
-      loader->ins_pos = FILE_Pos() + stream->cursor - stream->limit;
+      loader->ins_pos = (FT_ULong)( FILE_Pos() +
+                                    stream->cursor - stream->limit );
     }
 #endif
 
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -74,7 +74,7 @@
     while ( IS_ALPHANUM( *p ) && p < limit )
       p++;
 
-    len = p - *start;
+    len = (FT_Int)( p - *start );
 
     if ( len > 0 && len < 64 )
     {
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -55,7 +55,7 @@
 
     if ( buffer_max > 0 )
     {
-      FT_UInt  len = strlen( gname );
+      FT_UInt  len = (FT_UInt)( strlen( gname ) );
 
 
       if (len >= buffer_max)
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -420,7 +420,7 @@
       if (token->start[0] == '/')
         token->start++;
 
-      len = token->limit - token->start;
+      len = (FT_Int)( token->limit - token->start );
       if ( len <= 0 )
       {
         error = T1_Err_Invalid_File_Format;
@@ -838,7 +838,7 @@
     while ( cur2 < limit && is_alpha( *cur2 ) )
       cur2++;
 
-    len = cur2 - cur;
+    len = (FT_Int)( cur2 - cur );
     if ( len > 0 )
     {
       if ( ALLOC( face->type1.font_name, len + 1 ) )
@@ -1039,7 +1039,7 @@
             while ( cur2 < limit && is_alpha( *cur2 ) )
               cur2++;
 
-            len = cur2 - cur - 1;
+            len = (FT_Int)( cur2 - cur - 1 );
 
             parser->root.error = T1_Add_Table( char_table, charcode,
                                           cur + 1, len + 1 );
@@ -1244,7 +1244,7 @@
 
         while ( cur2 < limit && is_alpha( *cur2 ) )
           cur2++;
-        len = cur2 - cur - 1;
+        len = (FT_Int)( cur2 - cur - 1 );
 
         error = T1_Add_Table( name_table, n, cur + 1, len + 1 );
         if ( error )
@@ -1467,7 +1467,7 @@
           while ( cur2 < limit && is_alpha( *cur2 ) )
             cur2++;
 
-          len  = cur2 - cur;
+          len  = (FT_Int)( cur2 - cur );
           if ( len > 0 && len < 22 )
           {
             {
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -377,7 +377,7 @@
       /* dictionary.  We overwrite the base dictionary for disk-based */
       /* resources and allocate a new block otherwise                 */
 
-      size = parser->base_len - ( cur - parser->base_dict);
+      size = (FT_Long)( parser->base_len - ( cur - parser->base_dict ) );
 
       if ( parser->in_memory )
       {
@@ -440,7 +440,7 @@
         }
 
         /* put a safeguard */
-        parser->private_len = write - parser->private_dict;
+        parser->private_len = (FT_Int)( write - parser->private_dict );
         *write++ = 0;
       }
     }
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -242,7 +242,8 @@
           if ( type_id == 0x8008 )
           {
             font_count  = count;
-            font_offset = FILE_Pos() + 4 + ( stream->cursor - stream->limit );
+            font_offset = (FT_ULong)( FILE_Pos() + 4 +
+                                      ( stream->cursor - stream->limit ) );
             break;
           }