[gnumeric] Fixed test in staircase averaging.



commit 85e19d2af675cd8e8ead8a72335f9041745792f1
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Aug 15 11:17:32 2013 +0200

    Fixed test in staircase averaging.

 plugins/fn-tsa/ChangeLog   |    5 +++++
 plugins/fn-tsa/functions.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/fn-tsa/ChangeLog b/plugins/fn-tsa/ChangeLog
index 1702731..b3bd0e3 100644
--- a/plugins/fn-tsa/ChangeLog
+++ b/plugins/fn-tsa/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-15  Jean Brefort  <jean brefort normalesup org>
+
+       * functions.c (staircase_averaging): fixed test order to avoid using
+       uninitialized data.
+
 2013-07-10  Morten Welinder <terra gnome org>
 
        * Release 1.12.4
diff --git a/plugins/fn-tsa/functions.c b/plugins/fn-tsa/functions.c
index f69f26d..8955f4d 100644
--- a/plugins/fn-tsa/functions.c
+++ b/plugins/fn-tsa/functions.c
@@ -306,7 +306,7 @@ staircase_averaging (const gnm_float *absc, const gnm_float *ord, int nb_knots,
        while (j <= jmax && targets[0] >= absc[j])
                j++;
        for (i = 1; i <= nb_targets; i++) {
-               if (targets[i] < absc[j] || j > jmax) {
+               if (j > jmax || targets[i] < absc[j]) {
                        res[i - 1] = ord[j - 1];
                        continue;
                }


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