Commit 815ea43 for zlib

commit 815ea430b8be2f8dddca968d5562325d3d899b0c
Author: Mark Adler <git@madler.net>
Date:   Fri Oct 30 19:11:32 2026 -0700

    Enable 64-bit offsets in Windows, default to long for z_off_t.

    The long long type is not always available, so the backup type for
    z_off_t is restored to long. Instead allow 64-bit offsets on
    Windows in MSVC or MinGW by defining either _LARGEFILE64_SOURCE to
    get *64 functions, or _FILE_OFFSET_BITS=64 to make z_off_t 64 bits,
    when compiling an application with zlib. No changes are needed to
    the already-compiled library.

diff --git a/zconf.h b/zconf.h
index 828ca61..3d308f6 100644
--- a/zconf.h
+++ b/zconf.h
@@ -499,6 +499,10 @@ typedef uLong FAR uLongf;

 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
 #  define Z_LFS64
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
+      !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
+#  define Z_LFS64       /* native Windows has 64-bit file offsets */
+#  define Z_WINLFS
 #endif

 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
@@ -516,7 +520,7 @@ typedef uLong FAR uLongf;
 #endif

 #ifndef z_off_t
-#  define z_off_t long long
+#  define z_off_t long
 #endif

 #if !defined(_WIN32) && defined(Z_LARGE64)
@@ -531,6 +535,11 @@ typedef uLong FAR uLongf;
 #  define z_off64_t z_off_t
 #endif

+#if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
+#  undef z_off_t
+#  define z_off_t z_off64_t
+#endif
+
 /* MVS linker does not support external names larger than 8 bytes */
 #if defined(__MVS__)
   #pragma map(deflateInit_,"DEIN")
diff --git a/zconf.h.in b/zconf.h.in
index 828ca61..3d308f6 100644
--- a/zconf.h.in
+++ b/zconf.h.in
@@ -499,6 +499,10 @@ typedef uLong FAR uLongf;

 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
 #  define Z_LFS64
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
+      !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
+#  define Z_LFS64       /* native Windows has 64-bit file offsets */
+#  define Z_WINLFS
 #endif

 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
@@ -516,7 +520,7 @@ typedef uLong FAR uLongf;
 #endif

 #ifndef z_off_t
-#  define z_off_t long long
+#  define z_off_t long
 #endif

 #if !defined(_WIN32) && defined(Z_LARGE64)
@@ -531,6 +535,11 @@ typedef uLong FAR uLongf;
 #  define z_off64_t z_off_t
 #endif

+#if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
+#  undef z_off_t
+#  define z_off_t z_off64_t
+#endif
+
 /* MVS linker does not support external names larger than 8 bytes */
 #if defined(__MVS__)
   #pragma map(deflateInit_,"DEIN")
diff --git a/zlib.h b/zlib.h
index b6de239..1e874f8 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1983,7 +1983,8 @@ ZEXTERN int ZEXPORT gzgetc_(gzFile file);       /* backward compatibility */
  * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
  * both are true, the application gets the *64 functions, and the regular
  * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
+ * without large file support, _LFS64_LARGEFILE must also be true, except on
+ * native Windows, where 64-bit offsets are always available
  */
 #ifdef Z_LARGE64
    ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);