[gtk+] gtkscale: fix bogus compare func



commit f7d3ca46f78a076fd26a4036e31a95c8b7afdf4a
Author: Stefan Sauer <ensonic users sf net>
Date:   Mon Jan 9 18:16:53 2012 +0100

    gtkscale: fix bogus compare func
    
    The GtkScaleMark values are gdouble, a simple a-b compare func would fail for
    values with the same integer value. This breaks the sorting and causes random
    marker label placement.

 gtk/gtkscale.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 006a8dd..e4a7df9 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1529,7 +1529,7 @@ compare_marks (gpointer a, gpointer b)
 
   ma = a; mb = b;
 
-  return (gint) (ma->value - mb->value);
+  return (ma->value > mb->value) ? 1 : ((ma->value == mb->value) ? 0 : -1);
 }
 
 /**



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