ref: 319c00d7d6cb46b8abd4e64d5afcca619088fed9
parent: 13c4a4f171877c751ff621af2860abb5b3f00de7
author: Werner Lemberg <[email protected]>
date: Wed Apr 23 15:48:24 EDT 2003
Fixing bugs reported by Nelson Beebe. * src/base/ftstroker.c (FT_Stroker_ParseOutline): Remove unused variable `in_path'. * src/base/ftobjs (ft_glyphslot_set_bitmap): Change type of second argument to `FT_Byte*'. * include/freetype/internal/ftobjs.h: Updated. * src/bdf/bdflib.c (_bdf_readstream): Remove unused variable `res'. (_bdf_parse_glyphs): Remove unused variable `next'. Mark `call_data' as unused. * src/cache/ftlru.c (FT_LruList_Lookup): Remove unused variable `plast'. * src/pcf/pcfread.c (pcf_seek_to_table_type): Slight recoding to actually use `error'. (pcf_load_font): Remove unused variable `avgw'. * src/pfr/pfrobjs.c (pfr_face_get_kerning): Change return type to `void'. Mark `error' as unused. * src/pfr/pfrobjs.h: Updated. * src/pfr/pfrdrivr.c (pfr_get_kerning): Updated. * src/sfnt/ttload.c (sfnt_dir_check): Remove unused variable `format_tag'. * src/sfnt/ttcmap0.c (tt_cmap6_validate, tt_cmap10_validate): Remove unused variable `start'. (tt_cmap10_char_next): Remove unused variable `result' * src/sfnt/sfobjs.c (tt_face_get_name): Mark `error' as unused. * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Mark `error' as unused. * src/type1/t1objs.c (T1_Face_Init): Remove unused variable `pshinter'. * src/type1/t1gload.c (T1_Load_Glyph): Use `glyph_data_loaded' only for FT_CONFIG_OPTION_INCREMENTAL.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2003-04-23 Werner Lemberg <[email protected]>
+
+ Fixing bugs reported by Nelson Beebe.
+
+ * src/base/ftstroker.c (FT_Stroker_ParseOutline): Remove unused
+ variable `in_path'.
+
+ * src/base/ftobjs (ft_glyphslot_set_bitmap): Change type of
+ second argument to `FT_Byte*'.
+ * include/freetype/internal/ftobjs.h: Updated.
+
+ * src/bdf/bdflib.c (_bdf_readstream): Remove unused variable `res'.
+ (_bdf_parse_glyphs): Remove unused variable `next'.
+ Mark `call_data' as unused.
+
+ * src/cache/ftlru.c (FT_LruList_Lookup): Remove unused variable
+ `plast'.
+
+ * src/pcf/pcfread.c (pcf_seek_to_table_type): Slight recoding to
+ actually use `error'.
+ (pcf_load_font): Remove unused variable `avgw'.
+
+ * src/pfr/pfrobjs.c (pfr_face_get_kerning): Change return type
+ to `void'.
+ Mark `error' as unused.
+ * src/pfr/pfrobjs.h: Updated.
+ * src/pfr/pfrdrivr.c (pfr_get_kerning): Updated.
+
+ * src/sfnt/ttload.c (sfnt_dir_check): Remove unused variable
+ `format_tag'.
+
+ * src/sfnt/ttcmap0.c (tt_cmap6_validate, tt_cmap10_validate): Remove
+ unused variable `start'.
+ (tt_cmap10_char_next): Remove unused variable `result'
+
+ * src/sfnt/sfobjs.c (tt_face_get_name): Mark `error' as unused.
+
+ * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Mark `error' as
+ unused.
+
+ * src/type1/t1objs.c (T1_Face_Init): Remove unused variable
+ `pshinter'.
+
+ * src/type1/t1gload.c (T1_Load_Glyph): Use `glyph_data_loaded'
+ only for FT_CONFIG_OPTION_INCREMENTAL.
+
2003-04-23 Akito Hirai <[email protected]>
* src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -560,7 +560,7 @@
*/
FT_BASE( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Pointer buffer );
+ FT_Byte* buffer );
/*************************************************************************/
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -220,7 +220,7 @@
FT_BASE_DEF( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Pointer buffer )
+ FT_Byte* buffer )
{
ft_glyphslot_free_bitmap( slot );
@@ -429,10 +429,11 @@
/* documentation is in freetype.h */
FT_EXPORT_DEF( void )
- FT_Set_Hint_Flags( FT_Face face,
- FT_ULong flags )
+ FT_Set_Hint_Flags( FT_Face face,
+ FT_ULong flags )
{
FT_Face_Internal internal;
+
if ( !face )
return;
--- a/src/base/ftstroker.c
+++ b/src/base/ftstroker.c
@@ -1489,7 +1489,6 @@
FT_Int n; /* index of contour in outline */
FT_UInt first; /* index of first point in contour */
FT_Int tag; /* current point's state */
- FT_Int in_path;
if ( !outline || !stroker )
@@ -1497,8 +1496,6 @@
first = 0;
- in_path = 0;
-
for ( n = 0; n < outline->n_contours; n++ )
{
FT_Int last; /* index of last point in contour */
@@ -1547,8 +1544,6 @@
error = FT_Stroker_BeginSubPath( stroker, &v_start, opened );
if ( error )
goto Exit;
-
- in_path = 1;
while ( point < limit )
{
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002 Francesco Zappa Nardelli
+ * Copyright 2001, 2002, 2003 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -641,7 +641,7 @@
{
_bdf_line_func_t cb;
unsigned long lineno;
- int n, res, done, refill, bytes, hold;
+ int n, done, refill, bytes, hold;
char *ls, *le, *pp, *pe, *hp;
char *buf = 0;
FT_Memory memory = stream->memory;
@@ -661,7 +661,7 @@
lineno = 1;
buf[0] = 0;
- res = done = 0;
+ done = 0;
pp = ls = le = buf;
bytes = 65536L;
@@ -1443,7 +1443,6 @@
unsigned char* bp;
unsigned long i, slen, nibbles;
- _bdf_line_func_t* next;
_bdf_parse_t* p;
bdf_glyph_t* glyph;
bdf_font_t* font;
@@ -1451,11 +1450,11 @@
FT_Memory memory;
FT_Error error = BDF_Err_Ok;
+ FT_UNUSED( call_data );
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (_bdf_line_func_t *)call_data;
- p = (_bdf_parse_t *) client_data;
+ p = (_bdf_parse_t *)client_data;
font = p->font;
memory = font->memory;
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -130,7 +130,6 @@
FT_Error error = 0;
FT_LruNode node, *pnode;
FT_LruList_Class clazz;
- FT_LruNode* plast;
FT_LruNode result = NULL;
FT_Memory memory;
@@ -139,7 +138,6 @@
return FTC_Err_Invalid_Argument;
pnode = &list->nodes;
- plast = pnode;
node = NULL;
clazz = list->clazz;
memory = list->memory;
@@ -155,7 +153,6 @@
if ( clazz->node_compare( node, key, list->data ) )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
@@ -170,7 +167,6 @@
if ( node->key == key )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001, 2002 by
+ Copyright 2000, 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -250,7 +250,7 @@
FT_ULong *aformat,
FT_ULong *asize )
{
- FT_Error error = 0;
+ FT_Error error = PCF_Err_Invalid_File_Format;
FT_Int i;
@@ -257,11 +257,15 @@
for ( i = 0; i < ntables; i++ )
if ( tables[i].type == type )
{
- if ( stream->pos > tables[i].offset )
- return PCF_Err_Invalid_Stream_Skip;
+ if ( stream->pos > tables[i].offset ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
- if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )
- return PCF_Err_Invalid_Stream_Skip;
+ if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
*asize = tables[i].size; /* unused - to be removed */
*aformat = tables[i].format;
@@ -269,7 +273,8 @@
return PCF_Err_Ok;
}
- return PCF_Err_Invalid_File_Format;
+ Fail:
+ return error;
}
@@ -986,12 +991,11 @@
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop != NULL )
{
- PCF_Property xres, yres, avgw;
+ PCF_Property xres, yres;
xres = pcf_find_property( face, "RESOLUTION_X" );
yres = pcf_find_property( face, "RESOLUTION_Y" );
- avgw = pcf_find_property( face, "AVERAGE_WIDTH" );
if ( ( yres != NULL ) && ( xres != NULL ) )
{
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -30,29 +30,24 @@
FT_UInt right,
FT_Vector *avector )
{
- FT_Error error;
+ PFR_PhyFont phys = &face->phy_font;
- error = pfr_face_get_kerning( face, left, right, avector );
- if ( !error )
+ pfr_face_get_kerning( face, left, right, avector );
+
+ /* convert from metrics to outline units when necessary */
+ if ( phys->outline_resolution != phys->metrics_resolution )
{
- PFR_PhyFont phys = &face->phy_font;
+ if ( avector->x != 0 )
+ avector->x = FT_MulDiv( avector->x, phys->outline_resolution,
+ phys->metrics_resolution );
-
- /* convert from metrics to outline units when necessary */
- if ( phys->outline_resolution != phys->metrics_resolution )
- {
- if ( avector->x != 0 )
- avector->x = FT_MulDiv( avector->x, phys->outline_resolution,
- phys->metrics_resolution );
-
- if ( avector->y != 0 )
- avector->y = FT_MulDiv( avector->x, phys->outline_resolution,
- phys->metrics_resolution );
- }
+ if ( avector->y != 0 )
+ avector->y = FT_MulDiv( avector->x, phys->outline_resolution,
+ phys->metrics_resolution );
}
- return error;
+ return FT_Err_Ok;
}
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -397,18 +397,20 @@
/*************************************************************************/
/*************************************************************************/
- FT_LOCAL_DEF( FT_Error )
+ FT_LOCAL_DEF( void )
pfr_face_get_kerning( PFR_Face face,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
PFR_PhyFont phy_font = &face->phy_font;
PFR_KernItem item = phy_font->kern_items;
FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 );
+ FT_UNUSED( error ); /* just needed as syntactical sugar */
+
kerning->x = 0;
kerning->y = 0;
@@ -422,7 +424,7 @@
}
/* not found */
- goto Exit;
+ return;
Found_Item:
{
@@ -434,7 +436,7 @@
if ( FT_STREAM_SEEK( item->offset ) ||
FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
- goto Exit;
+ return;
min = 0;
max = item->pair_count;
@@ -475,9 +477,7 @@
FT_FRAME_EXIT();
}
-
- Exit:
- return 0;
}
+
/* END */
--- a/src/pfr/pfrobjs.h
+++ b/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (specification). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -67,11 +67,11 @@
pfr_face_done( PFR_Face face );
- FT_LOCAL( FT_Error )
- pfr_face_get_kerning( PFR_Face face,
- FT_UInt glyph1,
- FT_UInt glyph2,
- FT_Vector* kerning );
+ FT_LOCAL( void )
+ pfr_face_get_kerning( PFR_Face face,
+ FT_UInt glyph1,
+ FT_UInt glyph2,
+ FT_Vector* kerning );
FT_LOCAL( FT_Error )
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -149,9 +149,11 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_win;
FT_UInt len = name->stringLength / 2;
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
+ FT_UNUSED( error );
+
if ( !FT_ALLOC( result, name->stringLength + 1 ) )
{
FT_Stream stream = face->name_table.stream;
@@ -189,7 +191,9 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_apple;
FT_UInt len = name->stringLength;
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
+
+ FT_UNUSED( error );
if ( !FT_ALLOC( result, len + 1 ) )
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
/* */
/* SFNT object management (base). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -258,8 +258,10 @@
{
if ( rec->string == NULL )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
FT_Stream stream = face->name_table.stream;
+
+ FT_UNUSED( error );
if ( FT_NEW_ARRAY ( rec->string, rec->stringLength ) ||
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1018,7 +1018,7 @@
FT_Validator valid )
{
FT_Byte* p;
- FT_UInt length, start, count;
+ FT_UInt length, count;
if ( table + 10 > valid->limit )
@@ -1027,8 +1027,7 @@
p = table + 2;
length = TT_NEXT_USHORT( p );
- p = table + 6; /* skip language */
- start = TT_NEXT_USHORT( p );
+ p = table + 8; /* skip language and start index */
count = TT_NEXT_USHORT( p );
if ( table + length > valid->limit || length < 10 + count * 2 )
@@ -1399,7 +1398,7 @@
FT_Validator valid )
{
FT_Byte* p = table + 4;
- FT_ULong length, start, count;
+ FT_ULong length, count;
if ( table + 20 > valid->limit )
@@ -1406,8 +1405,7 @@
FT_INVALID_TOO_SHORT;
length = TT_NEXT_ULONG( p );
- p = table + 12;
- start = TT_NEXT_ULONG( p );
+ p = table + 16;
count = TT_NEXT_ULONG( p );
if ( table + length > valid->limit || length < 20 + count * 2 )
@@ -1455,7 +1453,6 @@
FT_UInt32 *pchar_code )
{
FT_Byte* table = cmap->data;
- FT_UInt32 result = 0;
FT_UInt32 char_code = *pchar_code + 1;
FT_UInt gindex = 0;
FT_Byte* p = table + 12;
@@ -1474,10 +1471,7 @@
{
gindex = TT_NEXT_USHORT( p );
if ( gindex != 0 )
- {
- result = char_code;
break;
- }
char_code++;
}
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -179,11 +179,8 @@
/* if 'num_tables' is 0, read the table count from the file */
if ( num_tables == 0 )
{
- FT_ULong format_tag;
-
-
if ( FT_STREAM_SEEK( offset ) ||
- FT_READ_ULONG ( format_tag ) ||
+ FT_STREAM_SKIP( 4 ) ||
FT_READ_USHORT( num_tables ) ||
FT_STREAM_SKIP( 6 ) )
goto Bad_Format;
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -226,7 +226,9 @@
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_Data glyph_data;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Bool glyph_data_loaded = 0;
+#endif
if ( load_flags & FT_LOAD_NO_RECURSE )
@@ -267,7 +269,9 @@
&glyph_data );
if ( error )
goto Exit;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
glyph_data_loaded = 1;
+#endif
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -278,7 +278,6 @@
FT_Error error;
PSNames_Service psnames;
PSAux_Service psaux;
- PSHinter_Service pshinter;
FT_UNUSED( num_params );
FT_UNUSED( params );
@@ -298,7 +297,6 @@
face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
"pshinter" );
- pshinter = (PSHinter_Service)face->pshinter;
/* open the tokenizer, this will also check the font format */
error = T1_Open_Face( face );