From f8d8f231fd0ec4e0aed7c172289d791c4f601ab4 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 6 Jun 2019 10:01:24 +0000 Subject: [PATCH] Fix a couple of warning about C99 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 | 17 ++++++++++------- postgis/lwgeom_sqlmm.c | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/postgis/geography_centroid.c b/postgis/geography_centroid.c index 3b988fb85..38f795a54 100644 --- a/postgis/geography_centroid.c +++ b/postgis/geography_centroid.c @@ -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); } } diff --git a/postgis/lwgeom_sqlmm.c b/postgis/lwgeom_sqlmm.c index f90ed2684..724a16d98 100644 --- a/postgis/lwgeom_sqlmm.c +++ b/postgis/lwgeom_sqlmm.c @@ -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) { -- 2.40.0