Commit 4ef17d6e authored by Cédric Traizet's avatar Cédric Traizet

ENH: remove version_proxy::Close

parent 47a369c3
......@@ -78,18 +78,6 @@ namespace version_proxy
OTBGdalAdapters_EXPORT
GDALDataset * Open(const char * filename, bool readOnly = true , std::vector< std::string > const & options = std::vector< std::string >() );
/**
* This function closes a dataset.
*
* Calls OGRDataSource::DestroyDataSource for gdal 1.x
* implementation and GDALClose for gdal 2.x implementation.
*
* \param dataset Pointer to the dataset to close. Will not be
* checked for null pointer.
*/
OTBGdalAdapters_EXPORT
void Close(GDALDataset * dataset);
/**
* This function creates a new dataset.
*
......
......@@ -54,7 +54,7 @@ void otb::ogr::DataSource::Reset(GDALDataset * source)
// OGR makes a pointless check for non-nullity in
// GDALDataset::DestroyDataSource (pointless because "delete 0" is
// perfectly valid -> it's a no-op)
ogr::version_proxy::Close(m_DataSource); // void, noexcept
GDALClose(m_DataSource); // void, noexcept
}
m_DataSource = source;
}
......@@ -233,7 +233,7 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
bool ds_exists = (ds!=nullptr);
ogr::version_proxy::Close(ds);
GDALClose(ds);
if (ds_exists && mode == Modes::Overwrite)
......
......@@ -64,15 +64,6 @@ GDALDataset * Open(const char * filename, bool readOnly , std::vector< std::stri
#endif
}
void Close(GDALDataset * dataset)
{
#if GDAL_VERSION_NUM<2000000
OGRDataSource::DestroyDataSource(dataset);
#else
GDALClose(dataset);
#endif
}
GDALDataset * Create(GDALDriver * driver, const char * name , std::vector< std::string > const & options )
{
#if GDAL_VERSION_NUM<2000000
......@@ -101,7 +92,7 @@ bool Delete(const char * name)
if(poDS)
{
poDriver = poDS->GetDriver();
Close(poDS);
GDALClose(poDS);
}
#if GDAL_VERSION_NUM<2000000
if(poDriver && poDriver->TestCapability(ODrCDeleteDataSource))
......
......@@ -62,7 +62,7 @@ OGRVectorDataIO::CanReadFile(const char* filename) const
return false;
}
// std::cout << poDS->GetDriver()->GetName() << std::endl;
ogr::version_proxy::Close(poDS);
GDALClose(poDS);
return true;
}
......@@ -184,7 +184,7 @@ OGRVectorDataIO
void OGRVectorDataIO::CloseInternalDataSource()
{
assert(m_DataSource != NULL && "m_DataSource cannot be NULL");
ogr::version_proxy::Close(m_DataSource);
GDALClose(m_DataSource);
m_DataSource = nullptr;
}
......@@ -226,7 +226,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */)
// free an existing previous data source, if any
if (m_DataSource != nullptr)
{
ogr::version_proxy::Close(m_DataSource);
GDALClose(m_DataSource);
}
// Erase the dataSource if already exist
......@@ -288,7 +288,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */)
otbMsgDevMacro( << "layerKept " << layerKept );
(void)layerKept; // keep compiler happy
otb::ogr::version_proxy::Close(m_DataSource);
GDALClose(m_DataSource);
m_DataSource = nullptr;
if (oSRS != nullptr)
......
......@@ -148,7 +148,7 @@ protected:
{
if (m_OGRDataSourcePointer != nullptr)
{
ogr::version_proxy::Close(m_OGRDataSourcePointer);
GDALClose(m_OGRDataSourcePointer);
}
}
......
......@@ -151,7 +151,7 @@ protected:
if (m_OGRDataSourcePointer != nullptr)
{
ogr::version_proxy::Close(m_OGRDataSourcePointer);
GDALClose(m_OGRDataSourcePointer);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment