فهرست منبع

v.profile: fix qsort cmp fn (see https://trac.osgeo.org/grass/ticket/3564)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73135 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 6 سال پیش
والد
کامیت
c64219e2bf
1فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 7 7
      vector/v.profile/main.c

+ 7 - 7
vector/v.profile/main.c

@@ -81,7 +81,7 @@ static int ring2pts(const GEOSGeometry *geom, struct line_pnts *Points)
 }
 
 /* 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 @@ static int compdist(const void *d1, const void *d2)
     G_debug(5, "Comparing %f with %f", r1->distance, r2->distance);
 
     if (r1->distance == r2->distance) {
-        if (r1->cat > r2->cat)
-            return 1;
-        else
+        if (r1->cat < r2->cat)
             return -1;
+        else
+            return (r1->cat > r2->cat);
     }
-    if (r1->distance > r2->distance)
-        return 1;
-    else
+    if (r1->distance < r2->distance)
         return -1;
+    else
+        return (r1->distance > r2->distance);
 }