[genius] Tue Oct 01 18:16:21 2013 Jiri (George) Lebl <jirka 5z com>



commit b8a75f2730669219934dfb87dc4f7901d8207970
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Tue Oct 1 18:16:25 2013 -0500

    Tue Oct 01 18:16:21 2013  Jiri (George) Lebl <jirka 5z com>
    
        * gtkextra/*.c: fix some more warnings include a leak

 ChangeLog                  |    4 ++++
 gtkextra/gtkplot.c         |    8 ++------
 gtkextra/gtkplot3d.c       |   12 ------------
 gtkextra/gtkplotcanvas.c   |    6 ------
 gtkextra/gtkplotcsurface.c |   40 +++++++---------------------------------
 gtkextra/gtkplotdata.c     |   30 +++++-------------------------
 6 files changed, 18 insertions(+), 82 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 93852cc..27995ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Oct 01 18:16:21 2013  Jiri (George) Lebl <jirka 5z com>
+
+       * gtkextra/*.c: fix some more warnings include a leak
+
 Tue Oct 01 18:02:13 2013  Jiri (George) Lebl <jirka 5z com>
 
        * src/eval.c, src/mpwrap.[ch]: fix subtle copy on write error with
diff --git a/gtkextra/gtkplot.c b/gtkextra/gtkplot.c
index 7e10505..5e3d5f7 100644
--- a/gtkextra/gtkplot.c
+++ b/gtkextra/gtkplot.c
@@ -3154,7 +3154,6 @@ gtk_plot_draw_grids(GtkPlot *plot)
 static void
 gtk_plot_draw_axis(GtkPlot *plot, GtkPlotAxis *axis, GtkPlotVector tick_direction)
 {
-  GtkWidget *widget;
   gdouble x_tick;
   gint ntick;
   gdouble m = plot->magnification;
@@ -3162,8 +3161,6 @@ gtk_plot_draw_axis(GtkPlot *plot, GtkPlotAxis *axis, GtkPlotVector tick_directio
   gdouble px, py;
   gdouble xx, yy;
 
-  widget = GTK_WIDGET(plot); 
-
   gtk_plot_get_pixel(plot, axis->origin.x, axis->origin.y, &x1, &y1);
 
   if(axis->ticks.apply_break){
@@ -3879,7 +3876,6 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
   gint x, y, y0;
   GList *family;
   gint numf;
-  gchar num[4];
   const gchar *aux = text;
   const gchar *lastchar = text;
   const gchar *wtext = text;
@@ -4074,7 +4070,7 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
            xaux = aux + 1;
            for (i=0; i<3; i++){
             if (xaux[i] >= '0' && xaux[i] <= '9')
-              num[i] = xaux[i];
+              ; //num[i] = xaux[i];
             else
               break;
            }
@@ -4082,7 +4078,7 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
               aux++;
               break;
            }
-           num[3] = '\0';
+           //num[3] = '\0';
            /* insert_char = (gchar)atoi(num); */
            /* \xNNN is always outputted with latin fonts. */
            pango_layout_set_font_description(layout, font);
diff --git a/gtkextra/gtkplot3d.c b/gtkextra/gtkplot3d.c
index 3291781..5530189 100644
--- a/gtkextra/gtkplot3d.c
+++ b/gtkextra/gtkplot3d.c
@@ -1873,16 +1873,12 @@ gtk_plot3d_draw_grids(GtkPlot3D *plot, GtkPlotAxis *axis, GtkPlotVector delta)
   gdouble xx;
   GtkPlotLine major_grid, minor_grid;
   gdouble x1, x2, y1, y2;
-  gint width, height;
   gdouble oz;
   gint ntick;
 
   /* no values! */
   if (axis->ticks.values == NULL) return;
 
