goffice r2226 - in trunk: . goffice/graph plugins/plot_barcol



Author: jbrefort
Date: Thu Sep 25 09:04:17 2008
New Revision: 2226
URL: http://svn.gnome.org/viewvc/goffice?rev=2226&view=rev

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

	* goffice/graph/gog-error-bar.c: (gog_error_bar_get_bounds):
	don't crash in index < 0.
	* plugins/plot_barcol/gog-line.c: (gog_line_view_render): fix index
	for error bars. [#553711]



Modified:
   trunk/ChangeLog
   trunk/goffice/graph/gog-error-bar.c
   trunk/plugins/plot_barcol/gog-line.c

Modified: trunk/goffice/graph/gog-error-bar.c
==============================================================================
--- trunk/goffice/graph/gog-error-bar.c	(original)
+++ trunk/goffice/graph/gog-error-bar.c	Thu Sep 25 09:04:17 2008
@@ -509,6 +509,7 @@
 	GODataVector *vec;
 	int length;
 
+printf("index=%d\n",index);
 	/* -1 ensures that the bar will not be displayed if the error is not a correct one.
 		With a 0 value, it might be, because of rounding errors */
 	*min = *max = -1.;
@@ -517,7 +518,7 @@
 	if (!gog_series_is_valid (bar->series))
 		return FALSE;
 	vec = GO_DATA_VECTOR (bar->series->values[bar->dim_i].data);
-	if (vec == NULL)
+	if (vec == NULL || index < 0)
 		return FALSE;
 	value = go_data_vector_get_value (vec, index);
 	data = bar->series->values[bar->error_i].data;

Modified: trunk/plugins/plot_barcol/gog-line.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-line.c	(original)
+++ trunk/plugins/plot_barcol/gog-line.c	Thu Sep 25 09:04:17 2008
@@ -526,7 +526,7 @@
 			if (vals[i] && gog_axis_map_finite (y_map, vals[i][j])) {
 				value = vals[i][j];
 				if (gog_error_bar_is_visible (errors[i])) {
-					gog_error_bar_get_bounds (errors[i], j - 1, &minus, &plus);
+					gog_error_bar_get_bounds (errors[i], j, &minus, &plus);
 				}
 			} else if (type == GOG_1_5D_NORMAL && !is_area_plot) {
 				value = go_nan;
@@ -542,7 +542,7 @@
 			sum += value;
 
 			if (gog_error_bar_is_visible (errors[i])) 
-				error_data[i][j].x = j;
+				error_data[i][j].x = j + 1;
 
 			switch (type) {
 				case GOG_1_5D_NORMAL :



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