Fix continued undesired usage of inflateValidate

Macro MAC_OS_X_VERSION_MIN_REQUIRED isn't present through, coincidental,
inclusion of <Availability.h>, which means inflateValidate can still be
used resulting in a warning when targeting pre-10.13 and a crash if
called pre-10.13 as described in (attempted fix) bda2970c65.

Fix by including the needed header explicitly.
This commit is contained in:
Dimitri Schoolwerth 2020-12-17 01:49:19 +01:00
parent dfc331f0bd
commit 759dc457a8
No known key found for this signature in database
GPG Key ID: 9DC3A9240BDC6737

View File

@ -22,14 +22,23 @@
/* Check if zlib's inflateValidate can be used. */
# if ZLIB_VERNUM >= 0x1290 && \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
/* Determine at compile-time whether inflateValidate is available by
* minimal supported OS version.
*/
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
MAC_OS_X_VERSION_MIN_REQUIRED < 101300
/* Don't use if targeting pre-macOS 10.13. */
# define PNG_USE_ZLIB_INFLATE_VALIDATE 0
# endif
# if defined(__APPLE__) && defined(__MACH__)
/* Determine at compile-time whether inflateValidate is available by
* minimal supported OS version.
*/
/* For MAC_OS_X_VERSION_MIN_REQUIRED.
* Not using the preferred <Availability.h> because it was introduced
* during the 10.5 SDK while this header has been available with Xcode
* since 1.0 (10.3 SDK).
*/
# include <AvailabilityMacros.h>
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
MAC_OS_X_VERSION_MIN_REQUIRED < 101300
/* Don't use if targeting pre-macOS 10.13. */
# define PNG_USE_ZLIB_INFLATE_VALIDATE 0
# endif
# endif /* __APPLE__ && __MACH__ */
# else
# define PNG_USE_ZLIB_INFLATE_VALIDATE 0
# endif /* ZLIB_VERNUM && PNG_SET_OPTION_SUPPORTED && PNG_IGNORE_ADLER32 */