[GRASS-SVN] r73135 - grass/trunk/vector/v.profile

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 22 11:38:10 PDT 2018


Author: mmetz
Date: 2018-08-22 11:38:10 -0700 (Wed, 22 Aug 2018)
New Revision: 73135

Modified:
   grass/trunk/vector/v.profile/main.c
Log:
v.profile: fix qsort cmp fn (see #3564)

Modified: grass/trunk/vector/v.profile/main.c
===================================================================
--- grass/trunk/vector/v.profile/main.c	2018-08-22 07:41:47 UTC (rev 73134)
+++ grass/trunk/vector/v.profile/main.c	2018-08-22 18:38:10 UTC (rev 73135)
@@ -81,7 +81,7 @@
 }
 
 /* Helper for converting multipoligons to GRASS poligons */
-static int add_poly(const GEOSGeometry *OGeom, struct line_pnts *Buffer) {
+static void add_poly(const GEOSGeometry *OGeom, struct line_pnts *Buffer) {
     const GEOSGeometry *geom2;
     static struct line_pnts *gPoints;
     int i, nrings;
@@ -754,13 +754,13 @@
     G_debug(5, "Comparing %f with %f", r1->distance, r2->distance);
 
     if (r1->distance == r2->distance) {
-        if (r1->cat > r2->cat)
-            return 1;
+        if (r1->cat < r2->cat)
+            return -1;
         else
-            return -1;
+            return (r1->cat > r2->cat);
     }
-    if (r1->distance > r2->distance)
-        return 1;
+    if (r1->distance < r2->distance)
+        return -1;
     else
-        return -1;
+        return (r1->distance > r2->distance);
 }



More information about the grass-commit mailing list