[dia] [warningectomy] sprinkle G_GNUC_UNUSED



commit 0bde5568ea728709d43b0d845ca9bff8d4abd1f7
Author: Hans Breuer <hans breuer org>
Date:   Fri Aug 6 15:18:36 2010 +0200

    [warningectomy] sprinkle G_GNUC_UNUSED
    
    A bunch less warnings by deleting unused variables or marking
    variables or functions as unused.
    
    geometry.c:525: warning: 'determinate' defined but not used
    prop_sdarray.c: In function 'darray_prop_edit':
    prop_sdarray.c:247: warning: unused variable 'prop'
    diacellrendererproperty.c:203: warning: unused variable 'cellproperty'
    class.c: In function 'umlclass_allow_resizing_callback':
    class.c:384: warning: statement with no effect
    class.c:385: warning: statement with no effect
    class.c: In function 'umlclass_draw_operationbox':
    class.c:972: warning: unused variable 'wrapping_needed'
    class.c: In function 'umlclass_calculate_data':
    class.c:1685: warning: unused variable 'min_box_width'
    diacairo-renderer.c: In function '_ellipse':
    diacairo-renderer.c:579: warning: unused variable 'co'
      (also removing a bbunch of obsolete code)
    diacairo-print.c:35: warning: 'count_objs' defined but not used
    diapsft2renderer.c: In function 'draw_string':
    diapsft2renderer.c:345: warning: unused variable 'width'
    pydia-property.c: In function 'PyDia_set_Arrow':
    pydia-property.c:264: warning: unused variable 'i'
    render_libart.c: In function 'new_libart_renderer':
    render_libart.c:86: warning: unused variable 'renderer_type'
    dia-render-script-import.c:38: warning: '_parse_real' defined but not
    used
    dia-render-script-import.c:49: warning: '_parse_point' defined but not
    used
    dia-render-script-import.c:65: warning: '_parse_points' defined but not
    used
    dia-render-script-import.c:90: warning: '_parse_bezpoints' defined but
    not used
    dia-render-script-import.c:121: warning: '_parse_color' defined but not
    used
    commands.c: In function 'dialogs_properties_callback':
    commands.c:1131: warning: unused variable 'selected'
    diagram_tree_view.c: In function '_dtv_locate_item':
    diagram_tree_view.c:363: warning: unused variable 'layer'
    dia-application.c: In function 'dia_application_class_init':
    dia-application.c:61: warning: unused variable 'object_class'
    test-boundingbox.c: In function 'main':
    test-boundingbox.c:131: warning: unused variable 'plugins'

 app/commands.c                          |    1 -
 app/dia-application.c                   |    2 +-
 app/diagram_tree_view.c                 |    1 -
 lib/diacellrendererproperty.c           |    2 +-
 lib/geometry.c                          |    2 +-
 lib/prop_sdarray.c                      |    2 +-
 objects/UML/class.c                     |   10 ++++------
 plug-ins/cairo/diacairo-print.c         |    2 +-
 plug-ins/cairo/diacairo-renderer.c      |   18 ------------------
 plug-ins/drs/dia-render-script-import.c |   10 +++++-----
 plug-ins/libart/render_libart.c         |    1 -
 plug-ins/postscript/diapsft2renderer.c  |    1 -
 plug-ins/python/pydia-property.c        |    2 +-
 tests/test-boundingbox.c                |    1 -
 14 files changed, 15 insertions(+), 40 deletions(-)
