]> granicus.if.org Git - postgis/commitdiff
Fix a couple of warning about C99
authorSandro Santilli <strk@kbt.io>
Thu, 6 Jun 2019 10:01:24 +0000 (10:01 +0000)
committerSandro Santilli <strk@kbt.io>
Thu, 6 Jun 2019 10:01:24 +0000 (10:01 +0000)
Note: these are turned to error for some possibly postgresql-injected
C flag, see https://dronie.osgeo.org/postgis/postgis/307/2/2

git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@17476 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_centroid.c
postgis/lwgeom_sqlmm.c

index 3b988fb85433bf30d29ad32000549a92e1b27deb..38f795a5452e2c8027819563b33c6639d554db3f 100644 (file)
@@ -330,33 +330,36 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid,
 
             /* split into triangles (two points + reference point) */
             for (i = 0; i < ring->npoints - 1; i++) {
+                LWPOLY* poly_tri;
+                LWGEOM* geom_tri;
+                LWPOINT* tri_centroid;
+                POINT3DM triangle[3];
+                double_t weight;
                 const POINT4D* p1 = (const POINT4D*) getPoint2d_cp(ring, i);
                 const POINT4D* p2 = (const POINT4D*) getPoint2d_cp(ring, i+1);
-
                 POINTARRAY* pa = ptarray_construct_empty(0, 0, 4);
+
                 ptarray_insert_point(pa, p1, 0);
                 ptarray_insert_point(pa, p2, 1);
                 ptarray_insert_point(pa, reference_point, 2);
                 ptarray_insert_point(pa, p1, 3);
 
-                LWPOLY* poly_tri = lwpoly_construct_empty(mpoly->srid, 0, 0);
+                poly_tri = lwpoly_construct_empty(mpoly->srid, 0, 0);
                 lwpoly_add_ring(poly_tri, pa);
 
-                LWGEOM* geom_tri = lwpoly_as_lwgeom(poly_tri);
+                geom_tri = lwpoly_as_lwgeom(poly_tri);
                 lwgeom_set_geodetic(geom_tri, LW_TRUE);
 
                /* Calculate the weight of the triangle. If counter clockwise,
                  * the weight is negative (e.g. for holes in polygons)
                  */
 
-                double_t weight;
                if ( use_spheroid )
                        weight = lwgeom_area_spheroid(geom_tri, s);
                else
                        weight = lwgeom_area_sphere(geom_tri, s);
 
 
-                POINT3DM triangle[3];
                 triangle[0].x = p1->x;
                 triangle[0].y = p1->y;
                 triangle[0].m = 1;
@@ -370,14 +373,14 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid,
                 triangle[2].m = 1;
 
                 /* get center of triangle */
-                LWPOINT* tri_centroid = geography_centroid_from_wpoints(mpoly->srid, triangle, 3);
+                tri_centroid = geography_centroid_from_wpoints(mpoly->srid, triangle, 3);
 
                 points[j].x = lwpoint_get_x(tri_centroid);
                 points[j].y = lwpoint_get_y(tri_centroid);
                 points[j].m = weight;
                 j++;
 
-                               lwpoint_free(tri_centroid);
+                lwpoint_free(tri_centroid);
                 lwgeom_free(geom_tri);
             }
         }
index f90ed26840fa5cc8ce2ec2f4b23352b4b00f739b..724a16d98a002c56d74c2aa51381068ce5faa462 100644 (file)
@@ -38,7 +38,6 @@
 
 
 Datum LWGEOM_has_arc(PG_FUNCTION_ARGS);
-Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS);
 Datum LWGEOM_line_desegmentize(PG_FUNCTION_ARGS);
 
 
@@ -65,6 +64,7 @@ Datum LWGEOM_has_arc(PG_FUNCTION_ARGS)
  *
  * TODO: drop, use ST_CurveToLine instead
  */
+Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(LWGEOM_curve_segmentize);
 Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS)
 {
@@ -96,6 +96,7 @@ Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(ret);
 }
 
+Datum ST_CurveToLine(PG_FUNCTION_ARGS);
 PG_FUNCTION_INFO_V1(ST_CurveToLine);
 Datum ST_CurveToLine(PG_FUNCTION_ARGS)
 {