File zlib-1.2.5-tml.patch of Package mingw32-zlib

--- zlib-1.2.5/gzguts.h	2010-04-18 21:28:32.000000000 +0200
+++ zlib-1.2.5/gzguts.h	2010-09-01 15:22:54.000000000 +0200
@@ -12,7 +12,7 @@
 #  endif
 #endif
 
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#if !defined(_WIN32) && ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
 #  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
 #else
 #  define ZLIB_INTERNAL
--- zlib-1.2.5/gzlib.c	2010-04-18 19:53:22.000000000 +0200
+++ zlib-1.2.5/gzlib.c	2010-09-01 15:22:54.000000000 +0200
@@ -5,11 +5,15 @@
 
 #include "gzguts.h"
 
+#if defined(_WIN32)
+#  define LSEEK _lseeki64
+#else
 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
 #  define LSEEK lseek64
 #else
 #  define LSEEK lseek
 #endif
+#endif
 
 /* Local functions */
 local void gz_reset OF((gz_statep));
--- zlib-1.2.5/win32/Makefile.gcc	2010-04-19 03:35:55.000000000 +0200
+++ zlib-1.2.5/win32/Makefile.gcc	2010-09-01 15:23:34.000000000 +0200
@@ -25,7 +25,7 @@
 
 STATICLIB = libz.a
 SHAREDLIB = zlib1.dll
-IMPLIB    = libzdll.a
+IMPLIB    = libz.dll.a
 
 #
 # Set to 1 if shared object needs to be installed
@@ -66,7 +66,7 @@
        gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
 OBJA =
 
-all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
+all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example_d.exe minigzip_d.exe
 
 test: example.exe minigzip.exe
 	./example
--- zlib-1.2.5/zconf.h.in	2010-04-18 19:58:06.000000000 +0200
+++ zlib-1.2.5/zconf.h.in	2010-09-01 15:22:54.000000000 +0200
@@ -270,7 +270,31 @@
 #  endif
 #endif
 
+/* When a specific build of zlib is done on Windows, it is either a
+ * DLL or not. That build should have a specific corresponding zconf.h
+ * distributed. The zconf.h thus knows a priori whether the
+ * corresponding library was built as a DLL or not. Requiring the
+ * library user to define ZLIB_DLL when compiling, and intending to
+ * link against the import library for such a DLL build, is
+ * silly. Instead just unconditionally define ZLIB_DLL here as this
+ * build is a DLL, period.
+ *
+ * Similarly, when a specific build of zlib is done on (32-bit)
+ * Windows, it either uses the WINAPI calling convention or not. A
+ * user of a prebuilt library can not choose later. So it is pointless
+ * to require the user to define ZLIB_WINAPI when compiling. Instead,
+ * just have a specific copy of this zconf.h that corresponds to that
+ * build of zlib. In the case here, we don't build zlib with WINAPI,
+ * so ignore any attempt by a misguided user to use it.
+ */
+
+#undef ZLIB_DLL
+#define ZLIB_DLL 1
+
+#undef ZLIB_WINAPI
+
 #if defined(WINDOWS) || defined(WIN32)
+   /* NOTE: Bogus. See above comment about ZLIB_DLL */
    /* If building or using zlib as a DLL, define ZLIB_DLL.
     * This is not mandatory, but it offers a little performance increase.
     */
@@ -283,6 +307,8 @@
 #      endif
 #    endif
 #  endif  /* ZLIB_DLL */
+
+   /* NOTE: Bogus. See above comment about ZLIB_WINAPI */
    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
     * define ZLIB_WINAPI.
     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
@@ -364,17 +390,23 @@
 #  include <sys/types.h>    /* for off_t */
 #endif
 
+/* LFS conventions have no meaning on Windows. Looking for feature
+ * macros like _LARGEFILE64_SOURCE or _FILE_OFFSET_BITS on Windows is
+ * wrong. So make sure any such macros misguidedly defined by the user
+ * have no effect.
+ */
+
 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
  * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
  * though the former does not conform to the LFS document), but considering
  * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  * equivalently requesting no 64-bit operations
  */
-#if -_LARGEFILE64_SOURCE - -1 == 1
+#if !defined(_WIN32) && -_LARGEFILE64_SOURCE - -1 == 1
 #  undef _LARGEFILE64_SOURCE
 #endif
 
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#if !defined(_WIN32) && (defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE))
 #  include <unistd.h>       /* for SEEK_* and off_t */
 #  ifdef VMS
 #    include <unixio.h>     /* for off_t */
@@ -394,11 +426,15 @@
 #  define z_off_t long
 #endif
 
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)
 #  define z_off64_t off64_t
 #else
+#  if defined(_WIN32)
+#    define z_off64_t __int64
+#  else
 #  define z_off64_t z_off_t
 #endif
+#endif
 
 #if defined(__OS400__)
 #  define NO_vsnprintf
--- zlib-1.2.5/zlib.h	2010-04-20 06:12:48.000000000 +0200
+++ zlib-1.2.5/zlib.h	2010-09-01 15:22:54.000000000 +0200
@@ -1556,13 +1556,21 @@
         inflateBackInit_((strm), (windowBits), (window), \
                                             ZLIB_VERSION, sizeof(z_stream))
 
+/* LFS conventions have no meaning on Windows. Looking for feature
+ * macros like _LARGEFILE64_SOURCE or _FILE_OFFSET_BITS on Windows is
+ * wrong. So make sure any such macros misguidedly defined by the user
+ * have no effect. Windows has large file support, period. So, no
+ * problem in always providing this API on Windows.
+ */
+
 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
  * 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
  */
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+
+#if defined(_WIN32) || (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)
    ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
    ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
    ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
@@ -1571,7 +1579,7 @@
    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
 #endif
 
-#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
+#if !defined(_WIN32) && !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
 #  define gzopen gzopen64
 #  define gzseek gzseek64
 #  define gztell gztell64
--- zlib-1.2.5/zutil.h	2010-04-18 21:29:24.000000000 +0200
+++ zlib-1.2.5/zutil.h	2010-09-01 15:22:54.000000000 +0200
@@ -13,7 +13,7 @@
 #ifndef ZUTIL_H
 #define ZUTIL_H
 
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#if !defined(_WIN32) && ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
 #  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
 #else
 #  define ZLIB_INTERNAL
@@ -160,7 +160,7 @@
 #endif
 
 /* provide prototypes for these when building zlib without LFS */
-#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
+#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
 #endif
openSUSE Build Service is sponsored by