goffice r2221 - in trunk: . goffice/app goffice/graph goffice/gtk goffice/math goffice/utils plugins/plot_distrib plugins/plot_radar plugins/plot_surface



Author: jbrefort
Date: Sat Sep 13 15:36:22 2008
New Revision: 2221
URL: http://svn.gnome.org/viewvc/goffice?rev=2221&view=rev

Log:
2008-09-13  Jean Brefort  <jean brefort normalesup org>

	* goffice/app/go-doc.c: (load_image): check attr != NULL before
	deferncing [Coverity 196].
	* goffice/graph/gog-axis-line.c:
	(gog_axis_base_view_label_position_request): initialize padding
	[Coverity 242].
	* goffice/graph/gog-legend.c: (cb_render_elements): add a test to
	hopefully fix Coverity 199.
	* goffice/graph/gog-object.c: (gog_object_dup): add a test to
	hopefully fix Coverity 72.
	* goffice/graph/gog-plot.c: (gog_plot_populate_editor): add missing
	labels [Coverity 154].
	* goffice/gtk/goffice-gtk.c: (go_gui_get_image_save_info): add a test
	to hopefully fix Coverity 71.
	* goffice/math/go-R.c: fix file name in license.
	* goffice/math/go-R.h: ditto.
	* goffice/math/go-distribution.c: ditto.
	* goffice/utils/go-pattern.c: (go_pattern_get_svg_path): don't check
	in an unsigned number is positive [Coverity 134].
	* goffice/utils/go-undo.c: (go_undo_group_undo): [Coverity 188].
	* plugins/plot_distrib/gog-boxplot.c: fix file name in license.
	* plugins/plot_distrib/gog-boxplot.h: ditto.
	* plugins/plot_distrib/gog-probability-plot.c:
	(gog_probability_plot_class_init): fix the comment for the second
	shapr property.
	* plugins/plot_radar/gog-radar.c: (gog_rt_view_render): add a few
	parenthesis in the hope to fix Coverity 73.
	* plugins/plot_surface/gog-xyz-surface.c:
	(gog_xyz_surface_plot_build_matrix): removed an invalid test [Coverity 135].



Modified:
   trunk/ChangeLog
   trunk/goffice/app/go-doc.c
   trunk/goffice/graph/gog-axis-line.c
   trunk/goffice/graph/gog-legend.c
   trunk/goffice/graph/gog-object.c
   trunk/goffice/graph/gog-plot.c
   trunk/goffice/gtk/goffice-gtk.c
   trunk/goffice/math/go-R.c
   trunk/goffice/math/go-R.h
   trunk/goffice/math/go-distribution.c
   trunk/goffice/utils/go-pattern.c
   trunk/goffice/utils/go-undo.c
   trunk/plugins/plot_distrib/gog-boxplot.c
   trunk/plugins/plot_distrib/gog-boxplot.h
   trunk/plugins/plot_distrib/gog-probability-plot.c
   trunk/plugins/plot_radar/gog-radar.c
   trunk/plugins/plot_surface/gog-xyz-surface.c

Modified: trunk/goffice/app/go-doc.c
==============================================================================
--- trunk/goffice/app/go-doc.c	(original)
+++ trunk/goffice/app/go-doc.c	Sat Sep 13 15:36:22 2008
@@ -421,10 +421,10 @@
 	GODoc *doc = GO_DOC (xin->user_state);
 	GOImage *image;
 	xmlChar const **attr = 	attrs;
-	while (*attr && strcmp (*attr, "name"))
-		attr += 2;
 	if (!*attr)
 		return;
+	while (*attr && strcmp (*attr, "name"))
+		attr += 2;
 	image = (GOImage *) g_hash_table_lookup (doc->imagebuf, attr[1]);
 	if (!image) /* this should not occur, but if it does, we might want to load the image? */
 		return;

Modified: trunk/goffice/graph/gog-axis-line.c
==============================================================================
--- trunk/goffice/graph/gog-axis-line.c	(original)
+++ trunk/goffice/graph/gog-axis-line.c	Sat Sep 13 15:36:22 2008
@@ -2196,7 +2196,7 @@
 	GogAxisSet axis_set;
 	GogAxisBase *axis_base = GOG_AXIS_BASE (view->model);
 	GogStyle *style = axis_base->base.style;
-	GogViewPadding padding;
+	GogViewPadding padding = {0};
 
 	if (gog_axis_get_atype (axis_base->axis) >= GOG_AXIS_VIRTUAL)
 		return;

