From b24e8ba28a9711e72975c11a37f1269254e5ac3c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 25 Nov 2014 08:30:49 +0100 Subject: [PATCH] [Savannah bug #43682] Add/remove `void' casts to some functions. We use a cast to indicate that we intentionally ignore a function's return value. However, this doesn't apply to API functions where errors can only happen for trivially invalid input. * src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder), src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c (cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning), src/type1/t1load.c (parse_encoding), src/type42/t42parse.c (t42_parse_encoding): Do it. --- ChangeLog | 14 ++++++++++++++ src/base/ftstroke.c | 6 +++--- src/base/ftsynth.c | 8 +++----- src/cff/cffgload.c | 26 +++++++++++++------------- src/pfr/pfrdrivr.c | 2 +- src/truetype/ttdriver.c | 4 ++-- src/type1/t1load.c | 2 +- src/type42/t42parse.c | 2 +- 8 files changed, 38 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e0a6c4fd..97cfa4882 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2014-11-24 Werner Lemberg + + [Savannah bug #43682] Add/remove `void' casts to some functions. + + We use a cast to indicate that we intentionally ignore a function's + return value. However, this doesn't apply to API functions where + errors can only happen for trivially invalid input. + + * src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder), + src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c + (cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning), + src/type1/t1load.c (parse_encoding), src/type42/t42parse.c + (t42_parse_encoding): Do it. + 2014-11-24 Werner Lemberg [Savannah bug #43682] Change some signatures to `void' return type. diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index dd75e32e9..ce24591ef 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -2294,7 +2294,7 @@ if ( error ) goto Fail; - (void)FT_Stroker_GetCounts( stroker, &num_points, &num_contours ); + FT_Stroker_GetCounts( stroker, &num_points, &num_contours ); FT_Outline_Done( glyph->library, outline ); @@ -2380,8 +2380,8 @@ if ( error ) goto Fail; - (void)FT_Stroker_GetBorderCounts( stroker, border, - &num_points, &num_contours ); + FT_Stroker_GetBorderCounts( stroker, border, + &num_points, &num_contours ); FT_Outline_Done( glyph->library, outline ); diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index 3098a60fa..fbe805db8 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2006, 2010, 2012, 2013 by */ +/* Copyright 2000-2006, 2010, 2012-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -100,10 +100,8 @@ ystr = xstr; if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - /* ignore error */ - (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); - } + FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); + else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ { /* round to full pixels */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index c8e9f9124..89f927303 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2013 by */ +/* Copyright 1996-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -2711,10 +2711,10 @@ /* compute linear advance widths */ - ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, - glyph_index, - &dummy, - &advance ); + (void)( (SFNT_Service)face->sfnt )->get_metrics( face, 0, + glyph_index, + &dummy, + &advance ); glyph->root.linearHoriAdvance = advance; has_vertical_info = FT_BOOL( @@ -2724,10 +2724,10 @@ /* get the vertical metrics from the vtmx table if we have one */ if ( has_vertical_info ) { - ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, - glyph_index, - &dummy, - &advance ); + (void)( (SFNT_Service)face->sfnt )->get_metrics( face, 1, + glyph_index, + &dummy, + &advance ); glyph->root.linearVertAdvance = advance; } else @@ -2964,10 +2964,10 @@ FT_UShort vertAdvance = 0; - ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, - glyph_index, - &vertBearingY, - &vertAdvance ); + (void)( (SFNT_Service)face->sfnt )->get_metrics( face, 1, + glyph_index, + &vertBearingY, + &vertAdvance ); metrics->vertBearingY = vertBearingY; metrics->vertAdvance = vertAdvance; } diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index 188aa0dd9..db66281ac 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -37,7 +37,7 @@ PFR_PhyFont phys = &face->phy_font; - pfr_face_get_kerning( pfrface, left, right, avector ); + (void)pfr_face_get_kerning( pfrface, left, right, avector ); /* convert from metrics to outline units when necessary */ if ( phys->outline_resolution != phys->metrics_resolution ) diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 36d23a282..af8824f9e 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2013 by */ +/* Copyright 1996-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -267,7 +267,7 @@ /* use the scaled metrics, even when tt_size_reset fails */ FT_Select_Metrics( size->face, strike_index ); - tt_size_reset( ttsize ); + tt_size_reset( ttsize ); /* ignore return value */ } else { diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 24b14a8bb..22b3f6b31 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1211,7 +1211,7 @@ char* notdef = (char *)".notdef"; - T1_Add_Table( char_table, n, notdef, 8 ); + (void)T1_Add_Table( char_table, n, notdef, 8 ); } /* Now we need to read records of the form */ diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index d45c0699a..fd3d669f6 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -366,7 +366,7 @@ char* notdef = (char *)".notdef"; - T1_Add_Table( char_table, n, notdef, 8 ); + (void)T1_Add_Table( char_table, n, notdef, 8 ); } /* Now we need to read records of the form */