Commit 2149b51f2543719b1ee78fb50ecf4e6e80f84ad7

Werner Lemberg 2021-03-13T19:08:09

Handle various VC++ compiler warnings. Fixes #1039. * src/base/ftstroke.c (ft_stroker_inside, ft_stroker_outside): Initialize `sigma`. * src/sdf/ftsdf.c (sdf_generate_with_overlaps): Exit immediately if function arguments are invalid. * src/sdf/ftsdfrend.c (sdf_property_set) <"overlaps">: Fix cast. * src/sfnt/sfwoff2.c (woff2_decompress) [!FT_CONFIG_OPTION_USE_BROTLI]: Use `FT_UNUSED`. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `fvar_head`.

diff --git a/ChangeLog b/ChangeLog
index ef2a65d..d4a748c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2021-03-13  Werner Lemberg  <wl@gnu.org>
+
+	Handle various VC++ compiler warnings.
+
+	Fixes #1039.
+
+	* src/base/ftstroke.c (ft_stroker_inside, ft_stroker_outside):
+	Initialize `sigma`.
+
+	* src/sdf/ftsdf.c (sdf_generate_with_overlaps): Exit immediately if
+	function arguments are invalid.
+	* src/sdf/ftsdfrend.c (sdf_property_set) <"overlaps">: Fix cast.
+
+	* src/sfnt/sfwoff2.c (woff2_decompress)
+	[!FT_CONFIG_OPTION_USE_BROTLI]: Use `FT_UNUSED`.
+
+	* src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `fvar_head`.
+
 2021-03-11  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[smooth] Reduce copying during integration phase.
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index dc64b1d..37e9649 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -974,7 +974,8 @@
     FT_StrokeBorder  border = stroker->borders + side;
     FT_Angle         phi, theta, rotate;
     FT_Fixed         length;
-    FT_Vector        sigma, delta;
+    FT_Vector        sigma = { 0, 0 };
+    FT_Vector        delta;
     FT_Error         error = FT_Err_Ok;
     FT_Bool          intersect;          /* use intersection of lines? */
 
@@ -1048,7 +1049,7 @@
     {
       /* this is a mitered (pointed) or beveled (truncated) corner */
       FT_Fixed   radius = stroker->radius;
-      FT_Vector  sigma;
+      FT_Vector  sigma = { 0, 0 };
       FT_Angle   theta = 0, phi = 0;
       FT_Bool    bevel, fixed_bevel;
 
diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c
index acaf283..b80b1cb 100644
--- a/src/sdf/ftsdf.c
+++ b/src/sdf/ftsdf.c
@@ -3510,10 +3510,7 @@
     head         = NULL;
 
     if ( !shape || !bitmap || !shape->memory )
-    {
-      error = FT_THROW( Invalid_Argument );
-      goto Exit;
-    }
+      return FT_THROW( Invalid_Argument );
 
     contour           = shape->contours;
     memory            = shape->memory;
diff --git a/src/sdf/ftsdfrend.c b/src/sdf/ftsdfrend.c
index 6ea9065..3226bdc 100644
--- a/src/sdf/ftsdfrend.c
+++ b/src/sdf/ftsdfrend.c
@@ -110,7 +110,7 @@
 
     else if ( ft_strcmp( property_name, "overlaps" ) == 0 )
     {
-      FT_Int  val = *(const FT_Int*)value;
+      FT_Bool  val = *(const FT_Bool*)value;
 
 
       render->overlaps = val;
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index edf173d..2edb15f 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -341,6 +341,11 @@
 
 #else /* !FT_CONFIG_OPTION_USE_BROTLI */
 
+    FT_UNUSED( dst );
+    FT_UNUSED( dst_size );
+    FT_UNUSED( src );
+    FT_UNUSED( src_size );
+
     FT_ERROR(( "woff2_decompress: Brotli support not available.\n" ));
     return FT_THROW( Unimplemented_Feature );
 
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 7a4f33f..ad87746 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2060,7 +2060,7 @@
     FT_Var_Axis*         a;
     FT_Fixed*            c;
     FT_Var_Named_Style*  ns;
-    GX_FVar_Head         fvar_head;
+    GX_FVar_Head         fvar_head  = { 0, 0, 0, 0, 0, 0 };
     FT_Bool              usePsName  = 0;
     FT_UInt              num_instances;
     FT_UInt              num_axes;