From d5fe06b792df18b46fbf118831b3d232932e3fb5 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 9 Jan 2025 19:40:40 +0100 Subject: [PATCH 1/4] Fix build in infback9 on MacOS and unity builds Fixes https://github.com/OSGeo/gdal/actions/runs/12695906104/job/35388828521?pr=11609 ``` In file included from /Users/runner/work/gdal/gdal/frmts/zlib/contrib/infback9/infback9.c:6: /Users/runner/work/gdal/gdal/frmts/zlib/contrib/infback9/minified_zutil.h:175:11: error: 'OS_CODE' macro redefined [-Werror,-Wmacro-redefined] [ 5%] Building CXX object apps/CMakeFiles/appslib.dir/Unity/unity_3_cxx.cxx.o 175 | # define OS_CODE 19 | ^ /Users/runner/work/gdal/gdal/frmts/zlib/contrib/infback9/minified_zutil.h:146:11: note: previous definition is here 146 | # define OS_CODE 7 | ^ ``` --- frmts/zlib/contrib/infback9/minified_zutil.h | 87 -------------------- 1 file changed, 87 deletions(-) diff --git a/frmts/zlib/contrib/infback9/minified_zutil.h b/frmts/zlib/contrib/infback9/minified_zutil.h index 102320ba685e..78aacd5032ee 100644 --- a/frmts/zlib/contrib/infback9/minified_zutil.h +++ b/frmts/zlib/contrib/infback9/minified_zutil.h @@ -92,89 +92,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(_WIN32)) -# define OS_CODE 0x00 -# ifndef Z_SOLO -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 1 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 2 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#ifdef __370__ -# if __TARGET_LIB__ < 0x20000000 -# define OS_CODE 4 -# elif __TARGET_LIB__ < 0x40000000 -# define OS_CODE 11 -# else -# define OS_CODE 8 -# endif -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 5 -#endif - -#ifdef OS2 -# define OS_CODE 6 -# if defined(M_I86) && !defined(Z_SOLO) -# include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif -#endif - -#ifdef __acorn -# define OS_CODE 13 -#endif - -#if defined(_WIN32) && !defined(__CYGWIN__) -# define OS_CODE 10 -#endif - -#ifdef _BEOS_ -# define OS_CODE 16 -#endif - -#ifdef __TOS_OS400__ -# define OS_CODE 18 -#endif - -#ifdef __APPLE__ -# define OS_CODE 19 -#endif - #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif @@ -203,10 +120,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* common defaults */ -#ifndef OS_CODE -# define OS_CODE 3 /* assume Unix */ -#endif - #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) #endif From e2d46a6d7cc10502db9f5eff3921262f9436e8e8 Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Thu, 9 Jan 2025 19:49:37 +0000 Subject: [PATCH 2/4] tif_jxl: Add include for TIFF type and use TIFF_SIZE_FORMAT for error. Ran into errors on a custom Android build on Arm. --- frmts/gtiff/tif_jxl.c | 4 ++-- frmts/gtiff/tif_jxl.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frmts/gtiff/tif_jxl.c b/frmts/gtiff/tif_jxl.c index 4634fad4558d..1e7a6af4b3b1 100644 --- a/frmts/gtiff/tif_jxl.c +++ b/frmts/gtiff/tif_jxl.c @@ -413,8 +413,8 @@ static int JXLPreDecode(TIFF *tif, uint16_t s) if (buffer_size != channel_size) { TIFFErrorExtR(tif, module, - "JxlDecoderExtraChannelBufferSize returned %ld, " - "expecting %u", + "JxlDecoderExtraChannelBufferSize returned " + "%" TIFF_SIZE_FORMAT ", expecting %u", buffer_size, channel_size); _TIFFfreeExt(tif, extra_channel_buffer); return 0; diff --git a/frmts/gtiff/tif_jxl.h b/frmts/gtiff/tif_jxl.h index 2827322c7541..5edfe9da9e87 100644 --- a/frmts/gtiff/tif_jxl.h +++ b/frmts/gtiff/tif_jxl.h @@ -25,6 +25,8 @@ #ifndef TIFF_JXL_H_DEFINED #define TIFF_JXL_H_DEFINED +#include "tiffio.h" + #ifndef COMPRESSION_JXL #define COMPRESSION_JXL \ 50002 /* JPEGXL: WARNING not registered in Adobe-maintained registry */ From c6bedc3cd47ca133a27af91d95fdef79b8241bfe Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 9 Jan 2025 22:11:36 +0100 Subject: [PATCH 3/4] Python bindings: fix Algorithm.GetAsDatasetValue() memory leak (master only) --- swig/include/Algorithm.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swig/include/Algorithm.i b/swig/include/Algorithm.i index 8a07b9412bf8..da869b0c130f 100644 --- a/swig/include/Algorithm.i +++ b/swig/include/Algorithm.i @@ -162,7 +162,7 @@ public: return GDALAlgorithmArgGetAsDouble(self); } -%newobject GetAsDataset; +%newobject GetAsDatasetValue; GDALArgDatasetValueHS* GetAsDatasetValue() { return GDALAlgorithmArgGetAsDatasetValue(self); } From 87d8e066bcbec5cbb794faa0ec9f37f96c7b5253 Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Thu, 9 Jan 2025 16:32:21 -0800 Subject: [PATCH 4/4] cpl_error.h: Move the include of stdbool for CPLErrorOnce into the header. (#11625) Callers of things in cpl_error.h should not have to be aware of internally required includes. --- frmts/aigrid/gridlib.c | 2 -- port/cpl_error.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frmts/aigrid/gridlib.c b/frmts/aigrid/gridlib.c index ac4423c82536..330cda968320 100644 --- a/frmts/aigrid/gridlib.c +++ b/frmts/aigrid/gridlib.c @@ -13,8 +13,6 @@ #include "aigrid.h" -#include - #ifndef CPL_IGNORE_RET_VAL_INT_defined #define CPL_IGNORE_RET_VAL_INT_defined diff --git a/port/cpl_error.h b/port/cpl_error.h index a4d8fcd0a862..63eaa6f3c37b 100644 --- a/port/cpl_error.h +++ b/port/cpl_error.h @@ -17,6 +17,7 @@ #include "cpl_port.h" #include +#include #include /*=====================================================================