[geos-devel]createEmptyGeometry()
strk at refractions.net
strk at refractions.net
Fri Mar 31 05:43:28 EST 2006
On Fri, Mar 31, 2006 at 12:35:12PM +0200, strk at refractions.net wrote:
> On Fri, Mar 31, 2006 at 01:20:51AM +0200, Mateusz £oskot wrote:
> > Martin Davis wrote:
> > > I thought about this, but on the principal of Occam's Razor decided
> > > just to use an empty GC. This has the advantage that there are fewer
> > > cases to handle for both developers and clients.
> >
> > That's clear for me.
> >
> > strk:
> > The only thing I'd do is to review current impl. of GEOS and see if
> > there are any possible runtime bugs.
>
> Code is FULL of assumption about the fact that geometries
> are not EMTPY... just took a look at LineString.cpp, and
> the CoordinateSequence pointer is dereferenced always w/out
> checks.
> Note that the same happens with JTS. Example:
>
> public Coordinate[] getCoordinates() {
> return points.toCoordinateArray();
> }
>
> 'points' is not checked for being NULL.
> In other places it is.
...
Sorry, I had a closer look, at it seems that
LineString refuses to be contructed with a NULL
CoordinateSequence. It creates an *empty*
CoordinateSequence when passed NULL as arg.
Yet another useless waste of memory, similar
to the NULL Envelope and NULL Coordinate representations...
--strk;
More information about the geos-devel
mailing list