From 6b992aaaf27c2d8bdb9541c4bae56d152b8abe5a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 11 Aug 2024 19:44:13 +0200 Subject: [PATCH] * src/*/*: Fix C++ compilation; fix clang warnings. --- src/cache/ftcbasic.c | 5 +++-- src/psaux/psintrp.c | 4 ++-- src/sfnt/ttgpos.c | 24 ++++++++---------------- src/sfnt/ttpost.c | 2 +- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 04f664fad..7102d3d2d 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -45,8 +45,9 @@ FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \ (a)->load_flags == (b)->load_flags ) -#define FTC_BASIC_ATTR_HASH( a ) \ - ( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags ) +#define FTC_BASIC_ATTR_HASH( a ) \ + ( FTC_SCALER_HASH( &(a)->scaler ) + \ + (FT_Offset)( 31 * (a)->load_flags ) ) typedef struct FTC_BasicQueryRec_ diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c index 6b445a996..7572e225e 100644 --- a/src/psaux/psintrp.c +++ b/src/psaux/psintrp.c @@ -445,7 +445,7 @@ cf2_stack_getReal( opStack, delta++ ) ) ); - FT_TRACE6(( "%f ", (float) sum / 65536 )); + FT_TRACE6(( "%f ", (double)sum / 65536 )); /* store blended result */ cf2_stack_setReal( opStack, i + base, sum ); @@ -2282,7 +2282,7 @@ arg = cf2_stack_popFixed( opStack ); if ( arg > 0 ) - arg = (CF2_F16Dot16)FT_SqrtFixed( arg ); + arg = (CF2_F16Dot16)FT_SqrtFixed( (FT_UInt32)arg ); else arg = 0; diff --git a/src/sfnt/ttgpos.c b/src/sfnt/ttgpos.c index c5dd043d6..b6cd8bf82 100644 --- a/src/sfnt/ttgpos.c +++ b/src/sfnt/ttgpos.c @@ -58,6 +58,7 @@ typedef enum gpos_lookup_type_ { + GPOS_LOOKUP_TYPE_NONE = 0, GPOS_LOOKUP_TYPE_SINGLE_ADJUSTMENT = 1, GPOS_LOOKUP_TYPE_PAIR_ADJUSTMENT = 2, GPOS_LOOKUP_TYPE_CURSIVE_ATTACHMENT = 3, @@ -132,14 +133,14 @@ else { context->current_lookup_table = NULL; - context->current_lookup_type = 0; + context->current_lookup_type = GPOS_LOOKUP_TYPE_NONE; context->subtable_count = 0; context->subtable_offsets = NULL; } context->subtable_idx = 0; context->subtable = NULL; - context->subtable_type = 0; + context->subtable_type = GPOS_LOOKUP_TYPE_NONE; } @@ -195,7 +196,7 @@ FT_Int m; FT_Int straw; - FT_Int needle = glyph; + FT_Int needle = (FT_Int)glyph; /* Binary search. */ @@ -230,7 +231,7 @@ FT_Int straw_start; FT_Int straw_end; - FT_Int needle = glyph; + FT_Int needle = (FT_Int)glyph; /* Binary search. */ @@ -254,14 +255,11 @@ FT_PEEK_USHORT( range_record + 4 ); - return start_coverage_index + glyph - straw_start; + return (FT_Int)start_coverage_index + (FT_Int)glyph - straw_start; } } break; } - - default: - return -1; /* unsupported */ } return -1; @@ -303,7 +301,7 @@ FT_Int straw_start; FT_Int straw_end; - FT_Int needle = glyph; + FT_Int needle = (FT_Int)glyph; while ( l <= r ) @@ -325,9 +323,6 @@ } break; } - - default: - return -1; /* Unsupported definition type, return an error. */ } /* "All glyphs not assigned to a class fall into class 0." */ @@ -514,7 +509,7 @@ pair_value_count = FT_PEEK_USHORT( pair_value_table ); pair_value_array = pair_value_table + 2; - needle = right_glyph; + needle = (FT_Int)right_glyph; r = pair_value_count - 1; l = 0; @@ -584,9 +579,6 @@ return x_advance; } - - default: - return 0; } } } diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index dd798d2b2..5698a62c8 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -240,7 +240,7 @@ if ( n < num_names ) { FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n", - num_names - n )); + (FT_UShort)( num_names - n ) )); for ( ; n < num_names; n++ ) name_strings[n] = p_end;