-  width = GTK_PLOT(plot)->internal_allocation.width;
-  height = GTK_PLOT(plot)->internal_allocation.height;
-
   major_grid = GTK_PLOT(plot)->left->major_grid;
   minor_grid = GTK_PLOT(plot)->left->minor_grid;
   switch(axis->orientation){
@@ -1958,7 +1954,6 @@ gtk_plot3d_draw_axis(GtkPlot3D *plot,
   GtkPlotPC *pc;
   gdouble xx;
   gint line_width;
-  gint width, height;
   gint ntick;
   gdouble m;
   gdouble oz;
@@ -1970,9 +1965,6 @@ gtk_plot3d_draw_axis(GtkPlot3D *plot,
 
   pc = GTK_PLOT(plot)->pc;
 
-  width = GTK_PLOT(plot)->internal_allocation.width;
-  height = GTK_PLOT(plot)->internal_allocation.height;
-
   m = GTK_PLOT(plot)->magnification;
 
   line_width = plot->frame.line_width;
@@ -2040,7 +2032,6 @@ gtk_plot3d_draw_labels(GtkPlot3D *plot,
   gdouble tick_value;
   gdouble xx;
   gint text_height, text_width, ascent, descent;
-  gint width, height;
   gint ntick;
   gdouble m;
   gdouble ox, oy, oz;
@@ -2053,9 +2044,6 @@ gtk_plot3d_draw_labels(GtkPlot3D *plot,
   widget = GTK_WIDGET(plot); 
   pc = GTK_PLOT(plot)->pc;
 
-  width = GTK_PLOT(plot)->internal_allocation.width;
-  height = GTK_PLOT(plot)->internal_allocation.height;
-
   m = GTK_PLOT(plot)->magnification;
 
   gtk_plot_pc_set_color (pc, &axis->labels_attr.fg);
diff --git a/gtkextra/gtkplotcanvas.c b/gtkextra/gtkplotcanvas.c
index 86016ae..1ab387e 100644
--- a/gtkextra/gtkplotcanvas.c
+++ b/gtkextra/gtkplotcanvas.c
@@ -494,14 +494,12 @@ gtk_plot_canvas_class_init (GtkPlotCanvasClass *klass)
 {
   GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
-  GtkContainerClass *container_class;
   GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
   parent_class = g_type_class_ref (gtk_fixed_get_type ());
 
   object_class = (GtkObjectClass *) klass;
   widget_class = (GtkWidgetClass *) klass;
-  container_class = (GtkContainerClass *) klass;
 
   
   /**
@@ -1456,17 +1454,13 @@ gtk_plot_canvas_button_press(GtkWidget *widget, GdkEventButton *event)
   GdkModifierType mods;
   gint x = 0, y = 0;
   gboolean veto;
-  gboolean double_click = FALSE;
-  gdouble m;
   gboolean new_item = FALSE;
   GtkPlotCanvasPos pos = GTK_PLOT_CANVAS_OUT;
 
   gdk_window_get_pointer(gtk_widget_get_window(widget), NULL, NULL, &mods);
   if(!(mods & GDK_BUTTON1_MASK)) return FALSE;
-  double_click = (event->button == GDK_2BUTTON_PRESS);
  
   canvas = GTK_PLOT_CANVAS(widget);
-  m = canvas->magnification;
 
 /*
   if(double_click && canvas->state == GTK_STATE_SELECTED) return TRUE;
diff --git a/gtkextra/gtkplotcsurface.c b/gtkextra/gtkplotcsurface.c
index 534f2b3..216fe64 100644
--- a/gtkextra/gtkplotcsurface.c
+++ b/gtkextra/gtkplotcsurface.c
@@ -146,7 +146,6 @@ static void
 gtk_plot_csurface_class_init (GtkPlotCSurfaceClass *klass)
 {
   GtkObjectClass *object_class;
-  GtkWidgetClass *widget_class;
   GtkPlotDataClass *data_class;
   GtkPlotSurfaceClass *surface_class;
   GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
@@ -154,7 +153,6 @@ gtk_plot_csurface_class_init (GtkPlotCSurfaceClass *klass)
   parent_class = g_type_class_ref (gtk_plot_surface_get_type ());
 
   object_class = (GtkObjectClass *) klass;
-  widget_class = (GtkWidgetClass *) klass;
   data_class = (GtkPlotDataClass *) klass;
   surface_class = (GtkPlotSurfaceClass *) klass;
 
@@ -372,13 +370,11 @@ static void
 gtk_plot_csurface_init (GtkPlotCSurface *dataset)
 {
   GtkWidget *widget;
-  GdkColormap *colormap;
   GtkPlotArray *dim;
 
   gtk_widget_set_has_window(GTK_WIDGET(dataset), FALSE);
 
   widget = GTK_WIDGET(dataset);
-  colormap = gtk_widget_get_colormap(widget);
 
   GTK_PLOT_DATA(dataset)->show_gradient = TRUE;
   GTK_PLOT_DATA(dataset)->show_labels = TRUE;
@@ -470,12 +466,10 @@ static void
 gtk_plot_csurface_draw_private         (GtkPlotData *data)
 {
   GtkPlot *plot;
-  GtkPlotSurface *surface;
   GtkPlotCSurface *csurface;
 
   if(!gtk_widget_get_visible(GTK_WIDGET(data))) return;
 
-  surface = GTK_PLOT_SURFACE(data);
   csurface = GTK_PLOT_CSURFACE(data);
   plot = data->plot;
 
@@ -649,9 +643,9 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
 {
   GtkPlotCSurface *csurface = GTK_PLOT_CSURFACE(data);
   GtkPlot *plot = GTK_PLOT(data->plot);
-  GtkPlotPoint *contour = NULL, *inner_contour = NULL;
+  GtkPlotPoint *contour = NULL;
   GdkColor color;
-  gboolean closed;
+  //gboolean closed;
   gint n1;
   GList *list, *lines = NULL;
   GtkPlotContourLine *branch = NULL;
@@ -714,7 +708,6 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
       if(nlines == 0){ polygons = last; continue; }
 
       contour = g_new0(GtkPlotPoint, ntotal); 
-      inner_contour = g_new0(GtkPlotPoint, ntotal); 
 
       /* Actual contour line */
       for(aux = polygons, n = 0, i = 0; n < nlines; aux = aux->next, n++, i+=2){
@@ -728,9 +721,9 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
    
       sort_lines(contour, nlines, &n1);
    
-      closed = FALSE;
+      /*closed = FALSE;
       if(contour[n1-1].x == contour[0].x && contour[n1-1].y == contour[0].y)
-        closed = TRUE; 
+        closed = TRUE; */
 
       branch = g_new0(GtkPlotContourLine, 1);
       branch->contour = contour;
@@ -855,7 +848,6 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
       gint i, n = 0, x = 0;
       GtkAllocation *aux_bb = NULL;
       GtkPlotPoint *line = NULL;
-      gboolean prev_x = 0;
 
       if(!line)
              line = (GtkPlotPoint *) g_new0(GtkPlotPoint,s->n1 +1); /* Tiny C Compiler support */
@@ -890,7 +882,6 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
         while(aux){
           gdouble t1 = 0., t2 = 0.;
           aux_bb = (GtkAllocation *)aux->data;
-          prev_x = x;
           x = line_intersect(aux_bb,p1,p2,&x1,&x2,&t1,&t2);
           if(x == 3) break;
           if(x != 0 && x != 3){
@@ -993,7 +984,6 @@ gtk_plot_csurface_real_draw_polygons (GtkPlotSurface *surface, GtkPlotProjection
   GtkPlot3D *plot3d;
   GtkPlotData *data;
   GtkPlotCSurface *csurface;
-  GdkDrawable *drawable;
   GtkPlotPoint t[4];
   GtkPlotDTtriangle *triangle;
   GtkPlotVector points[3], side[3], light, normal;
@@ -1006,7 +996,6 @@ gtk_plot_csurface_real_draw_polygons (GtkPlotSurface *surface, GtkPlotProjection
   data = GTK_PLOT_DATA(surface);
   plot = GTK_PLOT(data->plot);
   plot3d = GTK_PLOT3D(data->plot);
-  drawable = plot->drawable;
 
   list = surface->polygons;
   while(list){
@@ -1300,7 +1289,7 @@ gtk_plot_csurface_build_polygons(GtkPlotSurface *surface)
 {
   GList *list;
   GtkPlotData *data = GTK_PLOT_DATA(surface);
-  gdouble min, max, step;
+  gdouble max, step;
   gint nlevels;
   gdouble h;
   gint level;
@@ -1314,7 +1303,6 @@ gtk_plot_csurface_build_polygons(GtkPlotSurface *surface)
     return;
   }
 
-  min = data->gradient->ticks.min;
   max = data->gradient->ticks.max;
 
   ticks = data->gradient->ticks.values;
@@ -1404,18 +1392,14 @@ gtk_plot_csurface_build_contours(GtkPlotSurface *surface)
   GtkPlotData *data = GTK_PLOT_DATA(surface);
   GtkPlotCSurface *csurface = GTK_PLOT_CSURFACE(surface);
   GtkPlotPolygon *polygon = NULL, *prev = NULL;
-  gdouble min, max, step;
-  gint nlevels, nsublevels;
+  gdouble step;
+  gint nlevels;
   gdouble h = 0;
   gint level;
   gint nlines;
   GtkPlotTick *values;
 
-  min = data->gradient->ticks.min;
-  max = data->gradient->ticks.max;
-
   nlevels = data->gradient->ticks.nticks;
-  nsublevels = data->gradient->ticks.nminor;
   step = (data->gradient->ticks.max - data->gradient->ticks.min) ;
 
   values = data->gradient->ticks.values;
@@ -1620,16 +1604,11 @@ clear_polygons(GtkPlotCSurface *csurface)
 static void
 gtk_plot_csurface_get_legend_size(GtkPlotData *data, gint *width, gint *height)
 {
-  GtkPlotSurface *surface;
-  GtkPlotCSurface *csurface;
   GtkPlot *plot = NULL;
   GtkPlotText legend;
   gint lascent = 0, ldescent = 0, lheight = 0, lwidth = 0;
   gdouble m;
 
-  surface = GTK_PLOT_SURFACE(data);
-  csurface = GTK_PLOT_CSURFACE(data);
-
   g_return_if_fail(data->plot != NULL);
   g_return_if_fail(GTK_IS_PLOT(data->plot));
 
@@ -1660,8 +1639,6 @@ gtk_plot_csurface_get_legend_size(GtkPlotData *data, gint *width, gint *height)
 static void
 gtk_plot_csurface_draw_legend(GtkPlotData *data, gint x, gint y)
 {
-  GtkPlotSurface *surface;
-  GtkPlotCSurface *csurface;
   GtkPlot *plot = NULL;
   GtkPlotText legend;
   GdkRectangle area;
@@ -1669,9 +1646,6 @@ gtk_plot_csurface_draw_legend(GtkPlotData *data, gint x, gint y)
   gdouble m;
   GtkAllocation allocation;
 
-  surface = GTK_PLOT_SURFACE(data);
-  csurface = GTK_PLOT_CSURFACE(data);
-
   g_return_if_fail(data->plot != NULL);
   g_return_if_fail(GTK_IS_PLOT(data->plot));
 
diff --git a/gtkextra/gtkplotdata.c b/gtkextra/gtkplotdata.c
index fed9c49..9b28d9c 100644
--- a/gtkextra/gtkplotdata.c
+++ b/gtkextra/gtkplotdata.c
@@ -305,14 +305,12 @@ static void
 gtk_plot_data_class_init (GtkPlotDataClass *klass)
 {
   GtkObjectClass *object_class;
-  GtkWidgetClass *widget_class;
   GtkPlotDataClass *data_class;
   GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
   parent_class = g_type_class_ref (gtk_widget_get_type ());
 
   object_class = (GtkObjectClass *) klass;
-  widget_class = (GtkWidgetClass *) klass;
   data_class = (GtkPlotDataClass *) klass;
 
   object_class->destroy = gtk_plot_data_destroy;
@@ -2495,8 +2493,7 @@ gtk_plot_data_real_draw   (GtkPlotData *dataset,
   GtkWidget *widget;
   GtkPlot *plot = NULL;
   GtkPlotData *function;
-  GdkColormap *colormap;
-  GdkRectangle area, clip_area;
+  GdkRectangle area;
   gdouble x, y, z = 0., a = 0.;
   gdouble dx = 0., dy = 0., dz = 0., da = 0.;
   gdouble *fx = NULL;
@@ -2509,7 +2506,6 @@ gtk_plot_data_real_draw   (GtkPlotData *dataset,
   gdouble *fda = NULL;
   gchar **fl = NULL;
   gboolean error;
-  gdouble m;
   GtkAllocation allocation;
 
   g_return_if_fail(GTK_IS_PLOT_DATA(dataset));
@@ -2519,23 +2515,15 @@ gtk_plot_data_real_draw   (GtkPlotData *dataset,
 
   plot = dataset->plot;
   widget = GTK_WIDGET(plot);
-  colormap = gdk_colormap_get_system();
 
   gtk_plot_pc_gsave(plot->pc);
 
-  m = plot->magnification;
-
   gtk_widget_get_allocation(widget, &allocation);
   area.x = allocation.x;
   area.y = allocation.y;
   area.width = allocation.width;
   area.height = allocation.height;
 
-  clip_area.x = area.x + roundint(plot->x * area.width);
-  clip_area.y = area.y + roundint(plot->y * area.height);
-  clip_area.width = roundint(plot->width * area.width);
-  clip_area.height = roundint(plot->height * area.height);
-
   if(dataset->is_function)
     {
        gdouble xmin, xmax, px, py;
@@ -2671,7 +2659,6 @@ gtk_plot_data_real_real_draw   (GtkPlotData *dataset,
   GtkWidget *widget;
   GtkPlot *plot = NULL;
   GdkRectangle area;
-  GdkColormap *colormap;
   gdouble *array_x = NULL, *array_y = NULL, *array_z = NULL, *array_a = NULL;
   gdouble *array_dx = NULL, *array_dy = NULL, *array_dz = NULL, *array_da = NULL;
   GtkPlotArray *y_array;
@@ -2690,7 +2677,6 @@ gtk_plot_data_real_real_draw   (GtkPlotData *dataset,
 
   plot = dataset->plot;
   widget = GTK_WIDGET(plot);
-  colormap = gdk_colormap_get_system();
 
   gtk_widget_get_allocation(widget, &allocation);
   area.x = allocation.x;
@@ -3100,18 +3086,15 @@ draw_gradient_vertical(GtkPlotData *data, gdouble px, gdouble py)
     ry = y;
     gint ncolors = 0;
     for(level = nlevels-1; level >= 0; level--){
-      gdouble val, h;
-      gboolean sublevel = FALSE;
+/*     
+      gdouble val;
 
       val = data->gradient->ticks.values[level].value;
-      sublevel = data->gradient->ticks.values[level].minor;
 
-/*     
       if(val <= data->gradient->ticks.min || val > data->gradient->ticks.max) continue;
 */
 
       if(level != 0){
-        h = val;
         color = data->gradient_colors[level-1];
 
         gtk_plot_pc_set_color(plot->pc, &color);
@@ -3447,18 +3430,15 @@ draw_gradient_horizontal(GtkPlotData *data, gdouble px, gdouble py)
     rx = x;
     ncolors = 0;
     for(level = 0; level < nlevels; level++){
-      gdouble val, h;
-      gboolean sublevel = FALSE;
+/*
+      gdouble val;
 
       val = data->gradient->ticks.values[level].value;
-      sublevel = data->gradient->ticks.values[level].minor;
 
-/*
       if(val <= data->gradient->ticks.min || val > data->gradient->ticks.max) continue;
 */
 
       if(level != 0){
-        h = val;
         color = data->gradient_colors[level-1];
 
         gtk_plot_pc_set_color(plot->pc, &color);


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