efreet: fix signed warning
authorSebastian Dransfeld <sd@tango.flipp.net>
Mon, 11 May 2015 11:31:21 +0000 (13:31 +0200)
committerSebastian Dransfeld <sd@tango.flipp.net>
Mon, 11 May 2015 11:34:10 +0000 (13:34 +0200)
Update to 6a0d23. Casting to int isn't a real solution, since we could
have values which overflows.

Since we want the absolute value, just make sure we subtract the larger
value from the smaller.

src/lib/efreet/efreet_icon.c

index 89e87f0..3cb7f5c 100644 (file)
@@ -612,7 +612,10 @@ static double
 efreet_icon_size_distance(Efreet_Cache_Icon_Element *elem, unsigned int size)
 {
     if (elem->type == EFREET_ICON_SIZE_TYPE_FIXED)
-        return (abs((int) elem->normal - (int) size));
+    {
+        if (elem->normal > size) return elem->normal - size;
+        else return size - elem->normal;
+    }
 
     if ((elem->type == EFREET_ICON_SIZE_TYPE_SCALABLE) ||
         (elem->type == EFREET_ICON_SIZE_TYPE_THRESHOLD))