gnumeric r16916 - branches/gnumeric-1-8/plugins/fn-tsa



Author: jbrefort
Date: Thu Oct 23 08:35:43 2008
New Revision: 16916
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16916&view=rev

Log:
2008-10-23  Jean Brefort  <jean brefort normalesup org>

	* functions.c: (gnumeric_interpolation): return an error when the number
	of targets is negative (not only when it is nul). [#557515]
	(spline_interpolation), (spline_averaging): do not
	use a NULL GOCSpline struct. See #557442.



Modified:
   branches/gnumeric-1-8/plugins/fn-tsa/ChangeLog
   branches/gnumeric-1-8/plugins/fn-tsa/functions.c

Modified: branches/gnumeric-1-8/plugins/fn-tsa/functions.c
==============================================================================
--- branches/gnumeric-1-8/plugins/fn-tsa/functions.c	(original)
+++ branches/gnumeric-1-8/plugins/fn-tsa/functions.c	Thu Oct 23 08:35:43 2008
@@ -275,6 +275,8 @@
 	int i;
 	struct GnmCSpline *sp = gnm_cspline_init (absc, ord, nb_knots,
 				   GO_CSPLINE_NATURAL, 0., 0.);
+	if (!sp)
+		return NULL;
 	if (go_range_increasing (targets, nb_targets))
 		res = gnm_cspline_get_values (sp, targets, nb_targets);
 	else {
@@ -299,6 +301,8 @@
 		return NULL;
 	sp = gnm_cspline_init (absc, ord, nb_knots,
 				   GO_CSPLINE_NATURAL, 0., 0.);
+	if (!sp)
+		return NULL;
 	res = gnm_cspline_get_integrals (sp, targets, nb_targets);
 	imax = nb_targets - 1;
 	for (i = 0; i < imax; i++)
@@ -518,7 +522,7 @@
 		break;
 	}
 
-	if (n0 != n1 || n0 == 0 || n2==0) {
+	if (n0 != n1 || n0 == 0 || n2 <= 0) {
 		res = value_new_error_std (ei->pos, GNM_ERROR_VALUE);
 		for (i = 0; i < nb; i++)
 			if (values[i])



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