[GRASS-SVN] r73139 - grass/trunk/raster/r.distance

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 22 12:44:52 PDT 2018


Author: mmetz
Date: 2018-08-22 12:44:52 -0700 (Wed, 22 Aug 2018)
New Revision: 73139

Modified:
   grass/trunk/raster/r.distance/edges.c
Log:
r.distance: fix qsort cmp fn (see #3564)

Modified: grass/trunk/raster/r.distance/edges.c
===================================================================
--- grass/trunk/raster/r.distance/edges.c	2018-08-22 19:43:48 UTC (rev 73138)
+++ grass/trunk/raster/r.distance/edges.c	2018-08-22 19:44:52 UTC (rev 73139)
@@ -150,7 +150,10 @@
 {
     const struct CatEdgeList *a = aa, *b = bb;
 
-    return (int)(a->cat - b->cat);
+    if (a->cat < b->cat)
+	return -1;
+
+    return (a->cat > b->cat);
 }
 
 void sort_edge_list(struct Map *map)



More information about the grass-commit mailing list