Add iOS compile-time check for inflateValidate

Don't use inflateValidate if targeting pre-iOS 11.
This commit is contained in:
Dimitri Schoolwerth 2020-12-17 02:16:30 +01:00
parent 759dc457a8
commit fd4a538c67
No known key found for this signature in database
GPG Key ID: 9DC3A9240BDC6737

View File

@ -27,16 +27,27 @@
* minimal supported OS version. * minimal supported OS version.
*/ */
/* For MAC_OS_X_VERSION_MIN_REQUIRED. /* For TARGET_OS_IPHONE / TARGET_OS_MAC */
# include <TargetConditionals.h>
/* For IPHONE_OS_VERSION_MIN_REQUIRED / MAC_OS_X_VERSION_MIN_REQUIRED.
* Not using the preferred <Availability.h> because it was introduced * Not using the preferred <Availability.h> because it was introduced
* during the 10.5 SDK while this header has been available with Xcode * during the 10.5 SDK while this header has been available with Xcode
* since 1.0 (10.3 SDK). * since 1.0 (10.3 SDK).
*/ */
# include <AvailabilityMacros.h> # include <AvailabilityMacros.h>
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
MAC_OS_X_VERSION_MIN_REQUIRED < 101300 # if defined(IPHONE_OS_VERSION_MIN_REQUIRED) && \
/* Don't use if targeting pre-macOS 10.13. */ IPHONE_OS_VERSION_MIN_REQUIRED < 110000
# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 /* Don't use if targeting pre-iOS 11.0. */
# define PNG_USE_ZLIB_INFLATE_VALIDATE 0
# endif
# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
# 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 # endif
# endif /* __APPLE__ && __MACH__ */ # endif /* __APPLE__ && __MACH__ */
# else # else