[postgis-tickets] r16585 - Inconsistent results from qsort callback (yugr)

Paul Ramsey pramsey at cleverelephant.ca
Tue May 22 12:37:27 PDT 2018


Author: pramsey
Date: 2018-05-22 12:37:27 -0700 (Tue, 22 May 2018)
New Revision: 16585

Modified:
   branches/2.3/NEWS
   branches/2.3/liblwgeom/effectivearea.c
   branches/2.3/liblwgeom/measures.c
Log:
Inconsistent results from qsort callback (yugr)
References #4093



Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2018-05-22 19:36:23 UTC (rev 16584)
+++ branches/2.3/NEWS	2018-05-22 19:37:27 UTC (rev 16585)
@@ -6,7 +6,9 @@
   - #4071, ST_ClusterKMeans crash on NULL/EMPTY fixed (Darafei Praliaskouski)
   - #4074, Disable interrupt tests by default (Regina Obe)
   - #3997, fix bug in lwgeom_median and avoid division by zero (Raúl Marín)
+  - #4093, Inconsistent results from qsort callback (yugr)
 
+
 PostGIS 2.3.7
 2018/04/06
 

Modified: branches/2.3/liblwgeom/effectivearea.c
===================================================================
--- branches/2.3/liblwgeom/effectivearea.c	2018-05-22 19:36:23 UTC (rev 16584)
+++ branches/2.3/liblwgeom/effectivearea.c	2018-05-22 19:37:27 UTC (rev 16585)
@@ -112,7 +112,7 @@
 	if (v1==v2)
 		return (*(areanode**)a)-(*(areanode**)b);
 	else
-		return  (v1>v2 ) ? 1 : -1;
+		return  (v1 > v2) ? 1 : ((v1 < v2) ? -1 : 0);
 }
 
 

Modified: branches/2.3/liblwgeom/measures.c
===================================================================
--- branches/2.3/liblwgeom/measures.c	2018-05-22 19:36:23 UTC (rev 16584)
+++ branches/2.3/liblwgeom/measures.c	2018-05-22 19:37:27 UTC (rev 16585)
@@ -2060,7 +2060,8 @@
 {
 	LISTSTRUCT *ia = (LISTSTRUCT*)a;
 	LISTSTRUCT *ib = (LISTSTRUCT*)b;
-	return ( ia->themeasure>ib->themeasure ) ? 1 : -1;
+	return 
+		(ia->themeasure > ib->themeasure) ? 1 : ((ia->themeasure < ib->themeasure) ? -1 : 0);
 }
 
 /**



More information about the postgis-tickets mailing list