Commit 87989a1435c0b6a2848d502627ecaca9d3cfc3a1

Werner Lemberg 2022-03-31T07:43:41

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.

diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 0c33412..571dca1 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 282c912..eeda69c 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 5ee6877..0ee1834 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 cd43f75..39ce61a 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 b668a50..e12efca 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 5929e6c..6ab5038 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 3eaf9b3..887ea8d 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 891ef18..f0e4541 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 cb70ee8..69277da 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;
 
 
       /*