shithub: freetype+ttf2subf

Download patch

ref: cf24d51531d41b1675753d39533c6ae562f8104b
parent: 00a2207fd8149d7a75b6856899074d4eeba8324e
author: Werner Lemberg <[email protected]>
date: Mon Jun 18 10:23:45 EDT 2001

Minor cleanups to remove compiler warnings.

* include/freetype/cache/ftcmanag.h (FTC_MAX_BYTES_DEFAULT): Use
`L' for constant.
* include/freetype/config/ftoption.h (FT_RENDER_POOL_SIZE): Ditto.
* src/base/ftcalc.c (FT_MulDiv): Use `L' for constant.
* src/base/ftglyph.c (FT_Glyph_Get_CBox): Remove `error' variable.
* src/base/fttrigon.c (ft_trig_arctan_table): Use `L' for constants.
* src/base/ftobjs.c (FT_Done_Size): Fix return value.
(FT_Set_Char_Size, FT_Set_Pixel_Sizes, FT_Get_Kerning): Remove
unused `memory' variable.
* src/autohint/ahglyph.c (ah_get_orientation): Use `L' for constant.
* src/autohint/ahhint.c (ah_hint_edges_3,
ah_hinter_align_edge_points): Remove unused `before' and `after'
variables.
(ah_hinter_align_weak_points): Remove unused `edge_limit' variable.
(ah_hinter_load): Remove unused `new_advance', `start_contour',
and `metrics' variables.
* src/cff/cffload.c (CFF_Load_Encoding): Remove dead code to avoid
compiler warning.
* src/cff/cffobjs.c (CFF_Init_Face): Remove unused `base_offset'
variable.
* src/cff/cffgload.c (CFF_Parse_CharStrings): Remove unused
`outline' variable.
(cff_compute_bias): Use `U' for constant.
* src/cid/cidload.c (cid_decrypt): Ditto.
* src/psaux/psobjs.c (T1_Decrypt): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto.
* src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version'
variable.
* src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top'
variable.
* src/truetype/ttgload.c (load_truetype_glyph): Remove unused
`num_contours' and `ins_offset' variables.
(compute_glyph_metrics): Remove unused `Top' and `x_scale'
variables.
(TT_Load_Glyph): Remove unused `memory' variable.
* src/smooth/ftgrays.c (grays_raster_render): Use `L' for constants.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,46 @@
 2001-06-18  Werner Lemberg  <[email protected]>
 
+	Minor cleanups to remove compiler warnings.
+
+	* include/freetype/cache/ftcmanag.h (FTC_MAX_BYTES_DEFAULT): Use
+	`L' for constant.
+	* include/freetype/config/ftoption.h (FT_RENDER_POOL_SIZE): Ditto.
+	* src/base/ftcalc.c (FT_MulDiv): Use `L' for constant.
+	* src/base/ftglyph.c (FT_Glyph_Get_CBox): Remove `error' variable.
+	* src/base/fttrigon.c (ft_trig_arctan_table): Use `L' for constants.
+	* src/base/ftobjs.c (FT_Done_Size): Fix return value.
+	(FT_Set_Char_Size, FT_Set_Pixel_Sizes, FT_Get_Kerning): Remove
+	unused `memory' variable.
+	* src/autohint/ahglyph.c (ah_get_orientation): Use `L' for constant.
+	* src/autohint/ahhint.c (ah_hint_edges_3,
+	ah_hinter_align_edge_points): Remove unused `before' and `after'
+	variables.
+	(ah_hinter_align_weak_points): Remove unused `edge_limit' variable.
+	(ah_hinter_load): Remove unused `new_advance', `start_contour',
+	and `metrics' variables.
+	* src/cff/cffload.c (CFF_Load_Encoding): Remove dead code to avoid
+	compiler warning.
+	* src/cff/cffobjs.c (CFF_Init_Face): Remove unused `base_offset'
+	variable.
+	* src/cff/cffgload.c (CFF_Parse_CharStrings): Remove unused
+	`outline' variable.
+	(cff_compute_bias): Use `U' for constant.
+	* src/cid/cidload.c (cid_decrypt): Ditto.
+	* src/psaux/psobjs.c (T1_Decrypt): Ditto.
+	* src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto.
+	* src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version'
+	variable.
+	* src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top'
+	variable.
+	* src/truetype/ttgload.c (load_truetype_glyph): Remove unused
+	`num_contours' and `ins_offset' variables.
+	(compute_glyph_metrics): Remove unused `Top' and `x_scale'
+	variables.
+	(TT_Load_Glyph): Remove unused `memory' variable.
+	* src/smooth/ftgrays.c (grays_raster_render): Use `L' for constants.
+
+2001-06-18  Werner Lemberg  <[email protected]>
+
 	Make the new error scheme source compatible with older FT versions
 	by introducing another layer.
 
