[Gdal-dev] ogr2ogr little patch delete feature
Julien Demaria
dem at acri-st.fr
Thu Apr 14 09:33:10 EDT 2005
Is OGRFeature::DestroyFeature better than delete feature ?
@@ -758,41 +758,44 @@
CPLErrorReset();
poDstFeature = OGRFeature::CreateFeature(
poDstLayer->GetLayerDefn() );
if( poDstFeature->SetFrom( poFeature, TRUE ) != OGRERR_NONE )
{
if( nGroupTransactions )
poDstLayer->CommitTransaction();
- delete poFeature;
-
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to translate feature %d from layer %s.\n",
poFeature->GetFID(), poFDefn->GetName() );
+
+ delete poFeature;
return FALSE;
}
if( bPreserveFID )
poDstFeature->SetFID( poFeature->GetFID() );
if( poCT && poDstFeature->GetGeometryRef() != NULL )
{
eErr = poDstFeature->GetGeometryRef()->transform( poCT );
if( eErr != OGRERR_NONE )
{
if( nGroupTransactions )
poDstLayer->CommitTransaction();
printf( "Failed to transform feature %d.\n",
(int) poFeature->GetFID() );
if( !bSkipFailures )
+ {
+ delete poFeature;
return FALSE;
+ }
}
}
if( poDstFeature->GetGeometryRef() != NULL && bForceToPolygon )
{
poDstFeature->SetGeometryDirectly(
OGRGeometryFactory::forceToPolygon(
poDstFeature->StealGeometry() ) );
}
More information about the Gdal-dev
mailing list