---
diff --git a/app/commands.c b/app/commands.c
index be5cde4..17b20e9 100644
--- a/app/commands.c
+++ b/app/commands.c
@@ -1128,7 +1128,6 @@ void
 dialogs_properties_callback (GtkAction *action)
 {
   Diagram *dia;
-  DiaObject *selected;
 
   dia = ddisplay_active_diagram();
   if (!dia || textedit_mode(ddisplay_active())) return;
diff --git a/app/dia-application.c b/app/dia-application.c
index dc88f79..cc9e422 100644
--- a/app/dia-application.c
+++ b/app/dia-application.c
@@ -58,7 +58,7 @@ G_DEFINE_TYPE (DiaApplication, dia_application, G_TYPE_OBJECT);
 static void
 dia_application_class_init (DiaApplicationClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  G_GNUC_UNUSED GObjectClass *object_class = G_OBJECT_CLASS (klass);
   
   _dia_application_signals[DIAGRAM_ADD] =
     g_signal_new ("diagram_add",
diff --git a/app/diagram_tree_view.c b/app/diagram_tree_view.c
index 6ec4091..34fdcfc 100644
--- a/app/diagram_tree_view.c
+++ b/app/diagram_tree_view.c
@@ -360,7 +360,6 @@ _dtv_locate_item (GtkAction *action,
 
     if (gtk_tree_model_get_iter (model, &iter, r->data)) {
       Diagram   *diagram;
-      Layer     *layer;
       DiaObject *object;
 
       gtk_tree_model_get (model, &iter, DIAGRAM_COLUMN, &diagram, -1);
diff --git a/lib/diacellrendererproperty.c b/lib/diacellrendererproperty.c
index 2b72e3f..512cb55 100644
--- a/lib/diacellrendererproperty.c
+++ b/lib/diacellrendererproperty.c
@@ -200,7 +200,7 @@ dia_cell_renderer_property_get_size (GtkCellRenderer *cell,
                                       gint            *width,
                                       gint            *height)
 {
-  DiaCellRendererProperty *cellproperty;
+  G_GNUC_UNUSED DiaCellRendererProperty *cellproperty;
   gint                      view_width  = 0;
   gint                      view_height = 0;
   gint                      calc_width;
diff --git a/lib/geometry.c b/lib/geometry.c
index 8e4b782..290b63c 100644
--- a/lib/geometry.c
+++ b/lib/geometry.c
@@ -520,7 +520,7 @@ yshear_matrix (Matrix m, real shear)
 }
 
 /*  find the determinate for a 3x3 matrix  */
-static real
+G_GNUC_UNUSED static real
 determinate (Matrix m)
 {
   int i;
diff --git a/lib/prop_sdarray.c b/lib/prop_sdarray.c
index 0640009..9ac924a 100644
--- a/lib/prop_sdarray.c
+++ b/lib/prop_sdarray.c
@@ -244,7 +244,7 @@ darrayprop_set_from_offset(ArrayProperty *prop,
 static void
 darray_prop_edit (GtkWidget *widget, gpointer data)
 {
-  ArrayProperty *prop = data;
+  ArrayProperty *prop G_GNUC_UNUSED = data;
   
 }
 
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 2be337e..b8f998c 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -379,11 +379,10 @@ umlclass_show_comments_callback(DiaObject *obj, Point *pos, gpointer data)
 }
 
 static ObjectChange *
-umlclass_allow_resizing_callback(DiaObject *obj, Point *pos, gpointer data)
+umlclass_allow_resizing_callback(DiaObject *obj, 
+                                 Point *pos G_GNUC_UNUSED, 
+                                 gpointer data G_GNUC_UNUSED)
 {
-  pos; /* unused */
-  data; /* unused */
-
   return object_toggle_prop(obj, "allow_resizing", !((UMLClass *)obj)->allow_resizing); 
 }
 
@@ -969,7 +968,7 @@ umlclass_draw_operationbox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
     gint i = 0;
     GList *wrapsublist = NULL;
     gchar *part_opstr = NULL;
-    int wrap_pos, last_wrap_pos, ident, wrapping_needed;
+    int wrap_pos, last_wrap_pos, ident;
     int part_opstr_len = 0, part_opstr_need = 0;
 
     StartPoint.x += (umlclass->line_width/2.0 + 0.1);
@@ -1682,7 +1681,6 @@ umlclass_calculate_data(UMLClass *umlclass)
   real   maxwidth = 0.0;
   real   width;
   GList *list;
-  real   min_box_width;
 
   if (!umlclass->destroyed)
   {
diff --git a/plug-ins/cairo/diacairo-print.c b/plug-ins/cairo/diacairo-print.c
index b742024..4b4a130 100644
--- a/plug-ins/cairo/diacairo-print.c
+++ b/plug-ins/cairo/diacairo-print.c
@@ -30,7 +30,7 @@ typedef struct _PrintData
   DiaRenderer *renderer;
 } PrintData;
 
-static void
+G_GNUC_UNUSED static void
 count_objs(DiaObject *obj, DiaRenderer *renderer, int active_layer, guint *nobjs)
 {
   (*nobjs)++;
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index a380b06..1d8b7df 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -576,14 +576,12 @@ _ellipse(DiaRenderer *self,
          gboolean fill)
 {
   DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
-  double co;
 
   DIAG_NOTE(g_message("%s_ellipse %fx%f center @ %f,%f", 
             fill ? "fill" : "draw", width, height, center->x, center->y));
 
   cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);
   
-#if 1
   cairo_save (renderer->cr);
   /* don't create a line from the current point to the beginning 
    * of the ellipse */
@@ -593,22 +591,6 @@ _ellipse(DiaRenderer *self,
   cairo_scale (renderer->cr, width / 2., height / 2.);
   cairo_arc (renderer->cr, 0., 0., 1., 0., 2 * G_PI);
   cairo_restore (renderer->cr);
-#else
-  /* FIXME: how to make a perfect ellipse from a bezier ? */
-  co = sqrt(pow(width,2)/4 + pow(height,2)/4);
-
-  cairo_new_path (renderer->cr);
-  cairo_move_to (renderer->cr,
-                 center->x, center->y - height/2);
-  cairo_curve_to (renderer->cr,
-                  center->x + co, center->y - height/2,
-                  center->x + co, center->y + height/2,
-                  center->x, center->y + height/2);
-  cairo_curve_to (renderer->cr,
-                  center->x - co, center->y + height/2,
-                  center->x - co, center->y - height/2,
-                  center->x, center->y - height/2);
-#endif
 
   if (fill)
     cairo_fill (renderer->cr);
diff --git a/plug-ins/drs/dia-render-script-import.c b/plug-ins/drs/dia-render-script-import.c
index 1e7b7ff..3202a63 100644
--- a/plug-ins/drs/dia-render-script-import.c
+++ b/plug-ins/drs/dia-render-script-import.c
@@ -33,7 +33,7 @@
 
 #include "dia-render-script.h"
 
-static real
+G_GNUC_UNUSED static real
 _parse_real (xmlNodePtr node, const char *attrib)
 {
   xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
@@ -44,7 +44,7 @@ _parse_real (xmlNodePtr node, const char *attrib)
   }
   return val;
 }
-static Point *
+G_GNUC_UNUSED static Point *
 _parse_point (xmlNodePtr node, const char *attrib)
 {
   xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
@@ -60,7 +60,7 @@ _parse_point (xmlNodePtr node, const char *attrib)
   }
   return pt;
 }
-static GArray *
+G_GNUC_UNUSED static GArray *
 _parse_points (xmlNodePtr node, const char *attrib)
 {
   xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
@@ -85,7 +85,7 @@ _parse_points (xmlNodePtr node, const char *attrib)
   }
   return arr;
 }
-static GArray *
+G_GNUC_UNUSED static GArray *
 _parse_bezpoints (xmlNodePtr node, const char *attrib)
 {
   xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
@@ -116,7 +116,7 @@ _parse_bezpoints (xmlNodePtr node, const char *attrib)
   }
   return arr;
 }
-static Color *
+G_GNUC_UNUSED static Color *
 _parse_color (xmlNodePtr node, const char *attrib)
 {
   xmlChar *str = xmlGetProp(node, (const xmlChar *)attrib);
diff --git a/plug-ins/libart/render_libart.c b/plug-ins/libart/render_libart.c
index bcf7c3c..8a3be2e 100644
--- a/plug-ins/libart/render_libart.c
+++ b/plug-ins/libart/render_libart.c
@@ -83,7 +83,6 @@ DiaRenderer *
 new_libart_renderer(DiaTransform *trans, int interactive)
 {
   DiaLibartRenderer *renderer;
-  GType renderer_type = 0;
 
   renderer = g_object_new(DIA_TYPE_LIBART_RENDERER, NULL);
   renderer->transform = trans;
diff --git a/plug-ins/postscript/diapsft2renderer.c b/plug-ins/postscript/diapsft2renderer.c
index 997d518..f92a2ba 100644
--- a/plug-ins/postscript/diapsft2renderer.c
+++ b/plug-ins/postscript/diapsft2renderer.c
@@ -342,7 +342,6 @@ draw_string(DiaRenderer *self,
   DiaPsFt2Renderer *renderer = DIA_PS_FT2_RENDERER(self);
   TextLine *text_line = text_line_new(text, renderer->current_font,
 				      renderer->current_height);
-  real width = text_line_get_width(text_line);
   draw_text_line(self, text_line, pos, alignment, color);
   text_line_destroy(text_line);
 }
diff --git a/plug-ins/python/pydia-property.c b/plug-ins/python/pydia-property.c
index 7568746..c75e9b1 100644
--- a/plug-ins/python/pydia-property.c
+++ b/plug-ins/python/pydia-property.c
@@ -261,7 +261,7 @@ PyDia_set_Arrow (Property *prop, PyObject *val)
     p->arrow_data = ((PyDiaArrow *)val)->arrow;
     return 0;
   } else if (PyTuple_Check (val)) {
-    int i, len = PyTuple_Size(val);
+    int len = PyTuple_Size(val);
     PyObject *o;
     if (len < 3)
       return -1;
diff --git a/tests/test-boundingbox.c b/tests/test-boundingbox.c
index 7adaab5..4d693e0 100644
--- a/tests/test-boundingbox.c
+++ b/tests/test-boundingbox.c
@@ -128,7 +128,6 @@ _add_bezier_tests (void)
 int
 main (int argc, char** argv)
 {
-  GList *plugins = NULL;
   int ret;
   
 #if GLIB_CHECK_VERSION(2,16,0)



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