[gnumeric] Fix warning and casts



commit 8c9aa191ee2ac0e5581b5ed9a41aeec17c496f40
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Wed Dec 23 13:14:38 2009 -0700

    Fix warning and casts
    
    2009-12-23  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* functions.c (compare_doubles): rename to
    	  compare_gnumeric_eigen_ev and change all callers
    	(compare_gnumeric_eigen_ev): use the true type

 plugins/fn-math/ChangeLog   |   14 +++++++++++++-
 plugins/fn-math/functions.c |   25 ++++++++++++-------------
 2 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/plugins/fn-math/ChangeLog b/plugins/fn-math/ChangeLog
index 7172cbe..4325086 100644
--- a/plugins/fn-math/ChangeLog
+++ b/plugins/fn-math/ChangeLog
@@ -1,8 +1,20 @@
+2009-12-23  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c (compare_doubles): rename to 
+	  compare_gnumeric_eigen_ev and change all callers
+	(compare_gnumeric_eigen_ev): use the true type
+
 2009-12-23  Morten Welinder  <terra gnome org>
 
 	* functions.c (gnm_gcd_max): Fix type.
 
-2009-121  Andreas J. Guelzow <aguelzow pyrshep ca>
+2009-12-23  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c (compare_doubles): rename to 
+	  compare_gnumeric_eigen_ev and change all callers
+	(compare_gnumeric_eigen_ev): use the true type
+
+2009-12-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* plugin.xml.in: add EIGEN
 	* functions.c (help_eigen): new
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index e2cdb34..21823cc 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -3041,26 +3041,25 @@ new_matrix (int cols, int rows)
 	return res;
 }
 
-int
-compare_doubles (const void *a, const void *b)
+typedef struct {
+	gnm_float val;
+	int index;
+} gnumeric_eigen_ev_t;
+
+static int
+compare_gnumeric_eigen_ev (const void *a, const void *b)
 {
-  const gnm_float *da = (const double *) a;
-  const gnm_float *db = (const double *) b;
+  const gnumeric_eigen_ev_t *da = a;
+  const gnumeric_eigen_ev_t *db = b;
 
-  if (*da > *db)
+  if (da->val > db->val)
 	  return -1;
-  else if (*da == *db)
+  else if (da->val == db->val)
 	  return 0;
   else
 	  return 1;
 }
 
-
-typedef struct {
-	gnm_float val;
-	int index;
-} gnumeric_eigen_ev_t;
-
 static GnmValue *
 gnumeric_eigen (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 {
@@ -3109,7 +3108,7 @@ gnumeric_eigen (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 		ev_sort[c].val = eigenvalues[c];
 		ev_sort[c].index = c;
 	}
-	qsort (ev_sort, cols, sizeof (gnumeric_eigen_ev_t), compare_doubles);
+	qsort (ev_sort, cols, sizeof (gnumeric_eigen_ev_t), compare_gnumeric_eigen_ev);
 
 	res = value_new_array_non_init (cols, rows + 1);
 	for (c = 0; c < cols; ++c) {



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