From 87989a1435c0b6a2848d502627ecaca9d3cfc3a1 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 31 Mar 2022 07:43:41 +0200 Subject: [PATCH] Fix clang++ warnings. * src/base/ftglyph.c (ft_svg_glyph_prepare), src/base/ftobj.c (ft_glyphslot_init), src/cache/ftccmap.c (ftc_cmap_node_new), src/cache/ftcimage.c (FTC_INode_New), src/lzw/ftlzw.c (FT_Stream_OpenLZW), src/psaux/psobjs.c (ps_parser_load_field), src/pshinter/pshglob.c (psh_globals_new), src/sfnt/ttsvg.c (tt_face_load_svg_doc): Initialize variables used for allocation. * src/sdf/ftsdf.c (split_sdf_conic, split_sdf_cubic): Change type of `max_splits` to FT_UInt. (sdf_generate_bounding_box): Add cast. --- src/base/ftglyph.c | 2 +- src/base/ftobjs.c | 2 +- src/cache/ftccmap.c | 2 +- src/cache/ftcimage.c | 2 +- src/lzw/ftlzw.c | 2 +- src/psaux/psobjs.c | 2 +- src/pshinter/pshglob.c | 2 +- src/sdf/ftsdf.c | 6 +++--- src/sfnt/ttsvg.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 0c3341238..571dca1a9 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -469,7 +469,7 @@ FT_Error error = FT_Err_Ok; FT_Memory memory = svg_glyph->library->memory; - FT_SVG_Document document; + FT_SVG_Document document = NULL; if ( FT_NEW( document ) ) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 282c9121a..eeda69c3e 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -334,7 +334,7 @@ /* if SVG table exists, allocate the space in `slot->other` */ if ( slot->face->face_flags & FT_FACE_FLAG_SVG ) { - FT_SVG_Document document; + FT_SVG_Document document = NULL; if ( FT_NEW( document ) ) diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 5ee6877e4..0ee1834e2 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -112,7 +112,7 @@ FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; FT_Error error; FT_Memory memory = cache->memory; - FTC_CMapNode node; + FTC_CMapNode node = NULL; FT_UInt nn; diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index cd43f755f..39ce61a51 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -61,7 +61,7 @@ { FT_Memory memory = cache->memory; FT_Error error; - FTC_INode inode; + FTC_INode inode = NULL; if ( !FT_QNEW( inode ) ) diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c index b668a50a4..e12efcaa5 100644 --- a/src/lzw/ftlzw.c +++ b/src/lzw/ftlzw.c @@ -344,7 +344,7 @@ { FT_Error error; FT_Memory memory; - FT_LZWFile zip; + FT_LZWFile zip = NULL; if ( !stream || !source ) diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 5929e6cac..6ab503806 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -1115,7 +1115,7 @@ { FT_Memory memory = parser->memory; FT_UInt len = (FT_UInt)( limit - cur ); - FT_String* string; + FT_String* string = NULL; if ( cur >= limit ) diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index 3eaf9b354..887ea8d9c 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -646,7 +646,7 @@ T1_Private* priv, PSH_Globals *aglobals ) { - PSH_Globals globals; + PSH_Globals globals = NULL; FT_Error error; diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index 891ef187e..f0e45418c 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -1077,7 +1077,7 @@ static FT_Error split_sdf_conic( FT_Memory memory, FT_26D6_Vec* control_points, - FT_Int max_splits, + FT_UInt max_splits, SDF_Edge** out ) { FT_Error error = FT_Err_Ok; @@ -1146,7 +1146,7 @@ static FT_Error split_sdf_cubic( FT_Memory memory, FT_26D6_Vec* control_points, - FT_Int max_splits, + FT_UInt max_splits, SDF_Edge** out ) { FT_Error error = FT_Err_Ok; @@ -3288,7 +3288,7 @@ buffer = (FT_SDFFormat*)bitmap->buffer; if ( USE_SQUARED_DISTANCES ) - sp_sq = FT_INT_16D16( spread * spread ); + sp_sq = FT_INT_16D16( (FT_Int)( spread * spread ) ); else sp_sq = fixed_spread; diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c index cb70ee8b1..69277da57 100644 --- a/src/sfnt/ttsvg.c +++ b/src/sfnt/ttsvg.c @@ -319,7 +319,7 @@ #ifdef FT_CONFIG_OPTION_USE_ZLIB FT_ULong uncomp_size; - FT_Byte* uncomp_buffer; + FT_Byte* uncomp_buffer = NULL; /*