Bug 652841 - Various pieces of dead code found by gcc/clang static analyzer
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 17 Jun 2011 21:08:35 +0000 (17:08 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 17 Jun 2011 21:08:35 +0000 (17:08 -0400)
examples/cairoshape.c
modules/indic/indic-ot.c
pango-view/viewer-pangoft2.c
pango/opentype/hb-common.h
pango/pango-gravity.c
pango/pango-layout.c
pango/pango-ot-info.c
pango/pango-renderer.c
pango/pangocairo-font.c
pango/pangocairo-render.c
pango/pangofc-fontmap.c

index f668e92..d288db1 100644 (file)
@@ -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':
index 7a72d34..60f253b 100644 (file)
@@ -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]);
index 2699b74..87973c8 100644 (file)
@@ -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 = {
index a6be6ba..15396ab 100644 (file)
@@ -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
 
index 7553a07..603c377 100644 (file)
@@ -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);
 }
index 40f92fa..e6ed96e 100644 (file)
@@ -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);
index be7d53a..7bc249b 100644 (file)
@@ -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,
index 1565e64..e17bcbe 100644 (file)
@@ -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;
index 8dc8df0..2d5ee7f 100644 (file)
@@ -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);
index 2706fd2..f91c85f 100644 (file)
@@ -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;
index 2348968..e4641f5 100644 (file)
@@ -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;