[SF#477] Fix integer overflow on shorting by memory.
authorGyörgy Balló <city-busz@users.sourceforge.net>
Tue, 23 Sep 2014 14:27:52 +0000 (14:27 +0000)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 18 Oct 2014 15:34:29 +0000 (18:34 +0300)
This change fixes the integer overflow on sorting processes by memory usage. This is needed to fix bug 180 completely.

src/interface.c

index df21d20..cb0eeef 100644 (file)
@@ -545,10 +545,10 @@ gint compare_size_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter
     gtk_tree_model_get(model, iter1, column, &s1, -1);
     gtk_tree_model_get(model, iter2, column, &s2, -1);
 
-    gint64 i1 = string_to_size(s1);
-    gint64 i2 = string_to_size(s2);
+    guint64 i1 = string_to_size(s1);
+    guint64 i2 = string_to_size(s2);
 
-    ret = i2 - i1;
+    ret = (i2 > i1) - (i2 < i1);
 
     g_free(s1);
     g_free(s2);