Modified: trunk/goffice/graph/gog-legend.c
==============================================================================
--- trunk/goffice/graph/gog-legend.c	(original)
+++ trunk/goffice/graph/gog-legend.c	Sat Sep 13 15:36:22 2008
@@ -448,6 +448,7 @@
 
 	if (base_style->interesting_fields & GOG_STYLE_LINE) { /* line and marker */
 		style = gog_style_dup (base_style);
+		g_return_if_fail (style != NULL);
 		go_marker_set_size (style->marker.mark,
 				    go_marker_get_size (style->marker.mark) *
 				    data->swatch_scale_a + data->swatch_scale_b);

Modified: trunk/goffice/graph/gog-object.c
==============================================================================
--- trunk/goffice/graph/gog-object.c	(original)
+++ trunk/goffice/graph/gog-object.c	Sat Sep 13 15:36:22 2008
@@ -1007,6 +1007,8 @@
 	if (new_parent)
 		dst = gog_object_add_by_role (new_parent, src->role, dst);
 
+	g_return_val_if_fail (GOG_OBJECT (dst) != NULL, NULL);
+
 	dst->position = src->position;
 	/* properties */
 	props = g_object_class_list_properties (G_OBJECT_GET_CLASS (src), &n);

Modified: trunk/goffice/graph/gog-plot.c
==============================================================================
--- trunk/goffice/graph/gog-plot.c	(original)
+++ trunk/goffice/graph/gog-plot.c	Sat Sep 13 15:36:22 2008
@@ -269,14 +269,15 @@
 			  G_GNUC_UNUSED GogDataAllocator *dalloc,
 			  GOCmdContext *cc)
 {
-	static const char *axis_labels[7] = { 
+	static const char *axis_labels[GOG_AXIS_TYPES] = { 
 		N_("X axis:"), 
 		N_("Y axis:"), 
 		N_("Z axis:"), 
 		N_("Circular axis:"), 
 		N_("Radial axis:"), 
-		N_("Type axis:"), 
-		N_("Pseudo 3D axis:")
+		N_("Pseudo 3D axis:"), 
+		N_("Color axis:"), 
+		N_("Bubble axis:")
 	};
 	
 	GtkWidget *w;

Modified: trunk/goffice/gtk/goffice-gtk.c
==============================================================================
--- trunk/goffice/gtk/goffice-gtk.c	(original)
+++ trunk/goffice/gtk/goffice-gtk.c	Sat Sep 13 15:36:22 2008
@@ -730,7 +730,7 @@
 		goto loop;
 	}
  out:
-	if (uri != NULL) {
+	if (uri != NULL && ret_format != NULL) {
 		g_free (state->uri);
 		state->uri = g_strdup (uri);
 		state->format = *ret_format;

Modified: trunk/goffice/math/go-R.c
==============================================================================
--- trunk/goffice/math/go-R.c	(original)
+++ trunk/goffice/math/go-R.c	Sat Sep 13 15:36:22 2008
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * go-pnorm.h
+ * go-R.c
  *
  * Copyright (C) 2008 Jean Brefort (jean brefort normalesup org)
  *

Modified: trunk/goffice/math/go-R.h
==============================================================================
--- trunk/goffice/math/go-R.h	(original)
+++ trunk/goffice/math/go-R.h	Sat Sep 13 15:36:22 2008
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * go-pnorm.h
+ * go-R.h
  *
  * Copyright (C) 2008 Jean Brefort (jean brefort normalesup org)
  *
@@ -20,8 +20,8 @@
  * USA
  */
 
-#ifndef GO_PNORM_H
-#define GO_PNORM_H
+#ifndef GO_R_H
+#define GO_R_H
 
 double go_trunc (double);
 double go_dnorm (double x, double mu, double sigma, gboolean give_log);
@@ -57,4 +57,4 @@
 
 #endif
 
-#endif /* GO_PNORM_H */
+#endif /* GO_R_H */

Modified: trunk/goffice/math/go-distribution.c
==============================================================================
--- trunk/goffice/math/go-distribution.c	(original)
+++ trunk/goffice/math/go-distribution.c	Sat Sep 13 15:36:22 2008
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * gog-probability-plot.c
+ * go-distribution.c
  *
  * Copyright (C) 2007-2008 Jean Brefort (jean brefort normalesup org)
  *

Modified: trunk/goffice/utils/go-pattern.c
==============================================================================
--- trunk/goffice/utils/go-pattern.c	(original)
+++ trunk/goffice/utils/go-pattern.c	Sat Sep 13 15:36:22 2008
@@ -159,7 +159,7 @@
 	xmlDocPtr  doc;
 	xmlNodePtr ptr;
 
-	g_return_val_if_fail (pattern->pattern >= 0 || pattern->pattern < GO_PATTERN_MAX, NULL);
+	g_return_val_if_fail (pattern->pattern < GO_PATTERN_MAX, NULL);
 
 	path = g_build_filename (go_sys_data_dir(), "patterns", "svg-patterns.xml", NULL);
 	doc = go_xml_parse_file (path);

Modified: trunk/goffice/utils/go-undo.c
==============================================================================
--- trunk/goffice/utils/go-undo.c	(original)
+++ trunk/goffice/utils/go-undo.c	Sat Sep 13 15:36:22 2008
@@ -101,8 +101,8 @@
 	unsigned i;
 
 	for (i = ug->undos->len; i-- > 0; ) {
-		GOUndo *u = g_ptr_array_index (ug->undos, i);
-		go_undo_undo_with_data (u, data);
+		GOUndo *u_ = g_ptr_array_index (ug->undos, i);
+		go_undo_undo_with_data (u_, data);
 	}
 }
 

Modified: trunk/plugins/plot_distrib/gog-boxplot.c
==============================================================================
--- trunk/plugins/plot_distrib/gog-boxplot.c	(original)
+++ trunk/plugins/plot_distrib/gog-boxplot.c	Sat Sep 13 15:36:22 2008
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * go-boxplot.c
+ * gog-boxplot.c
  *
  * Copyright (C) 2005 Jean Brefort (jean brefort normalesup org)
  *

Modified: trunk/plugins/plot_distrib/gog-boxplot.h
==============================================================================
--- trunk/plugins/plot_distrib/gog-boxplot.h	(original)
+++ trunk/plugins/plot_distrib/gog-boxplot.h	Sat Sep 13 15:36:22 2008
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * go-boxplot.h
+ * gog-boxplot.h
  *
  * Copyright (C) 2005 Jean Brefort (jean brefort normalesup org)
  *

Modified: trunk/plugins/plot_distrib/gog-probability-plot.c
==============================================================================
--- trunk/plugins/plot_distrib/gog-probability-plot.c	(original)
+++ trunk/plugins/plot_distrib/gog-probability-plot.c	Sat Sep 13 15:36:22 2008
@@ -246,7 +246,7 @@
 	g_object_class_install_property (gobject_klass, PROBABILITY_PLOT_PROP_SHAPE_PARAM2,
 		g_param_spec_string ("param2", 
 			_("Second shape parameter"),
-			_("Name of the first shape parameter if any"),
+			_("Name of the second shape parameter if any"),
 			"none", 
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 

Modified: trunk/plugins/plot_radar/gog-radar.c
==============================================================================
--- trunk/plugins/plot_radar/gog-radar.c	(original)
+++ trunk/plugins/plot_radar/gog-radar.c	Sat Sep 13 15:36:22 2008
@@ -556,7 +556,7 @@
 				gog_styled_object_get_style (GOG_STYLED_OBJECT (series->radial_drop_lines)));
 			drop_path = go_path_new ();
 			for (i = 0; i < series->base.num_elements; i++) {
-				gog_chart_map_2D_to_view (chart_map, c_vals != NULL ? c_vals[i] : i+1,
+				gog_chart_map_2D_to_view (chart_map, ((c_vals != NULL) ? c_vals[i] : i+1),
 							  r_vals[i], &theta, &rho);
 				if (   go_finite (theta) 
 				    && go_finite (rho) 

Modified: trunk/plugins/plot_surface/gog-xyz-surface.c
==============================================================================
--- trunk/plugins/plot_surface/gog-xyz-surface.c	(original)
+++ trunk/plugins/plot_surface/gog-xyz-surface.c	Sat Sep 13 15:36:22 2008
@@ -70,7 +70,7 @@
 		index = i * jmax + j;
 		/* Watch out not to fall beyond array limits; however,
 		 * its unlikely and shouldn't happen normally */
-		if (G_LIKELY (index >= 0 && index < n)) {
+		if (G_LIKELY (index < n)) {
 			data[index] += z_vals[k];
 			grid[index]++;
 		}



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