From 37c72f66a56887ec25f4f541337b00e8ba69b9ee Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 25 Dec 2016 22:55:25 +0100 Subject: [PATCH] Minor formatting. --- src/base/ftcalc.c | 8 ++++---- src/cff/cf2hints.c | 4 ++-- src/cff/cf2intrp.c | 6 +++--- src/cff/cffgload.c | 6 +++--- src/cff/cffload.c | 4 ++-- src/pcf/pcfread.c | 2 +- src/psaux/psobjs.c | 2 +- src/pshinter/pshalgo.c | 4 ++-- src/raster/ftraster.c | 14 ++++++++------ src/sfnt/sfdriver.c | 2 +- src/smooth/ftsmooth.c | 4 ++-- src/truetype/ttinterp.c | 10 ++++++---- src/type42/t42parse.c | 2 +- 13 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 67549d0c4..1c2392222 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -449,8 +449,8 @@ FT_Add64( &temp, &temp2, &temp ); /* last attempt to ditch long division */ - a = temp.hi == 0 ? temp.lo / c - : ft_div64by32( temp.hi, temp.lo, c ); + a = ( temp.hi == 0 ) ? temp.lo / c + : ft_div64by32( temp.hi, temp.lo, c ); } a_ = (FT_Long)a; @@ -492,8 +492,8 @@ ft_multo64( a, b, &temp ); /* last attempt to ditch long division */ - a = temp.hi == 0 ? temp.lo / c - : ft_div64by32( temp.hi, temp.lo, c ); + a = ( temp.hi == 0 ) ? temp.lo / c + : ft_div64by32( temp.hi, temp.lo, c ); } a_ = (FT_Long)a; diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index bbbe8e3c3..c8f7dfeba 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -401,10 +401,10 @@ /* calculate all four possibilities; moves down are negative */ CF2_Fixed downMoveDown = 0 - fracDown; CF2_Fixed upMoveDown = 0 - fracUp; - CF2_Fixed downMoveUp = fracDown == 0 + CF2_Fixed downMoveUp = ( fracDown == 0 ) ? 0 : cf2_intToFixed( 1 ) - fracDown; - CF2_Fixed upMoveUp = fracUp == 0 + CF2_Fixed upMoveUp = ( fracUp == 0 ) ? 0 : cf2_intToFixed( 1 ) - fracUp; diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 9c059a181..c08aaba72 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -347,7 +347,7 @@ vals[0] = *curX; vals[1] = *curY; index = 0; - isHFlex = readFromStack[9] == FALSE; + isHFlex = FT_BOOL( readFromStack[9] == FALSE ); top = isHFlex ? 9 : 10; for ( i = 0; i < top; i++ ) @@ -797,7 +797,7 @@ CF2_UInt index; CF2_UInt count = cf2_stack_count( opStack ); - FT_Bool isX = op1 == cf2_cmdHLINETO; + FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO ); FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); @@ -1716,7 +1716,7 @@ CF2_UInt count, count1 = cf2_stack_count( opStack ); CF2_UInt index = 0; - FT_Bool alternate = op1 == cf2_cmdHVCURVETO; + FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO ); /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index f7ddb3caf..c58f6dbbe 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -2445,7 +2445,7 @@ case cff_op_and: { - FT_Fixed cond = args[0] && args[1]; + FT_Fixed cond = ( args[0] && args[1] ); FT_TRACE4(( " and\n" )); @@ -2457,7 +2457,7 @@ case cff_op_or: { - FT_Fixed cond = args[0] || args[1]; + FT_Fixed cond = ( args[0] || args[1] ); FT_TRACE4(( " or\n" )); @@ -2481,7 +2481,7 @@ case cff_op_eq: { - FT_Fixed cond = args[0] == args[1]; + FT_Fixed cond = ( args[0] == args[1] ); FT_TRACE4(( " eq\n" )); diff --git a/src/cff/cffload.c b/src/cff/cffload.c index c097523ea..09ae6f20b 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1925,8 +1925,8 @@ CFF_FontRecDict top = &subfont->font_dict; CFF_Private priv = &subfont->private_dict; - FT_Bool cff2 = ( code == CFF2_CODE_TOPDICT || - code == CFF2_CODE_FONTDICT ); + FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT || + code == CFF2_CODE_FONTDICT ); FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK : CFF_MAX_STACK_DEPTH; diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index c34d8d0be..6b2e82cb4 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -319,7 +319,7 @@ THE SOFTWARE. /* parsing normal metrics */ - fields = PCF_BYTE_ORDER( format ) == MSBFirst + fields = ( PCF_BYTE_ORDER( format ) == MSBFirst ) ? pcf_metric_msb_header : pcf_metric_header; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index f208b5fc6..dc19e8afc 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -695,7 +695,7 @@ /* ************ otherwise, it is any token **************/ default: token->start = cur; - token->type = ( *cur == '/' ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY ); + token->type = ( *cur == '/' ) ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY; ps_parser_skip_PS_token( parser ); cur = parser->cursor; if ( !parser->error ) diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 9dabb77cf..e4d82998b 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -1572,8 +1572,8 @@ PS_Mask mask = table->hint_masks->masks; FT_UInt num_masks = table->hint_masks->num_masks; FT_UInt first = 0; - FT_Int major_dir = dimension == 0 ? PSH_DIR_VERTICAL - : PSH_DIR_HORIZONTAL; + FT_Int major_dir = ( dimension == 0 ) ? PSH_DIR_VERTICAL + : PSH_DIR_HORIZONTAL; PSH_Dimension dim = &glyph->globals->dimension[dimension]; FT_Fixed scale = dim->scale_mult; FT_Int threshold; diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 7b9abe6a0..429f0d250 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -1520,8 +1520,9 @@ state_bez = y1 < y3 ? Ascending_State : Descending_State; if ( ras.state != state_bez ) { - Bool o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 ) - : IS_TOP_OVERSHOOT( y1 ); + Bool o = ( state_bez == Ascending_State ) + ? IS_BOTTOM_OVERSHOOT( y1 ) + : IS_TOP_OVERSHOOT( y1 ); /* finalize current profile if any */ @@ -1656,8 +1657,9 @@ /* detect a change of direction */ if ( ras.state != state_bez ) { - Bool o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 ) - : IS_TOP_OVERSHOOT( y1 ); + Bool o = ( state_bez == Ascending_State ) + ? IS_BOTTOM_OVERSHOOT( y1 ) + : IS_TOP_OVERSHOOT( y1 ); /* finalize current profile if any */ @@ -2390,7 +2392,7 @@ pxl = e2; /* check that the other pixel isn't set */ - e1 = pxl == e1 ? e2 : e1; + e1 = ( pxl == e1 ) ? e2 : e1; e1 = TRUNC( e1 ); @@ -2591,7 +2593,7 @@ pxl = e2; /* check that the other pixel isn't set */ - e1 = pxl == e1 ? e2 : e1; + e1 = ( pxl == e1 ) ? e2 : e1; e1 = TRUNC( e1 ); diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 73343a6e6..1f15223cb 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -88,7 +88,7 @@ break; case FT_SFNT_OS2: - table = face->os2.version == 0xFFFFU ? NULL : &face->os2; + table = ( face->os2.version == 0xFFFFU ) ? NULL : &face->os2; break; case FT_SFNT_POST: diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 137179235..5f6aa60ef 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -114,8 +114,8 @@ #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING FT_Pos height_org, width_org; #endif - FT_Int hmul = mode == FT_RENDER_MODE_LCD; - FT_Int vmul = mode == FT_RENDER_MODE_LCD_V; + FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); + FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); FT_Raster_Params params; diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 728750356..834784cb2 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -5577,9 +5577,9 @@ FT_Int B1, B2; #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - FT_Bool in_twilight = exc->GS.gep0 == 0 || \ - exc->GS.gep1 == 0 || \ - exc->GS.gep2 == 0; + FT_Bool in_twilight = FT_BOOL( exc->GS.gep0 == 0 || + exc->GS.gep1 == 0 || + exc->GS.gep2 == 0 ); #endif @@ -6537,7 +6537,9 @@ * Otherwise, by definition, the value of exc->twilight.orus[n] is (0,0), * for every n. */ - twilight = exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0; + twilight = ( exc->GS.gep0 == 0 || + exc->GS.gep1 == 0 || + exc->GS.gep2 == 0 ); if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) { diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index 9e23a51e8..ef36ffe3c 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -936,7 +936,7 @@ if ( *cur == '/' || *cur == '(' ) { FT_UInt len; - FT_Bool have_literal = ( *cur == '(' ); + FT_Bool have_literal = FT_BOOL( *cur == '(' ); if ( cur + ( have_literal ? 3 : 2 ) >= limit )