From 6a179ff7d55714501c5efce85e2a47de6055a07a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 16 Jan 2023 16:38:56 +0100 Subject: [PATCH] sr/*.c: Various minor fixes. * src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after variable declarations. * src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate unused variable. * src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++ compiler. * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid compiler warning. * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning. --- src/autofit/ft-hb.c | 3 ++- src/gxvalid/gxvjust.c | 3 +-- src/gzip/ftgzip.c | 2 ++ src/sfnt/ttcolr.c | 2 +- src/sfnt/ttsvg.c | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/autofit/ft-hb.c b/src/autofit/ft-hb.c index 1958f9c36..7ba1bfa55 100644 --- a/src/autofit/ft-hb.c +++ b/src/autofit/ft-hb.c @@ -38,12 +38,13 @@ static hb_blob_t * _hb_ft_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) { - FT_UNUSED (face); FT_Face ft_face = (FT_Face) user_data; FT_Byte *buffer; FT_ULong length = 0; FT_Error error; + FT_UNUSED (face); + /* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */ error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length); diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c index 6af2c79c8..389a15516 100644 --- a/src/gxvalid/gxvjust.c +++ b/src/gxvalid/gxvjust.c @@ -156,7 +156,6 @@ { FT_Bytes p = table; FT_Bytes wdc_end = table + GXV_JUST_DATA( wdc_offset_max ); - FT_UInt i; GXV_NAME_ENTER( "just justDeltaClusters" ); @@ -164,7 +163,7 @@ if ( limit <= wdc_end ) FT_INVALID_OFFSET; - for ( i = 0; p <= wdc_end; i++ ) + while ( p <= wdc_end ) { gxv_just_wdc_entry_validate( p, limit, gxvalid ); p += gxvalid->subtable_length; diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index b415e9d6c..f7ffebdcb 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -90,7 +90,9 @@ #if defined( __GNUC__ ) #pragma GCC diagnostic push +#ifndef __cplusplus #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c index d6693d773..710357c60 100644 --- a/src/sfnt/ttcolr.c +++ b/src/sfnt/ttcolr.c @@ -61,7 +61,7 @@ #define ENSURE_READ_BYTES( byte_size ) \ if ( p < colr->paints_start_v1 || \ p > (FT_Byte*)colr->table + colr->table_size - byte_size ) \ - return 0; + return 0 typedef enum FT_PaintFormat_Internal_ diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c index 411813a98..22b9a4bb1 100644 --- a/src/sfnt/ttsvg.c +++ b/src/sfnt/ttsvg.c @@ -310,7 +310,8 @@ if ( error != FT_Err_Ok ) goto Exit; - doc_limit = svg->table_size - ( doc_list - (FT_Byte*)svg->table ); + doc_limit = svg->table_size - + (FT_ULong)( doc_list - (FT_Byte*)svg->table ); if ( doc_offset > doc_limit || doc_length > doc_limit - doc_offset ) {