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.
This commit is contained in:
Werner Lemberg 2003-04-23 19:48:24 +00:00
parent 13c4a4f171
commit 319c00d7d6
16 changed files with 115 additions and 80 deletions

View File

@ -1,3 +1,49 @@
2003-04-23 Werner Lemberg <wl@gnu.org>
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 <akito@kde.gr.jp>
* src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant

View File

@ -560,7 +560,7 @@ FT_BEGIN_HEADER
*/
FT_BASE( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Pointer buffer );
FT_Byte* buffer );
/*************************************************************************/

View File

@ -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,11 +429,12 @@
/* 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;

View File

@ -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 */
@ -1548,8 +1545,6 @@
if ( error )
goto Exit;
in_path = 1;
while ( point < limit )
{
point++;

View File

@ -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;

4
src/cache/ftlru.c vendored
View File

@ -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;
}
}

View File

@ -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,18 +250,22 @@ THE SOFTWARE.
FT_ULong *aformat,
FT_ULong *asize )
{
FT_Error error = 0;
FT_Error error = PCF_Err_Invalid_File_Format;
FT_Int i;
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 @@ THE SOFTWARE.
return PCF_Err_Ok;
}
return PCF_Err_Invalid_File_Format;
Fail:
return error;
}
@ -986,12 +991,11 @@ THE SOFTWARE.
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 ) )
{

View File

@ -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;
}

View File

@ -397,17 +397,19 @@
/*************************************************************************/
/*************************************************************************/
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 */

View File

@ -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 @@ FT_BEGIN_HEADER
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 )

View File

@ -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,7 +149,9 @@
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 ) )
@ -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 ) )

View File

@ -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,9 +258,11 @@
{
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 ) ||
FT_STREAM_SEEK( rec->stringOffset ) ||

View File

@ -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,15 +1398,14 @@
FT_Validator valid )
{
FT_Byte* p = table + 4;
FT_ULong length, start, count;
FT_ULong length, count;
if ( table + 20 > valid->limit )
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++;
}

View File

@ -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;

View File

@ -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;

View File

@ -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 );