1diff -ru zlib-1.2.5/gzlib.c zlib/gzlib.c
2--- zlib-1.2.5/gzlib.c
3+++ zlib/gzlib.c
4@@ -5,7 +5,9 @@
5 
6 #include "gzguts.h"
7 
8-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
9+#if defined(_WIN32)
10+#  define LSEEK _lseeki64
11+#elif defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
12 #  define LSEEK lseek64
13 #else
14 #  define LSEEK lseek
15diff -ru zlib-1.2.5/mozzconf.h zlib/mozzconf.h
16--- zlib-1.2.5/mozzconf.h	2011-12-15 18:10:49.000000000 +0800
17+++ zlib/mozzconf.h	2011-12-16 16:08:00.000000000 +0800
18@@ -0,0 +1,168 @@
19+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
20+/* ***** BEGIN LICENSE BLOCK *****
21+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
22+ *
23+ * The contents of this file are subject to the Mozilla Public License Version
24+ * 1.1 (the "License"); you may not use this file except in compliance with
25+ * the License. You may obtain a copy of the License at
26+ * http://www.mozilla.org/MPL/
27+ *
28+ * Software distributed under the License is distributed on an "AS IS" basis,
29+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
30+ * for the specific language governing rights and limitations under the
31+ * License.
32+ *
33+ * The Original Code is the mozilla zlib configuration.
34+ *
35+ * The Initial Developer of the Original Code is IBM Corporation.
36+ * Portions created by the Initial Developer are Copyright (C) 2004
37+ * the Initial Developer. All Rights Reserved.
38+ *
39+ * Contributor(s):
40+ *
41+ * Alternatively, the contents of this file may be used under the terms of
42+ * either of the GNU General Public License Version 2 or later (the "GPL"),
43+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
44+ * in which case the provisions of the GPL or the LGPL are applicable instead
45+ * of those above. If you wish to allow use of your version of this file only
46+ * under the terms of either the GPL or the LGPL, and not to allow others to
47+ * use your version of this file under the terms of the MPL, indicate your
48+ * decision by deleting the provisions above and replace them with the notice
49+ * and other provisions required by the GPL or the LGPL. If you do not delete
50+ * the provisions above, a recipient may use your version of this file under
51+ * the terms of any one of the MPL, the GPL or the LGPL.
52+ *
53+ * ***** END LICENSE BLOCK ***** */
54+
55+#ifndef MOZZCONF_H
56+#define MOZZCONF_H
57+
58+#if defined(XP_WIN) && defined(ZLIB_DLL) && !defined(MOZ_ENABLE_LIBXUL)
59+#undef ZLIB_DLL
60+#endif
61+
62+#ifdef HAVE_VISIBILITY_ATTRIBUTE
63+#define ZEXTERN __attribute__((visibility ("default"))) extern
64+#endif
65+
66+/* Exported Symbols */
67+#define zlibVersion MOZ_Z_zlibVersion
68+#define deflate MOZ_Z_deflate
69+#define deflateEnd MOZ_Z_deflateEnd
70+#define inflate MOZ_Z_inflate
71+#define inflateEnd MOZ_Z_inflateEnd
72+#define deflateSetDictionary MOZ_Z_deflateSetDictionary
73+#define deflateCopy MOZ_Z_deflateCopy
74+#define deflateReset MOZ_Z_deflateReset
75+#define deflateParams MOZ_Z_deflateParams
76+#define deflateBound MOZ_Z_deflateBound
77+#define deflatePrime MOZ_Z_deflatePrime
78+#define inflateSetDictionary MOZ_Z_inflateSetDictionary
79+#define inflateSync MOZ_Z_inflateSync
80+#define inflateCopy MOZ_Z_inflateCopy
81+#define inflateReset MOZ_Z_inflateReset
82+#define inflateBack MOZ_Z_inflateBack
83+#define inflateBackEnd MOZ_Z_inflateBackEnd
84+#define zlibCompileFlags MOZ_Z_zlibCompileFlags
85+#define compress MOZ_Z_compress
86+#define compress2 MOZ_Z_compress2
87+#define compressBound MOZ_Z_compressBound
88+#define uncompress MOZ_Z_uncompress
89+#define gzopen MOZ_Z_gzopen
90+#define gzdopen MOZ_Z_gzdopen
91+#define gzsetparams MOZ_Z_gzsetparams
92+#define gzread MOZ_Z_gzread
93+#define gzwrite MOZ_Z_gzwrite
94+#define gzprintf MOZ_Z_gzprintf
95+#define gzputs MOZ_Z_gzputs
96+#define gzgets MOZ_Z_gzgets
97+#define gzputc MOZ_Z_gzputc
98+#define gzgetc MOZ_Z_gzgetc
99+#define gzungetc MOZ_Z_gzungetc
100+#define gzflush MOZ_Z_gzflush
101+#define gzseek MOZ_Z_gzseek
102+#define gzrewind MOZ_Z_gzrewind
103+#define gztell MOZ_Z_gztell
104+#define gzeof MOZ_Z_gzeof
105+#define gzclose MOZ_Z_gzclose
106+#define gzerror MOZ_Z_gzerror
107+#define gzclearerr MOZ_Z_gzclearerr
108+#define adler32 MOZ_Z_adler32
109+#define crc32 MOZ_Z_crc32
110+#define deflateInit_ MOZ_Z_deflateInit_
111+#define deflateInit2_ MOZ_Z_deflateInit2_
112+#define inflateInit_ MOZ_Z_inflateInit_
113+#define inflateInit2_ MOZ_Z_inflateInit2_
114+#define inflateBackInit_ MOZ_Z_inflateBackInit_
115+#define inflateSyncPoint MOZ_Z_inflateSyncPoint
116+#define get_crc_table MOZ_Z_get_crc_table
117+#define zError MOZ_Z_zError
118+
119+/* Extra global symbols */
120+#define _dist_code MOZ_Z__dist_code
121+#define _length_code MOZ_Z__length_code
122+#define _tr_align MOZ_Z__tr_align
123+#define _tr_flush_block MOZ_Z__tr_flush_block
124+#define _tr_init MOZ_Z__tr_init
125+#define _tr_stored_block MOZ_Z__tr_stored_block
126+#define _tr_tally MOZ_Z__tr_tally
127+#define deflate_copyright MOZ_Z_deflate_copyright
128+#define inflate_copyright MOZ_Z_inflate_copyright
129+#define inflate_fast MOZ_Z_inflate_fast
130+#define inflate_table MOZ_Z_inflate_table
131+#define z_errmsg MOZ_Z_z_errmsg
132+#define zcalloc MOZ_Z_zcalloc
133+#define zcfree MOZ_Z_zcfree
134+#define alloc_func MOZ_Z_alloc_func
135+#define free_func MOZ_Z_free_func
136+#define in_func MOZ_Z_in_func
137+#define out_func MOZ_Z_out_func
138+
139+/* New as of libpng-1.2.3 */
140+#define adler32_combine MOZ_Z_adler32_combine
141+#define crc32_combine MOZ_Z_crc32_combine
142+#define deflateSetHeader MOZ_Z_deflateSetHeader
143+#define deflateTune MOZ_Z_deflateTune
144+#define gzdirect MOZ_Z_gzdirect
145+#define inflatePrime MOZ_Z_inflatePrime
146+#define inflateGetHeader MOZ_Z_inflateGetHeader
147+
148+/* New as of zlib 1.2.5 */
149+#define gzoffset MOZ_Z_gzoffset
150+#define gzopen64 MOZ_Z_gzopen64
151+#define gzseek64 MOZ_Z_gzseek64
152+#define gztell64 MOZ_Z_gztell64
153+#define gzoffset64 MOZ_Z_gzoffset64
154+#define adler32_combine64 MOZ_Z_adler32_combine64
155+#define crc32_combine64 MOZ_Z_crc32_combine64
156+#define gz_error MOZ_Z_gz_error
157+#define gz_intmax MOZ_Z_gz_intmax
158+#define gz_strwinerror MOZ_Z_gz_strwinerror
159+#define gzbuffer MOZ_Z_gzbuffer
160+#define gzclose_r MOZ_Z_gzclose_r
161+#define gzclose_w MOZ_Z_gzclose_w
162+#define inflateMark MOZ_Z_inflateMark
163+#define inflateReset2 MOZ_Z_inflateReset2
164+#define inflateUndermine MOZ_Z_inflateUndermine
165+#define charf MOZ_Z_charf
166+#define gzFile MOZ_Z_gzFile
167+#define gz_header MOZ_Z_gz_header
168+#define gz_headerp MOZ_Z_gz_headerp
169+#define intf MOZ_Z_intf
170+#define uInt MOZ_Z_uInt
171+#define uIntf MOZ_Z_uIntf
172+#define uLong MOZ_Z_uLong
173+#define uLongf MOZ_Z_uLongf
174+#define voidp MOZ_Z_voidp
175+#define voidpc MOZ_Z_voidpc
176+#define voidpf MOZ_Z_voidpf
177+#define gz_header_s MOZ_Z_gz_header_s
178+#define internal_state MOZ_Z_internal_state
179+
180+/* Mangle Byte types except on Mac. */
181+#if !defined(__MACTYPES__)
182+#define Byte MOZ_Z_Byte
183+#define Bytef MOZ_Z_Bytef
184+#endif
185+
186+#endif
187diff -ru zlib-1.2.5/zconf.h zlib/zconf.h
188--- zlib-1.2.5/zconf.h	2010-04-19 01:58:06.000000000 +0800
189+++ zlib/zconf.h	2011-12-14 08:06:37.000000000 +0800
190@@ -8,6 +8,9 @@
191 #ifndef ZCONF_H
192 #define ZCONF_H
193 
194+/* This include does prefixing as below, but with an updated set of names */
195+#include "mozzconf.h"
196+
197 /*
198  * If you *really* need a unique prefix for all types and library functions,
199  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
200@@ -359,7 +359,7 @@ typedef uLong FAR uLongf;
201    typedef Byte       *voidp;
202 #endif
203 
204-#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
205+#if !defined(_WIN32)
206 #  define Z_HAVE_UNISTD_H
207 #endif
208 
209--- zlib-1.2.5/zlib.h	2010-04-20 12:12:48.000000000 +0800
210+++ zlib/zlib.h	2013-04-06 16:08:48.000000000 +0800
211@@ -1572,11 +1572,29 @@
212 #endif
213 
214 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
215+#  ifdef gzopen
216+#    undef gzopen
217+#  endif
218 #  define gzopen gzopen64
219+#  ifdef gzseek
220+#    undef gzseek
221+#  endif
222 #  define gzseek gzseek64
223+#  ifdef gztell
224+#    undef gztell
225+#  endif
226 #  define gztell gztell64
227+#  ifdef gzoffset
228+#    undef gzoffset
229+#  endif
230 #  define gzoffset gzoffset64
231+#  ifdef adler32_combine
232+#    undef adler32_combine
233+#  endif
234 #  define adler32_combine adler32_combine64
235+#  ifdef crc32_combine
236+#    undef crc32_combine
237+#  endif
238 #  define crc32_combine crc32_combine64
239 #  ifdef _LARGEFILE64_SOURCE
240      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
241