From 71d31441636c902e81033cd058ebc67a272f6346 Mon Sep 17 00:00:00 2001 From: Sam Gillingham Date: Tue, 20 Aug 2024 08:32:12 +1000 Subject: [PATCH 1/4] Fix overview writing and reduce warnings from released GDAL --- gdal/keadriver.cpp | 57 +++++++++++++++++++++++++++++++------------- gdal/keaoverview.cpp | 3 ++- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/gdal/keadriver.cpp b/gdal/keadriver.cpp index 8ad3f4d..a16965d 100644 --- a/gdal/keadriver.cpp +++ b/gdal/keadriver.cpp @@ -50,25 +50,48 @@ void GDALRegister_KEA() "KEA Image Format (.kea)" ); poDriver->SetMetadataItem( GDAL_DMD_EXTENSION, "kea" ); poDriver->SetMetadataItem( GDAL_DMD_CREATIONDATATYPES, - "Byte Int16 UInt16 Int32 UInt32 " + "Byte Int8 Int16 UInt16 Int32 UInt32 " #ifdef HAVE_64BITIMAGES - "Int64 UInt64 " + "Int64 UInt64 " #endif - "Float32 Float64" ); - poDriver->SetMetadataItem( GDAL_DMD_CREATIONOPTIONLIST, "\ - \ -" ); - + "Float32 Float64" ); + poDriver->SetMetadataItem( + GDAL_DMD_CREATIONOPTIONLIST, + CPLSPrintf( + " " + "", + static_cast(kealib::KEA_IMAGE_CHUNK_SIZE), + static_cast(kealib::KEA_ATT_CHUNK_SIZE), + static_cast(kealib::KEA_MDC_NELMTS), + static_cast(kealib::KEA_RDCC_NELMTS), + static_cast(kealib::KEA_RDCC_NBYTES), kealib::KEA_RDCC_W0, + static_cast(kealib::KEA_SIEVE_BUF), + static_cast(kealib::KEA_META_BLOCKSIZE), kealib::KEA_DEFLATE)); + poDriver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES"); + poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES"); + poDriver->SetMetadataItem(GDAL_DCAP_CREATE, "YES"); + poDriver->SetMetadataItem(GDAL_DCAP_CREATECOPY, "YES"); + // pointer to open function poDriver->pfnOpen = KEADataset::Open; // pointer to identify function diff --git a/gdal/keaoverview.cpp b/gdal/keaoverview.cpp index 506b6ef..f9a3e35 100644 --- a/gdal/keaoverview.cpp +++ b/gdal/keaoverview.cpp @@ -45,7 +45,8 @@ KEAOverview::KEAOverview(KEADataset *pDataset, int nSrcBand, GDALAccess eAccess, KEAOverview::~KEAOverview() { - + // according to the docs, this is required + this->FlushCache(); } // overridden implementation - calls readFromOverview instead From 6d2ffbe0939bd1e484fb7d20bf64fdb10a7aca64 Mon Sep 17 00:00:00 2001 From: Sam Gillingham Date: Tue, 20 Aug 2024 09:43:10 +1000 Subject: [PATCH 2/4] attempt to fix Windows --- gdal/keadriver.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdal/keadriver.cpp b/gdal/keadriver.cpp index a16965d..529b6e9 100644 --- a/gdal/keadriver.cpp +++ b/gdal/keadriver.cpp @@ -29,8 +29,15 @@ #include "keaband.h" // for HAVE_64BITIMAGES +// CPL_DLL definition seems to have changed for consumers of the library? +#if defined(_MSC_VER) + #define KEA_DLL __declspec(dllexport) +#else + #define KEA_DLL +#endif + CPL_C_START -void CPL_DLL GDALRegister_KEA(void); +void KEA_DLL GDALRegister_KEA(void); CPL_C_END // method to register this driver From 129a4d3b940bbf6149496c9fe0f6fb08d28d7326 Mon Sep 17 00:00:00 2001 From: Sam Gillingham Date: Tue, 20 Aug 2024 10:03:57 +1000 Subject: [PATCH 3/4] try another approach --- gdal/keadriver.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gdal/keadriver.cpp b/gdal/keadriver.cpp index 529b6e9..bb1ac63 100644 --- a/gdal/keadriver.cpp +++ b/gdal/keadriver.cpp @@ -27,17 +27,11 @@ * */ +#define GDAL_COMPILATION #include "keaband.h" // for HAVE_64BITIMAGES -// CPL_DLL definition seems to have changed for consumers of the library? -#if defined(_MSC_VER) - #define KEA_DLL __declspec(dllexport) -#else - #define KEA_DLL -#endif - CPL_C_START -void KEA_DLL GDALRegister_KEA(void); +void CPL_DLL GDALRegister_KEA(void); CPL_C_END // method to register this driver From cd5866c6359b08551eb62090641f482cabe77e22 Mon Sep 17 00:00:00 2001 From: Sam Gillingham Date: Tue, 20 Aug 2024 10:10:06 +1000 Subject: [PATCH 4/4] add comment --- gdal/keadriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdal/keadriver.cpp b/gdal/keadriver.cpp index bb1ac63..6cc51c7 100644 --- a/gdal/keadriver.cpp +++ b/gdal/keadriver.cpp @@ -27,7 +27,7 @@ * */ -#define GDAL_COMPILATION +#define GDAL_COMPILATION // required or linkage confusion on Windows... #include "keaband.h" // for HAVE_64BITIMAGES CPL_C_START