From 0cf627bbbad84df4fae96f49ad7be3b1bb1f1cd1 Mon Sep 17 00:00:00 2001
From: Cedric <cedric.traizet@c-s.fr>
Date: Fri, 4 Jan 2019 09:47:25 +0100
Subject: [PATCH] ENH: remove GetDriverNameFromDataSource()

---
 .../Adapters/GdalAdapters/include/otbOGRVersionProxy.h   | 3 ---
 Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx | 9 ---------
 .../Applications/AppSegmentation/app/otbSegmentation.cxx | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
index b229385ac6..9194ef811d 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
@@ -137,9 +137,6 @@ namespace version_proxy
   OTBGdalAdapters_EXPORT 
   GDALDriverType *  GetDriverByName(const char * name);
 
-  OTBGdalAdapters_EXPORT
-  std::string GetDriverNameFromDataSource(const GDALDatasetType * ds);
-
   /**
    * Return the list of files composing the dataset.
    * 
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx
index db2ac78141..7a70e6efb2 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx
@@ -201,15 +201,6 @@ std::vector<std::string> GetAvailableDriversAsStringVector()
   return ret;
 }
 
-std::string GetDriverNameFromDataSource(const GDALDatasetType * ds)
-{
-#if GDAL_VERSION_NUM<2000000
-  return std::string(const_cast<GDALDatasetType *>(ds)->GetDriver()->GetName());
-#else
-  return std::string(const_cast<GDALDatasetType *>(ds)->GetDriverName());
-#endif
-}
-
 /*----------------------[GDAL 2.2 change on IsFieldSet()]---------------------*/
 bool IsFieldSetAndNotNull(OGRFeature *feat, int index)
 {
diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
index ab2ea6779d..b3594c3b38 100644
--- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
@@ -689,7 +689,7 @@ private:
         //Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource,
         //so we must access the OGR pointer by using .ogr()
 
-        std::string driverName(otb::ogr::version_proxy::GetDriverNameFromDataSource(&ogrDS->ogr()));
+        std::string driverName(ogrDS->ogr().GetDriverName());
         if ( driverName.find("ESRI Shapefile") != std::string::npos)
           {
           otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
-- 
GitLab