]> granicus.if.org Git - postgis/commitdiff
Fix compiler warning in ST_GeometricMedian
authorDaniel Baston <dbaston@gmail.com>
Wed, 11 May 2016 14:27:52 +0000 (14:27 +0000)
committerDaniel Baston <dbaston@gmail.com>
Wed, 11 May 2016 14:27:52 +0000 (14:27 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@14892 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_functions_analytic.c

index fb83a6a8a2ab08c143020342b40fade4f257f9f2..6c9def87ea99f383a42ab55a9c320ee35605c020 100644 (file)
@@ -1155,7 +1155,8 @@ Datum ST_GeometricMedian(PG_FUNCTION_ARGS)
        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,15 +1195,10 @@ Datum ST_GeometricMedian(PG_FUNCTION_ARGS)
                /* 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)
-               {
-                       tolerance = min_default_tolerance;
-               }
-               else
+               if (box)
                {
                        double min_dim = FP_MIN(box->xmax - box->xmin, box->ymax - box->ymin);
                        if (lwgeom_has_z(input))