<div dir="ltr">Why are you doing this? Was there a discussion to switch the code base to a new style?<div><br></div><div>Dan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 22, 2018 at 10:52 AM, Darafei <span dir="ltr"><<a href="mailto:komzpa@gmail.com" target="_blank">komzpa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: komzpa<br>
Date: 2018-02-22 07:52:47 -0800 (Thu, 22 Feb 2018)<br>
New Revision: 16409<br>
<br>
Modified:<br>
trunk/liblwgeom/lwgeom_geos_<wbr>clean.c<br>
Log:<br>
Format lwgeom_geos_clean.c before digging in<br>
<br>
References #2508<br>
<br>
<br>
Modified: trunk/liblwgeom/lwgeom_geos_<wbr>clean.c<br>
==============================<wbr>==============================<wbr>=======<br>
--- trunk/liblwgeom/lwgeom_geos_<wbr>clean.c 2018-02-22 13:42:00 UTC (rev 16408)<br>
+++ trunk/liblwgeom/lwgeom_geos_<wbr>clean.c 2018-02-22 15:52:47 UTC (rev 16409)<br>
@@ -22,7 +22,6 @@<br>
*<br>
******************************<wbr>******************************<wbr>**********/<br>
<br>
-<br>
#include "liblwgeom.h"<br>
#include "lwgeom_geos.h"<br>
#include "liblwgeom_internal.h"<br>
@@ -36,7 +35,6 @@<br>
/* #define PARANOIA_LEVEL 2 */<br>
#undef LWGEOM_PROFILE_MAKEVALID<br>
<br>
-<br>
/*<br>
* Return Nth vertex in GEOSGeometry as a POINT.<br>
* May return NULL if the geometry has NO vertexex.<br>
@@ -53,7 +51,7 @@<br>
int gn;<br>
GEOSGeometry* ret;<br>
<br>
- switch ( GEOSGeomTypeId(g_in) )<br>
+ switch (GEOSGeomTypeId(g_in))<br>
{<br>
case GEOS_MULTIPOINT:<br>
case GEOS_MULTILINESTRING:<br>
@@ -60,11 +58,11 @@<br>
case GEOS_MULTIPOLYGON:<br>
case GEOS_GEOMETRYCOLLECTION:<br>
{<br>
- for (gn=0; gn<GEOSGetNumGeometries(g_in); ++gn)<br>
+ for (gn = 0; gn < GEOSGetNumGeometries(g_in); ++gn)<br>
{<br>
const GEOSGeometry* g = GEOSGetGeometryN(g_in, gn);<br>
- ret = LWGEOM_GEOS_getPointN(g,n);<br>
- if ( ret ) return ret;<br>
+ ret = LWGEOM_GEOS_getPointN(g, n);<br>
+ if (ret) return ret;<br>
}<br>
break;<br>
}<br>
@@ -72,12 +70,12 @@<br>
case GEOS_POLYGON:<br>
{<br>
ret = LWGEOM_GEOS_getPointN(<wbr>GEOSGetExteriorRing(g_in), n);<br>
- if ( ret ) return ret;<br>
- for (gn=0; gn<GEOSGetNumInteriorRings(g_<wbr>in); ++gn)<br>
+ if (ret) return ret;<br>
+ for (gn = 0; gn < GEOSGetNumInteriorRings(g_in); ++gn)<br>
{<br>
const GEOSGeometry* g = GEOSGetInteriorRingN(g_in, gn);<br>
ret = LWGEOM_GEOS_getPointN(g, n);<br>
- if ( ret ) return ret;<br>
+ if (ret) return ret;<br>
}<br>
break;<br>
}<br>
@@ -86,37 +84,34 @@<br>
case GEOS_LINESTRING:<br>
case GEOS_LINEARRING:<br>
break;<br>
-<br>
}<br>
<br>
seq_in = GEOSGeom_getCoordSeq(g_in);<br>
- if ( ! seq_in ) return NULL;<br>
- if ( ! GEOSCoordSeq_getSize(seq_in, &sz) ) return NULL;<br>
- if ( ! sz ) return NULL;<br>
+ if (!seq_in) return NULL;<br>
+ if (!GEOSCoordSeq_getSize(seq_in, &sz)) return NULL;<br>
+ if (!sz) return NULL;<br>
<br>
- if ( ! GEOSCoordSeq_getDimensions(<wbr>seq_in, &dims) ) return NULL;<br>
+ if (!GEOSCoordSeq_getDimensions(<wbr>seq_in, &dims)) return NULL;<br>
<br>
seq_out = GEOSCoordSeq_create(1, dims);<br>
- if ( ! seq_out ) return NULL;<br>
+ if (!seq_out) return NULL;<br>
<br>
- if ( ! GEOSCoordSeq_getX(seq_in, n, &val) ) return NULL;<br>
- if ( ! GEOSCoordSeq_setX(seq_out, n, val) ) return NULL;<br>
- if ( ! GEOSCoordSeq_getY(seq_in, n, &val) ) return NULL;<br>
- if ( ! GEOSCoordSeq_setY(seq_out, n, val) ) return NULL;<br>
- if ( dims > 2 )<br>
+ if (!GEOSCoordSeq_getX(seq_in, n, &val)) return NULL;<br>
+ if (!GEOSCoordSeq_setX(seq_out, n, val)) return NULL;<br>
+ if (!GEOSCoordSeq_getY(seq_in, n, &val)) return NULL;<br>
+ if (!GEOSCoordSeq_setY(seq_out, n, val)) return NULL;<br>
+ if (dims > 2)<br>
{<br>
- if ( ! GEOSCoordSeq_getZ(seq_in, n, &val) ) return NULL;<br>
- if ( ! GEOSCoordSeq_setZ(seq_out, n, val) ) return NULL;<br>
+ if (!GEOSCoordSeq_getZ(seq_in, n, &val)) return NULL;<br>
+ if (!GEOSCoordSeq_setZ(seq_out, n, val)) return NULL;<br>
}<br>
<br>
return GEOSGeom_createPoint(seq_out);<br>
}<br>
<br>
-<br>
-<br>
-LWGEOM * lwcollection_make_geos_<wbr>friendly(LWCOLLECTION *g);<br>
-LWGEOM * lwline_make_geos_friendly(<wbr>LWLINE *line);<br>
-LWGEOM * lwpoly_make_geos_friendly(<wbr>LWPOLY *poly);<br>
+LWGEOM* lwcollection_make_geos_<wbr>friendly(LWCOLLECTION* g);<br>
+LWGEOM* lwline_make_geos_friendly(<wbr>LWLINE* line);<br>
+LWGEOM* lwpoly_make_geos_friendly(<wbr>LWPOLY* poly);<br>
POINTARRAY* ring_make_geos_friendly(<wbr>POINTARRAY* ring);<br>
<br>
/*<br>
@@ -125,8 +120,8 @@<br>
* May return the input untouched (if already valid).<br>
* May return geometries of lower dimension (on collapses)<br>
*/<br>
-static LWGEOM *<br>
-lwgeom_make_geos_friendly(<wbr>LWGEOM *geom)<br>
+static LWGEOM*<br>
+lwgeom_make_geos_friendly(<wbr>LWGEOM* geom)<br>
{<br>
LWDEBUGF(2, "lwgeom_make_geos_friendly enter (type %d)", geom->type);<br>
switch (geom->type)<br>
@@ -139,18 +134,18 @@<br>
<br>
case LINETYPE:<br>
/* lines need at least 2 points */<br>
- return lwline_make_geos_friendly((<wbr>LWLINE *)geom);<br>
+ return lwline_make_geos_friendly((<wbr>LWLINE*)geom);<br>
break;<br>
<br>
case POLYGONTYPE:<br>
/* polygons need all rings closed and with npoints > 3 */<br>
- return lwpoly_make_geos_friendly((<wbr>LWPOLY *)geom);<br>
+ return lwpoly_make_geos_friendly((<wbr>LWPOLY*)geom);<br>
break;<br>
<br>
case MULTILINETYPE:<br>
case MULTIPOLYGONTYPE:<br>
case COLLECTIONTYPE:<br>
- return lwcollection_make_geos_<wbr>friendly((LWCOLLECTION *)geom);<br>
+ return lwcollection_make_geos_<wbr>friendly((LWCOLLECTION*)geom);<br>
break;<br>
<br>
case CIRCSTRINGTYPE:<br>
@@ -159,7 +154,9 @@<br>
case MULTISURFACETYPE:<br>
case MULTICURVETYPE:<br>
default:<br>
- lwerror("lwgeom_make_geos_<wbr>friendly: unsupported input geometry type: %s (%d)", lwtype_name(geom->type), geom->type);<br>
+ lwerror("lwgeom_make_geos_<wbr>friendly: unsupported input geometry type: %s (%d)",<br>
+ lwtype_name(geom->type),<br>
+ geom->type);<br>
break;<br>
}<br>
return 0;<br>
@@ -178,13 +175,10 @@<br>
POINTARRAY* newring;<br>
<br>
/* close the ring if not already closed (2d only) */<br>
- if ( ! ptarray_is_closed_2d(ring) )<br>
+ if (!ptarray_is_closed_2d(ring))<br>
{<br>
/* close it up */<br>
- newring = ptarray_addPoint(ring,<br>
- getPoint_internal(ring, 0),<br>
- FLAGS_NDIMS(ring->flags),<br>
- ring->npoints);<br>
+ newring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);<br>
ring = newring;<br>
}<br>
return ring;<br>
@@ -199,26 +193,19 @@<br>
<br>
/* close the ring if not already closed (2d only) */<br>
closedring = ptarray_close2d(ring);<br>
- if (closedring != ring )<br>
- {<br>
- ring = closedring;<br>
- }<br>
+ if (closedring != ring) ring = closedring;<br>
<br>
/* return 0 for collapsed ring (after closeup) */<br>
<br>
- while ( ring->npoints < 4 )<br>
+ while (ring->npoints < 4)<br>
{<br>
- POINTARRAY *oring = ring;<br>
+ POINTARRAY* oring = ring;<br>
LWDEBUGF(4, "ring has %d points, adding another", ring->npoints);<br>
/* let's add another... */<br>
- ring = ptarray_addPoint(ring,<br>
- getPoint_internal(ring, 0),<br>
- FLAGS_NDIMS(ring->flags),<br>
- ring->npoints);<br>
- if ( oring != ring_in ) ptarray_free(oring);<br>
+ ring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);<br>
+ if (oring != ring_in) ptarray_free(oring);<br>
}<br>
<br>
-<br>
return ring;<br>
}<br>
<br>
@@ -225,36 +212,35 @@<br>
/* Make sure all rings are closed and have > 3 points.<br>
* May return the input untouched.<br>
*/<br>
-LWGEOM *<br>
-lwpoly_make_geos_friendly(<wbr>LWPOLY *poly)<br>
+LWGEOM*<br>
+lwpoly_make_geos_friendly(<wbr>LWPOLY* poly)<br>
{<br>
LWGEOM* ret;<br>
- POINTARRAY **new_rings;<br>
+ POINTARRAY** new_rings;<br>
uint32_t i;<br>
<br>
/* If the polygon has no rings there's nothing to do */<br>
- if ( ! poly->nrings ) return (LWGEOM*)poly;<br>
+ if (!poly->nrings) return (LWGEOM*)poly;<br>
<br>
/* Allocate enough pointers for all rings */<br>
- new_rings = lwalloc(sizeof(POINTARRAY*)*<wbr>poly->nrings);<br>
+ new_rings = lwalloc(sizeof(POINTARRAY*) * poly->nrings);<br>
<br>
/* All rings must be closed and have > 3 points */<br>
- for (i=0; i<poly->nrings; i++)<br>
+ for (i = 0; i < poly->nrings; i++)<br>
{<br>
POINTARRAY* ring_in = poly->rings[i];<br>
POINTARRAY* ring_out = ring_make_geos_friendly(ring_<wbr>in);<br>
<br>
- if ( ring_in != ring_out )<br>
+ if (ring_in != ring_out)<br>
{<br>
- LWDEBUGF(3, "lwpoly_make_geos_friendly: ring %d cleaned, now has %d points", i, ring_out->npoints);<br>
+ LWDEBUGF(<br>
+ 3, "lwpoly_make_geos_friendly: ring %d cleaned, now has %d points", i, ring_out->npoints);<br>
ptarray_free(ring_in);<br>
}<br>
else<br>
- {<br>
LWDEBUGF(3, "lwpoly_make_geos_friendly: ring %d untouched", i);<br>
- }<br>
<br>
- assert ( ring_out );<br>
+ assert(ring_out);<br>
new_rings[i] = ring_out;<br>
}<br>
<br>
@@ -266,10 +252,10 @@<br>
}<br>
<br>
/* Need NO or >1 points. Duplicate first if only one. */<br>
-LWGEOM *<br>
-lwline_make_geos_friendly(<wbr>LWLINE *line)<br>
+LWGEOM*<br>
+lwline_make_geos_friendly(<wbr>LWLINE* line)<br>
{<br>
- LWGEOM *ret;<br>
+ LWGEOM* ret;<br>
<br>
if (line->points->npoints == 1) /* 0 is fine, 2 is fine */<br>
{<br>
@@ -276,9 +262,9 @@<br>
#if 1<br>
/* Duplicate point */<br>
line->points = ptarray_addPoint(line->points,<br>
- getPoint_internal(line-><wbr>points, 0),<br>
- FLAGS_NDIMS(line->points-><wbr>flags),<br>
- line->points->npoints);<br>
+ getPoint_internal(line-><wbr>points, 0),<br>
+ FLAGS_NDIMS(line->points-><wbr>flags),<br>
+ line->points->npoints);<br>
ret = (LWGEOM*)line;<br>
#else<br>
/* Turn into a point */<br>
@@ -293,38 +279,36 @@<br>
}<br>
}<br>
<br>
-LWGEOM *<br>
-lwcollection_make_geos_<wbr>friendly(LWCOLLECTION *g)<br>
+LWGEOM*<br>
+lwcollection_make_geos_<wbr>friendly(LWCOLLECTION* g)<br>
{<br>
- LWGEOM **new_geoms;<br>
- uint32_t i, new_ngeoms=0;<br>
- LWCOLLECTION *ret;<br>
+ LWGEOM** new_geoms;<br>
+ uint32_t i, new_ngeoms = 0;<br>
+ LWCOLLECTION* ret;<br>
<br>
/* enough space for all components */<br>
- new_geoms = lwalloc(sizeof(LWGEOM *)*g->ngeoms);<br>
+ new_geoms = lwalloc(sizeof(LWGEOM*) * g->ngeoms);<br>
<br>
ret = lwalloc(sizeof(LWCOLLECTION));<br>
memcpy(ret, g, sizeof(LWCOLLECTION));<br>
- ret->maxgeoms = g->ngeoms;<br>
+ ret->maxgeoms = g->ngeoms;<br>
<br>
- for (i=0; i<g->ngeoms; i++)<br>
+ for (i = 0; i < g->ngeoms; i++)<br>
{<br>
LWGEOM* newg = lwgeom_make_geos_friendly(g-><wbr>geoms[i]);<br>
- if ( newg ) new_geoms[new_ngeoms++] = newg;<br>
+ if (newg) new_geoms[new_ngeoms++] = newg;<br>
}<br>
<br>
ret->bbox = NULL; /* recompute later... */<br>
<br>
ret->ngeoms = new_ngeoms;<br>
- if ( new_ngeoms )<br>
- {<br>
+ if (new_ngeoms)<br>
ret->geoms = new_geoms;<br>
- }<br>
else<br>
{<br>
free(new_geoms);<br>
ret->geoms = NULL;<br>
- ret->maxgeoms = 0;<br>
+ ret->maxgeoms = 0;<br>
}<br>
<br>
return (LWGEOM*)ret;<br>
@@ -347,14 +331,12 @@<br>
*/<br>
<br>
point = LWGEOM_GEOS_getPointN(lines, 0);<br>
- if ( ! point ) return NULL;<br>
+ if (!point) return NULL;<br>
<br>
- LWDEBUGF(3,<br>
- "Boundary point: %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>point, 0)));<br>
+ LWDEBUGF(3, "Boundary point: %s", lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>point, 0)));<br>
<br>
noded = GEOSUnion(lines, point);<br>
- if ( NULL == noded )<br>
+ if (NULL == noded)<br>
{<br>
GEOSGeom_destroy(point);<br>
return NULL;<br>
@@ -363,9 +345,9 @@<br>
GEOSGeom_destroy(point);<br>
<br>
LWDEBUGF(3,<br>
- "LWGEOM_GEOS_nodeLines: in[%s] out[%s]",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>lines, 0)),<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>noded, 0)));<br>
+ "LWGEOM_GEOS_nodeLines: in[%s] out[%s]",<br>
+ lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>lines, 0)),<br>
+ lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>noded, 0)));<br>
<br>
return noded;<br>
}<br>
@@ -381,31 +363,24 @@<br>
GEOSGeom gout;<br>
GEOSGeom geos_bound;<br>
GEOSGeom geos_cut_edges, geos_area, collapse_points;<br>
- GEOSGeometry *vgeoms[3]; /* One for area, one for cut-edges */<br>
- unsigned int nvgeoms=0;<br>
+ GEOSGeometry* vgeoms[3]; /* One for area, one for cut-edges */<br>
+ unsigned int nvgeoms = 0;<br>
<br>
- assert (GEOSGeomTypeId(gin) == GEOS_POLYGON ||<br>
- GEOSGeomTypeId(gin) == GEOS_MULTIPOLYGON);<br>
+ assert(GEOSGeomTypeId(gin) == GEOS_POLYGON || GEOSGeomTypeId(gin) == GEOS_MULTIPOLYGON);<br>
<br>
geos_bound = GEOSBoundary(gin);<br>
- if ( NULL == geos_bound )<br>
- {<br>
- return NULL;<br>
- }<br>
+ if (NULL == geos_bound) return NULL;<br>
<br>
- LWDEBUGF(3,<br>
- "Boundaries: %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>geos_bound, 0)));<br>
+ LWDEBUGF(3, "Boundaries: %s", lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>geos_bound, 0)));<br>
<br>
/* Use noded boundaries as initial "cut" edges */<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: noding lines");<br>
+ lwnotice("ST_MakeValid: noding lines");<br>
#endif<br>
<br>
-<br>
geos_cut_edges = LWGEOM_GEOS_nodeLines(geos_<wbr>bound);<br>
- if ( NULL == geos_cut_edges )<br>
+ if (NULL == geos_cut_edges)<br>
{<br>
GEOSGeom_destroy(geos_bound);<br>
lwnotice("LWGEOM_GEOS_<wbr>nodeLines(): %s", lwgeom_geos_errmsg);<br>
@@ -419,46 +394,40 @@<br>
GEOSGeometry* po;<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: extracting unique points from bounds");<br>
+ lwnotice("ST_MakeValid: extracting unique points from bounds");<br>
#endif<br>
<br>
pi = GEOSGeom_extractUniquePoints(<wbr>geos_bound);<br>
- if ( NULL == pi )<br>
+ if (NULL == pi)<br>
{<br>
GEOSGeom_destroy(geos_bound);<br>
- lwnotice("GEOSGeom_<wbr>extractUniquePoints(): %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("GEOSGeom_<wbr>extractUniquePoints(): %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
<br>
- LWDEBUGF(3,<br>
- "Boundaries input points %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(pi, 0)));<br>
+ LWDEBUGF(3, "Boundaries input points %s", lwgeom_to_ewkt(GEOS2LWGEOM(pi, 0)));<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: extracting unique points from cut_edges");<br>
+ lwnotice("ST_MakeValid: extracting unique points from cut_edges");<br>
#endif<br>
<br>
po = GEOSGeom_extractUniquePoints(<wbr>geos_cut_edges);<br>
- if ( NULL == po )<br>
+ if (NULL == po)<br>
{<br>
GEOSGeom_destroy(geos_bound);<br>
GEOSGeom_destroy(pi);<br>
- lwnotice("GEOSGeom_<wbr>extractUniquePoints(): %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("GEOSGeom_<wbr>extractUniquePoints(): %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
<br>
- LWDEBUGF(3,<br>
- "Boundaries output points %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(po, 0)));<br>
+ LWDEBUGF(3, "Boundaries output points %s", lwgeom_to_ewkt(GEOS2LWGEOM(po, 0)));<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: find collapse points");<br>
+ lwnotice("ST_MakeValid: find collapse points");<br>
#endif<br>
<br>
collapse_points = GEOSDifference(pi, po);<br>
- if ( NULL == collapse_points )<br>
+ if (NULL == collapse_points)<br>
{<br>
GEOSGeom_destroy(geos_bound);<br>
GEOSGeom_destroy(pi);<br>
@@ -467,12 +436,10 @@<br>
return NULL;<br>
}<br>
<br>
- LWDEBUGF(3,<br>
- "Collapse points: %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>collapse_points, 0)));<br>
+ LWDEBUGF(3, "Collapse points: %s", lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>collapse_points, 0)));<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: cleanup(1)");<br>
+ lwnotice("ST_MakeValid: cleanup(1)");<br>
#endif<br>
<br>
GEOSGeom_destroy(pi);<br>
@@ -480,13 +447,11 @@<br>
}<br>
GEOSGeom_destroy(geos_bound);<br>
<br>
- LWDEBUGF(3,<br>
- "Noded Boundaries: %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>geos_cut_edges, 0)));<br>
+ LWDEBUGF(3, "Noded Boundaries: %s", lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>geos_cut_edges, 0)));<br>
<br>
/* And use an empty geometry as initial "area" */<br>
geos_area = GEOSGeom_createEmptyPolygon();<br>
- if ( ! geos_area )<br>
+ if (!geos_area)<br>
{<br>
lwnotice("GEOSGeom_<wbr>createEmptyPolygon(): %s", lwgeom_geos_errmsg);<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
@@ -501,13 +466,13 @@<br>
*/<br>
while (GEOSGetNumGeometries(geos_<wbr>cut_edges))<br>
{<br>
- GEOSGeometry* new_area=0;<br>
- GEOSGeometry* new_area_bound=0;<br>
- GEOSGeometry* symdif=0;<br>
- GEOSGeometry* new_cut_edges=0;<br>
+ GEOSGeometry* new_area = 0;<br>
+ GEOSGeometry* new_area_bound = 0;<br>
+ GEOSGeometry* symdif = 0;<br>
+ GEOSGeometry* new_cut_edges = 0;<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: building area from %d edges", GEOSGetNumGeometries(geos_cut_<wbr>edges));<br>
+ lwnotice("ST_MakeValid: building area from %d edges", GEOSGetNumGeometries(geos_cut_<wbr>edges));<br>
#endif<br>
<br>
/*<br>
@@ -515,16 +480,15 @@<br>
*/<br>
<br>
new_area = LWGEOM_GEOS_buildArea(geos_<wbr>cut_edges);<br>
- if ( ! new_area ) /* must be an exception */<br>
+ if (!new_area) /* must be an exception */<br>
{<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
GEOSGeom_destroy(geos_area);<br>
- lwnotice("LWGEOM_GEOS_<wbr>buildArea() threw an error: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("LWGEOM_GEOS_<wbr>buildArea() threw an error: %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
<br>
- if ( GEOSisEmpty(new_area) )<br>
+ if (GEOSisEmpty(new_area))<br>
{<br>
/* no more rings can be build with thes edges */<br>
GEOSGeom_destroy(new_area);<br>
@@ -536,7 +500,8 @@<br>
*/<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: ring built with %d cut edges, saving boundaries", GEOSGetNumGeometries(geos_cut_<wbr>edges));<br>
+ lwnotice("ST_MakeValid: ring built with %d cut edges, saving boundaries",<br>
+ GEOSGetNumGeometries(geos_cut_<wbr>edges));<br>
#endif<br>
<br>
/*<br>
@@ -544,13 +509,13 @@<br>
* further cut edges later)<br>
*/<br>
new_area_bound = GEOSBoundary(new_area);<br>
- if ( ! new_area_bound )<br>
+ if (!new_area_bound)<br>
{<br>
/* We did check for empty area already so<br>
* this must be some other error */<br>
lwnotice("GEOSBoundary('%s') threw an error: %s",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>new_area, 0)),<br>
- lwgeom_geos_errmsg);<br>
+ lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>new_area, 0)),<br>
+ lwgeom_geos_errmsg);<br>
GEOSGeom_destroy(new_area);<br>
GEOSGeom_destroy(geos_area);<br>
return NULL;<br>
@@ -557,7 +522,7 @@<br>
}<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: running SymDifference with new area");<br>
+ lwnotice("ST_MakeValid: running SymDifference with new area");<br>
#endif<br>
<br>
/*<br>
@@ -564,14 +529,13 @@<br>
* Now symdif new and old area<br>
*/<br>
symdif = GEOSSymDifference(geos_area, new_area);<br>
- if ( ! symdif ) /* must be an exception */<br>
+ if (!symdif) /* must be an exception */<br>
{<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
GEOSGeom_destroy(new_area);<br>
GEOSGeom_destroy(new_area_<wbr>bound);<br>
GEOSGeom_destroy(geos_area);<br>
- lwnotice("GEOSSymDifference() threw an error: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("GEOSSymDifference() threw an error: %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
<br>
@@ -592,19 +556,18 @@<br>
*/<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: computing new cut_edges (GEOSDifference)");<br>
+ lwnotice("ST_MakeValid: computing new cut_edges (GEOSDifference)");<br>
#endif<br>
<br>
new_cut_edges = GEOSDifference(geos_cut_edges, new_area_bound);<br>
GEOSGeom_destroy(new_area_<wbr>bound);<br>
- if ( ! new_cut_edges ) /* an exception ? */<br>
+ if (!new_cut_edges) /* an exception ? */<br>
{<br>
/* cleanup and throw */<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
GEOSGeom_destroy(geos_area);<br>
/* TODO: Shouldn't this be an lwerror ? */<br>
- lwnotice("GEOSDifference() threw an error: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("GEOSDifference() threw an error: %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
@@ -612,37 +575,25 @@<br>
}<br>
<br>
#ifdef LWGEOM_PROFILE_MAKEVALID<br>
- lwnotice("ST_MakeValid: final checks");<br>
+ lwnotice("ST_MakeValid: final checks");<br>
#endif<br>
<br>
- if ( ! GEOSisEmpty(geos_area) )<br>
- {<br>
+ if (!GEOSisEmpty(geos_area))<br>
vgeoms[nvgeoms++] = geos_area;<br>
- }<br>
else<br>
- {<br>
GEOSGeom_destroy(geos_area);<br>
- }<br>
<br>
- if ( ! GEOSisEmpty(geos_cut_edges) )<br>
- {<br>
+ if (!GEOSisEmpty(geos_cut_edges))<br>
vgeoms[nvgeoms++] = geos_cut_edges;<br>
- }<br>
else<br>
- {<br>
GEOSGeom_destroy(geos_cut_<wbr>edges);<br>
- }<br>
<br>
- if ( ! GEOSisEmpty(collapse_points) )<br>
- {<br>
+ if (!GEOSisEmpty(collapse_points)<wbr>)<br>
vgeoms[nvgeoms++] = collapse_points;<br>
- }<br>
else<br>
- {<br>
GEOSGeom_destroy(collapse_<wbr>points);<br>
- }<br>
<br>
- if ( 1 == nvgeoms )<br>
+ if (1 == nvgeoms)<br>
{<br>
/* Return cut edges */<br>
gout = vgeoms[0];<br>
@@ -651,12 +602,11 @@<br>
{<br>
/* Collect areas and lines (if any line) */<br>
gout = GEOSGeom_createCollection(<wbr>GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);<br>
- if ( ! gout ) /* an exception again */<br>
+ if (!gout) /* an exception again */<br>
{<br>
/* cleanup and throw */<br>
/* TODO: Shouldn't this be an lwerror ? */<br>
- lwnotice("GEOSGeom_<wbr>createCollection() threw an error: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwnotice("GEOSGeom_<wbr>createCollection() threw an error: %s", lwgeom_geos_errmsg);<br>
/* TODO: cleanup! */<br>
return NULL;<br>
}<br>
@@ -663,7 +613,6 @@<br>
}<br>
<br>
return gout;<br>
-<br>
}<br>
<br>
static GEOSGeometry*<br>
@@ -679,44 +628,40 @@<br>
{<br>
GEOSGeometry** lines;<br>
GEOSGeometry** points;<br>
- GEOSGeometry* mline_out=0;<br>
- GEOSGeometry* mpoint_out=0;<br>
- GEOSGeometry* gout=0;<br>
- uint32_t nlines=0, nlines_alloc;<br>
- uint32_t npoints=0;<br>
- uint32_t ngeoms=0, nsubgeoms;<br>
+ GEOSGeometry* mline_out = 0;<br>
+ GEOSGeometry* mpoint_out = 0;<br>
+ GEOSGeometry* gout = 0;<br>
+ uint32_t nlines = 0, nlines_alloc;<br>
+ uint32_t npoints = 0;<br>
+ uint32_t ngeoms = 0, nsubgeoms;<br>
uint32_t i, j;<br>
<br>
ngeoms = GEOSGetNumGeometries(gin);<br>
<br>
nlines_alloc = ngeoms;<br>
- lines = lwalloc(sizeof(GEOSGeometry*)*<wbr>nlines_alloc);<br>
- points = lwalloc(sizeof(GEOSGeometry*)*<wbr>ngeoms);<br>
+ lines = lwalloc(sizeof(GEOSGeometry*) * nlines_alloc);<br>
+ points = lwalloc(sizeof(GEOSGeometry*) * ngeoms);<br>
<br>
- for (i=0; i<ngeoms; ++i)<br>
+ for (i = 0; i < ngeoms; ++i)<br>
{<br>
const GEOSGeometry* g = GEOSGetGeometryN(gin, i);<br>
GEOSGeometry* vg;<br>
vg = LWGEOM_GEOS_makeValidLine(g);<br>
- if ( GEOSisEmpty(vg) )<br>
+ if (GEOSisEmpty(vg))<br>
{<br>
/* we don't care about this one */<br>
GEOSGeom_destroy(vg);<br>
}<br>
- if ( GEOSGeomTypeId(vg) == GEOS_POINT )<br>
- {<br>
+ if (GEOSGeomTypeId(vg) == GEOS_POINT)<br>
points[npoints++] = vg;<br>
- }<br>
- else if ( GEOSGeomTypeId(vg) == GEOS_LINESTRING )<br>
- {<br>
+ else if (GEOSGeomTypeId(vg) == GEOS_LINESTRING)<br>
lines[nlines++] = vg;<br>
- }<br>
- else if ( GEOSGeomTypeId(vg) == GEOS_MULTILINESTRING )<br>
+ else if (GEOSGeomTypeId(vg) == GEOS_MULTILINESTRING)<br>
{<br>
- nsubgeoms=<wbr>GEOSGetNumGeometries(vg);<br>
+ nsubgeoms = GEOSGetNumGeometries(vg);<br>
nlines_alloc += nsubgeoms;<br>
- lines = lwrealloc(lines, sizeof(GEOSGeometry*)*nlines_<wbr>alloc);<br>
- for (j=0; j<nsubgeoms; ++j)<br>
+ lines = lwrealloc(lines, sizeof(GEOSGeometry*) * nlines_alloc);<br>
+ for (j = 0; j < nsubgeoms; ++j)<br>
{<br>
const GEOSGeometry* gc = GEOSGetGeometryN(vg, j);<br>
/* NOTE: ownership of the cloned geoms will be<br>
@@ -728,55 +673,39 @@<br>
{<br>
/* NOTE: return from GEOSGeomType will leak<br>
* but we really don't expect this to happen */<br>
- lwerror("unexpected geom type returned "<br>
- "by LWGEOM_GEOS_makeValid: %s",<br>
- GEOSGeomType(vg));<br>
+ lwerror("unexpected geom type returned by LWGEOM_GEOS_makeValid: %s", GEOSGeomType(vg));<br>
}<br>
}<br>
<br>
- if ( npoints )<br>
+ if (npoints)<br>
{<br>
- if ( npoints > 1 )<br>
- {<br>
- mpoint_out = GEOSGeom_createCollection(<wbr>GEOS_MULTIPOINT,<br>
- points, npoints);<br>
- }<br>
+ if (npoints > 1)<br>
+ mpoint_out = GEOSGeom_createCollection(<wbr>GEOS_MULTIPOINT, points, npoints);<br>
else<br>
- {<br>
mpoint_out = points[0];<br>
- }<br>
}<br>
<br>
- if ( nlines )<br>
+ if (nlines)<br>
{<br>
- if ( nlines > 1 )<br>
- {<br>
- mline_out = GEOSGeom_createCollection(<br>
- GEOS_MULTILINESTRING, lines, nlines);<br>
- }<br>
+ if (nlines > 1)<br>
+ mline_out = GEOSGeom_createCollection(<wbr>GEOS_MULTILINESTRING, lines, nlines);<br>
else<br>
- {<br>
mline_out = lines[0];<br>
- }<br>
}<br>
<br>
lwfree(lines);<br>
<br>
- if ( mline_out && mpoint_out )<br>
+ if (mline_out && mpoint_out)<br>
{<br>
points[0] = mline_out;<br>
points[1] = mpoint_out;<br>
- gout = GEOSGeom_createCollection(<wbr>GEOS_GEOMETRYCOLLECTION,<br>
- points, 2);<br>
+ gout = GEOSGeom_createCollection(<wbr>GEOS_GEOMETRYCOLLECTION, points, 2);<br>
}<br>
- else if ( mline_out )<br>
- {<br>
+ else if (mline_out)<br>
gout = mline_out;<br>
- }<br>
- else if ( mpoint_out )<br>
- {<br>
+<br>
+ else if (mpoint_out)<br>
gout = mpoint_out;<br>
- }<br>
<br>
lwfree(points);<br>
<br>
@@ -793,27 +722,31 @@<br>
LWGEOM_GEOS_<wbr>makeValidCollection(const GEOSGeometry* gin)<br>
{<br>
int nvgeoms;<br>
- GEOSGeometry **vgeoms;<br>
+ GEOSGeometry** vgeoms;<br>
GEOSGeom gout;<br>
int i;<br>
<br>
nvgeoms = GEOSGetNumGeometries(gin);<br>
- if ( nvgeoms == -1 ) {<br>
+ if (nvgeoms == -1)<br>
+ {<br>
lwerror("GEOSGetNumGeometries: %s", lwgeom_geos_errmsg);<br>
return 0;<br>
}<br>
<br>
- vgeoms = lwalloc( sizeof(GEOSGeometry*) * nvgeoms );<br>
- if ( ! vgeoms ) {<br>
+ vgeoms = lwalloc(sizeof(GEOSGeometry*) * nvgeoms);<br>
+ if (!vgeoms)<br>
+ {<br>
lwerror("LWGEOM_GEOS_<wbr>makeValidCollection: out of memory");<br>
return 0;<br>
}<br>
<br>
- for ( i=0; i<nvgeoms; ++i ) {<br>
- vgeoms[i] = LWGEOM_GEOS_makeValid( GEOSGetGeometryN(gin, i) );<br>
- if ( ! vgeoms[i] ) {<br>
+ for (i = 0; i < nvgeoms; ++i)<br>
+ {<br>
+ vgeoms[i] = LWGEOM_GEOS_makeValid(<wbr>GEOSGetGeometryN(gin, i));<br>
+ if (!vgeoms[i])<br>
+ {<br>
int j;<br>
- for (j = 0; j<i-1; j++)<br>
+ for (j = 0; j < i - 1; j++)<br>
GEOSGeom_destroy(vgeoms[j]);<br>
lwfree(vgeoms);<br>
/* we expect lwerror being called already by makeValid */<br>
@@ -823,22 +756,20 @@<br>
<br>
/* Collect areas and lines (if any line) */<br>
gout = GEOSGeom_createCollection(<wbr>GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);<br>
- if ( ! gout ) /* an exception again */<br>
+ if (!gout) /* an exception again */<br>
{<br>
/* cleanup and throw */<br>
- for ( i=0; i<nvgeoms; ++i ) GEOSGeom_destroy(vgeoms[i]);<br>
+ for (i = 0; i < nvgeoms; ++i)<br>
+ GEOSGeom_destroy(vgeoms[i]);<br>
lwfree(vgeoms);<br>
- lwerror("GEOSGeom_<wbr>createCollection() threw an error: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwerror("GEOSGeom_<wbr>createCollection() threw an error: %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
lwfree(vgeoms);<br>
<br>
return gout;<br>
-<br>
}<br>
<br>
-<br>
static GEOSGeometry*<br>
LWGEOM_GEOS_makeValid(const GEOSGeometry* gin)<br>
{<br>
@@ -850,17 +781,15 @@<br>
*/<br>
<br>
ret_char = GEOSisValid(gin);<br>
- if ( ret_char == 2 )<br>
+ if (ret_char == 2)<br>
{<br>
/* I don't think should ever happen */<br>
lwerror("GEOSisValid(): %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
- else if ( ret_char )<br>
+ else if (ret_char)<br>
{<br>
- LWDEBUGF(3,<br>
- "Geometry [%s] is valid. ",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>gin, 0)));<br>
+ LWDEBUGF(3, "Geometry [%s] is valid. ", lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>gin, 0)));<br>
<br>
/* It's valid at this step, return what we have */<br>
return GEOSGeom_clone(gin);<br>
@@ -867,12 +796,10 @@<br>
}<br>
<br>
LWDEBUGF(3,<br>
- "Geometry [%s] is still not valid: %s. "<br>
- "Will try to clean up further.",<br>
- lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>gin, 0)), lwgeom_geos_errmsg);<br>
+ "Geometry [%s] is still not valid: %s. Will try to clean up further.",<br>
+ lwgeom_to_ewkt(GEOS2LWGEOM(<wbr>gin, 0)),<br>
+ lwgeom_geos_errmsg);<br>
<br>
-<br>
-<br>
/*<br>
* Step 3 : make what we got valid<br>
*/<br>
@@ -888,7 +815,7 @@<br>
<br>
case GEOS_LINESTRING:<br>
gout = LWGEOM_GEOS_makeValidLine(gin)<wbr>;<br>
- if ( ! gout ) /* an exception or something */<br>
+ if (!gout) /* an exception or something */<br>
{<br>
/* cleanup and throw */<br>
lwerror("%s", lwgeom_geos_errmsg);<br>
@@ -898,7 +825,7 @@<br>
<br>
case GEOS_MULTILINESTRING:<br>
gout = LWGEOM_GEOS_<wbr>makeValidMultiLine(gin);<br>
- if ( ! gout ) /* an exception or something */<br>
+ if (!gout) /* an exception or something */<br>
{<br>
/* cleanup and throw */<br>
lwerror("%s", lwgeom_geos_errmsg);<br>
@@ -910,7 +837,7 @@<br>
case GEOS_MULTIPOLYGON:<br>
{<br>
gout = LWGEOM_GEOS_makeValidPolygon(<wbr>gin);<br>
- if ( ! gout ) /* an exception or something */<br>
+ if (!gout) /* an exception or something */<br>
{<br>
/* cleanup and throw */<br>
lwerror("%s", lwgeom_geos_errmsg);<br>
@@ -922,7 +849,7 @@<br>
case GEOS_GEOMETRYCOLLECTION:<br>
{<br>
gout = LWGEOM_GEOS_<wbr>makeValidCollection(gin);<br>
- if ( ! gout ) /* an exception or something */<br>
+ if (!gout) /* an exception or something */<br>
{<br>
/* cleanup and throw */<br>
lwerror("%s", lwgeom_geos_errmsg);<br>
@@ -934,8 +861,7 @@<br>
default:<br>
{<br>
char* typname = GEOSGeomType(gin);<br>
- lwnotice("ST_MakeValid: doesn't support geometry type: %s",<br>
- typname);<br>
+ lwnotice("ST_MakeValid: doesn't support geometry type: %s", typname);<br>
GEOSFree(typname);<br>
return NULL;<br>
break;<br>
@@ -944,35 +870,33 @@<br>
<br>
#if PARANOIA_LEVEL > 1<br>
/*<br>
- * Now check if every point of input is also found<br>
- * in output, or abort by returning NULL<br>
+ * Now check if every point of input is also found in output, or abort by returning NULL<br>
*<br>
* Input geometry was lwgeom_in<br>
*/<br>
{<br>
- int loss;<br>
- GEOSGeometry *pi, *po, *pd;<br>
+ int loss;<br>
+ GEOSGeometry *pi, *po, *pd;<br>
<br>
- /* TODO: handle some errors here...<br>
- * Lack of exceptions is annoying indeed,<br>
- * I'm getting old --strk;<br>
- */<br>
- pi = GEOSGeom_extractUniquePoints(<wbr>gin);<br>
- po = GEOSGeom_extractUniquePoints(<wbr>gout);<br>
- pd = GEOSDifference(pi, po); /* input points - output points */<br>
- GEOSGeom_destroy(pi);<br>
- GEOSGeom_destroy(po);<br>
- loss = !GEOSisEmpty(pd);<br>
- GEOSGeom_destroy(pd);<br>
- if ( loss )<br>
- {<br>
- lwnotice("%s [%d] Vertices lost in LWGEOM_GEOS_makeValid", __FILE__, __LINE__);<br>
- /* return NULL */<br>
- }<br>
+ /* TODO: handle some errors here...<br>
+ * Lack of exceptions is annoying indeed,<br>
+ * I'm getting old --strk;<br>
+ */<br>
+ pi = GEOSGeom_extractUniquePoints(<wbr>gin);<br>
+ po = GEOSGeom_extractUniquePoints(<wbr>gout);<br>
+ pd = GEOSDifference(pi, po); /* input points - output points */<br>
+ GEOSGeom_destroy(pi);<br>
+ GEOSGeom_destroy(po);<br>
+ loss = !GEOSisEmpty(pd);<br>
+ GEOSGeom_destroy(pd);<br>
+ if (loss)<br>
+ {<br>
+ lwnotice("%s [%d] Vertices lost in LWGEOM_GEOS_makeValid", __FILE__, __LINE__);<br>
+ /* return NULL */<br>
+ }<br>
}<br>
#endif /* PARANOIA_LEVEL > 1 */<br>
<br>
-<br>
return gout;<br>
}<br>
<br>
@@ -983,7 +907,7 @@<br>
int is3d;<br>
GEOSGeom geosgeom;<br>
GEOSGeometry* geosout;<br>
- LWGEOM *lwgeom_out;<br>
+ LWGEOM* lwgeom_out;<br>
<br>
is3d = FLAGS_GET_Z(lwgeom_in->flags);<br>
<br>
@@ -996,30 +920,24 @@<br>
<br>
lwgeom_out = lwgeom_in;<br>
geosgeom = LWGEOM2GEOS(lwgeom_out, 0);<br>
- if ( ! geosgeom )<br>
+ if (!geosgeom)<br>
{<br>
LWDEBUGF(4,<br>
- "Original geom can't be converted to GEOS (%s)"<br>
- " - will try cleaning that up first",<br>
- lwgeom_geos_errmsg);<br>
+ "Original geom can't be converted to GEOS (%s)"<br>
+ " - will try cleaning that up first",<br>
+ lwgeom_geos_errmsg);<br>
<br>
-<br>
lwgeom_out = lwgeom_make_geos_friendly(<wbr>lwgeom_out);<br>
- if ( ! lwgeom_out )<br>
- {<br>
- lwerror("Could not make a valid geometry out of input");<br>
- }<br>
+ if (!lwgeom_out) lwerror("Could not make a valid geometry out of input");<br>
<br>
/* try again as we did cleanup now */<br>
/* TODO: invoke LWGEOM2GEOS directly with autoclean ? */<br>
geosgeom = LWGEOM2GEOS(lwgeom_out, 0);<br>
- if ( ! geosgeom )<br>
+ if (!geosgeom)<br>
{<br>
- lwerror("Couldn't convert POSTGIS geom to GEOS: %s",<br>
- lwgeom_geos_errmsg);<br>
+ lwerror("Couldn't convert POSTGIS geom to GEOS: %s", lwgeom_geos_errmsg);<br>
return NULL;<br>
}<br>
-<br>
}<br>
else<br>
{<br>
@@ -1029,30 +947,26 @@<br>
<br>
geosout = LWGEOM_GEOS_makeValid(<wbr>geosgeom);<br>
GEOSGeom_destroy(geosgeom);<br>
- if ( ! geosout )<br>
- {<br>
- return NULL;<br>
- }<br>
+ if (!geosout) return NULL;<br>
<br>
lwgeom_out = GEOS2LWGEOM(geosout, is3d);<br>
GEOSGeom_destroy(geosout);<br>
<br>
- if ( lwgeom_is_collection(lwgeom_<wbr>in) && ! lwgeom_is_collection(lwgeom_<wbr>out) )<br>
- {{<br>
- LWGEOM **ogeoms = lwalloc(sizeof(LWGEOM*));<br>
- LWGEOM *ogeom;<br>
+ if (lwgeom_is_collection(lwgeom_<wbr>in) && !lwgeom_is_collection(lwgeom_<wbr>out))<br>
+ {<br>
+ LWGEOM** ogeoms = lwalloc(sizeof(LWGEOM*));<br>
+ LWGEOM* ogeom;<br>
LWDEBUG(3, "lwgeom_make_valid: forcing multi");<br>
/* NOTE: this is safe because lwgeom_out is surely not lwgeom_in or<br>
* otherwise we couldn't have a collection and a non-collection */<br>
assert(lwgeom_in != lwgeom_out);<br>
ogeoms[0] = lwgeom_out;<br>
- ogeom = (LWGEOM *)lwcollection_construct(<wbr>MULTITYPE[lwgeom_out->type],<br>
- lwgeom_out->srid, lwgeom_out->bbox, 1, ogeoms);<br>
+ ogeom = (LWGEOM*)lwcollection_<wbr>construct(<br>
+ MULTITYPE[lwgeom_out->type], lwgeom_out->srid, lwgeom_out->bbox, 1, ogeoms);<br>
lwgeom_out->bbox = NULL;<br>
lwgeom_out = ogeom;<br>
- }}<br>
+ }<br>
<br>
lwgeom_out->srid = lwgeom_in->srid;<br>
return lwgeom_out;<br>
}<br>
-<br>
<br>
______________________________<wbr>_________________<br>
postgis-tickets mailing list<br>
<a href="mailto:postgis-tickets@lists.osgeo.org">postgis-tickets@lists.osgeo.<wbr>org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-tickets" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-<wbr>tickets</a></blockquote></div><br></div>