Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GCC warnings #162

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions liblwgeom/lwgeom_geos.c
Expand Up @@ -19,6 +19,7 @@
**********************************************************************
*
* Copyright 2011-2014 Sandro Santilli <strk@kbt.io>
* Copyright 2017 Darafei Praliaskouski <me@komzpa.net>
*
**********************************************************************/

Expand Down Expand Up @@ -273,18 +274,24 @@ ptarray_to_GEOSLinearRing(const POINTARRAY *pa, int autofix)
*/
if ( ! ptarray_is_closed_2d(pa) || pa->npoints < 4 )
{
pa = ptarray_addPoint(pa, getPoint_internal(pa, 0), FLAGS_NDIMS(pa->flags), pa->npoints);
npa = pa;
npa = ptarray_addPoint(pa, getPoint_internal(pa, 0), FLAGS_NDIMS(pa->flags), pa->npoints);
}
/* Check ring for having at least 4 vertices */
while ( pa->npoints < 4 )
while ( npa->npoints < 4 )
{
ptarray_append_point(pa, getPoint_internal(pa, 0), LW_TRUE);
ptarray_append_point(npa, (POINT4D*)getPoint_internal(npa, 0), LW_TRUE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you use getPoint4d_p instead? Getting addicted to pointing right into the array is a good way to start reading off the end of it.

}
}

sq = ptarray_to_GEOSCoordSeq(pa);
if ( npa ) ptarray_free(npa);
if ( npa )
{
sq = ptarray_to_GEOSCoordSeq(npa);
ptarray_free(npa);
}
else
{
sq = ptarray_to_GEOSCoordSeq(pa);
}
g = GEOSGeom_createLinearRing(sq);
return g;
}
Expand Down Expand Up @@ -2140,4 +2147,3 @@ LWGEOM* lwgeom_voronoi_diagram(const LWGEOM* g, const GBOX* env, double toleranc
return lwgeom_result;
#endif /* POSTGIS_GEOS_VERSION < 35 */
}