This adapts
https://github.com/madler/zlib/commit/4bd9a71f3539b5ce47f0c67ab5e01f3196dc8ef9
(2024-01-14), which appeared in zlib 1.3.1 (2024-01-22), to the snapshot of zlib
in zipfile-deflate64 0.2.0 (2022-01-05). This zlib snapshot is based on zlib
1.2.11 (2017-01-15).

This patch is necessary for compatibility with the Clang compiler in Xcode ≥
16.3: TARGET_OS_MAC as it was used in zutil.h intends to refer to the Classic
Mac OS. This macro has long been defined by the macOS SDK to mean modern macOS,
but was only defined by <TargetConditionals.h>, which was not ordinarily
#included by any part of the zipfile-deflate64 build.
https://github.com/llvm/llvm-project/commit/6e1f19168bca7e3bd4eefda50ba03eac8441dbbf
(2023-12-07, in upstream Clang 18.1, 2024-01-29, and in Xcode 16.3, 2025-03-31)
now has the compiler itself defining this macro unconditionally for Apple
targets
(https://releases.llvm.org/18.1.0/tools/clang/docs/ReleaseNotes.html#clang-frontend-potentially-breaking-changes),
with the effect of breaking code like this that used the macro in a different
way. There was some discussion of this at
https://github.com/madler/zlib/pull/895.

--- zlib/zutil.h	2022-01-05 09:23:23
+++ zlib/zutil.h	2025-09-20 03:33:30
@@ -130,17 +130,8 @@
 #  endif
 #endif
 
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
 #  define OS_CODE  7
-#  ifndef Z_SOLO
-#    if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-#      include <unix.h> /* for fdopen */
-#    else
-#      ifndef fdopen
-#        define fdopen(fd,mode) NULL /* No fdopen() */
-#      endif
-#    endif
-#  endif
 #endif
 
 #ifdef __acorn
@@ -163,19 +154,12 @@
 #  define OS_CODE 19
 #endif
 
-#if defined(_BEOS_) || defined(RISCOS)
-#  define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
 #  if defined(_WIN32_WCE)
-#    define fdopen(fd,mode) NULL /* No fdopen() */
 #    ifndef _PTRDIFF_T_DEFINED
        typedef int ptrdiff_t;
 #      define _PTRDIFF_T_DEFINED
 #    endif
-#  else
-#    define fdopen(fd,type)  _fdopen(fd,type)
 #  endif
 #endif
 