--- a/include/freetype/cache/ftcmanag.h
+++ b/include/freetype/cache/ftcmanag.h
@@ -81,7 +81,7 @@
 
 #define FTC_MAX_FACES_DEFAULT  2
 #define FTC_MAX_SIZES_DEFAULT  4
-#define FTC_MAX_BYTES_DEFAULT  200000  /* 200kByte by default! */
+#define FTC_MAX_BYTES_DEFAULT  200000L  /* 200kByte by default! */
 
   /* maximum number of caches registered in a single manager */
 #define FTC_MAX_CACHES         16
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -247,7 +247,7 @@
   /*                                                                       */
   /* This must be greater than 4kByte.                                     */
   /*                                                                       */
-#define FT_RENDER_POOL_SIZE  32768
+#define FT_RENDER_POOL_SIZE  32768L
 
 
   /*************************************************************************/
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -230,8 +230,8 @@
     indices.xMax = -1;
     indices.yMax = -1;
 
-    box.xMin = box.yMin =  32767;
-    box.xMax = box.yMax = -32768;
+    box.xMin = box.yMin =  32767L;
+    box.xMax = box.yMax = -32768L;
 
     /* is it empty? */
     if ( outline->n_contours < 1 )
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -205,8 +205,6 @@
     for ( dimension = 1; dimension >= 0; dimension-- )
     {
       AH_Edge*  edge;
-      AH_Edge*  before = 0;
-      AH_Edge*  after  = 0;
       AH_Edge*  anchor = 0;
       int       has_serifs = 0;
 
@@ -264,8 +262,6 @@
 
       /* now, we will align all stem edges, trying to maintain the */
       /* relative order of stems in the glyph..                    */
-      before = 0;
-      after  = 0;
       for ( edge = edges; edge < edge_limit; edge++ )
       {
         AH_Edge  *edge2;
@@ -434,13 +430,8 @@
     for ( dimension = 1; dimension >= 0; dimension-- )
     {
       AH_Edge*   edge;
-      AH_Edge*   before;
-      AH_Edge*   after;
 
 
-      before = 0;
-      after  = 0;
-
       edge = edges;
       for ( ; edge < edge_limit; edge++ )
       {
@@ -706,7 +697,6 @@
     AH_Outline*  outline = hinter->glyph;
     FT_Int       dimension;
     AH_Edge*     edges;
-    AH_Edge*     edge_limit;
     AH_Point*    points;
     AH_Point*    point_limit;
     AH_Point**   contour_limit;
@@ -719,7 +709,6 @@
     /* PASS 1: Move segment points to edge positions */
 
     edges      = outline->horz_edges;
-    edge_limit = edges + outline->num_hedges;
     touch_flag = ah_flah_touch_y;
 
     contour_limit = outline->contours + outline->num_contours;
@@ -1012,7 +1001,6 @@
     FT_Slot_Internal  internal = slot->internal;
     FT_Fixed          x_scale  = face->size->metrics.x_scale;
     FT_Fixed          y_scale  = face->size->metrics.y_scale;
-    FT_Glyph_Metrics  metrics;  /* temporary metrics */
     FT_Error          error;
     AH_Outline*       outline  = hinter->glyph;
     AH_Loader*        gloader  = hinter->loader;
@@ -1042,9 +1030,6 @@
       FT_Vector_Transform( &hinter->trans_delta, &imatrix );
     }
 
-    /* save current glyph metrics */
-    metrics = slot->metrics;
-
     /* set linear horizontal metrics */
     slot->linearHoriAdvance = slot->metrics.horiAdvance;
     slot->linearVertAdvance = slot->metrics.vertAdvance;
@@ -1122,7 +1107,7 @@
       /* width/positioning that occured during the hinting process  */
       {
         FT_Pos    old_width, new_width;
-        FT_Pos    old_advance, new_advance;
+        FT_Pos    old_advance;
         FT_Pos    old_lsb, new_lsb;
         AH_Edge*  edge1 = outline->vert_edges;     /* leftmost edge  */
         AH_Edge*  edge2 = edge1 +
@@ -1136,9 +1121,6 @@
         old_lsb     = edge1->opos;
         new_lsb     = edge1->pos;
 
-        new_advance = old_advance +
-                      ( new_width + new_lsb - old_width - old_lsb );
-
         hinter->pp1.x = ( ( new_lsb - old_lsb ) + 32 ) & -64;
         hinter->pp2.x = ( ( edge2->pos +
                             ( old_advance - edge2->opos ) ) + 32 ) & -64;
@@ -1151,12 +1133,11 @@
     case ft_glyph_format_composite:
       {
         FT_UInt       nn, num_subglyphs = slot->num_subglyphs;
-        FT_UInt       num_base_subgs, start_point, start_contour;
+        FT_UInt       num_base_subgs, start_point;
         FT_SubGlyph*  subglyph;
 
 
         start_point   = gloader->base.outline.n_points;
-        start_contour = gloader->base.outline.n_contours;
 
         /* first of all, copy the subglyph descriptors in the glyph loader */
         error = ah_loader_check_subglyphs( gloader, num_subglyphs );
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -362,7 +362,7 @@
     s ^= b; b = ABS( b );
     s ^= c; c = ABS( c );
 
-    if ( a <= 46340 && b <= 46340 && c <= 176095L && c > 0 )
+    if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
     {
       a = ( a * b + ( c >> 1 ) ) / c;
     }
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -515,16 +515,20 @@
                                             FT_BBox  *acbox )
   {
     const FT_Glyph_Class*  clazz;
-    FT_Error               error = FT_Err_Ok;
 
 
-    if ( !acbox || !glyph || !glyph->clazz )
-      error = FT_Err_Invalid_Argument;
+    if ( !acbox )
+      return;
+
+    acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;
+
+    if ( !glyph || !glyph->clazz )
+      return;
     else
     {
       clazz = glyph->clazz;
       if ( !clazz->glyph_bbox )
-        error = FT_Err_Invalid_Glyph_Format;
+        return;
       else
       {
         /* retrieve bbox in 26.6 coordinates */
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1524,7 +1524,7 @@
     else
       error = FT_Err_Invalid_Size_Handle;
 
-    return FT_Err_Ok;
+    return error;
   }
 
 
@@ -1558,7 +1558,6 @@
   {
     FT_Error          error = FT_Err_Ok;
     FT_Driver         driver;
-    FT_Memory         memory;
     FT_Driver_Class*  clazz;
     FT_Size_Metrics*  metrics;
     FT_Long           dim_x, dim_y;
@@ -1584,7 +1583,6 @@
 
     driver = face->driver;
     clazz  = driver->clazz;
-    memory = driver->root.memory;
 
     /* default processing -- this can be overridden by the driver */
     if ( char_width  < 1 * 64 )
@@ -1628,7 +1626,6 @@
   {
     FT_Error          error = FT_Err_Ok;
     FT_Driver         driver;
-    FT_Memory         memory;
     FT_Driver_Class*  clazz;
     FT_Size_Metrics*  metrics = &face->size->metrics;
 
@@ -1638,7 +1635,6 @@
 
     driver = face->driver;
     clazz  = driver->clazz;
-    memory = driver->root.memory;
 
     /* default processing -- this can be overridden by the driver */
     if ( pixel_width == 0 )
@@ -1684,7 +1680,6 @@
   {
     FT_Error   error = FT_Err_Ok;
     FT_Driver  driver;
-    FT_Memory  memory;
 
 
     if ( !face )
@@ -1694,7 +1689,6 @@
       return FT_Err_Invalid_Argument;
 
     driver = face->driver;
-    memory = driver->root.memory;
 
     akerning->x = 0;
     akerning->y = 0;
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -29,9 +29,9 @@
   static const FT_Fixed
   ft_trig_arctan_table[24] =
   {
-    4157273, 2949120, 1740967, 919879, 466945, 234379, 117304, 58666,
-    29335, 14668, 7334, 3667, 1833, 917, 458, 229, 115, 57, 29, 14, 7,
-    4, 2, 1
+    4157273L, 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L,
+    58666L, 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L,
+    57L, 29L, 14L, 7L, 4L, 2L, 1L
   };
 
   /* the Cordic shrink factor, multiplied by 2^32 */
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -306,10 +306,10 @@
 
     if ( num_subrs < 1240 )
       result = 107;
-    else if ( num_subrs < 33900 )
+    else if ( num_subrs < 33900U )
       result = 1131;
     else
-      result = 32768;
+      result = 32768U;
 
     return result;
   }
@@ -695,7 +695,6 @@
     FT_Byte*           ip;
     FT_Byte*           limit;
     CFF_Builder*       builder = &decoder->builder;
-    FT_Outline*        outline;
     FT_Pos             x, y;
     FT_Fixed           seed;
     FT_Fixed*          stack;
@@ -725,8 +724,7 @@
     limit = zone->limit  = charstring_base + charstring_len;
     ip    = zone->cursor = zone->base;
 
-    error   = CFF_Err_Ok;
-    outline = builder->current;
+    error = CFF_Err_Ok;
 
     x = builder->pos_x;
     y = builder->pos_y;
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1919,7 +1919,6 @@
         FT_ERROR(( "CFF_Load_Encoding: invalid table format!\n" ));
         error = CFF_Err_Invalid_File_Format;
         goto Exit;
-       break;
       }
     }
 
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -346,13 +346,10 @@
       FT_Memory  memory = face->root.memory;
       FT_Face    root;
       FT_UInt    flags;
-      FT_ULong   base_offset;
 
 
       if ( ALLOC( cff, sizeof ( *cff ) ) )
         goto Exit;
-
-      base_offset = FILE_Pos();
 
       face->extra.data = cff;
       error = CFF_Load_Font( stream, face_index, cff );
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -71,7 +71,7 @@
 
 
       plain     = ( *buffer ^ ( seed >> 8 ) );
-      seed      = ( *buffer + seed ) * 52845 + 22719;
+      seed      = ( *buffer + seed ) * 52845U + 22719;
       *buffer++ = plain;
       length--;
     }
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -1283,7 +1283,7 @@
 
 
       plain     = ( *buffer ^ ( seed >> 8 ) );
-      seed      = ( *buffer + seed ) * 52845 + 22719;
+      seed      = ( *buffer + seed ) * 52845U + 22719;
       *buffer++ = plain;
       length--;
     }
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -323,7 +323,6 @@
     FT_Byte*          ip;
     FT_Byte*          limit;
     T1_Builder*       builder = &decoder->builder;
-    FT_Outline*       outline;
     FT_Pos            x, y;
 
 
@@ -346,8 +345,7 @@
     limit = zone->limit  = charstring_base + charstring_len;
     ip    = zone->cursor = zone->base;
 
-    error   = PSaux_Err_Ok;
-    outline = builder->current;
+    error = PSaux_Err_Ok;
 
     x = builder->pos_x;
     y = builder->pos_y;
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1542,7 +1542,7 @@
     FT_Error   error;
     FT_Memory  memory = stream->memory;
 
-    FT_UInt    n, num_tables, version;
+    FT_UInt    n, num_tables;
 
 
     /* the kern table is optional; exit silently if it is missing */
@@ -1553,7 +1553,7 @@
     if ( ACCESS_Frame( 4L ) )
       goto Exit;
 
-    version    = GET_UShort();
+    (void)GET_UShort();         /* version */
     num_tables = GET_UShort();
 
     FORGET_Frame();
@@ -1567,7 +1567,7 @@
       if ( ACCESS_Frame( 6L ) )
         goto Exit;
 
-      version  = GET_UShort();      /* version                 */
+      (void)GET_UShort();           /* version                 */
       length   = GET_UShort() - 6;  /* substract header length */
       coverage = GET_UShort();
 
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1443,11 +1443,9 @@
     {
       /* in case of a horizontal strike only */
       FT_Int  advance;
-      FT_Int  top;
 
 
       advance = strike->hori.ascender - strike->hori.descender;
-      top     = advance / 10;
 
       /* some heuristic values */
 
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1876,10 +1876,10 @@
     }
     else
     {
-      ras.clip_box.xMin = -32768;
-      ras.clip_box.yMin = -32768;
-      ras.clip_box.xMax =  32767;
-      ras.clip_box.yMax =  32767;
+      ras.clip_box.xMin = -32768L;
+      ras.clip_box.yMin = -32768L;
+      ras.clip_box.xMax =  32767L;
+      ras.clip_box.yMax =  32767L;
     }
 
     ras.outline   = *outline;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -670,9 +670,8 @@
     TT_Face          face   = (TT_Face)loader->face;
     FT_ULong         offset;
     FT_Int           contours_count;
-    FT_UInt          index, num_points, num_contours, count;
+    FT_UInt          index, num_points, count;
     FT_Fixed         x_scale, y_scale;
-    FT_ULong         ins_offset;
     FT_GlyphLoader*  gloader = loader->gloader;
     FT_Bool          opened_frame = 0;
 
@@ -686,9 +685,7 @@
     }
 
     loader->glyph_index = glyph_index;
-    num_contours = 0;
     num_points   = 0;
-    ins_offset   = 0;
 
     x_scale = 0x10000L;
     y_scale = 0x10000L;
@@ -1119,18 +1116,14 @@
   {
     FT_BBox       bbox;
     TT_Face       face = (TT_Face)loader->face;
-    FT_Fixed      x_scale, y_scale;
+    FT_Fixed      y_scale;
     TT_GlyphSlot  glyph = loader->glyph;
     TT_Size       size = (TT_Size)loader->size;
 
 
-    x_scale = 0x10000L;
     y_scale = 0x10000L;
     if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
-    {
-      x_scale = size->root.metrics.x_scale;
       y_scale = size->root.metrics.y_scale;
-    }
 
     if ( glyph->format != ft_glyph_format_composite )
     {
@@ -1190,7 +1183,6 @@
       FT_UShort  advance_height; /* vertical advance height   (EM units) */
 
       FT_Pos  left;     /* scaled vertical left side bearing         */
-      FT_Pos  Top;      /* scaled original vertical top side bearing */
       FT_Pos  top;      /* scaled vertical top side bearing          */
       FT_Pos  advance;  /* scaled vertical advance height            */
 
@@ -1244,7 +1236,6 @@
       /* scale the metrics */
       if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
       {
-        Top     = FT_MulFix( top_bearing, y_scale );
         top     = FT_MulFix( top_bearing + loader->bbox.yMax, y_scale )
                     - bbox.yMax;
         advance = FT_MulFix( advance_height, y_scale );
@@ -1251,7 +1242,6 @@
       }
       else
       {
-        Top     = top_bearing;
         top     = top_bearing + loader->bbox.yMax - bbox.yMax;
         advance = advance_height;
       }
@@ -1332,7 +1322,6 @@
     SFNT_Interface*  sfnt;
     TT_Face          face;
     FT_Stream        stream;
-    FT_Memory        memory;
     FT_Error         error;
     TT_Loader        loader;
 
@@ -1340,7 +1329,6 @@
     face   = (TT_Face)glyph->face;
     sfnt   = (SFNT_Interface*)face->sfnt;
     stream = face->root.stream;
-    memory = face->root.memory;
     error  = 0;
 
     if ( !size || ( load_flags & FT_LOAD_NO_SCALE )   ||