[Savannah bug #43682] Properly handle missing return errors.

The functions in this patch *do* return non-trivial errors that must
be taken care of.

* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
This commit is contained in:
Werner Lemberg 2014-11-25 08:53:09 +01:00
parent b24e8ba28a
commit 6689a009ce
10 changed files with 80 additions and 41 deletions

View File

@ -1,3 +1,19 @@
2014-11-24 Werner Lemberg <wl@gnu.org>
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-24 Werner Lemberg <wl@gnu.org>
[Savannah bug #43682] Add/remove `void' casts to some functions.

View File

@ -131,8 +131,8 @@
loader->trans_delta = internal->glyph_delta;
inverse = loader->trans_matrix;
FT_Matrix_Invert( &inverse );
FT_Vector_Transform( &loader->trans_delta, &inverse );
if ( !FT_Matrix_Invert( &inverse ) )
FT_Vector_Transform( &loader->trans_delta, &inverse );
}
switch ( slot->format )

View File

@ -3747,11 +3747,11 @@
FT_Face face;
if ( size == NULL )
if ( !size )
return FT_THROW( Invalid_Argument );
face = size->face;
if ( face == NULL || face->driver == NULL )
if ( !face || !face->driver )
return FT_THROW( Invalid_Argument );
/* we don't need anything more complex than that; all size objects */
@ -4037,7 +4037,11 @@
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
FT_Set_Renderer( library, renderer, 0, 0 );
{
error = FT_Set_Renderer( library, renderer, 0, 0 );
if ( error )
break;
}
}
}
@ -4047,6 +4051,7 @@
#define FT_COMPONENT trace_bitmap
/* we convert to a single bitmap format for computing the checksum */
if ( !error )
{
FT_Bitmap bitmap;
FT_Error err;

View File

@ -643,7 +643,7 @@
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
FT_Set_Renderer( library, renderer, 0, 0 );
error = FT_Set_Renderer( library, renderer, 0, 0 );
return error;
}

View File

@ -1989,9 +1989,6 @@
}
else
{
if ( !error )
error = FT_Err_Ok;
cff_builder_close_contour( builder );
/* close hints recording session */
@ -2002,10 +1999,12 @@
goto Syntax_Error;
/* apply hints to the loaded glyph outline now */
hinter->apply( hinter->hints,
builder->current,
(PSH_Globals)builder->hints_globals,
decoder->hint_mode );
error = hinter->apply( hinter->hints,
builder->current,
(PSH_Globals)builder->hints_globals,
decoder->hint_mode );
if ( error )
goto Fail;
}
/* add current outline to the glyph slot */

View File

@ -1338,7 +1338,15 @@
{
parser->cursor = token->start;
parser->limit = token->limit;
ps_parser_load_field( parser, &fieldrec, objects, max_objects, 0 );
error = ps_parser_load_field( parser,
&fieldrec,
objects,
max_objects,
0 );
if ( error )
break;
fieldrec.offset += fieldrec.size;
}

View File

@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
/* Copyright 2000-2013 by */
/* Copyright 2000-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -1098,10 +1098,12 @@
goto Syntax_Error;
/* apply hints to the loaded glyph outline now */
hinter->apply( hinter->hints,
builder->current,
(PSH_Globals)builder->hints_globals,
decoder->hint_mode );
error = hinter->apply( hinter->hints,
builder->current,
(PSH_Globals)builder->hints_globals,
decoder->hint_mode );
if ( error )
goto Fail;
}
/* add current outline to the glyph slot */

View File

@ -1787,8 +1787,12 @@
/* (1): exists from the beginning */
/* (2): components that have been loaded so far */
/* (3): the newly loaded component */
TT_Process_Composite_Component( loader, subglyph, start_point,
num_base_points );
error = TT_Process_Composite_Component( loader,
subglyph,
start_point,
num_base_points );
if ( error )
goto Exit;
}
loader->stream = old_stream;
@ -1797,16 +1801,17 @@
/* process the glyph */
loader->ins_pos = ins_pos;
if ( IS_HINTED( loader->load_flags ) &&
#ifdef TT_USE_BYTECODE_INTERPRETER
subglyph->flags & WE_HAVE_INSTR &&
#endif
num_points > start_point )
TT_Process_Composite_Glyph( loader, start_point, start_contour );
{
error = TT_Process_Composite_Glyph( loader,
start_point,
start_contour );
if ( error )
goto Exit;
}
}
}
else
@ -2081,6 +2086,8 @@
FT_Int32 load_flags,
FT_Bool glyf_table_only )
{
FT_Error error;
TT_Face face;
FT_Stream stream;
#ifdef TT_USE_BYTECODE_INTERPRETER
@ -2120,9 +2127,7 @@
if ( size->bytecode_ready < 0 || size->cvt_ready < 0 )
{
FT_Error error = tt_size_ready_bytecode( size, pedantic );
error = tt_size_ready_bytecode( size, pedantic );
if ( error )
return error;
}
@ -2193,7 +2198,9 @@
FT_RENDER_MODE_MONO );
}
TT_Load_Context( exec, face, size );
error = TT_Load_Context( exec, face, size );
if ( error )
return error;
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
@ -2240,8 +2247,7 @@
if ( reexecute )
{
FT_UInt i;
FT_Error error;
FT_UInt i;
for ( i = 0; i < size->cvt_size; i++ )
@ -2279,8 +2285,7 @@
#endif
{
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 );
error = face->goto_table( face, TTAG_glyf, stream, 0 );
if ( FT_ERR_EQ( error, Table_Missing ) )
loader->glyf_offset = 0;
@ -2462,7 +2467,7 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
compute_glyph_metrics( &loader, glyph_index );
error = compute_glyph_metrics( &loader, glyph_index );
}
/* Set the `high precision' bit flag. */

View File

@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
/* Copyright 2004-2013 by */
/* Copyright 2004-2014 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -938,13 +938,13 @@
FT_FREE( face->cvt );
face->cvt = NULL;
tt_face_load_cvt( face, face->root.stream );
error = tt_face_load_cvt( face, face->root.stream );
break;
case mcvt_modify:
/* The original cvt table is in memory. All we need to do is */
/* apply the `cvar' table (if any). */
tt_face_vary_cvt( face, face->root.stream );
error = tt_face_vary_cvt( face, face->root.stream );
break;
case mcvt_retain:

View File

@ -760,7 +760,9 @@
if ( !exec )
return FT_THROW( Could_Not_Find_Context );
TT_Load_Context( exec, face, size );
error = TT_Load_Context( exec, face, size );
if ( error )
return error;
exec->callTop = 0;
exec->top = 0;
@ -852,7 +854,9 @@
if ( !exec )
return FT_THROW( Could_Not_Find_Context );
TT_Load_Context( exec, face, size );
error = TT_Load_Context( exec, face, size );
if ( error )
return error;
exec->callTop = 0;
exec->top = 0;