[postgis-tickets] r17476 - Fix a couple of warning about C99
Sandro Santilli
strk at kbt.io
Thu Jun 6 03:01:25 PDT 2019
Author: strk
Date: 2019-06-06 03:01:24 -0700 (Thu, 06 Jun 2019)
New Revision: 17476
Modified:
branches/2.4/postgis/geography_centroid.c
branches/2.4/postgis/lwgeom_sqlmm.c
Log:
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
Modified: branches/2.4/postgis/geography_centroid.c
===================================================================
--- branches/2.4/postgis/geography_centroid.c 2019-06-06 09:47:26 UTC (rev 17475)
+++ branches/2.4/postgis/geography_centroid.c 2019-06-06 10:01:24 UTC (rev 17476)
@@ -330,19 +330,24 @@
/* 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);
- 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,
@@ -349,7 +354,6 @@
* the weight is negative (e.g. for holes in polygons)
*/
- double_t weight;
if ( use_spheroid )
weight = lwgeom_area_spheroid(geom_tri, s);
else
@@ -356,7 +360,6 @@
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,7 +373,7 @@
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);
@@ -377,7 +380,7 @@
points[j].m = weight;
j++;
- lwpoint_free(tri_centroid);
+ lwpoint_free(tri_centroid);
lwgeom_free(geom_tri);
}
}
Modified: branches/2.4/postgis/lwgeom_sqlmm.c
===================================================================
--- branches/2.4/postgis/lwgeom_sqlmm.c 2019-06-06 09:47:26 UTC (rev 17475)
+++ branches/2.4/postgis/lwgeom_sqlmm.c 2019-06-06 10:01:24 UTC (rev 17476)
@@ -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 @@
*
* 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 @@
PG_RETURN_POINTER(ret);
}
+Datum ST_CurveToLine(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(ST_CurveToLine);
Datum ST_CurveToLine(PG_FUNCTION_ARGS)
{
More information about the postgis-tickets
mailing list