[postgis-tickets] r14892 - Fix compiler warning in ST_GeometricMedian

Daniel Baston dbaston at gmail.com
Wed May 11 07:27:53 PDT 2016


Author: dbaston
Date: 2016-05-11 07:27:52 -0700 (Wed, 11 May 2016)
New Revision: 14892

Modified:
   trunk/postgis/lwgeom_functions_analytic.c
Log:
Fix compiler warning in ST_GeometricMedian

Modified: trunk/postgis/lwgeom_functions_analytic.c
===================================================================
--- trunk/postgis/lwgeom_functions_analytic.c	2016-05-11 14:18:53 UTC (rev 14891)
+++ trunk/postgis/lwgeom_functions_analytic.c	2016-05-11 14:27:52 UTC (rev 14892)
@@ -1155,7 +1155,8 @@
 	GSERIALIZED* result;
 	LWGEOM* input;
 	LWPOINT* lwresult;
-	double tolerance;
+	static const double min_default_tolerance = 1e-8;
+	double tolerance = min_default_tolerance;
 	bool compute_tolerance_from_box;
 	bool fail_if_not_converged;
 	int max_iter;
@@ -1194,16 +1195,11 @@
 		/* Compute a default tolerance based on the smallest dimension
 		 * of the geometry's bounding box.
 		 */
-		static const double min_default_tolerance = 1e-8;
 		static const double tolerance_coefficient = 1e-6;
 		const GBOX* box = lwgeom_get_bbox(input);
 
-		if (!box)
+		if (box)
 		{
-			tolerance = min_default_tolerance;
-		}
-		else
-		{
 			double min_dim = FP_MIN(box->xmax - box->xmin, box->ymax - box->ymin);
 			if (lwgeom_has_z(input))
 				min_dim = FP_MIN(min_dim, box->zmax - box->zmin);



More information about the postgis-tickets mailing list