[Gdal-dev] A list of things in the wrappers and geom type in ogr

Ari Jolma ari.jolma at tkk.fi
Mon Oct 10 02:28:35 EDT 2005


Hi,

I submitted a bug report 
http://bugzilla.remotesensing.org/show_bug.cgi?id=951 and did then some 
investigations. The reason turns out to be that in my test.pl I more or 
less blindly create ogr layers of unsupported types. The result was a 
strange memory corruption which was very hard to debug. Frank has 
written "// I should be verifying that the geometry matches the defn's 
type." into SetGeometry. Could we have it there, i.e. something like:  
if (poGeometry->getGeometryType() != poDefn->GetGeomType()) return 
OGRERR_UNSUPPORTED_GEOMETRY_TYPE;?

Also shapefile layers can be created with unsupported geom type.

I tried the unsupported error and it lead me to noticing that the 
wrappers use throw but do not catch. Don't we need something like

try{
    result = (OGRErr)OGRFeatureShadow_SetGeometry(arg1,arg2);
}
catch (int e) {
    SWIG_exception( SWIG_RuntimeError, OGRErrMessages(e) );
}

in the wrappers (but more general, in the cpl_exceptions.i)?

Still one more thing, null pointers and wrapper functions. Is the plan 
to test for inappropriate null pointers in the wrapper functions, or do 
we write the checks into typemaps? Now the situation is still that it is 
far too easy to create a segfault with undefined script variables thrown 
at methods.

Cheers,

Ari

-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list