[pango] Bug 652841 - Various pieces of dead code found by gcc/clang static analyzer



commit a0296ccbdd570b66a36bf4226760aed312d020d4
Author: Behdad Esfahbod <behdad behdad org>
Date:   Fri Jun 17 17:08:35 2011 -0400

    Bug 652841 - Various pieces of dead code found by gcc/clang static analyzer

 examples/cairoshape.c        |    4 ++--
 modules/indic/indic-ot.c     |    1 -
 pango-view/viewer-pangoft2.c |    4 ++--
 pango/opentype/hb-common.h   |    2 +-
 pango/pango-gravity.c        |    4 ----
 pango/pango-layout.c         |    7 -------
 pango/pango-ot-info.c        |    2 --
 pango/pango-renderer.c       |    1 -
 pango/pangocairo-font.c      |    4 ++--
 pango/pangocairo-render.c    |    1 -
 pango/pangofc-fontmap.c      |    5 +----
 11 files changed, 8 insertions(+), 27 deletions(-)
---
diff --git a/examples/cairoshape.c b/examples/cairoshape.c
index f668e92..d288db1 100644
--- a/examples/cairoshape.c
+++ b/examples/cairoshape.c
@@ -58,12 +58,12 @@ mini_svg_render (MiniSvg  *shape,
   double x, y;
   const char *p;
   char op[2];
-  int items, len;
+  int len;
 
   cairo_get_current_point (cr, &x, &y);
   cairo_translate (cr, x, y);
 
-  for (p = shape->path; (items = sscanf (p, "%1s %n", op, &len)), p += len, *p;)
+  for (p = shape->path; sscanf (p, "%1s %n", op, &len), p += len, *p;)
     switch (*op)
     {
       case 'M':
diff --git a/modules/indic/indic-ot.c b/modules/indic/indic-ot.c
index 7a72d34..60f253b 100644
--- a/modules/indic/indic-ot.c
+++ b/modules/indic/indic-ot.c
@@ -315,7 +315,6 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c
 	    postBaseLimit = class_table->scriptFlags & SF_POST_BASE_LIMIT_MASK;
 	    seenVattu = false;
 	    seenBelowBaseForm = false;
-	    supressVattu = true;
 
 	    while (baseConsonant > baseLimit) {
 		IndicOTCharClass charClass = indic_ot_get_char_class(class_table, chars[baseConsonant]);
diff --git a/pango-view/viewer-pangoft2.c b/pango-view/viewer-pangoft2.c
index 2699b74..87973c8 100644
--- a/pango-view/viewer-pangoft2.c
+++ b/pango-view/viewer-pangoft2.c
@@ -133,7 +133,7 @@ pangoft2_view_write (gpointer instance G_GNUC_UNUSED,
 		     int      width,
 		     int      height)
 {
-  int row, bytes;
+  int row;
   FT_Bitmap *bitmap = (FT_Bitmap *) surface;
 
   /* Write it as pgm to output */
@@ -142,7 +142,7 @@ pangoft2_view_write (gpointer instance G_GNUC_UNUSED,
 	  "%d %d\n"
 	  "255\n", width, height);
   for (row = 0; row < height; row++)
-    bytes = fwrite(bitmap->buffer + row * bitmap->pitch, 1, width, stream);
+    fwrite (bitmap->buffer + row * bitmap->pitch, 1, width, stream);
 }
 
 const PangoViewer pangoft2_viewer = {
diff --git a/pango/opentype/hb-common.h b/pango/opentype/hb-common.h
index a6be6ba..15396ab 100644
--- a/pango/opentype/hb-common.h
+++ b/pango/opentype/hb-common.h
@@ -29,7 +29,7 @@
 
 # ifdef HAVE_STDINT_H
 #  include <stdint.h>
-# else ifdef HAVE_INTTYPES_H
+# elif defined(HAVE_INTTYPES_H)
 # include <inttypes.h>
 # endif
 
diff --git a/pango/pango-gravity.c b/pango/pango-gravity.c
index 7553a07..603c377 100644
--- a/pango/pango-gravity.c
+++ b/pango/pango-gravity.c
@@ -256,14 +256,10 @@ pango_gravity_get_for_script (PangoScript      script,
 			      PangoGravityHint hint)
 {
   PangoScriptProperties props = get_script_properties (script);
-  gboolean vertical;
-
 
   if (G_UNLIKELY (base_gravity == PANGO_GRAVITY_AUTO))
     base_gravity = props.preferred_gravity;
 
-  vertical = PANGO_GRAVITY_IS_VERTICAL (base_gravity);
-
   return pango_gravity_get_for_script_and_width (script, props.wide,
 						 base_gravity, hint);
 }
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 40f92fa..e6ed96e 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4406,13 +4406,6 @@ pango_layout_get_empty_extents_at_index (PangoLayout    *layout,
 
 	      if (start <= index && index < end)
 		{
-		  PangoFontDescription *base_font_desc;
-
-		  if (layout->font_desc)
-		    base_font_desc = layout->font_desc;
-		  else
-		    base_font_desc = pango_context_get_font_description (layout->context);
-
 		  if (!free_font_desc)
 		    {
 		      font_desc = pango_font_description_copy_static (font_desc);
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index be7d53a..7bc249b 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -513,14 +513,12 @@ _pango_ot_info_substitute  (const PangoOTInfo    *info,
   for (i = 0; i < ruleset->rules->len; i++)
     {
       PangoOTRule *rule = &g_array_index (ruleset->rules, PangoOTRule, i);
-      hb_mask_t mask;
       unsigned int lookup_count, j;
       unsigned int lookup_indexes[1000];
 
       if (rule->table_type != PANGO_OT_TABLE_GSUB)
 	continue;
 
-      mask = rule->property_bit;
       lookup_count = G_N_ELEMENTS (lookup_indexes);
       hb_ot_layout_feature_get_lookup_indexes (info->hb_face,
 					       HB_OT_TAG_GSUB,
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 1565e64..e17bcbe 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -985,7 +985,6 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer,
   int i;
 
   x += (width - width_units * unit_width) / 2;
-  width = width_units * unit_width;
 
   if (renderer->matrix)
     matrix = renderer->matrix;
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 8dc8df0..2d5ee7fb 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -378,7 +378,7 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
   cairo_scaled_font_t *scaled_font, *scaled_mini_font;
   PangoMatrix pango_ctm;
   cairo_matrix_t cairo_ctm;
-  PangoGravity gravity;
+  /*PangoGravity gravity;*/
 
   if (!cf_priv)
     return NULL;
@@ -395,7 +395,7 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
   font_options = cairo_font_options_create ();
   desc = pango_font_describe_with_absolute_size ((PangoFont *)cf_priv->cfont);
   size = pango_font_description_get_size (desc) / (1.*PANGO_SCALE);
-  gravity = pango_font_description_get_gravity (desc);
+  /*gravity = pango_font_description_get_gravity (desc);*/
 
   cairo_scaled_font_get_ctm (scaled_font, &cairo_ctm);
   cairo_scaled_font_get_font_options (scaled_font, font_options);
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 2706fd2..f91c85f 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -573,7 +573,6 @@ draw_error_underline (cairo_t *cr,
   int i;
 
   x += (width - width_units * unit_width) / 2;
-  width = width_units * unit_width;
 
   y_top = y;
   y_bottom = y + height;
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 2348968..e4641f5 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -956,7 +956,7 @@ pango_fc_fontset_get_font (PangoFontset  *fontset,
   unsigned int i;
 
   for (i = 0;
-       (font = pango_fc_fontset_get_font_at (fcfontset, i));
+       pango_fc_fontset_get_font_at (fcfontset, i);
        i++)
     {
       coverage = g_ptr_array_index (fcfontset->coverages, i);
@@ -1827,7 +1827,6 @@ PangoFcCmapCache *
 _pango_fc_font_map_get_cmap_cache (PangoFcFontMap *fcfontmap,
 				   PangoFcFont    *fcfont)
 {
-  PangoFcFontMapPrivate *priv;
   PangoFcFontFaceData *data;
 
   if (G_UNLIKELY (fcfontmap == NULL))
@@ -1836,8 +1835,6 @@ _pango_fc_font_map_get_cmap_cache (PangoFcFontMap *fcfontmap,
   if (G_UNLIKELY (!fcfont->font_pattern))
     return NULL;
 
-  priv = fcfontmap->priv;
-
   data = pango_fc_font_map_get_font_face_data (fcfontmap, fcfont->font_pattern);
   if (G_UNLIKELY (!data))
     return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]