Commit fc58155afc5213480f331990c28e83105f20a371

Werner Lemberg 2010-01-05T20:00:35

Apply reports from clang static analyzer. * src/lzw/ftlzw.c (ft_lzw_file_init), src/base/ftstroke.c (FT_Stroker_ParseOutline), src/base/ftsynth.c (FT_GlyphSlot_Embolden): Remove dead code. * src/base/ftpatent.c (_tt_check_patents_in_table): Initialize `offset_i'.

diff --git a/ChangeLog b/ChangeLog
index 254a734..49cd248 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-05  Werner Lemberg  <wl@gnu.org>
+
+	Apply reports from clang static analyzer.
+
+	* src/lzw/ftlzw.c (ft_lzw_file_init), src/base/ftstroke.c
+	(FT_Stroker_ParseOutline), src/base/ftsynth.c
+	(FT_GlyphSlot_Embolden): Remove dead code.
+
+	* src/base/ftpatent.c (_tt_check_patents_in_table): Initialize
+	`offset_i'.
+
 2010-01-05  Ralph Giles  <giles@ghostscript.com>
 
 	Enable the incremental font interface by default.
diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c
index 236d9a6..baad4da 100644
--- a/src/base/ftpatent.c
+++ b/src/base/ftpatent.c
@@ -5,7 +5,7 @@
 /*    FreeType API for checking patented TrueType bytecode instructions    */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 2007, 2008 by David Turner.                                  */
+/*  Copyright 2007, 2008, 2010 by David Turner.                            */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -114,7 +114,7 @@
                               FT_ULong  tag )
   {
     FT_Stream              stream = face->stream;
-    FT_Error               error = FT_Err_Ok;
+    FT_Error               error  = FT_Err_Ok;
     FT_Service_SFNT_Table  service;
     FT_Bool                result = FALSE;
 
@@ -124,13 +124,14 @@
     if ( service )
     {
       FT_UInt   i = 0;
-      FT_ULong  tag_i = 0, offset_i, length_i;
+      FT_ULong  tag_i = 0, offset_i = 0, length_i;
+
 
       for ( i = 0; !error && tag_i != tag ; i++ )
         error = service->table_info( face, i,
                                      &tag_i, &offset_i, &length_i );
 
-      if ( error                    ||
+      if ( error                      ||
            FT_STREAM_SEEK( offset_i ) )
         goto Exit;
 
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 5005b1c..75bcbde 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType path stroker (body).                                        */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by                  */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by            */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -1736,13 +1736,10 @@
         }
         else
         {
-          /* if both first and last points are conic,         */
-          /* start at their middle and record its position    */
-          /* for closure                                      */
+          /* if both first and last points are conic, */
+          /* start at their middle                    */
           v_start.x = ( v_start.x + v_last.x ) / 2;
           v_start.y = ( v_start.y + v_last.y ) / 2;
-
-          v_last = v_start;
         }
         point--;
         tags--;
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 326d8e7..ba3c633 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType synthesizing code for emboldening and slanting (body).      */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -100,8 +100,8 @@
 
     if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
     {
-      error = FT_Outline_Embolden( &slot->outline, xstr );
       /* ignore error */
+      (void)FT_Outline_Embolden( &slot->outline, xstr );
 
       /* this is more than enough for most glyphs; if you need accurate */
       /* values, you have to call FT_Outline_Get_CBox                   */
diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c
index 4f601a1..6e57ded 100644
--- a/src/lzw/ftlzw.c
+++ b/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
 /*  be used to parse compressed PCF fonts, as found with many X11 server   */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006, 2009 by                                    */
+/*  Copyright 2004, 2005, 2006, 2009, 2010 by                              */
 /*  Albert Chin-A-Young.                                                   */
 /*                                                                         */
 /*  Based on code in src/gzip/ftgzip.c, Copyright 2004 by                  */
@@ -122,13 +122,9 @@
     zip->pos    = 0;
 
     /* check and skip .Z header */
-    {
-      stream = source;
-
-      error = ft_lzw_check_header( source );
-      if ( error )
-        goto Exit;
-    }
+    error = ft_lzw_check_header( source );
+    if ( error )
+      goto Exit;
 
     /* initialize internal lzw variable */
     ft_lzwstate_init( lzw, source );