Fix FTBFS with GDAL 3.13.0.
authorBas Couwenberg <sebastic@debian.org>
Fri, 8 May 2026 12:41:38 +0000 (14:41 +0200)
committerDrew Parsons <dparsons@debian.org>
Fri, 8 May 2026 12:41:38 +0000 (14:41 +0200)
error: invalid conversion from 'CSLConstList' {aka 'const char* const*'} to 'char**' [-fpermissive]

From GDAL 3.13.0 NEWS:
"
 * GDALMajorObject: Use CSLConstList for GetMetadata, SetMetadata (API breakage)
"

Gbp-Pq: Name gdal-3.13.patch

IO/GDAL/vtkGDALRasterReader.cxx

index 2069e78af1e103c16f0ea84c83f20420100d4b92..8293d95a1e59ac89a90e9e2197437f9d358b6e80 100644 (file)
@@ -182,7 +182,11 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::ReadMetaData(const std::s
     this->Reader->DriverShortName = GDALGetDriverShortName(driver);
     this->Reader->DriverLongName = GDALGetDriverLongName(driver);
 
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3, 13, 0)
+    CSLConstList papszMetaData = GDALGetMetadata(this->GDALData, nullptr);
+#else
     char** papszMetaData = GDALGetMetadata(this->GDALData, nullptr);
+#endif
     if (CSLCount(papszMetaData) > 0)
     {
       for (int i = 0; papszMetaData[i] != nullptr; ++i)
@@ -878,7 +882,11 @@ std::vector<std::string> vtkGDALRasterReader::GetDomainMetaData(const std::strin
 {
   std::vector<std::string> domainMetaData;
 
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3, 13, 0)
+  CSLConstList papszMetadata = GDALGetMetadata(this->Impl->GDALData, domain.c_str());
+#else
   char** papszMetadata = GDALGetMetadata(this->Impl->GDALData, domain.c_str());
+#endif
 
   if (CSLCount(papszMetadata) > 0)
   {