summaryrefslogtreecommitdiffstats
path: root/zlib
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2012-03-02 17:15:20 +0000
committerMatthias Klose <doko@gcc.gnu.org>2012-03-02 17:15:20 +0000
commit43743d63b3e6026088cb5bacca87ccc08acd97cd (patch)
tree08301625dedcb8a8837a464f46ca0292c54c5ecb /zlib
parentarm.c (arm_sat_operator_match): New function. (diff)
downloadgcc-43743d63b3e6026088cb5bacca87ccc08acd97cd.tar.gz
gcc-43743d63b3e6026088cb5bacca87ccc08acd97cd.tar.bz2
gcc-43743d63b3e6026088cb5bacca87ccc08acd97cd.tar.xz
2012-03-02 Matthias Klose <doko@ubuntu.com>
* Imported zlib 1.2.5; merged local changes. From-SVN: r184805
Diffstat (limited to 'zlib')
-rw-r--r--zlib/CMakeLists.txt190
-rw-r--r--zlib/ChangeLog355
-rw-r--r--zlib/ChangeLog.gcj4
-rw-r--r--zlib/FAQ261
-rw-r--r--zlib/INDEX30
-rw-r--r--zlib/Makefile.am5
-rw-r--r--zlib/Makefile.in47
-rw-r--r--zlib/README86
-rw-r--r--zlib/adler32.c38
-rw-r--r--zlib/amiga/Makefile.pup9
-rw-r--r--zlib/amiga/Makefile.sas9
-rw-r--r--zlib/compress.c5
-rw-r--r--zlib/contrib/README.contrib22
-rw-r--r--zlib/contrib/amd64/amd64-match.S452
-rw-r--r--zlib/contrib/asm586/README.58643
-rw-r--r--zlib/contrib/asm586/match.S364
-rw-r--r--zlib/contrib/asm686/README.68617
-rw-r--r--zlib/contrib/asm686/match.S24
-rw-r--r--zlib/contrib/delphi/ZLib.pas2
-rw-r--r--zlib/contrib/delphi/zlibd32.mak16
-rw-r--r--zlib/contrib/dotzlib/DotZLib.build4
-rw-r--r--zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs20
-rw-r--r--zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs10
-rw-r--r--zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs4
-rw-r--r--zlib/contrib/dotzlib/DotZLib/CodecBase.cs8
-rw-r--r--zlib/contrib/dotzlib/DotZLib/Deflater.cs6
-rw-r--r--zlib/contrib/dotzlib/DotZLib/DotZLib.cs20
-rw-r--r--zlib/contrib/dotzlib/DotZLib/GZipStream.cs18
-rw-r--r--zlib/contrib/dotzlib/DotZLib/Inflater.cs6
-rw-r--r--zlib/contrib/dotzlib/DotZLib/UnitTests.cs8
-rw-r--r--zlib/contrib/dotzlib/readme.txt18
-rw-r--r--zlib/contrib/gcc_gvmat64/gvmat64.S574
-rw-r--r--zlib/contrib/infback9/infback9.c91
-rw-r--r--zlib/contrib/infback9/inftree9.c21
-rw-r--r--zlib/contrib/infback9/inftree9.h24
-rw-r--r--zlib/contrib/inflate86/inffas86.c2
-rw-r--r--zlib/contrib/masm686/match.asm413
-rw-r--r--zlib/contrib/masmx64/gvmat64.asm52
-rw-r--r--zlib/contrib/masmx64/inffas8664.c6
-rw-r--r--zlib/contrib/masmx64/inffasx64.asm12
-rw-r--r--zlib/contrib/masmx64/readme.txt7
-rw-r--r--zlib/contrib/masmx86/bld_ml32.bat4
-rw-r--r--zlib/contrib/masmx86/gvmat32.asm972
-rw-r--r--zlib/contrib/masmx86/gvmat32c.c62
-rw-r--r--zlib/contrib/masmx86/inffas32.asm12
-rw-r--r--zlib/contrib/masmx86/match686.asm478
-rwxr-xr-xzlib/contrib/masmx86/mkasm.bat3
-rw-r--r--zlib/contrib/masmx86/readme.txt48
-rw-r--r--zlib/contrib/minizip/ChangeLogUnzip67
-rw-r--r--zlib/contrib/minizip/MiniZip64_Changes.txt6
-rw-r--r--zlib/contrib/minizip/MiniZip64_info.txt74
-rw-r--r--zlib/contrib/minizip/crypt.h17
-rw-r--r--zlib/contrib/minizip/ioapi.c220
-rw-r--r--zlib/contrib/minizip/ioapi.h181
-rw-r--r--zlib/contrib/minizip/iowin32.c309
-rw-r--r--zlib/contrib/minizip/iowin32.h15
-rw-r--r--zlib/contrib/minizip/make_vms.com25
-rw-r--r--zlib/contrib/minizip/miniunz.c141
-rw-r--r--zlib/contrib/minizip/minizip.c131
-rw-r--r--zlib/contrib/minizip/mztools.c30
-rw-r--r--zlib/contrib/minizip/mztools.h8
-rw-r--r--zlib/contrib/minizip/unzip.c1283
-rw-r--r--zlib/contrib/minizip/unzip.h127
-rw-r--r--zlib/contrib/minizip/zip.c1829
-rw-r--r--zlib/contrib/minizip/zip.h175
-rw-r--r--zlib/contrib/pascal/zlibd32.mak16
-rw-r--r--zlib/contrib/pascal/zlibpas.pas2
-rw-r--r--zlib/contrib/puff/puff.c214
-rw-r--r--zlib/contrib/puff/puff.h4
-rw-r--r--zlib/contrib/testzlib/testzlib.c6
-rw-r--r--zlib/contrib/vstudio/readme.txt39
-rw-r--r--zlib/contrib/vstudio/vc10/miniunz.vcxproj310
-rw-r--r--zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters22
-rw-r--r--zlib/contrib/vstudio/vc10/miniunz.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc10/minizip.vcxproj307
-rw-r--r--zlib/contrib/vstudio/vc10/minizip.vcxproj.filters22
-rw-r--r--zlib/contrib/vstudio/vc10/minizip.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc10/testzlib.vcxproj420
-rw-r--r--zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters58
-rw-r--r--zlib/contrib/vstudio/vc10/testzlib.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc10/testzlibdll.vcxproj310
-rw-r--r--zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters22
-rw-r--r--zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc10/zlib.rc (renamed from zlib/contrib/vstudio/vc7/zlib.rc)10
-rw-r--r--zlib/contrib/vstudio/vc10/zlibstat.vcxproj457
-rw-r--r--zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters77
-rw-r--r--zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc10/zlibvc.def (renamed from zlib/contrib/vstudio/vc7/zlibvc.def)44
-rw-r--r--zlib/contrib/vstudio/vc10/zlibvc.sln135
-rw-r--r--zlib/contrib/vstudio/vc10/zlibvc.vcxproj659
-rw-r--r--zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters118
-rw-r--r--zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user3
-rw-r--r--zlib/contrib/vstudio/vc7/miniunz.vcproj126
-rw-r--r--zlib/contrib/vstudio/vc7/minizip.vcproj126
-rw-r--r--zlib/contrib/vstudio/vc7/testzlib.vcproj126
-rw-r--r--zlib/contrib/vstudio/vc7/zlibstat.vcproj246
-rw-r--r--zlib/contrib/vstudio/vc7/zlibvc.sln78
-rw-r--r--zlib/contrib/vstudio/vc7/zlibvc.vcproj445
-rw-r--r--zlib/contrib/vstudio/vc9/miniunz.vcproj (renamed from zlib/contrib/vstudio/vc8/miniunz.vcproj)81
-rw-r--r--zlib/contrib/vstudio/vc9/minizip.vcproj (renamed from zlib/contrib/vstudio/vc8/minizip.vcproj)83
-rw-r--r--zlib/contrib/vstudio/vc9/testzlib.vcproj (renamed from zlib/contrib/vstudio/vc8/testzlib.vcproj)136
-rw-r--r--zlib/contrib/vstudio/vc9/testzlibdll.vcproj (renamed from zlib/contrib/vstudio/vc8/testzlibdll.vcproj)82
-rw-r--r--zlib/contrib/vstudio/vc9/zlib.rc (renamed from zlib/contrib/vstudio/vc8/zlib.rc)10
-rw-r--r--zlib/contrib/vstudio/vc9/zlibstat.vcproj (renamed from zlib/contrib/vstudio/vc8/zlibstat.vcproj)87
-rw-r--r--zlib/contrib/vstudio/vc9/zlibvc.def (renamed from zlib/contrib/vstudio/vc8/zlibvc.def)44
-rw-r--r--zlib/contrib/vstudio/vc9/zlibvc.sln (renamed from zlib/contrib/vstudio/vc8/zlibvc.sln)20
-rw-r--r--zlib/contrib/vstudio/vc9/zlibvc.vcproj (renamed from zlib/contrib/vstudio/vc8/zlibvc.vcproj)133
-rw-r--r--zlib/crc32.c35
-rw-r--r--zlib/deflate.c268
-rw-r--r--zlib/deflate.h35
-rw-r--r--zlib/doc/algorithm.txt (renamed from zlib/algorithm.txt)2
-rw-r--r--zlib/doc/rfc1950.txt619
-rw-r--r--zlib/doc/rfc1951.txt955
-rw-r--r--zlib/doc/rfc1952.txt675
-rw-r--r--zlib/doc/txtvsbin.txt107
-rw-r--r--zlib/example.c4
-rw-r--r--zlib/examples/README.examples15
-rw-r--r--zlib/examples/enough.c569
-rw-r--r--zlib/examples/gun.c44
-rw-r--r--zlib/examples/gzlog.c1303
-rw-r--r--zlib/examples/gzlog.h93
-rw-r--r--zlib/examples/zlib_how.html36
-rw-r--r--zlib/examples/zpipe.c24
-rw-r--r--zlib/examples/zran.c2
-rw-r--r--zlib/gzclose.c25
-rw-r--r--zlib/gzguts.h132
-rw-r--r--zlib/gzio.c1026
-rw-r--r--zlib/gzlib.c537
-rw-r--r--zlib/gzread.c653
-rw-r--r--zlib/gzwrite.c531
-rw-r--r--zlib/infback.c93
-rw-r--r--zlib/inffast.c80
-rw-r--r--zlib/inffast.h4
-rw-r--r--zlib/inflate.c282
-rw-r--r--zlib/inflate.h31
-rw-r--r--zlib/inftrees.c63
-rw-r--r--zlib/inftrees.h27
-rw-r--r--zlib/make_vms.com479
-rw-r--r--zlib/minigzip.c134
-rw-r--r--zlib/msdos/Makefile.bor16
-rw-r--r--zlib/msdos/Makefile.dj24
-rw-r--r--zlib/msdos/Makefile.emx4
-rw-r--r--zlib/msdos/Makefile.msc12
-rw-r--r--zlib/msdos/Makefile.tc16
-rw-r--r--zlib/nintendods/Makefile126
-rw-r--r--zlib/nintendods/README5
-rw-r--r--zlib/old/as400/bndsrc (renamed from zlib/as400/bndsrc)0
-rw-r--r--zlib/old/as400/compile.clp (renamed from zlib/as400/compile.clp)0
-rw-r--r--zlib/old/as400/readme.txt (renamed from zlib/as400/readme.txt)0
-rw-r--r--zlib/old/as400/zlib.inc (renamed from zlib/as400/zlib.inc)6
-rw-r--r--zlib/old/visualc6/README.txt (renamed from zlib/projects/visualc6/README.txt)0
-rw-r--r--zlib/old/visualc6/example.dsp (renamed from zlib/projects/visualc6/example.dsp)126
-rw-r--r--zlib/old/visualc6/minigzip.dsp (renamed from zlib/projects/visualc6/minigzip.dsp)126
-rw-r--r--zlib/old/visualc6/zlib.dsp (renamed from zlib/projects/visualc6/zlib.dsp)242
-rw-r--r--zlib/old/visualc6/zlib.dsw (renamed from zlib/projects/visualc6/zlib.dsw)0
-rw-r--r--zlib/old/zlib.html971
-rw-r--r--zlib/projects/README.projects41
-rw-r--r--zlib/qnx/package.qpg10
-rw-r--r--zlib/treebuild.xml116
-rw-r--r--zlib/trees.c93
-rw-r--r--zlib/trees.h4
-rw-r--r--zlib/uncompr.c4
-rw-r--r--zlib/watcom/watcom_f.mak43
-rw-r--r--zlib/watcom/watcom_l.mak43
-rw-r--r--zlib/win32/DLL_FAQ.txt8
-rw-r--r--zlib/win32/Makefile.bor21
-rw-r--r--zlib/win32/Makefile.emx4
-rw-r--r--zlib/win32/Makefile.gcc71
-rw-r--r--zlib/win32/Makefile.msc75
-rw-r--r--zlib/win32/README-WIN32.txt103
-rw-r--r--zlib/win32/zlib.def16
-rw-r--r--zlib/win32/zlib1.rc17
-rw-r--r--zlib/zconf.h190
-rw-r--r--zlib/zconf.h.cmakein430
-rw-r--r--zlib/zconf.h.in (renamed from zlib/zconf.in.h)190
-rw-r--r--zlib/zlib.366
-rw-r--r--zlib/zlib.h1162
-rw-r--r--zlib/zlib.map68
-rw-r--r--zlib/zlib.pc.in13
-rw-r--r--zlib/zlib2ansi152
-rw-r--r--zlib/zutil.c32
-rw-r--r--zlib/zutil.h63
182 files changed, 19137 insertions, 9048 deletions
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
new file mode 100644
index 00000000000..a64fe0b2cae
--- /dev/null
+++ b/zlib/CMakeLists.txt
@@ -0,0 +1,190 @@
1cmake_minimum_required(VERSION 2.4.4)
2set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
3
4project(zlib C)
5
6if(NOT DEFINED BUILD_SHARED_LIBS)
7 option(BUILD_SHARED_LIBS "Build a shared library form of zlib" ON)
8endif()
9
10include(CheckTypeSize)
11include(CheckFunctionExists)
12include(CheckIncludeFile)
13include(CheckCSourceCompiles)
14enable_testing()
15
16check_include_file(sys/types.h HAVE_SYS_TYPES_H)
17check_include_file(stdint.h HAVE_STDINT_H)
18check_include_file(stddef.h HAVE_STDDEF_H)
19
20#
21# Check to see if we have large file support
22#
23set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
24# We add these other definitions here because CheckTypeSize.cmake
25# in CMake 2.4.x does not automatically do so and we want
26# compatibility with CMake 2.4.x.
27if(HAVE_SYS_TYPES_H)
28 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
29endif()
30if(HAVE_STDINT_H)
31 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
32endif()
33if(HAVE_STDDEF_H)
34 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
35endif()
36check_type_size(off64_t OFF64_T)
37if(HAVE_OFF64_T)
38 add_definitions(-D_LARGEFILE64_SOURCE=1)
39endif()
40set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
41
42#
43# Check for fseeko
44#
45check_function_exists(fseeko HAVE_FSEEKO)
46if(NOT HAVE_FSEEKO)
47 add_definitions(-DNO_FSEEKO)
48endif()
49
50#
51# Check for unistd.h
52#
53check_include_file(unistd.h Z_HAVE_UNISTD_H)
54
55if(MSVC)
56 set(CMAKE_DEBUG_POSTFIX "d")
57 add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
58 add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
59endif()
60
61if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
62 # If we're doing an out of source build and the user has a zconf.h
63 # in their source tree...
64 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
65 message(FATAL_ERROR
66 "You must remove ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h "
67 "from the source tree. This file is included with zlib "
68 "but CMake generates this file for you automatically "
69 "in the build directory.")
70 endif()
71endif()
72
73configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
74 ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
75include_directories(${CMAKE_CURRENT_BINARY_DIR})
76
77
78#============================================================================
79# zlib
80#============================================================================
81
82set(ZLIB_PUBLIC_HDRS
83 ${CMAKE_CURRENT_BINARY_DIR}/zconf.h
84 zlib.h
85)
86set(ZLIB_PRIVATE_HDRS
87 crc32.h
88 deflate.h
89 gzguts.h
90 inffast.h
91 inffixed.h
92 inflate.h
93 inftrees.h
94 trees.h
95 zutil.h
96)
97set(ZLIB_SRCS
98 adler32.c
99 compress.c
100 crc32.c
101 deflate.c
102 gzclose.c
103 gzlib.c
104 gzread.c
105 gzwrite.c
106 inflate.c
107 infback.c
108 inftrees.c
109 inffast.c
110 trees.c
111 uncompr.c
112 zutil.c
113 win32/zlib1.rc
114)
115
116# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
117file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
118string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*"
119 "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
120
121if(MINGW)
122 # This gets us DLL resource information when compiling on MinGW.
123 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
124 COMMAND windres.exe
125 -D GCC_WINDRES
126 -I ${CMAKE_CURRENT_SOURCE_DIR}
127 -I ${CMAKE_CURRENT_BINARY_DIR}
128 -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
129 -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
130 set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
131endif(MINGW)
132
133add_library(zlib ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
134set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
135
136set_target_properties(zlib PROPERTIES SOVERSION 1)
137
138if(NOT CYGWIN)
139 # This property causes shared libraries on Linux to have the full version
140 # encoded into their final filename. We disable this on Cygwin because
141 # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
142 # seems to be the default.
143 #
144 # This has no effect with MSVC, on that platform the version info for
145 # the DLL comes from the resource file win32/zlib1.rc
146 set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
147endif()
148
149if(UNIX)
150 # On unix-like platforms the library is almost always called libz
151 set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
152elseif(BUILD_SHARED_LIBS AND WIN32)
153 # Creates zlib1.dll when building shared library version
154 set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
155endif()
156
157if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
158 install(TARGETS zlib
159 RUNTIME DESTINATION bin
160 ARCHIVE DESTINATION lib
161 LIBRARY DESTINATION lib )
162endif()
163if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
164 install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION include)
165endif()
166if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
167 install(FILES zlib.3 DESTINATION share/man/man3)
168endif()
169
170#============================================================================
171# Example binaries
172#============================================================================
173
174add_executable(example example.c)
175target_link_libraries(example zlib)
176add_test(example example)
177
178add_executable(minigzip minigzip.c)
179target_link_libraries(minigzip zlib)
180
181if(HAVE_OFF64_T)
182 add_executable(example64 example.c)
183 target_link_libraries(example64 zlib)
184 set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
185 add_test(example64 example64)
186
187 add_executable(minigzip64 minigzip.c)
188 target_link_libraries(minigzip64 zlib)
189 set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
190endif()
diff --git a/zlib/ChangeLog b/zlib/ChangeLog
index aedb9367e08..fd4cae655e3 100644
--- a/zlib/ChangeLog
+++ b/zlib/ChangeLog
@@ -1,6 +1,359 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.2.5 (19 Apr 2010)
5- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
6- Default to libdir as sharedlibdir in configure [Nieder]
7- Update copyright dates on modified source files
8- Update trees.c to be able to generate modified trees.h
9- Exit configure for MinGW, suggesting win32/Makefile.gcc
10
11Changes in 1.2.4.5 (18 Apr 2010)
12- Set sharedlibdir in configure [Torok]
13- Set LDFLAGS in Makefile.in [Bar-Lev]
14- Avoid mkdir objs race condition in Makefile.in [Bowler]
15- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
16- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
17- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
18
19Changes in 1.2.4.4 (18 Apr 2010)
20- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
21- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
22- Try to use bash or ksh regardless of functionality of /bin/sh
23- Fix configure incompatibility with NetBSD sh
24- Remove attempt to run under bash or ksh since have better NetBSD fix
25- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
26- Add diagnostic messages when using CROSS_PREFIX in configure
27- Added --sharedlibdir option to configure [Weigelt]
28- Use hidden visibility attribute when available [Frysinger]
29
30Changes in 1.2.4.3 (10 Apr 2010)
31- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
32- Use CROSS_PREFIX for nm [Bar-Lev]
33- Assume _LARGEFILE64_SOURCE defined is equivalent to true
34- Avoid use of undefined symbols in #if with && and ||
35- Make *64 prototypes in gzguts.h consistent with functions
36- Add -shared load option for MinGW in configure [Bowler]
37- Move z_off64_t to public interface, use instead of off64_t
38- Remove ! from shell test in configure (not portable to Solaris)
39- Change +0 macro tests to -0 for possibly increased portability
40
41Changes in 1.2.4.2 (9 Apr 2010)
42- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
43- Really provide prototypes for *64 functions when building without LFS
44- Only define unlink() in minigzip.c if unistd.h not included
45- Update README to point to contrib/vstudio project files
46- Move projects/vc6 to old/ and remove projects/
47- Include stdlib.h in minigzip.c for setmode() definition under WinCE
48- Clean up assembler builds in win32/Makefile.msc [Rowe]
49- Include sys/types.h for Microsoft for off_t definition
50- Fix memory leak on error in gz_open()
51- Symbolize nm as $NM in configure [Weigelt]
52- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
53- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
54- Fix bug in gzeof() to take into account unused input data
55- Avoid initialization of structures with variables in puff.c
56- Updated win32/README-WIN32.txt [Rowe]
57
58Changes in 1.2.4.1 (28 Mar 2010)
59- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
60- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
61- Restore "for debugging" comment on sprintf() in gzlib.c
62- Remove fdopen for MVS from gzguts.h
63- Put new README-WIN32.txt in win32 [Rowe]
64- Add check for shell to configure and invoke another shell if needed
65- Fix big fat stinking bug in gzseek() on uncompressed files
66- Remove vestigial F_OPEN64 define in zutil.h
67- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
68- Avoid errors on non-LFS systems when applications define LFS macros
69- Set EXE to ".exe" in configure for MINGW [Kahle]
70- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
71- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
72- Add DLL install in win32/makefile.gcc [Bar-Lev]
73- Allow Linux* or linux* from uname in configure [Bar-Lev]
74- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
75- Add cross-compilation prefixes to configure [Bar-Lev]
76- Match type exactly in gz_load() invocation in gzread.c
77- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
78- Provide prototypes for *64 functions when building zlib without LFS
79- Don't use -lc when linking shared library on MinGW
80- Remove errno.h check in configure and vestigial errno code in zutil.h
81
82Changes in 1.2.4 (14 Mar 2010)
83- Fix VER3 extraction in configure for no fourth subversion
84- Update zlib.3, add docs to Makefile.in to make .pdf out of it
85- Add zlib.3.pdf to distribution
86- Don't set error code in gzerror() if passed pointer is NULL
87- Apply destination directory fixes to CMakeLists.txt [Lowman]
88- Move #cmakedefine's to a new zconf.in.cmakein
89- Restore zconf.h for builds that don't use configure or cmake
90- Add distclean to dummy Makefile for convenience
91- Update and improve INDEX, README, and FAQ
92- Update CMakeLists.txt for the return of zconf.h [Lowman]
93- Update contrib/vstudio/vc9 and vc10 [Vollant]
94- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
95- Apply license and readme changes to contrib/asm686 [Raiter]
96- Check file name lengths and add -c option in minigzip.c [Li]
97- Update contrib/amd64 and contrib/masmx86/ [Vollant]
98- Avoid use of "eof" parameter in trees.c to not shadow library variable
99- Update make_vms.com for removal of zlibdefs.h [Zinser]
100- Update assembler code and vstudio projects in contrib [Vollant]
101- Remove outdated assembler code contrib/masm686 and contrib/asm586
102- Remove old vc7 and vc8 from contrib/vstudio
103- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
104- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
105- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
106- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
107- Fix bug in void-returning vsprintf() case in gzwrite.c
108- Fix name change from inflate.h in contrib/inflate86/inffas86.c
109- Check if temporary file exists before removing in make_vms.com [Zinser]
110- Fix make install and uninstall for --static option
111- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
112- Update readme.txt in contrib/masmx64 and masmx86 to assemble
113
114Changes in 1.2.3.9 (21 Feb 2010)
115- Expunge gzio.c
116- Move as400 build information to old
117- Fix updates in contrib/minizip and contrib/vstudio
118- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
119- Delete zconf.h (made by configure) [Weigelt]
120- Change zconf.in.h to zconf.h.in per convention [Weigelt]
121- Check for NULL buf in gzgets()
122- Return empty string for gzgets() with len == 1 (like fgets())
123- Fix description of gzgets() in zlib.h for end-of-file, NULL return
124- Update minizip to 1.1 [Vollant]
125- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
126- Note in zlib.h that gzerror() should be used to distinguish from EOF
127- Remove use of snprintf() from gzlib.c
128- Fix bug in gzseek()
129- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
130- Fix zconf.h generation in CMakeLists.txt [Lowman]
131- Improve comments in zconf.h where modified by configure
132
133Changes in 1.2.3.8 (13 Feb 2010)
134- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
135- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
136- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
137- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
138- Fix missing error return in gzflush(), add zlib.h note
139- Add *64 functions to zlib.map [Levin]
140- Fix signed/unsigned comparison in gz_comp()
141- Use SFLAGS when testing shared linking in configure
142- Add --64 option to ./configure to use -m64 with gcc
143- Fix ./configure --help to correctly name options
144- Have make fail if a test fails [Levin]
145- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
146- Remove assembler object files from contrib
147
148Changes in 1.2.3.7 (24 Jan 2010)
149- Always gzopen() with O_LARGEFILE if available
150- Fix gzdirect() to work immediately after gzopen() or gzdopen()
151- Make gzdirect() more precise when the state changes while reading
152- Improve zlib.h documentation in many places
153- Catch memory allocation failure in gz_open()
154- Complete close operation if seek forward in gzclose_w() fails
155- Return Z_ERRNO from gzclose_r() if close() fails
156- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
157- Return zero for gzwrite() errors to match zlib.h description
158- Return -1 on gzputs() error to match zlib.h description
159- Add zconf.in.h to allow recovery from configure modification [Weigelt]
160- Fix static library permissions in Makefile.in [Weigelt]
161- Avoid warnings in configure tests that hide functionality [Weigelt]
162- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
163- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
164- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
165- Keep object files in subdirectories to reduce the clutter somewhat
166- Remove default Makefile and zlibdefs.h, add dummy Makefile
167- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
168- Remove zlibdefs.h completely -- modify zconf.h instead
169
170Changes in 1.2.3.6 (17 Jan 2010)
171- Avoid void * arithmetic in gzread.c and gzwrite.c
172- Make compilers happier with const char * for gz_error message
173- Avoid unused parameter warning in inflate.c
174- Avoid signed-unsigned comparison warning in inflate.c
175- Indent #pragma's for traditional C
176- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
177- Correct email address in configure for system options
178- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
179- Update zlib.map [Brown]
180- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
181- Apply various fixes to CMakeLists.txt [Lowman]
182- Add checks on len in gzread() and gzwrite()
183- Add error message for no more room for gzungetc()
184- Remove zlib version check in gzwrite()
185- Defer compression of gzprintf() result until need to
186- Use snprintf() in gzdopen() if available
187- Remove USE_MMAP configuration determination (only used by minigzip)
188- Remove examples/pigz.c (available separately)
189- Update examples/gun.c to 1.6
190
191Changes in 1.2.3.5 (8 Jan 2010)
192- Add space after #if in zutil.h for some compilers
193- Fix relatively harmless bug in deflate_fast() [Exarevsky]
194- Fix same problem in deflate_slow()
195- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
196- Add deflate_rle() for faster Z_RLE strategy run-length encoding
197- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
198- Change name of "write" variable in inffast.c to avoid library collisions
199- Fix premature EOF from gzread() in gzio.c [Brown]
200- Use zlib header window size if windowBits is 0 in inflateInit2()
201- Remove compressBound() call in deflate.c to avoid linking compress.o
202- Replace use of errno in gz* with functions, support WinCE [Alves]
203- Provide alternative to perror() in minigzip.c for WinCE [Alves]
204- Don't use _vsnprintf on later versions of MSVC [Lowman]
205- Add CMake build script and input file [Lowman]
206- Update contrib/minizip to 1.1 [Svensson, Vollant]
207- Moved nintendods directory from contrib to .
208- Replace gzio.c with a new set of routines with the same functionality
209- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
210- Update contrib/minizip to 1.1b
211- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
212
213Changes in 1.2.3.4 (21 Dec 2009)
214- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
215- Update comments in configure and Makefile.in for default --shared
216- Fix test -z's in configure [Marquess]
217- Build examplesh and minigzipsh when not testing
218- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
219- Import LDFLAGS from the environment in configure
220- Fix configure to populate SFLAGS with discovered CFLAGS options
221- Adapt make_vms.com to the new Makefile.in [Zinser]
222- Add zlib2ansi script for C++ compilation [Marquess]
223- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
224- Add AMD64 assembler code for longest match to contrib [Teterin]
225- Include options from $SFLAGS when doing $LDSHARED
226- Simplify 64-bit file support by introducing z_off64_t type
227- Make shared object files in objs directory to work around old Sun cc
228- Use only three-part version number for Darwin shared compiles
229- Add rc option to ar in Makefile.in for when ./configure not run
230- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
231- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
232- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
233- Rename Makefile.in targets allstatic to static and allshared to shared
234- Fix static and shared Makefile.in targets to be independent
235- Correct error return bug in gz_open() by setting state [Brown]
236- Put spaces before ;;'s in configure for better sh compatibility
237- Add pigz.c (parallel implementation of gzip) to examples/
238- Correct constant in crc32.c to UL [Leventhal]
239- Reject negative lengths in crc32_combine()
240- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
241- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
242- Correct typo in doc/algorithm.txt [Janik]
243- Fix bug in adler32_combine() [Zhu]
244- Catch missing-end-of-block-code error in all inflates and in puff
245 Assures that random input to inflate eventually results in an error
246- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
247- Update ENOUGH and its usage to reflect discovered bounds
248- Fix gzerror() error report on empty input file [Brown]
249- Add ush casts in trees.c to avoid pedantic runtime errors
250- Fix typo in zlib.h uncompress() description [Reiss]
251- Correct inflate() comments with regard to automatic header detection
252- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
253- Put new version of gzlog (2.0) in examples with interruption recovery
254- Add puff compile option to permit invalid distance-too-far streams
255- Add puff TEST command options, ability to read piped input
256- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
257 _LARGEFILE64_SOURCE not defined
258- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
259- Fix deflateSetDictionary() to use all 32K for output consistency
260- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
261- Clear bytes after deflate lookahead to avoid use of uninitialized data
262- Change a limit in inftrees.c to be more transparent to Coverity Prevent
263- Update win32/zlib.def with exported symbols from zlib.h
264- Correct spelling error in zlib.h [Willem]
265- Allow Z_BLOCK for deflate() to force a new block
266- Allow negative bits in inflatePrime() to delete existing bit buffer
267- Add Z_TREES flush option to inflate() to return at end of trees
268- Add inflateMark() to return current state information for random access
269- Add Makefile for NintendoDS to contrib [Costa]
270- Add -w in configure compile tests to avoid spurious warnings [Beucler]
271- Fix typos in zlib.h comments for deflateSetDictionary()
272- Fix EOF detection in transparent gzread() [Maier]
273
274Changes in 1.2.3.3 (2 October 2006)
275- Make --shared the default for configure, add a --static option
276- Add compile option to permit invalid distance-too-far streams
277- Add inflateUndermine() function which is required to enable above
278- Remove use of "this" variable name for C++ compatibility [Marquess]
279- Add testing of shared library in make test, if shared library built
280- Use ftello() and fseeko() if available instead of ftell() and fseek()
281- Provide two versions of all functions that use the z_off_t type for
282 binary compatibility -- a normal version and a 64-bit offset version,
283 per the Large File Support Extension when _LARGEFILE64_SOURCE is
284 defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
285 is defined to be 64
286- Add a --uname= option to configure to perhaps help with cross-compiling
287
288Changes in 1.2.3.2 (3 September 2006)
289- Turn off silly Borland warnings [Hay]
290- Use off64_t and define _LARGEFILE64_SOURCE when present
291- Fix missing dependency on inffixed.h in Makefile.in
292- Rig configure --shared to build both shared and static [Teredesai, Truta]
293- Remove zconf.in.h and instead create a new zlibdefs.h file
294- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
295- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
296
297Changes in 1.2.3.1 (16 August 2006)
298- Add watcom directory with OpenWatcom make files [Daniel]
299- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
300- Update make_vms.com [Zinser]
301- Use -fPIC for shared build in configure [Teredesai, Nicholson]
302- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
303- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bck]
304- Add some FAQ entries about the contrib directory
305- Update the MVS question in the FAQ
306- Avoid extraneous reads after EOF in gzio.c [Brown]
307- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
308- Add comments to zlib.h about gzerror() usage [Brown]
309- Set extra flags in gzip header in gzopen() like deflate() does
310- Make configure options more compatible with double-dash conventions
311 [Weigelt]
312- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
313- Fix uninstall target in Makefile.in [Truta]
314- Add pkgconfig support [Weigelt]
315- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
316- Replace set_data_type() with a more accurate detect_data_type() in
317 trees.c, according to the txtvsbin.txt document [Truta]
318- Swap the order of #include <stdio.h> and #include "zlib.h" in
319 gzio.c, example.c and minigzip.c [Truta]
320- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
321 Truta] (where?)
322- Fix target "clean" from win32/Makefile.bor [Truta]
323- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
324- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
325- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
326- Enable browse info in the "Debug" and "ASM Debug" configurations in
327 the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
328- Add pkgconfig support [Weigelt]
329- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
330 for use in win32/zlib1.rc [Polushin, Rowe, Truta]
331- Add a document that explains the new text detection scheme to
332 doc/txtvsbin.txt [Truta]
333- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
334- Move algorithm.txt into doc/ [Truta]
335- Synchronize FAQ with website
336- Fix compressBound(), was low for some pathological cases [Fearnley]
337- Take into account wrapper variations in deflateBound()
338- Set examples/zpipe.c input and output to binary mode for Windows
339- Update examples/zlib_how.html with new zpipe.c (also web site)
340- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
341 that gcc became pickier in 4.0)
342- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
343 un-versioned, the patch adds versioning only for symbols introduced in
344 zlib-1.2.0 or later. It also declares as local those symbols which are
345 not designed to be exported." [Levin]
346- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
347- Do not initialize global static by default in trees.c, add a response
348 NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
349- Don't use strerror() in gzio.c under WinCE [Yakimov]
350- Don't use errno.h in zutil.h under WinCE [Yakimov]
351- Move arguments for AR to its usage to allow replacing ar [Marot]
352- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
353- Improve inflateInit() and inflateInit2() documentation
354- Fix structure size comment in inflate.h
355- Change configure help option from --h* to --help [Santos]
356
4Changes in 1.2.3 (18 July 2005) 357Changes in 1.2.3 (18 July 2005)
5- Apply security vulnerability fixes to contrib/infback9 as well 358- Apply security vulnerability fixes to contrib/infback9 as well
6- Clean up some text files (carriage returns, trailing space) 359- Clean up some text files (carriage returns, trailing space)
@@ -13,7 +366,7 @@ Changes in 1.2.2.4 (11 July 2005)
13 compile 366 compile
14- Fix some spelling errors in comments [Betts] 367- Fix some spelling errors in comments [Betts]
15- Correct inflateInit2() error return documentation in zlib.h 368- Correct inflateInit2() error return documentation in zlib.h
16- Added zran.c example of compressed data random access to examples 369- Add zran.c example of compressed data random access to examples
17 directory, shows use of inflatePrime() 370 directory, shows use of inflatePrime()
18- Fix cast for assignments to strm->state in inflate.c and infback.c 371- Fix cast for assignments to strm->state in inflate.c and infback.c
19- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] 372- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index 7afe93793c2..8cce45d3023 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,7 @@
12012-03-02 Matthias Klose <doko@ubuntu.com>
2
3 * Imported zlib 1.2.5; merged local changes.
4
12011-11-21 Andreas Tobler <andreast@fgznet.ch> 52011-11-21 Andreas Tobler <andreast@fgznet.ch>
2 6
3 * configure: Regenerate. 7 * configure: Regenerate.
diff --git a/zlib/FAQ b/zlib/FAQ
index 441d910daa1..1a22750a58e 100644
--- a/zlib/FAQ
+++ b/zlib/FAQ
@@ -3,8 +3,8 @@
3 3
4 4
5If your question is not there, please check the zlib home page 5If your question is not there, please check the zlib home page
6http://www.zlib.org which may have more recent information. 6http://zlib.net/ which may have more recent information.
7The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html 7The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
8 8
9 9
10 1. Is zlib Y2K-compliant? 10 1. Is zlib Y2K-compliant?
@@ -13,54 +13,51 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
13 13
14 2. Where can I get a Windows DLL version? 14 2. Where can I get a Windows DLL version?
15 15
16 The zlib sources can be compiled without change to produce a DLL. 16 The zlib sources can be compiled without change to produce a DLL. See the
17 See the file win32/DLL_FAQ.txt in the zlib distribution. 17 file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
18 Pointers to the precompiled DLL are found in the zlib web site at 18 precompiled DLL are found in the zlib web site at http://zlib.net/ .
19 http://www.zlib.org.
20 19
21 3. Where can I get a Visual Basic interface to zlib? 20 3. Where can I get a Visual Basic interface to zlib?
22 21
23 See 22 See
24 * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm 23 * http://marknelson.us/1997/01/01/zlib-engine/
25 * contrib/visual-basic.txt in the zlib distribution
26 * win32/DLL_FAQ.txt in the zlib distribution 24 * win32/DLL_FAQ.txt in the zlib distribution
27 25
28 4. compress() returns Z_BUF_ERROR. 26 4. compress() returns Z_BUF_ERROR.
29 27
30 Make sure that before the call of compress, the length of the compressed 28 Make sure that before the call of compress(), the length of the compressed
31 buffer is equal to the total size of the compressed buffer and not 29 buffer is equal to the available size of the compressed buffer and not
32 zero. For Visual Basic, check that this parameter is passed by reference 30 zero. For Visual Basic, check that this parameter is passed by reference
33 ("as any"), not by value ("as long"). 31 ("as any"), not by value ("as long").
34 32
35 5. deflate() or inflate() returns Z_BUF_ERROR. 33 5. deflate() or inflate() returns Z_BUF_ERROR.
36 34
37 Before making the call, make sure that avail_in and avail_out are not 35 Before making the call, make sure that avail_in and avail_out are not zero.
38 zero. When setting the parameter flush equal to Z_FINISH, also make sure 36 When setting the parameter flush equal to Z_FINISH, also make sure that
39 that avail_out is big enough to allow processing all pending input. 37 avail_out is big enough to allow processing all pending input. Note that a
40 Note that a Z_BUF_ERROR is not fatal--another call to deflate() or 38 Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
41 inflate() can be made with more input or output space. A Z_BUF_ERROR 39 made with more input or output space. A Z_BUF_ERROR may in fact be
42 may in fact be unavoidable depending on how the functions are used, since 40 unavoidable depending on how the functions are used, since it is not
43 it is not possible to tell whether or not there is more output pending 41 possible to tell whether or not there is more output pending when
44 when strm.avail_out returns with zero. 42 strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
43 heavily annotated example.
45 44
46 6. Where's the zlib documentation (man pages, etc.)? 45 6. Where's the zlib documentation (man pages, etc.)?
47 46
48 It's in zlib.h for the moment, and Francis S. Lin has converted it to a 47 It's in zlib.h . Examples of zlib usage are in the files example.c and
49 web page zlib.html. Volunteers to transform this to Unix-style man pages, 48 minigzip.c, with more in examples/ .
50 please contact us (zlib@gzip.org). Examples of zlib usage are in the files
51 example.c and minigzip.c.
52 49
53 7. Why don't you use GNU autoconf or libtool or ...? 50 7. Why don't you use GNU autoconf or libtool or ...?
54 51
55 Because we would like to keep zlib as a very small and simple 52 Because we would like to keep zlib as a very small and simple package.
56 package. zlib is rather portable and doesn't need much configuration. 53 zlib is rather portable and doesn't need much configuration.
57 54
58 8. I found a bug in zlib. 55 8. I found a bug in zlib.
59 56
60 Most of the time, such problems are due to an incorrect usage of 57 Most of the time, such problems are due to an incorrect usage of zlib.
61 zlib. Please try to reproduce the problem with a small program and send 58 Please try to reproduce the problem with a small program and send the
62 the corresponding source to us at zlib@gzip.org . Do not send 59 corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
63 multi-megabyte data files without prior agreement. 60 data files without prior agreement.
64 61
65 9. Why do I get "undefined reference to gzputc"? 62 9. Why do I get "undefined reference to gzputc"?
66 63
@@ -82,7 +79,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
82 79
8312. Can zlib handle .Z files? 8012. Can zlib handle .Z files?
84 81
85 No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt 82 No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
86 the code of uncompress on your own. 83 the code of uncompress on your own.
87 84
8813. How can I make a Unix shared library? 8513. How can I make a Unix shared library?
@@ -99,8 +96,10 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
99 96
100 However, many flavors of Unix come with a shared zlib already installed. 97 However, many flavors of Unix come with a shared zlib already installed.
101 Before going to the trouble of compiling a shared version of zlib and 98 Before going to the trouble of compiling a shared version of zlib and
102 trying to install it, you may want to check if it's already there! If you 99 trying to install it, you may want to check if it's already there! If you
103 can #include <zlib.h>, it's there. The -lz option will probably link to it. 100 can #include <zlib.h>, it's there. The -lz option will probably link to
101 it. You can check the version at the top of zlib.h or with the
102 ZLIB_VERSION symbol defined in zlib.h .
104 103
10515. I have a question about OttoPDF. 10415. I have a question about OttoPDF.
106 105
@@ -109,8 +108,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
109 108
11016. Can zlib decode Flate data in an Adobe PDF file? 10916. Can zlib decode Flate data in an Adobe PDF file?
111 110
112 Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ . 111 Yes. See http://www.pdflib.com/ . To modify PDF forms, see
113 To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ . 112 http://sourceforge.net/projects/acroformtool/ .
114 113
11517. Why am I getting this "register_frame_info not found" error on Solaris? 11417. Why am I getting this "register_frame_info not found" error on Solaris?
116 115
@@ -121,67 +120,67 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
121 symbol __register_frame_info: referenced symbol not found 120 symbol __register_frame_info: referenced symbol not found
122 121
123 The symbol __register_frame_info is not part of zlib, it is generated by 122 The symbol __register_frame_info is not part of zlib, it is generated by
124 the C compiler (cc or gcc). You must recompile applications using zlib 123 the C compiler (cc or gcc). You must recompile applications using zlib
125 which have this problem. This problem is specific to Solaris. See 124 which have this problem. This problem is specific to Solaris. See
126 http://www.sunfreeware.com for Solaris versions of zlib and applications 125 http://www.sunfreeware.com for Solaris versions of zlib and applications
127 using zlib. 126 using zlib.
128 127
12918. Why does gzip give an error on a file I make with compress/deflate? 12818. Why does gzip give an error on a file I make with compress/deflate?
130 129
131 The compress and deflate functions produce data in the zlib format, which 130 The compress and deflate functions produce data in the zlib format, which
132 is different and incompatible with the gzip format. The gz* functions in 131 is different and incompatible with the gzip format. The gz* functions in
133 zlib on the other hand use the gzip format. Both the zlib and gzip 132 zlib on the other hand use the gzip format. Both the zlib and gzip formats
134 formats use the same compressed data format internally, but have different 133 use the same compressed data format internally, but have different headers
135 headers and trailers around the compressed data. 134 and trailers around the compressed data.
136 135
13719. Ok, so why are there two different formats? 13619. Ok, so why are there two different formats?
138 137
139 The gzip format was designed to retain the directory information about 138 The gzip format was designed to retain the directory information about a
140 a single file, such as the name and last modification date. The zlib 139 single file, such as the name and last modification date. The zlib format
141 format on the other hand was designed for in-memory and communication 140 on the other hand was designed for in-memory and communication channel
142 channel applications, and has a much more compact header and trailer and 141 applications, and has a much more compact header and trailer and uses a
143 uses a faster integrity check than gzip. 142 faster integrity check than gzip.
144 143
14520. Well that's nice, but how do I make a gzip file in memory? 14420. Well that's nice, but how do I make a gzip file in memory?
146 145
147 You can request that deflate write the gzip format instead of the zlib 146 You can request that deflate write the gzip format instead of the zlib
148 format using deflateInit2(). You can also request that inflate decode 147 format using deflateInit2(). You can also request that inflate decode the
149 the gzip format using inflateInit2(). Read zlib.h for more details. 148 gzip format using inflateInit2(). Read zlib.h for more details.
150 149
15121. Is zlib thread-safe? 15021. Is zlib thread-safe?
152 151
153 Yes. However any library routines that zlib uses and any application- 152 Yes. However any library routines that zlib uses and any application-
154 provided memory allocation routines must also be thread-safe. zlib's gz* 153 provided memory allocation routines must also be thread-safe. zlib's gz*
155 functions use stdio library routines, and most of zlib's functions use the 154 functions use stdio library routines, and most of zlib's functions use the
156 library memory allocation routines by default. zlib's Init functions allow 155 library memory allocation routines by default. zlib's *Init* functions
157 for the application to provide custom memory allocation routines. 156 allow for the application to provide custom memory allocation routines.
158 157
159 Of course, you should only operate on any given zlib or gzip stream from a 158 Of course, you should only operate on any given zlib or gzip stream from a
160 single thread at a time. 159 single thread at a time.
161 160
16222. Can I use zlib in my commercial application? 16122. Can I use zlib in my commercial application?
163 162
164 Yes. Please read the license in zlib.h. 163 Yes. Please read the license in zlib.h.
165 164
16623. Is zlib under the GNU license? 16523. Is zlib under the GNU license?
167 166
168 No. Please read the license in zlib.h. 167 No. Please read the license in zlib.h.
169 168
17024. The license says that altered source versions must be "plainly marked". So 16924. The license says that altered source versions must be "plainly marked". So
171 what exactly do I need to do to meet that requirement? 170 what exactly do I need to do to meet that requirement?
172 171
173 You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In 172 You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
174 particular, the final version number needs to be changed to "f", and an 173 particular, the final version number needs to be changed to "f", and an
175 identification string should be appended to ZLIB_VERSION. Version numbers 174 identification string should be appended to ZLIB_VERSION. Version numbers
176 x.x.x.f are reserved for modifications to zlib by others than the zlib 175 x.x.x.f are reserved for modifications to zlib by others than the zlib
177 maintainers. For example, if the version of the base zlib you are altering 176 maintainers. For example, if the version of the base zlib you are altering
178 is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and 177 is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
179 ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also 178 ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
180 update the version strings in deflate.c and inftrees.c. 179 update the version strings in deflate.c and inftrees.c.
181 180
182 For altered source distributions, you should also note the origin and 181 For altered source distributions, you should also note the origin and
183 nature of the changes in zlib.h, as well as in ChangeLog and README, along 182 nature of the changes in zlib.h, as well as in ChangeLog and README, along
184 with the dates of the alterations. The origin should include at least your 183 with the dates of the alterations. The origin should include at least your
185 name (or your company's name), and an email address to contact for help or 184 name (or your company's name), and an email address to contact for help or
186 issues with the library. 185 issues with the library.
187 186
@@ -197,105 +196,112 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
197 196
19826. Will zlib work on a 64-bit machine? 19726. Will zlib work on a 64-bit machine?
199 198
200 It should. It has been tested on 64-bit machines, and has no dependence 199 Yes. It has been tested on 64-bit machines, and has no dependence on any
201 on any data types being limited to 32-bits in length. If you have any 200 data types being limited to 32-bits in length. If you have any
202 difficulties, please provide a complete problem report to zlib@gzip.org 201 difficulties, please provide a complete problem report to zlib@gzip.org
203 202
20427. Will zlib decompress data from the PKWare Data Compression Library? 20327. Will zlib decompress data from the PKWare Data Compression Library?
205 204
206 No. The PKWare DCL uses a completely different compressed data format 205 No. The PKWare DCL uses a completely different compressed data format than
207 than does PKZIP and zlib. However, you can look in zlib's contrib/blast 206 does PKZIP and zlib. However, you can look in zlib's contrib/blast
208 directory for a possible solution to your problem. 207 directory for a possible solution to your problem.
209 208
21028. Can I access data randomly in a compressed stream? 20928. Can I access data randomly in a compressed stream?
211 210
212 No, not without some preparation. If when compressing you periodically 211 No, not without some preparation. If when compressing you periodically use
213 use Z_FULL_FLUSH, carefully write all the pending data at those points, 212 Z_FULL_FLUSH, carefully write all the pending data at those points, and
214 and keep an index of those locations, then you can start decompression 213 keep an index of those locations, then you can start decompression at those
215 at those points. You have to be careful to not use Z_FULL_FLUSH too 214 points. You have to be careful to not use Z_FULL_FLUSH too often, since it
216 often, since it can significantly degrade compression. 215 can significantly degrade compression. Alternatively, you can scan a
216 deflate stream once to generate an index, and then use that index for
217 random access. See examples/zran.c .
217 218
21829. Does zlib work on MVS, OS/390, CICS, etc.? 21929. Does zlib work on MVS, OS/390, CICS, etc.?
219 220
220 We don't know for sure. We have heard occasional reports of success on 221 It has in the past, but we have not heard of any recent evidence. There
221 these systems. If you do use it on one of these, please provide us with 222 were working ports of zlib 1.1.4 to MVS, but those links no longer work.
222 a report, instructions, and patches that we can reference when we get 223 If you know of recent, successful applications of zlib on these operating
223 these questions. Thanks. 224 systems, please let us know. Thanks.
224 225
22530. Is there some simpler, easier to read version of inflate I can look at 22630. Is there some simpler, easier to read version of inflate I can look at to
226 to understand the deflate format? 227 understand the deflate format?
227 228
228 First off, you should read RFC 1951. Second, yes. Look in zlib's 229 First off, you should read RFC 1951. Second, yes. Look in zlib's
229 contrib/puff directory. 230 contrib/puff directory.
230 231
23131. Does zlib infringe on any patents? 23231. Does zlib infringe on any patents?
232 233
233 As far as we know, no. In fact, that was originally the whole point behind 234 As far as we know, no. In fact, that was originally the whole point behind
234 zlib. Look here for some more information: 235 zlib. Look here for some more information:
235 236
236 http://www.gzip.org/#faq11 237 http://www.gzip.org/#faq11
237 238
23832. Can zlib work with greater than 4 GB of data? 23932. Can zlib work with greater than 4 GB of data?
239 240
240 Yes. inflate() and deflate() will process any amount of data correctly. 241 Yes. inflate() and deflate() will process any amount of data correctly.
241 Each call of inflate() or deflate() is limited to input and output chunks 242 Each call of inflate() or deflate() is limited to input and output chunks
242 of the maximum value that can be stored in the compiler's "unsigned int" 243 of the maximum value that can be stored in the compiler's "unsigned int"
243 type, but there is no limit to the number of chunks. Note however that the 244 type, but there is no limit to the number of chunks. Note however that the
244 strm.total_in and strm_total_out counters may be limited to 4 GB. These 245 strm.total_in and strm_total_out counters may be limited to 4 GB. These
245 counters are provided as a convenience and are not used internally by 246 counters are provided as a convenience and are not used internally by
246 inflate() or deflate(). The application can easily set up its own counters 247 inflate() or deflate(). The application can easily set up its own counters
247 updated after each call of inflate() or deflate() to count beyond 4 GB. 248 updated after each call of inflate() or deflate() to count beyond 4 GB.
248 compress() and uncompress() may be limited to 4 GB, since they operate in a 249 compress() and uncompress() may be limited to 4 GB, since they operate in a
249 single call. gzseek() and gztell() may be limited to 4 GB depending on how 250 single call. gzseek() and gztell() may be limited to 4 GB depending on how
250 zlib is compiled. See the zlibCompileFlags() function in zlib.h. 251 zlib is compiled. See the zlibCompileFlags() function in zlib.h.
251 252
252 The word "may" appears several times above since there is a 4 GB limit 253 The word "may" appears several times above since there is a 4 GB limit only
253 only if the compiler's "long" type is 32 bits. If the compiler's "long" 254 if the compiler's "long" type is 32 bits. If the compiler's "long" type is
254 type is 64 bits, then the limit is 16 exabytes. 255 64 bits, then the limit is 16 exabytes.
255 256
25633. Does zlib have any security vulnerabilities? 25733. Does zlib have any security vulnerabilities?
257 258
258 The only one that we are aware of is potentially in gzprintf(). If zlib 259 The only one that we are aware of is potentially in gzprintf(). If zlib is
259 is compiled to use sprintf() or vsprintf(), then there is no protection 260 compiled to use sprintf() or vsprintf(), then there is no protection
260 against a buffer overflow of a 4K string space, other than the caller of 261 against a buffer overflow of an 8K string space (or other value as set by
261 gzprintf() assuring that the output will not exceed 4K. On the other 262 gzbuffer()), other than the caller of gzprintf() assuring that the output
262 hand, if zlib is compiled to use snprintf() or vsnprintf(), which should 263 will not exceed 8K. On the other hand, if zlib is compiled to use
263 normally be the case, then there is no vulnerability. The ./configure 264 snprintf() or vsnprintf(), which should normally be the case, then there is
264 script will display warnings if an insecure variation of sprintf() will 265 no vulnerability. The ./configure script will display warnings if an
265 be used by gzprintf(). Also the zlibCompileFlags() function will return 266 insecure variation of sprintf() will be used by gzprintf(). Also the
266 information on what variant of sprintf() is used by gzprintf(). 267 zlibCompileFlags() function will return information on what variant of
268 sprintf() is used by gzprintf().
267 269
268 If you don't have snprintf() or vsnprintf() and would like one, you can 270 If you don't have snprintf() or vsnprintf() and would like one, you can
269 find a portable implementation here: 271 find a portable implementation here:
270 272
271 http://www.ijs.si/software/snprintf/ 273 http://www.ijs.si/software/snprintf/
272 274
273 Note that you should be using the most recent version of zlib. Versions 275 Note that you should be using the most recent version of zlib. Versions
274 1.1.3 and before were subject to a double-free vulnerability. 276 1.1.3 and before were subject to a double-free vulnerability, and versions
277 1.2.1 and 1.2.2 were subject to an access exception when decompressing
278 invalid compressed data.
275 279
27634. Is there a Java version of zlib? 28034. Is there a Java version of zlib?
277 281
278 Probably what you want is to use zlib in Java. zlib is already included 282 Probably what you want is to use zlib in Java. zlib is already included
279 as part of the Java SDK in the java.util.zip package. If you really want 283 as part of the Java SDK in the java.util.zip package. If you really want
280 a version of zlib written in the Java language, look on the zlib home 284 a version of zlib written in the Java language, look on the zlib home
281 page for links: http://www.zlib.org/ 285 page for links: http://zlib.net/ .
282 286
28335. I get this or that compiler or source-code scanner warning when I crank it 28735. I get this or that compiler or source-code scanner warning when I crank it
284 up to maximally-pedantic. Can't you guys write proper code? 288 up to maximally-pedantic. Can't you guys write proper code?
285 289
286 Many years ago, we gave up attempting to avoid warnings on every compiler 290 Many years ago, we gave up attempting to avoid warnings on every compiler
287 in the universe. It just got to be a waste of time, and some compilers 291 in the universe. It just got to be a waste of time, and some compilers
288 were downright silly. So now, we simply make sure that the code always 292 were downright silly as well as contradicted each other. So now, we simply
289 works. 293 make sure that the code always works.
290 294
29136. Valgrind (or some similar memory access checker) says that deflate is 29536. Valgrind (or some similar memory access checker) says that deflate is
292 performing a conditional jump that depends on an uninitialized value. 296 performing a conditional jump that depends on an uninitialized value.
293 Isn't that a bug? 297 Isn't that a bug?
294 298
295 No. That is intentional for performance reasons, and the output of 299 No. That is intentional for performance reasons, and the output of deflate
296 deflate is not affected. This only started showing up recently since 300 is not affected. This only started showing up recently since zlib 1.2.x
297 zlib 1.2.x uses malloc() by default for allocations, whereas earlier 301 uses malloc() by default for allocations, whereas earlier versions used
298 versions used calloc(), which zeros out the allocated memory. 302 calloc(), which zeros out the allocated memory. Even though the code was
303 correct, versions 1.2.4 and later was changed to not stimulate these
304 checkers.
299 305
30037. Will zlib read the (insert any ancient or arcane format here) compressed 30637. Will zlib read the (insert any ancient or arcane format here) compressed
301 data format? 307 data format?
@@ -305,20 +311,21 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
305 311
30638. How can I encrypt/decrypt zip files with zlib? 31238. How can I encrypt/decrypt zip files with zlib?
307 313
308 zlib doesn't support encryption. The original PKZIP encryption is very weak 314 zlib doesn't support encryption. The original PKZIP encryption is very
309 and can be broken with freely available programs. To get strong encryption, 315 weak and can be broken with freely available programs. To get strong
310 use GnuPG, http://www.gnupg.org/ , which already includes zlib compression. 316 encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
311 For PKZIP compatible "encryption", look at http://www.info-zip.org/ 317 compression. For PKZIP compatible "encryption", look at
318 http://www.info-zip.org/
312 319
31339. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? 32039. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
314 321
315 "gzip" is the gzip format, and "deflate" is the zlib format. They should 322 "gzip" is the gzip format, and "deflate" is the zlib format. They should
316 probably have called the second one "zlib" instead to avoid confusion 323 probably have called the second one "zlib" instead to avoid confusion with
317 with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 324 the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
318 correctly points to the zlib specification in RFC 1950 for the "deflate" 325 correctly points to the zlib specification in RFC 1950 for the "deflate"
319 transfer encoding, there have been reports of servers and browsers that 326 transfer encoding, there have been reports of servers and browsers that
320 incorrectly produce or expect raw deflate data per the deflate 327 incorrectly produce or expect raw deflate data per the deflate
321 specficiation in RFC 1951, most notably Microsoft. So even though the 328 specficiation in RFC 1951, most notably Microsoft. So even though the
322 "deflate" transfer encoding using the zlib format would be the more 329 "deflate" transfer encoding using the zlib format would be the more
323 efficient approach (and in fact exactly what the zlib format was designed 330 efficient approach (and in fact exactly what the zlib format was designed
324 for), using the "gzip" transfer encoding is probably more reliable due to 331 for), using the "gzip" transfer encoding is probably more reliable due to
@@ -328,12 +335,32 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
328 335
32940. Does zlib support the new "Deflate64" format introduced by PKWare? 33640. Does zlib support the new "Deflate64" format introduced by PKWare?
330 337
331 No. PKWare has apparently decided to keep that format proprietary, since 338 No. PKWare has apparently decided to keep that format proprietary, since
332 they have not documented it as they have previous compression formats. 339 they have not documented it as they have previous compression formats. In
333 In any case, the compression improvements are so modest compared to other 340 any case, the compression improvements are so modest compared to other more
334 more modern approaches, that it's not worth the effort to implement. 341 modern approaches, that it's not worth the effort to implement.
335 342
33641. Can you please sign these lengthy legal documents and fax them back to us 34341. I'm having a problem with the zip functions in zlib, can you help?
344
345 There are no zip functions in zlib. You are probably using minizip by
346 Giles Vollant, which is found in the contrib directory of zlib. It is not
347 part of zlib. In fact none of the stuff in contrib is part of zlib. The
348 files in there are not supported by the zlib authors. You need to contact
349 the authors of the respective contribution for help.
350
35142. The match.asm code in contrib is under the GNU General Public License.
352 Since it's part of zlib, doesn't that mean that all of zlib falls under the
353 GNU GPL?
354
355 No. The files in contrib are not part of zlib. They were contributed by
356 other authors and are provided as a convenience to the user within the zlib
357 distribution. Each item in contrib has its own license.
358
35943. Is zlib subject to export controls? What is its ECCN?
360
361 zlib is not subject to export controls, and so is classified as EAR99.
362
36344. Can you please sign these lengthy legal documents and fax them back to us
337 so that we can use your software in our product? 364 so that we can use your software in our product?
338 365
339 No. Go away. Shoo. 366 No. Go away. Shoo.
diff --git a/zlib/INDEX b/zlib/INDEX
index 0587e5902bd..f6c51ca1759 100644
--- a/zlib/INDEX
+++ b/zlib/INDEX
@@ -1,23 +1,32 @@
1CMakeLists.txt cmake build file
1ChangeLog history of changes 2ChangeLog history of changes
2FAQ Frequently Asked Questions about zlib 3FAQ Frequently Asked Questions about zlib
3INDEX this file 4INDEX this file
4Makefile makefile for Unix (generated by configure) 5Makefile dummy Makefile that tells you to ./configure
5Makefile.in makefile for Unix (template for configure) 6Makefile.in template for Unix Makefile
6README guess what 7README guess what
7algorithm.txt description of the (de)compression algorithm
8configure configure script for Unix 8configure configure script for Unix
9zconf.in.h template for zconf.h (used by configure) 9make_vms.com makefile for VMS
10treebuild.xml XML description of source file dependencies
11zconf.h.cmakein zconf.h template for cmake
12zconf.h.in zconf.h template for configure
13zlib.3 Man page for zlib
14zlib.3.pdf Man page in PDF format
15zlib.map Linux symbol information
16zlib.pc.in Template for pkg-config descriptor
17zlib2ansi perl script to convert source files for C++ compilation
10 18
11amiga/ makefiles for Amiga SAS C 19amiga/ makefiles for Amiga SAS C
12as400/ makefiles for IBM AS/400 20doc/ documentation for formats and algorithms
13msdos/ makefiles for MSDOS 21msdos/ makefiles for MSDOS
22nintendods/ makefile for Nintendo DS
14old/ makefiles for various architectures and zlib documentation 23old/ makefiles for various architectures and zlib documentation
15 files that have not yet been updated for zlib 1.2.x 24 files that have not yet been updated for zlib 1.2.x
16projects/ projects for various Integrated Development Environments
17qnx/ makefiles for QNX 25qnx/ makefiles for QNX
26watcom/ makefiles for OpenWatcom
18win32/ makefiles for Windows 27win32/ makefiles for Windows
19 28
20 zlib public header files (must be kept): 29 zlib public header files (required for library use):
21zconf.h 30zconf.h
22zlib.h 31zlib.h
23 32
@@ -28,7 +37,11 @@ crc32.c
28crc32.h 37crc32.h
29deflate.c 38deflate.c
30deflate.h 39deflate.h
31gzio.c 40gzclose.c
41gzguts.h
42gzlib.c
43gzread.c
44gzwrite.c
32infback.c 45infback.c
33inffast.c 46inffast.c
34inffast.h 47inffast.h
@@ -46,6 +59,7 @@ zutil.h
46 source files for sample programs: 59 source files for sample programs:
47example.c 60example.c
48minigzip.c 61minigzip.c
62See examples/README.examples for more
49 63
50 unsupported contribution by third parties 64 unsupported contribution by third parties
51See contrib/README.contrib 65See contrib/README.contrib
diff --git a/zlib/Makefile.am b/zlib/Makefile.am
index 55418e497a9..a9c42cb2cf5 100644
--- a/zlib/Makefile.am
+++ b/zlib/Makefile.am
@@ -5,9 +5,10 @@ AUTOMAKE_OPTIONS = 1.8 cygnus
5ACLOCAL_AMFLAGS = -I .. -I ../config 5ACLOCAL_AMFLAGS = -I .. -I ../config
6 6
7ZLIB_SOURCES = adler32.c compress.c crc32.c crc32.h deflate.c \ 7ZLIB_SOURCES = adler32.c compress.c crc32.c crc32.h deflate.c \
8deflate.h gzio.c infback.c inffast.c inffast.h inffixed.h inflate.c \ 8deflate.h gzguts.h gzread.c gzclose.c gzwrite.c gzlib.c \
9infback.c inffast.c inffast.h inffixed.h inflate.c \
9inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h \ 10inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h \
10zconf.in.h zlib.h zutil.c zutil.h 11zconf.h.in zlib.h zutil.c zutil.h
11 12
12if TARGET_LIBRARY 13if TARGET_LIBRARY
13noinst_LTLIBRARIES = libzgcj_convenience.la 14noinst_LTLIBRARIES = libzgcj_convenience.la
diff --git a/zlib/Makefile.in b/zlib/Makefile.in
index 20b25499e58..f5ef37a647f 100644
--- a/zlib/Makefile.in
+++ b/zlib/Makefile.in
@@ -84,17 +84,19 @@ libz_a_AR = $(AR) $(ARFLAGS)
84libz_a_LIBADD = 84libz_a_LIBADD =
85am__objects_1 = libz_a-adler32.$(OBJEXT) libz_a-compress.$(OBJEXT) \ 85am__objects_1 = libz_a-adler32.$(OBJEXT) libz_a-compress.$(OBJEXT) \
86 libz_a-crc32.$(OBJEXT) libz_a-deflate.$(OBJEXT) \ 86 libz_a-crc32.$(OBJEXT) libz_a-deflate.$(OBJEXT) \
87 libz_a-gzio.$(OBJEXT) libz_a-infback.$(OBJEXT) \ 87 libz_a-gzread.$(OBJEXT) libz_a-gzclose.$(OBJEXT) \
88 libz_a-inffast.$(OBJEXT) libz_a-inflate.$(OBJEXT) \ 88 libz_a-gzwrite.$(OBJEXT) libz_a-gzlib.$(OBJEXT) \
89 libz_a-inftrees.$(OBJEXT) libz_a-trees.$(OBJEXT) \ 89 libz_a-infback.$(OBJEXT) libz_a-inffast.$(OBJEXT) \
90 libz_a-uncompr.$(OBJEXT) libz_a-zutil.$(OBJEXT) 90 libz_a-inflate.$(OBJEXT) libz_a-inftrees.$(OBJEXT) \
91 libz_a-trees.$(OBJEXT) libz_a-uncompr.$(OBJEXT) \
92 libz_a-zutil.$(OBJEXT)
91@TARGET_LIBRARY_FALSE@am_libz_a_OBJECTS = $(am__objects_1) 93@TARGET_LIBRARY_FALSE@am_libz_a_OBJECTS = $(am__objects_1)
92libz_a_OBJECTS = $(am_libz_a_OBJECTS) 94libz_a_OBJECTS = $(am_libz_a_OBJECTS)
93LTLIBRARIES = $(noinst_LTLIBRARIES) 95LTLIBRARIES = $(noinst_LTLIBRARIES)
94libzgcj_convenience_la_LIBADD = 96libzgcj_convenience_la_LIBADD =
95am__objects_2 = adler32.lo compress.lo crc32.lo deflate.lo gzio.lo \ 97am__objects_2 = adler32.lo compress.lo crc32.lo deflate.lo gzread.lo \
96 infback.lo inffast.lo inflate.lo inftrees.lo trees.lo \ 98 gzclose.lo gzwrite.lo gzlib.lo infback.lo inffast.lo \
97 uncompr.lo zutil.lo 99 inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
98@TARGET_LIBRARY_TRUE@am_libzgcj_convenience_la_OBJECTS = \ 100@TARGET_LIBRARY_TRUE@am_libzgcj_convenience_la_OBJECTS = \
99@TARGET_LIBRARY_TRUE@ $(am__objects_2) 101@TARGET_LIBRARY_TRUE@ $(am__objects_2)
100libzgcj_convenience_la_OBJECTS = $(am_libzgcj_convenience_la_OBJECTS) 102libzgcj_convenience_la_OBJECTS = $(am_libzgcj_convenience_la_OBJECTS)
@@ -244,9 +246,10 @@ top_srcdir = @top_srcdir@
244AUTOMAKE_OPTIONS = 1.8 cygnus 246AUTOMAKE_OPTIONS = 1.8 cygnus
245ACLOCAL_AMFLAGS = -I .. -I ../config 247ACLOCAL_AMFLAGS = -I .. -I ../config
246ZLIB_SOURCES = adler32.c compress.c crc32.c crc32.h deflate.c \ 248ZLIB_SOURCES = adler32.c compress.c crc32.c crc32.h deflate.c \
247deflate.h gzio.c infback.c inffast.c inffast.h inffixed.h inflate.c \ 249deflate.h gzguts.h gzread.c gzclose.c gzwrite.c gzlib.c \
250infback.c inffast.c inffast.h inffixed.h inflate.c \
248inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h \ 251inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h \
249zconf.in.h zlib.h zutil.c zutil.h 252zconf.h.in zlib.h zutil.c zutil.h
250 253
251@TARGET_LIBRARY_TRUE@noinst_LTLIBRARIES = libzgcj_convenience.la 254@TARGET_LIBRARY_TRUE@noinst_LTLIBRARIES = libzgcj_convenience.la
252@TARGET_LIBRARY_TRUE@libzgcj_convenience_la_SOURCES = $(ZLIB_SOURCES) 255@TARGET_LIBRARY_TRUE@libzgcj_convenience_la_SOURCES = $(ZLIB_SOURCES)
@@ -420,11 +423,29 @@ libz_a-deflate.o: deflate.c
420libz_a-deflate.obj: deflate.c 423libz_a-deflate.obj: deflate.c
421 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-deflate.obj `if test -f 'deflate.c'; then $(CYGPATH_W) 'deflate.c'; else $(CYGPATH_W) '$(srcdir)/deflate.c'; fi` 424 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-deflate.obj `if test -f 'deflate.c'; then $(CYGPATH_W) 'deflate.c'; else $(CYGPATH_W) '$(srcdir)/deflate.c'; fi`
422 425
423libz_a-gzio.o: gzio.c 426libz_a-gzread.o: gzread.c
424 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzio.o `test -f 'gzio.c' || echo '$(srcdir)/'`gzio.c 427 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzread.o `test -f 'gzread.c' || echo '$(srcdir)/'`gzread.c
425 428
426libz_a-gzio.obj: gzio.c 429libz_a-gzread.obj: gzread.c
427 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzio.obj `if test -f 'gzio.c'; then $(CYGPATH_W) 'gzio.c'; else $(CYGPATH_W) '$(srcdir)/gzio.c'; fi` 430 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzread.obj `if test -f 'gzread.c'; then $(CYGPATH_W) 'gzread.c'; else $(CYGPATH_W) '$(srcdir)/gzread.c'; fi`
431
432libz_a-gzclose.o: gzclose.c
433 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzclose.o `test -f 'gzclose.c' || echo '$(srcdir)/'`gzclose.c
434
435libz_a-gzclose.obj: gzclose.c
436 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzclose.obj `if test -f 'gzclose.c'; then $(CYGPATH_W) 'gzclose.c'; else $(CYGPATH_W) '$(srcdir)/gzclose.c'; fi`
437
438libz_a-gzwrite.o: gzwrite.c
439 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzwrite.o `test -f 'gzwrite.c' || echo '$(srcdir)/'`gzwrite.c
440
441libz_a-gzwrite.obj: gzwrite.c
442 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzwrite.obj `if test -f 'gzwrite.c'; then $(CYGPATH_W) 'gzwrite.c'; else $(CYGPATH_W) '$(srcdir)/gzwrite.c'; fi`
443
444libz_a-gzlib.o: gzlib.c
445 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzlib.o `test -f 'gzlib.c' || echo '$(srcdir)/'`gzlib.c
446
447libz_a-gzlib.obj: gzlib.c
448 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-gzlib.obj `if test -f 'gzlib.c'; then $(CYGPATH_W) 'gzlib.c'; else $(CYGPATH_W) '$(srcdir)/gzlib.c'; fi`
428 449
429libz_a-infback.o: infback.c 450libz_a-infback.o: infback.c
430 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-infback.o `test -f 'infback.c' || echo '$(srcdir)/'`infback.c 451 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libz_a_CFLAGS) $(CFLAGS) -c -o libz_a-infback.o `test -f 'infback.c' || echo '$(srcdir)/'`infback.c
diff --git a/zlib/README b/zlib/README
index 0f171029d20..2070218cf1e 100644
--- a/zlib/README
+++ b/zlib/README
@@ -3,57 +3,53 @@ shipped with GCC as convenience.
3 3
4ZLIB DATA COMPRESSION LIBRARY 4ZLIB DATA COMPRESSION LIBRARY
5 5
6zlib 1.2.3 is a general purpose data compression library. All the code is 6zlib 1.2.5 is a general purpose data compression library. All the code is
7thread safe. The data format used by the zlib library is described by RFCs 7thread safe. The data format used by the zlib library is described by RFCs
8(Request for Comments) 1950 to 1952 in the files 8(Request for Comments) 1950 to 1952 in the files
9http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 9http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
10and rfc1952.txt (gzip format). These documents are also available in other 10and rfc1952.txt (gzip format).
11formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
12 11
13All functions of the compression library are documented in the file zlib.h 12All functions of the compression library are documented in the file zlib.h
14(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example 13(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
15of the library is given in the file example.c which also tests that the library 14of the library is given in the file example.c which also tests that the library
16is working correctly. Another example is given in the file minigzip.c. The 15is working correctly. Another example is given in the file minigzip.c. The
17compression library itself is composed of all source files except example.c and 16compression library itself is composed of all source files except example.c and
18minigzip.c. 17minigzip.c.
19 18
20To compile all files and run the test program, follow the instructions given at 19To compile all files and run the test program, follow the instructions given at
21the top of Makefile. In short "make test; make install" should work for most 20the top of Makefile.in. In short "./configure; make test", and if that goes
22machines. For Unix: "./configure; make test; make install". For MSDOS, use one 21well, "make install" should work for most flavors of Unix. For Windows, use one
23of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. 22of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
23make_vms.com.
24 24
25Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant 25Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
26<info@winimage.com> for the Windows DLL version. The zlib home page is 26<info@winimage.com> for the Windows DLL version. The zlib home page is
27http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, 27http://zlib.net/ . Before reporting a problem, please check this site to
28please check this site to verify that you have the latest version of zlib; 28verify that you have the latest version of zlib; otherwise get the latest
29otherwise get the latest version and check whether the problem still exists or 29version and check whether the problem still exists or not.
30not.
31 30
32PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking 31PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
33for help.
34 32
35Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 33Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
36issue of Dr. Dobb's Journal; a copy of the article is available in 34issue of Dr. Dobb's Journal; a copy of the article is available at
37http://dogma.net/markn/articles/zlibtool/zlibtool.htm 35http://marknelson.us/1997/01/01/zlib-engine/ .
38 36
39The changes made in version 1.2.3 are documented in the file ChangeLog. 37The changes made in version 1.2.5 are documented in the file ChangeLog.
40 38
41Unsupported third party contributions are provided in directory "contrib". 39Unsupported third party contributions are provided in directory contrib/ .
42 40
43A Java implementation of zlib is available in the Java Development Kit 41zlib is available in Java using the java.util.zip package, documented at
44http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html 42http://java.sun.com/developer/technicalArticles/Programming/compression/ .
45See the zlib home page http://www.zlib.org for details.
46 43
47A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the 44A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
48CPAN (Comprehensive Perl Archive Network) sites 45at CPAN (Comprehensive Perl Archive Network) sites, including
49http://www.cpan.org/modules/by-module/Compress/ 46http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
50 47
51A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is 48A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
52available in Python 1.5 and later versions, see 49available in Python 1.5 and later versions, see
53http://www.python.org/doc/lib/module-zlib.html 50http://www.python.org/doc/lib/module-zlib.html .
54 51
55A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is 52zlib is built into tcl: http://wiki.tcl.tk/4610 .
56availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
57 53
58An experimental package to read and write files in .zip format, written on top 54An experimental package to read and write files in .zip format, written on top
59of zlib by Gilles Vollant <info@winimage.com>, is available in the 55of zlib by Gilles Vollant <info@winimage.com>, is available in the
@@ -77,25 +73,21 @@ Notes for some targets:
77- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with 73- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
78 other compilers. Use "make test" to check your compiler. 74 other compilers. Use "make test" to check your compiler.
79 75
80- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. 76- gzdopen is not supported on RISCOS or BEOS.
81 77
82- For PalmOs, see http://palmzlib.sourceforge.net/ 78- For PalmOs, see http://palmzlib.sourceforge.net/
83 79
84- When building a shared, i.e. dynamic library on Mac OS X, the library must be
85 installed before testing (do "make install" before "make test"), since the
86 library location is specified in the library.
87
88 80
89Acknowledgments: 81Acknowledgments:
90 82
91 The deflate format used by zlib was defined by Phil Katz. The deflate 83 The deflate format used by zlib was defined by Phil Katz. The deflate and
92 and zlib specifications were written by L. Peter Deutsch. Thanks to all the 84 zlib specifications were written by L. Peter Deutsch. Thanks to all the
93 people who reported problems and suggested various improvements in zlib; 85 people who reported problems and suggested various improvements in zlib; they
94 they are too numerous to cite here. 86 are too numerous to cite here.
95 87
96Copyright notice: 88Copyright notice:
97 89
98 (C) 1995-2004 Jean-loup Gailly and Mark Adler 90 (C) 1995-2010 Jean-loup Gailly and Mark Adler
99 91
100 This software is provided 'as-is', without any express or implied 92 This software is provided 'as-is', without any express or implied
101 warranty. In no event will the authors be held liable for any damages 93 warranty. In no event will the authors be held liable for any damages
@@ -116,13 +108,11 @@ Copyright notice:
116 Jean-loup Gailly Mark Adler 108 Jean-loup Gailly Mark Adler
117 jloup@gzip.org madler@alumni.caltech.edu 109 jloup@gzip.org madler@alumni.caltech.edu
118 110
119If you use the zlib library in a product, we would appreciate *not* 111If you use the zlib library in a product, we would appreciate *not* receiving
120receiving lengthy legal documents to sign. The sources are provided 112lengthy legal documents to sign. The sources are provided for free but without
121for free but without warranty of any kind. The library has been 113warranty of any kind. The library has been entirely written by Jean-loup
122entirely written by Jean-loup Gailly and Mark Adler; it does not 114Gailly and Mark Adler; it does not include third-party code.
123include third-party code.
124 115
125If you redistribute modified sources, we would appreciate that you include 116If you redistribute modified sources, we would appreciate that you include in
126in the file ChangeLog history information documenting your changes. Please 117the file ChangeLog history information documenting your changes. Please read
127read the FAQ for more information on the distribution of modified source 118the FAQ for more information on the distribution of modified source versions.
128versions.
diff --git a/zlib/adler32.c b/zlib/adler32.c
index 2aec8514131..c772d935184 100644
--- a/zlib/adler32.c
+++ b/zlib/adler32.c
@@ -1,12 +1,15 @@
1/* adler32.c -- compute the Adler-32 checksum of a data stream 1/* adler32.c -- compute the Adler-32 checksum of a data stream
2 * Copyright (C) 1995-2004 Mark Adler 2 * Copyright (C) 1995-2007 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* @(#) $Id: adler32.c,v 1.1.1.2 2002/03/11 21:53:23 tromey Exp $ */ 6/* @(#) $Id: adler32.c,v 1.1.1.2 2002/03/11 21:53:23 tromey Exp $ */
7 7
8#define ZLIB_INTERNAL 8#include "zutil.h"
9#include "zlib.h" 9
10#define local static
11
12local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
10 13
11#define BASE 65521UL /* largest prime smaller than 65536 */ 14#define BASE 65521UL /* largest prime smaller than 65536 */
12#define NMAX 5552 15#define NMAX 5552
@@ -125,10 +128,10 @@ uLong ZEXPORT adler32(adler, buf, len)
125} 128}
126 129
127/* ========================================================================= */ 130/* ========================================================================= */
128uLong ZEXPORT adler32_combine(adler1, adler2, len2) 131local uLong adler32_combine_(adler1, adler2, len2)
129 uLong adler1; 132 uLong adler1;
130 uLong adler2; 133 uLong adler2;
131 z_off_t len2; 134 z_off64_t len2;
132{ 135{
133 unsigned long sum1; 136 unsigned long sum1;
134 unsigned long sum2; 137 unsigned long sum2;
@@ -141,9 +144,26 @@ uLong ZEXPORT adler32_combine(adler1, adler2, len2)
141 MOD(sum2); 144 MOD(sum2);
142 sum1 += (adler2 & 0xffff) + BASE - 1; 145 sum1 += (adler2 & 0xffff) + BASE - 1;
143 sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; 146 sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
144 if (sum1 > BASE) sum1 -= BASE; 147 if (sum1 >= BASE) sum1 -= BASE;
145 if (sum1 > BASE) sum1 -= BASE; 148 if (sum1 >= BASE) sum1 -= BASE;
146 if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); 149 if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
147 if (sum2 > BASE) sum2 -= BASE; 150 if (sum2 >= BASE) sum2 -= BASE;
148 return sum1 | (sum2 << 16); 151 return sum1 | (sum2 << 16);
149} 152}
153
154/* ========================================================================= */
155uLong ZEXPORT adler32_combine(adler1, adler2, len2)
156 uLong adler1;
157 uLong adler2;
158 z_off_t len2;
159{
160 return adler32_combine_(adler1, adler2, len2);
161}
162
163uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
164 uLong adler1;
165 uLong adler2;
166 z_off64_t len2;
167{
168 return adler32_combine_(adler1, adler2, len2);
169}
diff --git a/zlib/amiga/Makefile.pup b/zlib/amiga/Makefile.pup
index 3f7e15537f1..8940c120fbb 100644
--- a/zlib/amiga/Makefile.pup
+++ b/zlib/amiga/Makefile.pup
@@ -14,8 +14,8 @@ LDFLAGS = -o
14LDLIBS = LIB:scppc.a LIB:end.o 14LDLIBS = LIB:scppc.a LIB:end.o
15RM = delete quiet 15RM = delete quiet
16 16
17OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 17OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
18 zutil.o inflate.o infback.o inftrees.o inffast.o 18 uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
19 19
20TEST_OBJS = example.o minigzip.o 20TEST_OBJS = example.o minigzip.o
21 21
@@ -55,7 +55,10 @@ compress.o: zlib.h zconf.h
55crc32.o: crc32.h zlib.h zconf.h 55crc32.o: crc32.h zlib.h zconf.h
56deflate.o: deflate.h zutil.h zlib.h zconf.h 56deflate.o: deflate.h zutil.h zlib.h zconf.h
57example.o: zlib.h zconf.h 57example.o: zlib.h zconf.h
58gzio.o: zutil.h zlib.h zconf.h 58gzclose.o: zlib.h zconf.h gzguts.h
59gzlib.o: zlib.h zconf.h gzguts.h
60gzread.o: zlib.h zconf.h gzguts.h
61gzwrite.o: zlib.h zconf.h gzguts.h
59inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 62inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
60inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 63inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
61infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 64infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
diff --git a/zlib/amiga/Makefile.sas b/zlib/amiga/Makefile.sas
index 296ef48a22b..749e2915271 100644
--- a/zlib/amiga/Makefile.sas
+++ b/zlib/amiga/Makefile.sas
@@ -13,8 +13,8 @@ SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
13 NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \ 13 NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
14 DEF=POSTINC 14 DEF=POSTINC
15 15
16OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 16OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
17 zutil.o inflate.o infback.o inftrees.o inffast.o 17 uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
18 18
19TEST_OBJS = example.o minigzip.o 19TEST_OBJS = example.o minigzip.o
20 20
@@ -54,7 +54,10 @@ compress.o: zlib.h zconf.h
54crc32.o: crc32.h zlib.h zconf.h 54crc32.o: crc32.h zlib.h zconf.h
55deflate.o: deflate.h zutil.h zlib.h zconf.h 55deflate.o: deflate.h zutil.h zlib.h zconf.h
56example.o: zlib.h zconf.h 56example.o: zlib.h zconf.h
57gzio.o: zutil.h zlib.h zconf.h 57gzclose.o: zlib.h zconf.h gzguts.h
58gzlib.o: zlib.h zconf.h gzguts.h
59gzread.o: zlib.h zconf.h gzguts.h
60gzwrite.o: zlib.h zconf.h gzguts.h
58inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 61inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
59inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 62inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
60infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 63infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
diff --git a/zlib/compress.c b/zlib/compress.c
index 08f276718fa..7de97663f9e 100644
--- a/zlib/compress.c
+++ b/zlib/compress.c
@@ -1,5 +1,5 @@
1/* compress.c -- compress a memory buffer 1/* compress.c -- compress a memory buffer
2 * Copyright (C) 1995-2003 Jean-loup Gailly. 2 * Copyright (C) 1995-2005 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
@@ -75,5 +75,6 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
75uLong ZEXPORT compressBound (sourceLen) 75uLong ZEXPORT compressBound (sourceLen)
76 uLong sourceLen; 76 uLong sourceLen;
77{ 77{
78 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; 78 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
79 (sourceLen >> 25) + 13;
79} 80}
diff --git a/zlib/contrib/README.contrib b/zlib/contrib/README.contrib
index 20afc621541..dd2285d960a 100644
--- a/zlib/contrib/README.contrib
+++ b/zlib/contrib/README.contrib
@@ -8,7 +8,10 @@ ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
8 Support for Ada 8 Support for Ada
9 See http://zlib-ada.sourceforge.net/ 9 See http://zlib-ada.sourceforge.net/
10 10
11asm586/ 11amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
12 asm code for AMD64
13 See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
14
12asm686/ by Brian Raiter <breadbox@muppetlabs.com> 15asm686/ by Brian Raiter <breadbox@muppetlabs.com>
13 asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax 16 asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
14 See http://www.muppetlabs.com/~breadbox/software/assembly.html 17 See http://www.muppetlabs.com/~breadbox/software/assembly.html
@@ -22,6 +25,10 @@ delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
22dotzlib/ by Henrik Ravn <henrik@ravn.com> 25dotzlib/ by Henrik Ravn <henrik@ravn.com>
23 Support for Microsoft .Net and Visual C++ .Net 26 Support for Microsoft .Net and Visual C++ .Net
24 27
28gcc_gvmat64/by Gilles Vollant <info@winimage.com>
29 GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64
30 assembler to replace longest_match() and inflate_fast()
31
25infback9/ by Mark Adler <madler@alumni.caltech.edu> 32infback9/ by Mark Adler <madler@alumni.caltech.edu>
26 Unsupported diffs to infback to decode the deflate64 format 33 Unsupported diffs to infback to decode the deflate64 format
27 34
@@ -38,20 +45,19 @@ iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
38 and Kevin Ruland <kevin@rodin.wustl.edu> 45 and Kevin Ruland <kevin@rodin.wustl.edu>
39 Yet another C++ I/O streams interface 46 Yet another C++ I/O streams interface
40 47
41masm686/ by Dan Higdon <hdan@kinesoft.com>
42 and Chuck Walbourn <chuckw@kinesoft.com>
43 asm code for Pentium Pro/PII, using the MASM syntax
44
45masmx64/ by Gilles Vollant <info@winimage.com> 48masmx64/ by Gilles Vollant <info@winimage.com>
46 x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to 49 x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
47 replace longest_match() and inflate_fast() 50 replace longest_match() and inflate_fast(), also masm x86
51 64-bits translation of Chris Anderson inflate_fast()
48 52
49masmx86/ by Gilles Vollant <info@winimage.com> 53masmx86/ by Gilles Vollant <info@winimage.com>
50 x86 asm code to replace longest_match() and inflate_fast(), 54 x86 asm code to replace longest_match() and inflate_fast(),
51 for Visual C++ and MASM 55 for Visual C++ and MASM (32 bits).
56 Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
52 57
53minizip/ by Gilles Vollant <info@winimage.com> 58minizip/ by Gilles Vollant <info@winimage.com>
54 Mini zip and unzip based on zlib 59 Mini zip and unzip based on zlib
60 Includes Zip64 support by Mathias Svensson <mathias@result42.com>
55 See http://www.winimage.com/zLibDll/unzip.html 61 See http://www.winimage.com/zLibDll/unzip.html
56 62
57pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al. 63pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
diff --git a/zlib/contrib/amd64/amd64-match.S b/zlib/contrib/amd64/amd64-match.S
new file mode 100644
index 00000000000..81d4a1c9494
--- /dev/null
+++ b/zlib/contrib/amd64/amd64-match.S
@@ -0,0 +1,452 @@
1/*
2 * match.S -- optimized version of longest_match()
3 * based on the similar work by Gilles Vollant, and Brian Raiter, written 1998
4 *
5 * This is free software; you can redistribute it and/or modify it
6 * under the terms of the BSD License. Use by owners of Che Guevarra
7 * parafernalia is prohibited, where possible, and highly discouraged
8 * elsewhere.
9 */
10
11#ifndef NO_UNDERLINE
12# define match_init _match_init
13# define longest_match _longest_match
14#endif
15
16#define scanend ebx
17#define scanendw bx
18#define chainlenwmask edx /* high word: current chain len low word: s->wmask */
19#define curmatch rsi
20#define curmatchd esi
21#define windowbestlen r8
22#define scanalign r9
23#define scanalignd r9d
24#define window r10
25#define bestlen r11
26#define bestlend r11d
27#define scanstart r12d
28#define scanstartw r12w
29#define scan r13
30#define nicematch r14d
31#define limit r15
32#define limitd r15d
33#define prev rcx
34
35/*
36 * The 258 is a "magic number, not a parameter -- changing it
37 * breaks the hell loose
38 */
39#define MAX_MATCH (258)
40#define MIN_MATCH (3)
41#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
42#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
43
44/* stack frame offsets */
45#define LocalVarsSize (112)
46#define _chainlenwmask ( 8-LocalVarsSize)(%rsp)
47#define _windowbestlen (16-LocalVarsSize)(%rsp)
48#define save_r14 (24-LocalVarsSize)(%rsp)
49#define save_rsi (32-LocalVarsSize)(%rsp)
50#define save_rbx (40-LocalVarsSize)(%rsp)
51#define save_r12 (56-LocalVarsSize)(%rsp)
52#define save_r13 (64-LocalVarsSize)(%rsp)
53#define save_r15 (80-LocalVarsSize)(%rsp)
54
55
56.globl match_init, longest_match
57
58/*
59 * On AMD64 the first argument of a function (in our case -- the pointer to
60 * deflate_state structure) is passed in %rdi, hence our offsets below are
61 * all off of that.
62 */
63
64/* you can check the structure offset by running
65
66#include <stdlib.h>
67#include <stdio.h>
68#include "deflate.h"
69
70void print_depl()
71{
72deflate_state ds;
73deflate_state *s=&ds;
74printf("size pointer=%u\n",(int)sizeof(void*));
75
76printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s)));
77printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s)));
78printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s)));
79printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s)));
80printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s)));
81printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s)));
82printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s)));
83printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s)));
84printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s)));
85printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s)));
86printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
87printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s)));
88printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s)));
89}
90
91*/
92
93
94/*
95 to compile for XCode 3.2 on MacOSX x86_64
96 - run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S"
97 */
98
99
100#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE
101#define dsWSize ( 68)(%rdi)
102#define dsWMask ( 76)(%rdi)
103#define dsWindow ( 80)(%rdi)
104#define dsPrev ( 96)(%rdi)
105#define dsMatchLen (144)(%rdi)
106#define dsPrevMatch (148)(%rdi)
107#define dsStrStart (156)(%rdi)
108#define dsMatchStart (160)(%rdi)
109#define dsLookahead (164)(%rdi)
110#define dsPrevLen (168)(%rdi)
111#define dsMaxChainLen (172)(%rdi)
112#define dsGoodMatch (188)(%rdi)
113#define dsNiceMatch (192)(%rdi)
114
115#else
116
117#ifndef STRUCT_OFFSET
118# define STRUCT_OFFSET (0)
119#endif
120
121
122#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi)
123#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi)
124#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi)
125#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi)
126#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi)
127#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi)
128#define dsStrStart (148 + STRUCT_OFFSET)(%rdi)
129#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi)
130#define dsLookahead (156 + STRUCT_OFFSET)(%rdi)
131#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi)
132#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi)
133#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi)
134#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi)
135
136#endif
137
138
139
140
141.text
142
143/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
144
145longest_match:
146/*
147 * Retrieve the function arguments. %curmatch will hold cur_match
148 * throughout the entire function (passed via rsi on amd64).
149 * rdi will hold the pointer to the deflate_state (first arg on amd64)
150 */
151 mov %rsi, save_rsi
152 mov %rbx, save_rbx
153 mov %r12, save_r12
154 mov %r13, save_r13
155 mov %r14, save_r14
156 mov %r15, save_r15
157
158/* uInt wmask = s->w_mask; */
159/* unsigned chain_length = s->max_chain_length; */
160/* if (s->prev_length >= s->good_match) { */
161/* chain_length >>= 2; */
162/* } */
163
164 movl dsPrevLen, %eax
165 movl dsGoodMatch, %ebx
166 cmpl %ebx, %eax
167 movl dsWMask, %eax
168 movl dsMaxChainLen, %chainlenwmask
169 jl LastMatchGood
170 shrl $2, %chainlenwmask
171LastMatchGood:
172
173/* chainlen is decremented once beforehand so that the function can */
174/* use the sign flag instead of the zero flag for the exit test. */
175/* It is then shifted into the high word, to make room for the wmask */
176/* value, which it will always accompany. */
177
178 decl %chainlenwmask
179 shll $16, %chainlenwmask
180 orl %eax, %chainlenwmask
181
182/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
183
184 movl dsNiceMatch, %eax
185 movl dsLookahead, %ebx
186 cmpl %eax, %ebx
187 jl LookaheadLess
188 movl %eax, %ebx
189LookaheadLess: movl %ebx, %nicematch
190
191/* register Bytef *scan = s->window + s->strstart; */
192
193 mov dsWindow, %window
194 movl dsStrStart, %limitd
195 lea (%limit, %window), %scan
196
197/* Determine how many bytes the scan ptr is off from being */
198/* dword-aligned. */
199
200 mov %scan, %scanalign
201 negl %scanalignd
202 andl $3, %scanalignd
203
204/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
205/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
206
207 movl dsWSize, %eax
208 subl $MIN_LOOKAHEAD, %eax
209 xorl %ecx, %ecx
210 subl %eax, %limitd
211 cmovng %ecx, %limitd
212
213/* int best_len = s->prev_length; */
214
215 movl dsPrevLen, %bestlend
216
217/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */
218
219 lea (%window, %bestlen), %windowbestlen
220 mov %windowbestlen, _windowbestlen
221
222/* register ush scan_start = *(ushf*)scan; */
223/* register ush scan_end = *(ushf*)(scan+best_len-1); */
224/* Posf *prev = s->prev; */
225
226 movzwl (%scan), %scanstart
227 movzwl -1(%scan, %bestlen), %scanend
228 mov dsPrev, %prev
229
230/* Jump into the main loop. */
231
232 movl %chainlenwmask, _chainlenwmask
233 jmp LoopEntry
234
235.balign 16
236
237/* do {
238 * match = s->window + cur_match;
239 * if (*(ushf*)(match+best_len-1) != scan_end ||
240 * *(ushf*)match != scan_start) continue;
241 * [...]
242 * } while ((cur_match = prev[cur_match & wmask]) > limit
243 * && --chain_length != 0);
244 *
245 * Here is the inner loop of the function. The function will spend the
246 * majority of its time in this loop, and majority of that time will
247 * be spent in the first ten instructions.
248 */
249LookupLoop:
250 andl %chainlenwmask, %curmatchd
251 movzwl (%prev, %curmatch, 2), %curmatchd
252 cmpl %limitd, %curmatchd
253 jbe LeaveNow
254 subl $0x00010000, %chainlenwmask
255 js LeaveNow
256LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw
257 jne LookupLoop
258 cmpw %scanstartw, (%window, %curmatch)
259 jne LookupLoop
260
261/* Store the current value of chainlen. */
262 movl %chainlenwmask, _chainlenwmask
263
264/* %scan is the string under scrutiny, and %prev to the string we */
265/* are hoping to match it up with. In actuality, %esi and %edi are */
266/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
267/* initialized to -(MAX_MATCH_8 - scanalign). */
268
269 mov $(-MAX_MATCH_8), %rdx
270 lea (%curmatch, %window), %windowbestlen
271 lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen
272 lea MAX_MATCH_8(%scan, %scanalign), %prev
273
274/* the prefetching below makes very little difference... */
275 prefetcht1 (%windowbestlen, %rdx)
276 prefetcht1 (%prev, %rdx)
277
278/*
279 * Test the strings for equality, 8 bytes at a time. At the end,
280 * adjust %rdx so that it is offset to the exact byte that mismatched.
281 *
282 * It should be confessed that this loop usually does not represent
283 * much of the total running time. Replacing it with a more
284 * straightforward "rep cmpsb" would not drastically degrade
285 * performance -- unrolling it, for example, makes no difference.
286 */
287
288#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */
289
290LoopCmps:
291#ifdef USE_SSE
292 /* Preload the SSE registers */
293 movdqu (%windowbestlen, %rdx), %xmm1
294 movdqu (%prev, %rdx), %xmm2
295 pcmpeqb %xmm2, %xmm1
296 movdqu 16(%windowbestlen, %rdx), %xmm3
297 movdqu 16(%prev, %rdx), %xmm4
298 pcmpeqb %xmm4, %xmm3
299 movdqu 32(%windowbestlen, %rdx), %xmm5
300 movdqu 32(%prev, %rdx), %xmm6
301 pcmpeqb %xmm6, %xmm5
302 movdqu 48(%windowbestlen, %rdx), %xmm7
303 movdqu 48(%prev, %rdx), %xmm8
304 pcmpeqb %xmm8, %xmm7
305
306 /* Check the comparisions' results */
307 pmovmskb %xmm1, %rax
308 notw %ax
309 bsfw %ax, %ax
310 jnz LeaveLoopCmps
311
312 /* this is the only iteration of the loop with a possibility of having
313 incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40
314 and (0x40*4)+8=0x108 */
315 add $8, %rdx
316 jz LenMaximum
317 add $8, %rdx
318
319
320 pmovmskb %xmm3, %rax
321 notw %ax
322 bsfw %ax, %ax
323 jnz LeaveLoopCmps
324
325
326 add $16, %rdx
327
328
329 pmovmskb %xmm5, %rax
330 notw %ax
331 bsfw %ax, %ax
332 jnz LeaveLoopCmps
333
334 add $16, %rdx
335
336
337 pmovmskb %xmm7, %rax
338 notw %ax
339 bsfw %ax, %ax
340 jnz LeaveLoopCmps
341
342 add $16, %rdx
343
344 jmp LoopCmps
345LeaveLoopCmps: add %rax, %rdx
346#else
347 mov (%windowbestlen, %rdx), %rax
348 xor (%prev, %rdx), %rax
349 jnz LeaveLoopCmps
350
351 mov 8(%windowbestlen, %rdx), %rax
352 xor 8(%prev, %rdx), %rax
353 jnz LeaveLoopCmps8
354
355 mov 16(%windowbestlen, %rdx), %rax
356 xor 16(%prev, %rdx), %rax
357 jnz LeaveLoopCmps16
358
359 add $24, %rdx
360 jnz LoopCmps
361 jmp LenMaximum
362# if 0
363/*
364 * This three-liner is tantalizingly simple, but bsf is a slow instruction,
365 * and the complicated alternative down below is quite a bit faster. Sad...
366 */
367
368LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */
369 shrl $3, %eax /* divide by 8 to get the byte */
370 add %rax, %rdx
371# else
372LeaveLoopCmps16:
373 add $8, %rdx
374LeaveLoopCmps8:
375 add $8, %rdx
376LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */
377 jnz Check16
378 add $4, %rdx
379 shr $32, %rax
380Check16: testw $0xFFFF, %ax
381 jnz LenLower
382 add $2, %rdx
383 shrl $16, %eax
384LenLower: subb $1, %al
385 adc $0, %rdx
386# endif
387#endif
388
389/* Calculate the length of the match. If it is longer than MAX_MATCH, */
390/* then automatically accept it as the best possible match and leave. */
391
392 lea (%prev, %rdx), %rax
393 sub %scan, %rax
394 cmpl $MAX_MATCH, %eax
395 jge LenMaximum
396
397/* If the length of the match is not longer than the best match we */
398/* have so far, then forget it and return to the lookup loop. */
399
400 cmpl %bestlend, %eax
401 jg LongerMatch
402 mov _windowbestlen, %windowbestlen
403 mov dsPrev, %prev
404 movl _chainlenwmask, %edx
405 jmp LookupLoop
406
407/* s->match_start = cur_match; */
408/* best_len = len; */
409/* if (len >= nice_match) break; */
410/* scan_end = *(ushf*)(scan+best_len-1); */
411
412LongerMatch:
413 movl %eax, %bestlend
414 movl %curmatchd, dsMatchStart
415 cmpl %nicematch, %eax
416 jge LeaveNow
417
418 lea (%window, %bestlen), %windowbestlen
419 mov %windowbestlen, _windowbestlen
420
421 movzwl -1(%scan, %rax), %scanend
422 mov dsPrev, %prev
423 movl _chainlenwmask, %chainlenwmask
424 jmp LookupLoop
425
426/* Accept the current string, with the maximum possible length. */
427
428LenMaximum:
429 movl $MAX_MATCH, %bestlend
430 movl %curmatchd, dsMatchStart
431
432/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
433/* return s->lookahead; */
434
435LeaveNow:
436 movl dsLookahead, %eax
437 cmpl %eax, %bestlend
438 cmovngl %bestlend, %eax
439LookaheadRet:
440
441/* Restore the registers and return from whence we came. */
442
443 mov save_rsi, %rsi
444 mov save_rbx, %rbx
445 mov save_r12, %r12
446 mov save_r13, %r13
447 mov save_r14, %r14
448 mov save_r15, %r15
449
450 ret
451
452match_init: ret
diff --git a/zlib/contrib/asm586/README.586 b/zlib/contrib/asm586/README.586
deleted file mode 100644
index 6bb78f32069..00000000000
--- a/zlib/contrib/asm586/README.586
+++ /dev/null
@@ -1,43 +0,0 @@
1This is a patched version of zlib modified to use
2Pentium-optimized assembly code in the deflation algorithm. The files
3changed/added by this patch are:
4
5README.586
6match.S
7
8The effectiveness of these modifications is a bit marginal, as the the
9program's bottleneck seems to be mostly L1-cache contention, for which
10there is no real way to work around without rewriting the basic
11algorithm. The speedup on average is around 5-10% (which is generally
12less than the amount of variance between subsequent executions).
13However, when used at level 9 compression, the cache contention can
14drop enough for the assembly version to achieve 10-20% speedup (and
15sometimes more, depending on the amount of overall redundancy in the
16files). Even here, though, cache contention can still be the limiting
17factor, depending on the nature of the program using the zlib library.
18This may also mean that better improvements will be seen on a Pentium
19with MMX, which suffers much less from L1-cache contention, but I have
20not yet verified this.
21
22Note that this code has been tailored for the Pentium in particular,
23and will not perform well on the Pentium Pro (due to the use of a
24partial register in the inner loop).
25
26If you are using an assembler other than GNU as, you will have to
27translate match.S to use your assembler's syntax. (Have fun.)
28
29Brian Raiter
30breadbox@muppetlabs.com
31April, 1998
32
33
34Added for zlib 1.1.3:
35
36The patches come from
37http://www.muppetlabs.com/~breadbox/software/assembly.html
38
39To compile zlib with this asm file, copy match.S to the zlib directory
40then do:
41
42CFLAGS="-O3 -DASMV" ./configure
43make OBJA=match.o
diff --git a/zlib/contrib/asm586/match.S b/zlib/contrib/asm586/match.S
deleted file mode 100644
index 0368b35fe3a..00000000000
--- a/zlib/contrib/asm586/match.S
+++ /dev/null
@@ -1,364 +0,0 @@
1/* match.s -- Pentium-optimized version of longest_match()
2 * Written for zlib 1.1.2
3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
4 *
5 * This is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License.
7 */
8
9#ifndef NO_UNDERLINE
10#define match_init _match_init
11#define longest_match _longest_match
12#endif
13
14#define MAX_MATCH (258)
15#define MIN_MATCH (3)
16#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
17#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
18
19/* stack frame offsets */
20
21#define wmask 0 /* local copy of s->wmask */
22#define window 4 /* local copy of s->window */
23#define windowbestlen 8 /* s->window + bestlen */
24#define chainlenscanend 12 /* high word: current chain len */
25 /* low word: last bytes sought */
26#define scanstart 16 /* first two bytes of string */
27#define scanalign 20 /* dword-misalignment of string */
28#define nicematch 24 /* a good enough match size */
29#define bestlen 28 /* size of best match so far */
30#define scan 32 /* ptr to string wanting match */
31
32#define LocalVarsSize (36)
33/* saved ebx 36 */
34/* saved edi 40 */
35/* saved esi 44 */
36/* saved ebp 48 */
37/* return address 52 */
38#define deflatestate 56 /* the function arguments */
39#define curmatch 60
40
41/* Offsets for fields in the deflate_state structure. These numbers
42 * are calculated from the definition of deflate_state, with the
43 * assumption that the compiler will dword-align the fields. (Thus,
44 * changing the definition of deflate_state could easily cause this
45 * program to crash horribly, without so much as a warning at
46 * compile time. Sigh.)
47 */
48
49/* All the +zlib1222add offsets are due to the addition of fields
50 * in zlib in the deflate_state structure since the asm code was first written
51 * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
52 * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
53 * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
54 */
55
56#define zlib1222add (8)
57
58#define dsWSize (36+zlib1222add)
59#define dsWMask (44+zlib1222add)
60#define dsWindow (48+zlib1222add)
61#define dsPrev (56+zlib1222add)
62#define dsMatchLen (88+zlib1222add)
63#define dsPrevMatch (92+zlib1222add)
64#define dsStrStart (100+zlib1222add)
65#define dsMatchStart (104+zlib1222add)
66#define dsLookahead (108+zlib1222add)
67#define dsPrevLen (112+zlib1222add)
68#define dsMaxChainLen (116+zlib1222add)
69#define dsGoodMatch (132+zlib1222add)
70#define dsNiceMatch (136+zlib1222add)
71
72
73.file "match.S"
74
75.globl match_init, longest_match
76
77.text
78
79/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
80
81longest_match:
82
83/* Save registers that the compiler may be using, and adjust %esp to */
84/* make room for our stack frame. */
85
86 pushl %ebp
87 pushl %edi
88 pushl %esi
89 pushl %ebx
90 subl $LocalVarsSize, %esp
91
92/* Retrieve the function arguments. %ecx will hold cur_match */
93/* throughout the entire function. %edx will hold the pointer to the */
94/* deflate_state structure during the function's setup (before */
95/* entering the main loop). */
96
97 movl deflatestate(%esp), %edx
98 movl curmatch(%esp), %ecx
99
100/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
101
102 movl dsNiceMatch(%edx), %eax
103 movl dsLookahead(%edx), %ebx
104 cmpl %eax, %ebx
105 jl LookaheadLess
106 movl %eax, %ebx
107LookaheadLess: movl %ebx, nicematch(%esp)
108
109/* register Bytef *scan = s->window + s->strstart; */
110
111 movl dsWindow(%edx), %esi
112 movl %esi, window(%esp)
113 movl dsStrStart(%edx), %ebp
114 lea (%esi,%ebp), %edi
115 movl %edi, scan(%esp)
116
117/* Determine how many bytes the scan ptr is off from being */
118/* dword-aligned. */
119
120 movl %edi, %eax
121 negl %eax
122 andl $3, %eax
123 movl %eax, scanalign(%esp)
124
125/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
126/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
127
128 movl dsWSize(%edx), %eax
129 subl $MIN_LOOKAHEAD, %eax
130 subl %eax, %ebp
131 jg LimitPositive
132 xorl %ebp, %ebp
133LimitPositive:
134
135/* unsigned chain_length = s->max_chain_length; */
136/* if (s->prev_length >= s->good_match) { */
137/* chain_length >>= 2; */
138/* } */
139
140 movl dsPrevLen(%edx), %eax
141 movl dsGoodMatch(%edx), %ebx
142 cmpl %ebx, %eax
143 movl dsMaxChainLen(%edx), %ebx
144 jl LastMatchGood
145 shrl $2, %ebx
146LastMatchGood:
147
148/* chainlen is decremented once beforehand so that the function can */
149/* use the sign flag instead of the zero flag for the exit test. */
150/* It is then shifted into the high word, to make room for the scanend */
151/* scanend value, which it will always accompany. */
152
153 decl %ebx
154 shll $16, %ebx
155
156/* int best_len = s->prev_length; */
157
158 movl dsPrevLen(%edx), %eax
159 movl %eax, bestlen(%esp)
160
161/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
162
163 addl %eax, %esi
164 movl %esi, windowbestlen(%esp)
165
166/* register ush scan_start = *(ushf*)scan; */
167/* register ush scan_end = *(ushf*)(scan+best_len-1); */
168
169 movw (%edi), %bx
170 movw %bx, scanstart(%esp)
171 movw -1(%edi,%eax), %bx
172 movl %ebx, chainlenscanend(%esp)
173
174/* Posf *prev = s->prev; */
175/* uInt wmask = s->w_mask; */
176
177 movl dsPrev(%edx), %edi
178 movl dsWMask(%edx), %edx
179 mov %edx, wmask(%esp)
180
181/* Jump into the main loop. */
182
183 jmp LoopEntry
184
185.balign 16
186
187/* do {
188 * match = s->window + cur_match;
189 * if (*(ushf*)(match+best_len-1) != scan_end ||
190 * *(ushf*)match != scan_start) continue;
191 * [...]
192 * } while ((cur_match = prev[cur_match & wmask]) > limit
193 * && --chain_length != 0);
194 *
195 * Here is the inner loop of the function. The function will spend the
196 * majority of its time in this loop, and majority of that time will
197 * be spent in the first ten instructions.
198 *
199 * Within this loop:
200 * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend)
201 * %ecx = curmatch
202 * %edx = curmatch & wmask
203 * %esi = windowbestlen - i.e., (window + bestlen)
204 * %edi = prev
205 * %ebp = limit
206 *
207 * Two optimization notes on the choice of instructions:
208 *
209 * The first instruction uses a 16-bit address, which costs an extra,
210 * unpairable cycle. This is cheaper than doing a 32-bit access and
211 * zeroing the high word, due to the 3-cycle misalignment penalty which
212 * would occur half the time. This also turns out to be cheaper than
213 * doing two separate 8-bit accesses, as the memory is so rarely in the
214 * L1 cache.
215 *
216 * The window buffer, however, apparently spends a lot of time in the
217 * cache, and so it is faster to retrieve the word at the end of the
218 * match string with two 8-bit loads. The instructions that test the
219 * word at the beginning of the match string, however, are executed
220 * much less frequently, and there it was cheaper to use 16-bit
221 * instructions, which avoided the necessity of saving off and
222 * subsequently reloading one of the other registers.
223 */
224LookupLoop:
225 /* 1 U & V */
226 movw (%edi,%edx,2), %cx /* 2 U pipe */
227 movl wmask(%esp), %edx /* 2 V pipe */
228 cmpl %ebp, %ecx /* 3 U pipe */
229 jbe LeaveNow /* 3 V pipe */
230 subl $0x00010000, %ebx /* 4 U pipe */
231 js LeaveNow /* 4 V pipe */
232LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */
233 andl %ecx, %edx /* 5 V pipe */
234 cmpb %bl, %al /* 6 U pipe */
235 jnz LookupLoop /* 6 V pipe */
236 movb (%esi,%ecx), %ah
237 cmpb %bh, %ah
238 jnz LookupLoop
239 movl window(%esp), %eax
240 movw (%eax,%ecx), %ax
241 cmpw scanstart(%esp), %ax
242 jnz LookupLoop
243
244/* Store the current value of chainlen. */
245
246 movl %ebx, chainlenscanend(%esp)
247
248/* Point %edi to the string under scrutiny, and %esi to the string we */
249/* are hoping to match it up with. In actuality, %esi and %edi are */
250/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
251/* initialized to -(MAX_MATCH_8 - scanalign). */
252
253 movl window(%esp), %esi
254 movl scan(%esp), %edi
255 addl %ecx, %esi
256 movl scanalign(%esp), %eax
257 movl $(-MAX_MATCH_8), %edx
258 lea MAX_MATCH_8(%edi,%eax), %edi
259 lea MAX_MATCH_8(%esi,%eax), %esi
260
261/* Test the strings for equality, 8 bytes at a time. At the end,
262 * adjust %edx so that it is offset to the exact byte that mismatched.
263 *
264 * We already know at this point that the first three bytes of the
265 * strings match each other, and they can be safely passed over before
266 * starting the compare loop. So what this code does is skip over 0-3
267 * bytes, as much as necessary in order to dword-align the %edi
268 * pointer. (%esi will still be misaligned three times out of four.)
269 *
270 * It should be confessed that this loop usually does not represent
271 * much of the total running time. Replacing it with a more
272 * straightforward "rep cmpsb" would not drastically degrade
273 * performance.
274 */
275LoopCmps:
276 movl (%esi,%edx), %eax
277 movl (%edi,%edx), %ebx
278 xorl %ebx, %eax
279 jnz LeaveLoopCmps
280 movl 4(%esi,%edx), %eax
281 movl 4(%edi,%edx), %ebx
282 xorl %ebx, %eax
283 jnz LeaveLoopCmps4
284 addl $8, %edx
285 jnz LoopCmps
286 jmp LenMaximum
287LeaveLoopCmps4: addl $4, %edx
288LeaveLoopCmps: testl $0x0000FFFF, %eax
289 jnz LenLower
290 addl $2, %edx
291 shrl $16, %eax
292LenLower: subb $1, %al
293 adcl $0, %edx
294
295/* Calculate the length of the match. If it is longer than MAX_MATCH, */
296/* then automatically accept it as the best possible match and leave. */
297
298 lea (%edi,%edx), %eax
299 movl scan(%esp), %edi
300 subl %edi, %eax
301 cmpl $MAX_MATCH, %eax
302 jge LenMaximum
303
304/* If the length of the match is not longer than the best match we */
305/* have so far, then forget it and return to the lookup loop. */
306
307 movl deflatestate(%esp), %edx
308 movl bestlen(%esp), %ebx
309 cmpl %ebx, %eax
310 jg LongerMatch
311 movl chainlenscanend(%esp), %ebx
312 movl windowbestlen(%esp), %esi
313 movl dsPrev(%edx), %edi
314 movl wmask(%esp), %edx
315 andl %ecx, %edx
316 jmp LookupLoop
317
318/* s->match_start = cur_match; */
319/* best_len = len; */
320/* if (len >= nice_match) break; */
321/* scan_end = *(ushf*)(scan+best_len-1); */
322
323LongerMatch: movl nicematch(%esp), %ebx
324 movl %eax, bestlen(%esp)
325 movl %ecx, dsMatchStart(%edx)
326 cmpl %ebx, %eax
327 jge LeaveNow
328 movl window(%esp), %esi
329 addl %eax, %esi
330 movl %esi, windowbestlen(%esp)
331 movl chainlenscanend(%esp), %ebx
332 movw -1(%edi,%eax), %bx
333 movl dsPrev(%edx), %edi
334 movl %ebx, chainlenscanend(%esp)
335 movl wmask(%esp), %edx
336 andl %ecx, %edx
337 jmp LookupLoop
338
339/* Accept the current string, with the maximum possible length. */
340
341LenMaximum: movl deflatestate(%esp), %edx
342 movl $MAX_MATCH, bestlen(%esp)
343 movl %ecx, dsMatchStart(%edx)
344
345/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
346/* return s->lookahead; */
347
348LeaveNow:
349 movl deflatestate(%esp), %edx
350 movl bestlen(%esp), %ebx
351 movl dsLookahead(%edx), %eax
352 cmpl %eax, %ebx
353 jg LookaheadRet
354 movl %ebx, %eax
355LookaheadRet:
356
357/* Restore the stack and return from whence we came. */
358
359 addl $LocalVarsSize, %esp
360 popl %ebx
361 popl %esi
362 popl %edi
363 popl %ebp
364match_init: ret
diff --git a/zlib/contrib/asm686/README.686 b/zlib/contrib/asm686/README.686
index a593f23afd6..a0bf3bea4af 100644
--- a/zlib/contrib/asm686/README.686
+++ b/zlib/contrib/asm686/README.686
@@ -32,3 +32,20 @@ then do:
32 32
33CFLAGS="-O3 -DASMV" ./configure 33CFLAGS="-O3 -DASMV" ./configure
34make OBJA=match.o 34make OBJA=match.o
35
36
37Update:
38
39I've been ignoring these assembly routines for years, believing that
40gcc's generated code had caught up with it sometime around gcc 2.95
41and the major rearchitecting of the Pentium 4. However, I recently
42learned that, despite what I believed, this code still has some life
43in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
44faster than the code produced by gcc 4.1.
45
46In acknowledgement of its continuing usefulness, I've altered the
47license to match that of the rest of zlib. Share and Enjoy!
48
49Brian Raiter
50breadbox@muppetlabs.com
51April, 2007
diff --git a/zlib/contrib/asm686/match.S b/zlib/contrib/asm686/match.S
index 5c3e9ee3671..06817e1dd08 100644
--- a/zlib/contrib/asm686/match.S
+++ b/zlib/contrib/asm686/match.S
@@ -1,9 +1,23 @@
1/* match.s -- Pentium-Pro-optimized version of longest_match() 1/* match.S -- x86 assembly version of the zlib longest_match() function.
2 * Written for zlib 1.1.2 2 * Optimized for the Intel 686 chips (PPro and later).
3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
4 * 3 *
5 * This is free software; you can redistribute it and/or modify it 4 * Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com>
6 * under the terms of the GNU General Public License. 5 *
6 * This software is provided 'as-is', without any express or implied
7 * warranty. In no event will the author be held liable for any damages
8 * arising from the use of this software.
9 *
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it
12 * freely, subject to the following restrictions:
13 *
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 * 3. This notice may not be removed or altered from any source distribution.
7 */ 21 */
8 22
9#ifndef NO_UNDERLINE 23#ifndef NO_UNDERLINE
diff --git a/zlib/contrib/delphi/ZLib.pas b/zlib/contrib/delphi/ZLib.pas
index 3f2b8b4a5cd..0d86fb52fcf 100644
--- a/zlib/contrib/delphi/ZLib.pas
+++ b/zlib/contrib/delphi/ZLib.pas
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer); 152 const OutBuf: Pointer; BufSize: Integer);
153 153
154const 154const
155 zlib_version = '1.2.3'; 155 zlib_version = '1.2.5';
156 156
157type 157type
158 EZlibError = class(Exception); 158 EZlibError = class(Exception);
diff --git a/zlib/contrib/delphi/zlibd32.mak b/zlib/contrib/delphi/zlibd32.mak
index 88fafa0b14d..0d0699a69a3 100644
--- a/zlib/contrib/delphi/zlibd32.mak
+++ b/zlib/contrib/delphi/zlibd32.mak
@@ -18,10 +18,10 @@ LDFLAGS =
18# variables 18# variables
19ZLIB_LIB = zlib.lib 19ZLIB_LIB = zlib.lib
20 20
21OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj 21OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
22OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 22OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
23OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj 23OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
24OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 24OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
25 25
26 26
27# targets 27# targets
@@ -38,7 +38,13 @@ crc32.obj: crc32.c zlib.h zconf.h crc32.h
38 38
39deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 39deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
40 40
41gzio.obj: gzio.c zutil.h zlib.h zconf.h 41gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
42
43gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
44
45gzread.obj: gzread.c zlib.h zconf.h gzguts.h
46
47gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
42 48
43infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 49infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
44 inffast.h inffixed.h 50 inffast.h inffixed.h
diff --git a/zlib/contrib/dotzlib/DotZLib.build b/zlib/contrib/dotzlib/DotZLib.build
index ed19cc9dcd9..7f90d6bc7c4 100644
--- a/zlib/contrib/dotzlib/DotZLib.build
+++ b/zlib/contrib/dotzlib/DotZLib.build
@@ -4,7 +4,7 @@
4 4
5 <property name="nunit.location" value="c:/program files/NUnit V2.1/bin" /> 5 <property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />
6 <property name="build.root" value="bin" /> 6 <property name="build.root" value="bin" />
7 7
8 <property name="debug" value="true" /> 8 <property name="debug" value="true" />
9 <property name="nunit" value="true" /> 9 <property name="nunit" value="true" />
10 10
@@ -16,7 +16,7 @@
16 </target> 16 </target>
17 17
18 <target name="build" description="compiles the source code"> 18 <target name="build" description="compiles the source code">
19 19
20 <mkdir dir="${build.folder}" /> 20 <mkdir dir="${build.folder}" />
21 <csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}"> 21 <csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">
22 <references basedir="${nunit.location}"> 22 <references basedir="${nunit.location}">
diff --git a/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs
index 6fc0fdcc24e..0491bfc2b03 100644
--- a/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs
+++ b/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs
@@ -2,7 +2,7 @@ using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3 3
4// 4//
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8// 8//
@@ -13,42 +13,42 @@ using System.Runtime.CompilerServices;
13[assembly: AssemblyProduct("")] 13[assembly: AssemblyProduct("")]
14[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")] 14[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// 18//
19// Version information for an assembly consists of the following four values: 19// Version information for an assembly consists of the following four values:
20// 20//
21// Major Version 21// Major Version
22// Minor Version 22// Minor Version
23// Build Number 23// Build Number
24// Revision 24// Revision
25// 25//
26// You can specify all the values or you can default the Revision and Build Numbers 26// You can specify all the values or you can default the Revision and Build Numbers
27// by using the '*' as shown below: 27// by using the '*' as shown below:
28 28
29[assembly: AssemblyVersion("1.0.*")] 29[assembly: AssemblyVersion("1.0.*")]
30 30
31// 31//
32// In order to sign your assembly you must specify a key to use. Refer to the 32// In order to sign your assembly you must specify a key to use. Refer to the
33// Microsoft .NET Framework documentation for more information on assembly signing. 33// Microsoft .NET Framework documentation for more information on assembly signing.
34// 34//
35// Use the attributes below to control which key is used for signing. 35// Use the attributes below to control which key is used for signing.
36// 36//
37// Notes: 37// Notes:
38// (*) If no key is specified, the assembly is not signed. 38// (*) If no key is specified, the assembly is not signed.
39// (*) KeyName refers to a key that has been installed in the Crypto Service 39// (*) KeyName refers to a key that has been installed in the Crypto Service
40// Provider (CSP) on your machine. KeyFile refers to a file which contains 40// Provider (CSP) on your machine. KeyFile refers to a file which contains
41// a key. 41// a key.
42// (*) If the KeyFile and the KeyName values are both specified, the 42// (*) If the KeyFile and the KeyName values are both specified, the
43// following processing occurs: 43// following processing occurs:
44// (1) If the KeyName can be found in the CSP, that key is used. 44// (1) If the KeyName can be found in the CSP, that key is used.
45// (2) If the KeyName does not exist and the KeyFile does exist, the key 45// (2) If the KeyName does not exist and the KeyFile does exist, the key
46// in the KeyFile is installed into the CSP and used. 46// in the KeyFile is installed into the CSP and used.
47// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 47// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48// When specifying the KeyFile, the location of the KeyFile should be 48// When specifying the KeyFile, the location of the KeyFile should be
49// relative to the project output directory which is 49// relative to the project output directory which is
50// %Project Directory%\obj\<configuration>. For example, if your KeyFile is 50// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
51// located in the project directory, you would specify the AssemblyKeyFile 51// located in the project directory, you would specify the AssemblyKeyFile
52// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 52// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 53// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54// documentation for more information on this. 54// documentation for more information on this.
diff --git a/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
index dfe7e90a8a1..788b2fceced 100644
--- a/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
+++ b/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -25,7 +25,7 @@ namespace DotZLib
25 protected uint _current; 25 protected uint _current;
26 26
27 /// <summary> 27 /// <summary>
28 /// Initializes a new instance of the checksum generator base - the current checksum is 28 /// Initializes a new instance of the checksum generator base - the current checksum is
29 /// set to zero 29 /// set to zero
30 /// </summary> 30 /// </summary>
31 public ChecksumGeneratorBase() 31 public ChecksumGeneratorBase()
@@ -61,7 +61,7 @@ namespace DotZLib
61 /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception> 61 /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
62 /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception> 62 /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
63 /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception> 63 /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
64 /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one. 64 /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
65 /// This is therefore the only method a derived class has to implement</remarks> 65 /// This is therefore the only method a derived class has to implement</remarks>
66 public abstract void Update(byte[] data, int offset, int count); 66 public abstract void Update(byte[] data, int offset, int count);
67 67
@@ -101,7 +101,7 @@ namespace DotZLib
101 /// <summary> 101 /// <summary>
102 /// Implements a CRC32 checksum generator 102 /// Implements a CRC32 checksum generator
103 /// </summary> 103 /// </summary>
104 public sealed class CRC32Checksum : ChecksumGeneratorBase 104 public sealed class CRC32Checksum : ChecksumGeneratorBase
105 { 105 {
106 #region DLL imports 106 #region DLL imports
107 107
@@ -152,7 +152,7 @@ namespace DotZLib
152 /// <summary> 152 /// <summary>
153 /// Implements a checksum generator that computes the Adler checksum on data 153 /// Implements a checksum generator that computes the Adler checksum on data
154 /// </summary> 154 /// </summary>
155 public sealed class AdlerChecksum : ChecksumGeneratorBase 155 public sealed class AdlerChecksum : ChecksumGeneratorBase
156 { 156 {
157 #region DLL imports 157 #region DLL imports
158 158
diff --git a/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs b/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs
index 16997e906b6..c1cab3a02c6 100644
--- a/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs
+++ b/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -25,7 +25,7 @@ namespace DotZLib
25 #endregion 25 #endregion
26 26
27 public CircularBuffer(int capacity) 27 public CircularBuffer(int capacity)
28 { 28 {
29 Debug.Assert( capacity > 0 ); 29 Debug.Assert( capacity > 0 );
30 _buffer = new byte[capacity]; 30 _buffer = new byte[capacity];
31 _capacity = capacity; 31 _capacity = capacity;
diff --git a/zlib/contrib/dotzlib/DotZLib/CodecBase.cs b/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
index 954db7db05f..42e6da3a565 100644
--- a/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
+++ b/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -19,7 +19,7 @@ namespace DotZLib
19 #region Data members 19 #region Data members
20 20
21 /// <summary> 21 /// <summary>
22 /// Instance of the internal zlib buffer structure that is 22 /// Instance of the internal zlib buffer structure that is
23 /// passed to all functions in the zlib dll 23 /// passed to all functions in the zlib dll
24 /// </summary> 24 /// </summary>
25 internal ZStream _ztream = new ZStream(); 25 internal ZStream _ztream = new ZStream();
@@ -45,7 +45,7 @@ namespace DotZLib
45 #endregion 45 #endregion
46 46
47 /// <summary> 47 /// <summary>
48 /// Initializes a new instance of the <c>CodeBase</c> class. 48 /// Initializes a new instance of the <c>CodeBase</c> class.
49 /// </summary> 49 /// </summary>
50 public CodecBase() 50 public CodecBase()
51 { 51 {
@@ -77,7 +77,7 @@ namespace DotZLib
77 if (_ztream.total_out > 0) 77 if (_ztream.total_out > 0)
78 { 78 {
79 if (DataAvailable != null) 79 if (DataAvailable != null)
80 DataAvailable( _outBuffer, 0, (int)_ztream.total_out); 80 DataAvailable( _outBuffer, 0, (int)_ztream.total_out);
81 resetOutput(); 81 resetOutput();
82 } 82 }
83 } 83 }
diff --git a/zlib/contrib/dotzlib/DotZLib/Deflater.cs b/zlib/contrib/dotzlib/DotZLib/Deflater.cs
index d7b8dcccac6..c2477925b62 100644
--- a/zlib/contrib/dotzlib/DotZLib/Deflater.cs
+++ b/zlib/contrib/dotzlib/DotZLib/Deflater.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -56,7 +56,7 @@ namespace DotZLib
56 if (data == null) throw new ArgumentNullException(); 56 if (data == null) throw new ArgumentNullException();
57 if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); 57 if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
58 if ((offset+count) > data.Length) throw new ArgumentException(); 58 if ((offset+count) > data.Length) throw new ArgumentException();
59 59
60 int total = count; 60 int total = count;
61 int inputIndex = offset; 61 int inputIndex = offset;
62 int err = 0; 62 int err = 0;
@@ -86,7 +86,7 @@ namespace DotZLib
86 public override void Finish() 86 public override void Finish()
87 { 87 {
88 int err; 88 int err;
89 do 89 do
90 { 90 {
91 err = deflate(ref _ztream, (int)FlushTypes.Finish); 91 err = deflate(ref _ztream, (int)FlushTypes.Finish);
92 OnDataAvailable(); 92 OnDataAvailable();
diff --git a/zlib/contrib/dotzlib/DotZLib/DotZLib.cs b/zlib/contrib/dotzlib/DotZLib/DotZLib.cs
index 410deb08851..be184b4c71b 100644
--- a/zlib/contrib/dotzlib/DotZLib/DotZLib.cs
+++ b/zlib/contrib/dotzlib/DotZLib/DotZLib.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -19,7 +19,7 @@ namespace DotZLib
19 /// <summary> 19 /// <summary>
20 /// Defines constants for the various flush types used with zlib 20 /// Defines constants for the various flush types used with zlib
21 /// </summary> 21 /// </summary>
22 internal enum FlushTypes 22 internal enum FlushTypes
23 { 23 {
24 None, Partial, Sync, Full, Finish, Block 24 None, Partial, Sync, Full, Finish, Block
25 } 25 }
@@ -38,7 +38,7 @@ namespace DotZLib
38 public uint total_out; 38 public uint total_out;
39 39
40 [MarshalAs(UnmanagedType.LPStr)] 40 [MarshalAs(UnmanagedType.LPStr)]
41 string msg; 41 string msg;
42 uint state; 42 uint state;
43 43
44 uint zalloc; 44 uint zalloc;
@@ -51,7 +51,7 @@ namespace DotZLib
51 } 51 }
52 52
53 #endregion 53 #endregion
54 54
55 #endregion 55 #endregion
56 56
57 #region Public enums 57 #region Public enums
@@ -63,7 +63,7 @@ namespace DotZLib
63 /// <summary> 63 /// <summary>
64 /// The default compression level with a reasonable compromise between compression and speed 64 /// The default compression level with a reasonable compromise between compression and speed
65 /// </summary> 65 /// </summary>
66 Default = -1, 66 Default = -1,
67 /// <summary> 67 /// <summary>
68 /// No compression at all. The data are passed straight through. 68 /// No compression at all. The data are passed straight through.
69 /// </summary> 69 /// </summary>
@@ -71,7 +71,7 @@ namespace DotZLib
71 /// <summary> 71 /// <summary>
72 /// The maximum compression rate available. 72 /// The maximum compression rate available.
73 /// </summary> 73 /// </summary>
74 Best = 9, 74 Best = 9,
75 /// <summary> 75 /// <summary>
76 /// The fastest available compression level. 76 /// The fastest available compression level.
77 /// </summary> 77 /// </summary>
@@ -86,7 +86,7 @@ namespace DotZLib
86 public class ZLibException : ApplicationException 86 public class ZLibException : ApplicationException
87 { 87 {
88 /// <summary> 88 /// <summary>
89 /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified 89 /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
90 /// error message and error code 90 /// error message and error code
91 /// </summary> 91 /// </summary>
92 /// <param name="errorCode">The zlib error code that caused the exception</param> 92 /// <param name="errorCode">The zlib error code that caused the exception</param>
@@ -96,7 +96,7 @@ namespace DotZLib
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified 99 /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
100 /// error code 100 /// error code
101 /// </summary> 101 /// </summary>
102 /// <param name="errorCode">The zlib error code that caused the exception</param> 102 /// <param name="errorCode">The zlib error code that caused the exception</param>
@@ -109,7 +109,7 @@ namespace DotZLib
109 #region Interfaces 109 #region Interfaces
110 110
111 /// <summary> 111 /// <summary>
112 /// Declares methods and properties that enables a running checksum to be calculated 112 /// Declares methods and properties that enables a running checksum to be calculated
113 /// </summary> 113 /// </summary>
114 public interface ChecksumGenerator 114 public interface ChecksumGenerator
115 { 115 {
@@ -163,7 +163,7 @@ namespace DotZLib
163 /// <paramref name="data">The byte array containing the processed data</paramref> 163 /// <paramref name="data">The byte array containing the processed data</paramref>
164 /// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref> 164 /// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>
165 /// <paramref name="count">The number of processed bytes available</paramref> 165 /// <paramref name="count">The number of processed bytes available</paramref>
166 /// <remarks>On return from this method, the data may be overwritten, so grab it while you can. 166 /// <remarks>On return from this method, the data may be overwritten, so grab it while you can.
167 /// You cannot assume that startIndex will be zero. 167 /// You cannot assume that startIndex will be zero.
168 /// </remarks> 168 /// </remarks>
169 public delegate void DataAvailableHandler(byte[] data, int startIndex, int count); 169 public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);
diff --git a/zlib/contrib/dotzlib/DotZLib/GZipStream.cs b/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
index f861675b518..b161300b185 100644
--- a/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
+++ b/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -84,7 +84,7 @@ namespace DotZLib
84 return !_isWriting; 84 return !_isWriting;
85 } 85 }
86 } 86 }
87 87
88 88
89 /// <summary> 89 /// <summary>
90 /// Returns false. 90 /// Returns false.
@@ -96,7 +96,7 @@ namespace DotZLib
96 return false; 96 return false;
97 } 97 }
98 } 98 }
99 99
100 /// <summary> 100 /// <summary>
101 /// Returns true if this tsream is writeable, false otherwise 101 /// Returns true if this tsream is writeable, false otherwise
102 /// </summary> 102 /// </summary>
@@ -108,7 +108,7 @@ namespace DotZLib
108 } 108 }
109 } 109 }
110 #endregion 110 #endregion
111 111
112 #region Destructor & IDispose stuff 112 #region Destructor & IDispose stuff
113 113
114 /// <summary> 114 /// <summary>
@@ -137,7 +137,7 @@ namespace DotZLib
137 } 137 }
138 } 138 }
139 #endregion 139 #endregion
140 140
141 #region Basic reading and writing 141 #region Basic reading and writing
142 /// <summary> 142 /// <summary>
143 /// Attempts to read a number of bytes from the stream. 143 /// Attempts to read a number of bytes from the stream.
@@ -244,7 +244,7 @@ namespace DotZLib
244 { 244 {
245 throw new NotSupportedException(); 245 throw new NotSupportedException();
246 } 246 }
247 247
248 /// <summary> 248 /// <summary>
249 /// Not suppported. 249 /// Not suppported.
250 /// </summary> 250 /// </summary>
@@ -256,7 +256,7 @@ namespace DotZLib
256 { 256 {
257 throw new NotSupportedException(); 257 throw new NotSupportedException();
258 } 258 }
259 259
260 /// <summary> 260 /// <summary>
261 /// Flushes the <c>GZipStream</c>. 261 /// Flushes the <c>GZipStream</c>.
262 /// </summary> 262 /// </summary>
@@ -266,7 +266,7 @@ namespace DotZLib
266 { 266 {
267 // left empty on purpose 267 // left empty on purpose
268 } 268 }
269 269
270 /// <summary> 270 /// <summary>
271 /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported. 271 /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
272 /// </summary> 272 /// </summary>
@@ -283,7 +283,7 @@ namespace DotZLib
283 throw new NotSupportedException(); 283 throw new NotSupportedException();
284 } 284 }
285 } 285 }
286 286
287 /// <summary> 287 /// <summary>
288 /// Gets the size of the stream. Not suppported. 288 /// Gets the size of the stream. Not suppported.
289 /// </summary> 289 /// </summary>
diff --git a/zlib/contrib/dotzlib/DotZLib/Inflater.cs b/zlib/contrib/dotzlib/DotZLib/Inflater.cs
index 4e60cda078b..8ed5451d664 100644
--- a/zlib/contrib/dotzlib/DotZLib/Inflater.cs
+++ b/zlib/contrib/dotzlib/DotZLib/Inflater.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
11 11
12namespace DotZLib 12namespace DotZLib
13{ 13{
14 14
15 /// <summary> 15 /// <summary>
16 /// Implements a data decompressor, using the inflate algorithm in the ZLib dll 16 /// Implements a data decompressor, using the inflate algorithm in the ZLib dll
17 /// </summary> 17 /// </summary>
@@ -84,7 +84,7 @@ namespace DotZLib
84 public override void Finish() 84 public override void Finish()
85 { 85 {
86 int err; 86 int err;
87 do 87 do
88 { 88 {
89 err = inflate(ref _ztream, (int)FlushTypes.Finish); 89 err = inflate(ref _ztream, (int)FlushTypes.Finish);
90 OnDataAvailable(); 90 OnDataAvailable();
diff --git a/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
index 8dc00db92dd..3bbcc8cee6e 100644
--- a/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ b/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -1,7 +1,7 @@
1// 1//
2// Copyright Henrik Ravn 2004 2// Copyright Henrik Ravn 2004
3// 3//
4// Use, modification and distribution are subject to the Boost Software License, Version 1.0. 4// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6// 6//
7 7
@@ -156,7 +156,7 @@ namespace DotZLibTests
156 public void Info_Version() 156 public void Info_Version()
157 { 157 {
158 Info info = new Info(); 158 Info info = new Info();
159 Assert.AreEqual("1.2.3", Info.Version); 159 Assert.AreEqual("1.2.5", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt); 160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong); 161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer); 162 Assert.AreEqual(32, info.SizeOfPointer);
@@ -225,7 +225,7 @@ namespace DotZLibTests
225 225
226 [Test] 226 [Test]
227 public void Inflate_Expand() 227 public void Inflate_Expand()
228 { 228 {
229 uncompressedData.Clear(); 229 uncompressedData.Clear();
230 230
231 using (Inflater inf = new Inflater()) 231 using (Inflater inf = new Inflater())
@@ -271,4 +271,4 @@ namespace DotZLibTests
271 } 271 }
272} 272}
273 273
274#endif \ No newline at end of file 274#endif
diff --git a/zlib/contrib/dotzlib/readme.txt b/zlib/contrib/dotzlib/readme.txt
index 210f4b00192..b2395720d4c 100644
--- a/zlib/contrib/dotzlib/readme.txt
+++ b/zlib/contrib/dotzlib/readme.txt
@@ -1,6 +1,6 @@
1This directory contains a .Net wrapper class library for the ZLib1.dll 1This directory contains a .Net wrapper class library for the ZLib1.dll
2 2
3The wrapper includes support for inflating/deflating memory buffers, 3The wrapper includes support for inflating/deflating memory buffers,
4.Net streaming wrappers for the gz streams part of zlib, and wrappers 4.Net streaming wrappers for the gz streams part of zlib, and wrappers
5for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples. 5for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
6 6
@@ -26,11 +26,11 @@ Build instructions:
26 26
271. Using Visual Studio.Net 2003: 271. Using Visual Studio.Net 2003:
28 Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll) 28 Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
29 will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on 29 will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
30 you are building the release or debug version of the library. Check 30 you are building the release or debug version of the library. Check
31 DotZLib/UnitTests.cs for instructions on how to include unit tests in the 31 DotZLib/UnitTests.cs for instructions on how to include unit tests in the
32 build. 32 build.
33 33
342. Using NAnt: 342. Using NAnt:
35 Open a command prompt with access to the build environment and run nant 35 Open a command prompt with access to the build environment and run nant
36 in the same directory as the DotZLib.build file. 36 in the same directory as the DotZLib.build file.
@@ -38,15 +38,15 @@ Build instructions:
38 debug={true|false} to toggle between release/debug builds (default=true). 38 debug={true|false} to toggle between release/debug builds (default=true).
39 nunit={true|false} to include or esclude unit tests (default=true). 39 nunit={true|false} to include or esclude unit tests (default=true).
40 Also the target clean will remove binaries. 40 Also the target clean will remove binaries.
41 Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release 41 Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
42 or ./DotZLib/bin/debug, depending on whether you are building the release 42 or ./DotZLib/bin/debug, depending on whether you are building the release
43 or debug version of the library. 43 or debug version of the library.
44 44
45 Examples: 45 Examples:
46 nant -D:debug=false -D:nunit=false 46 nant -D:debug=false -D:nunit=false
47 will build a release mode version of the library without unit tests. 47 will build a release mode version of the library without unit tests.
48 nant 48 nant
49 will build a debug version of the library with unit tests 49 will build a debug version of the library with unit tests
50 nant clean 50 nant clean
51 will remove all previously built files. 51 will remove all previously built files.
52 52
@@ -54,5 +54,5 @@ Build instructions:
54--------------------------------- 54---------------------------------
55Copyright (c) Henrik Ravn 2004 55Copyright (c) Henrik Ravn 2004
56 56
57Use, modification and distribution are subject to the Boost Software License, Version 1.0. 57Use, modification and distribution are subject to the Boost Software License, Version 1.0.
58(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 58(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/zlib/contrib/gcc_gvmat64/gvmat64.S b/zlib/contrib/gcc_gvmat64/gvmat64.S
new file mode 100644
index 00000000000..dd858ddbd16
--- /dev/null
+++ b/zlib/contrib/gcc_gvmat64/gvmat64.S
@@ -0,0 +1,574 @@
1/*
2;uInt longest_match_x64(
3; deflate_state *s,
4; IPos cur_match); // current match
5
6; gvmat64.S -- Asm portion of the optimized longest_match for 32 bits x86_64
7; (AMD64 on Athlon 64, Opteron, Phenom
8; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7)
9; this file is translation from gvmat64.asm to GCC 4.x (for Linux, Mac XCode)
10; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
11;
12; File written by Gilles Vollant, by converting to assembly the longest_match
13; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
14; and by taking inspiration on asm686 with masm, optimised assembly code
15; from Brian Raiter, written 1998
16;
17; This software is provided 'as-is', without any express or implied
18; warranty. In no event will the authors be held liable for any damages
19; arising from the use of this software.
20;
21; Permission is granted to anyone to use this software for any purpose,
22; including commercial applications, and to alter it and redistribute it
23; freely, subject to the following restrictions:
24;
25; 1. The origin of this software must not be misrepresented; you must not
26; claim that you wrote the original software. If you use this software
27; in a product, an acknowledgment in the product documentation would be
28; appreciated but is not required.
29; 2. Altered source versions must be plainly marked as such, and must not be
30; misrepresented as being the original software
31; 3. This notice may not be removed or altered from any source distribution.
32;
33; http://www.zlib.net
34; http://www.winimage.com/zLibDll
35; http://www.muppetlabs.com/~breadbox/software/assembly.html
36;
37; to compile this file for zLib, I use option:
38; gcc -c -arch x86_64 gvmat64.S
39
40
41;uInt longest_match(s, cur_match)
42; deflate_state *s;
43; IPos cur_match; // current match /
44;
45; with XCode for Mac, I had strange error with some jump on intel syntax
46; this is why BEFORE_JMP and AFTER_JMP are used
47 */
48
49
50#define BEFORE_JMP .att_syntax
51#define AFTER_JMP .intel_syntax noprefix
52
53#ifndef NO_UNDERLINE
54# define match_init _match_init
55# define longest_match _longest_match
56#endif
57
58.intel_syntax noprefix
59
60.globl match_init, longest_match
61.text
62longest_match:
63
64
65
66#define LocalVarsSize 96
67/*
68; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
69; free register : r14,r15
70; register can be saved : rsp
71*/
72
73#define chainlenwmask (rsp + 8 - LocalVarsSize)
74#define nicematch (rsp + 16 - LocalVarsSize)
75
76#define save_rdi (rsp + 24 - LocalVarsSize)
77#define save_rsi (rsp + 32 - LocalVarsSize)
78#define save_rbx (rsp + 40 - LocalVarsSize)
79#define save_rbp (rsp + 48 - LocalVarsSize)
80#define save_r12 (rsp + 56 - LocalVarsSize)
81#define save_r13 (rsp + 64 - LocalVarsSize)
82#define save_r14 (rsp + 72 - LocalVarsSize)
83#define save_r15 (rsp + 80 - LocalVarsSize)
84
85
86/*
87; all the +4 offsets are due to the addition of pending_buf_size (in zlib
88; in the deflate_state structure since the asm code was first written
89; (if you compile with zlib 1.0.4 or older, remove the +4).
90; Note : these value are good with a 8 bytes boundary pack structure
91*/
92
93#define MAX_MATCH 258
94#define MIN_MATCH 3
95#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
96
97/*
98;;; Offsets for fields in the deflate_state structure. These numbers
99;;; are calculated from the definition of deflate_state, with the
100;;; assumption that the compiler will dword-align the fields. (Thus,
101;;; changing the definition of deflate_state could easily cause this
102;;; program to crash horribly, without so much as a warning at
103;;; compile time. Sigh.)
104
105; all the +zlib1222add offsets are due to the addition of fields
106; in zlib in the deflate_state structure since the asm code was first written
107; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
108; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
109; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
110*/
111
112
113
114/* you can check the structure offset by running
115
116#include <stdlib.h>
117#include <stdio.h>
118#include "deflate.h"
119
120void print_depl()
121{
122deflate_state ds;
123deflate_state *s=&ds;
124printf("size pointer=%u\n",(int)sizeof(void*));
125
126printf("#define dsWSize %u\n",(int)(((char*)&(s->w_size))-((char*)s)));
127printf("#define dsWMask %u\n",(int)(((char*)&(s->w_mask))-((char*)s)));
128printf("#define dsWindow %u\n",(int)(((char*)&(s->window))-((char*)s)));
129printf("#define dsPrev %u\n",(int)(((char*)&(s->prev))-((char*)s)));
130printf("#define dsMatchLen %u\n",(int)(((char*)&(s->match_length))-((char*)s)));
131printf("#define dsPrevMatch %u\n",(int)(((char*)&(s->prev_match))-((char*)s)));
132printf("#define dsStrStart %u\n",(int)(((char*)&(s->strstart))-((char*)s)));
133printf("#define dsMatchStart %u\n",(int)(((char*)&(s->match_start))-((char*)s)));
134printf("#define dsLookahead %u\n",(int)(((char*)&(s->lookahead))-((char*)s)));
135printf("#define dsPrevLen %u\n",(int)(((char*)&(s->prev_length))-((char*)s)));
136printf("#define dsMaxChainLen %u\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
137printf("#define dsGoodMatch %u\n",(int)(((char*)&(s->good_match))-((char*)s)));
138printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s)));
139}
140*/
141
142#define dsWSize 68
143#define dsWMask 76
144#define dsWindow 80
145#define dsPrev 96
146#define dsMatchLen 144
147#define dsPrevMatch 148
148#define dsStrStart 156
149#define dsMatchStart 160
150#define dsLookahead 164
151#define dsPrevLen 168
152#define dsMaxChainLen 172
153#define dsGoodMatch 188
154#define dsNiceMatch 192
155
156#define window_size [ rcx + dsWSize]
157#define WMask [ rcx + dsWMask]
158#define window_ad [ rcx + dsWindow]
159#define prev_ad [ rcx + dsPrev]
160#define strstart [ rcx + dsStrStart]
161#define match_start [ rcx + dsMatchStart]
162#define Lookahead [ rcx + dsLookahead] //; 0ffffffffh on infozip
163#define prev_length [ rcx + dsPrevLen]
164#define max_chain_length [ rcx + dsMaxChainLen]
165#define good_match [ rcx + dsGoodMatch]
166#define nice_match [ rcx + dsNiceMatch]
167
168/*
169; windows:
170; parameter 1 in rcx(deflate state s), param 2 in rdx (cur match)
171
172; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
173; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
174;
175; All registers must be preserved across the call, except for
176; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
177
178;
179; gcc on macosx-linux:
180; see http://www.x86-64.org/documentation/abi-0.99.pdf
181; param 1 in rdi, param 2 in rsi
182; rbx, rsp, rbp, r12 to r15 must be preserved
183
184;;; Save registers that the compiler may be using, and adjust esp to
185;;; make room for our stack frame.
186
187
188;;; Retrieve the function arguments. r8d will hold cur_match
189;;; throughout the entire function. edx will hold the pointer to the
190;;; deflate_state structure during the function's setup (before
191;;; entering the main loop.
192
193; ms: parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
194; mac: param 1 in rdi, param 2 rsi
195; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
196*/
197 mov [save_rbx],rbx
198 mov [save_rbp],rbp
199
200
201 mov rcx,rdi
202
203 mov r8d,esi
204
205
206 mov [save_r12],r12
207 mov [save_r13],r13
208 mov [save_r14],r14
209 mov [save_r15],r15
210
211
212//;;; uInt wmask = s->w_mask;
213//;;; unsigned chain_length = s->max_chain_length;
214//;;; if (s->prev_length >= s->good_match) {
215//;;; chain_length >>= 2;
216//;;; }
217
218
219 mov edi, prev_length
220 mov esi, good_match
221 mov eax, WMask
222 mov ebx, max_chain_length
223 cmp edi, esi
224 jl LastMatchGood
225 shr ebx, 2
226LastMatchGood:
227
228//;;; chainlen is decremented once beforehand so that the function can
229//;;; use the sign flag instead of the zero flag for the exit test.
230//;;; It is then shifted into the high word, to make room for the wmask
231//;;; value, which it will always accompany.
232
233 dec ebx
234 shl ebx, 16
235 or ebx, eax
236
237//;;; on zlib only
238//;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
239
240
241
242 mov eax, nice_match
243 mov [chainlenwmask], ebx
244 mov r10d, Lookahead
245 cmp r10d, eax
246 cmovnl r10d, eax
247 mov [nicematch],r10d
248
249
250
251//;;; register Bytef *scan = s->window + s->strstart;
252 mov r10, window_ad
253 mov ebp, strstart
254 lea r13, [r10 + rbp]
255
256//;;; Determine how many bytes the scan ptr is off from being
257//;;; dword-aligned.
258
259 mov r9,r13
260 neg r13
261 and r13,3
262
263//;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
264//;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
265
266
267 mov eax, window_size
268 sub eax, MIN_LOOKAHEAD
269
270
271 xor edi,edi
272 sub ebp, eax
273
274 mov r11d, prev_length
275
276 cmovng ebp,edi
277
278//;;; int best_len = s->prev_length;
279
280
281//;;; Store the sum of s->window + best_len in esi locally, and in esi.
282
283 lea rsi,[r10+r11]
284
285//;;; register ush scan_start = *(ushf*)scan;
286//;;; register ush scan_end = *(ushf*)(scan+best_len-1);
287//;;; Posf *prev = s->prev;
288
289 movzx r12d,word ptr [r9]
290 movzx ebx, word ptr [r9 + r11 - 1]
291
292 mov rdi, prev_ad
293
294//;;; Jump into the main loop.
295
296 mov edx, [chainlenwmask]
297
298 cmp bx,word ptr [rsi + r8 - 1]
299 jz LookupLoopIsZero
300
301
302
303LookupLoop1:
304 and r8d, edx
305
306 movzx r8d, word ptr [rdi + r8*2]
307 cmp r8d, ebp
308 jbe LeaveNow
309
310
311
312 sub edx, 0x00010000
313 BEFORE_JMP
314 js LeaveNow
315 AFTER_JMP
316
317LoopEntry1:
318 cmp bx,word ptr [rsi + r8 - 1]
319 BEFORE_JMP
320 jz LookupLoopIsZero
321 AFTER_JMP
322
323LookupLoop2:
324 and r8d, edx
325
326 movzx r8d, word ptr [rdi + r8*2]
327 cmp r8d, ebp
328 BEFORE_JMP
329 jbe LeaveNow
330 AFTER_JMP
331 sub edx, 0x00010000
332 BEFORE_JMP
333 js LeaveNow
334 AFTER_JMP
335
336LoopEntry2:
337 cmp bx,word ptr [rsi + r8 - 1]
338 BEFORE_JMP
339 jz LookupLoopIsZero
340 AFTER_JMP
341
342LookupLoop4:
343 and r8d, edx
344
345 movzx r8d, word ptr [rdi + r8*2]
346 cmp r8d, ebp
347 BEFORE_JMP
348 jbe LeaveNow
349 AFTER_JMP
350 sub edx, 0x00010000
351 BEFORE_JMP
352 js LeaveNow
353 AFTER_JMP
354
355LoopEntry4:
356
357 cmp bx,word ptr [rsi + r8 - 1]
358 BEFORE_JMP
359 jnz LookupLoop1
360 jmp LookupLoopIsZero
361 AFTER_JMP
362/*
363;;; do {
364;;; match = s->window + cur_match;
365;;; if (*(ushf*)(match+best_len-1) != scan_end ||
366;;; *(ushf*)match != scan_start) continue;
367;;; [...]
368;;; } while ((cur_match = prev[cur_match & wmask]) > limit
369;;; && --chain_length != 0);
370;;;
371;;; Here is the inner loop of the function. The function will spend the
372;;; majority of its time in this loop, and majority of that time will
373;;; be spent in the first ten instructions.
374;;;
375;;; Within this loop:
376;;; ebx = scanend
377;;; r8d = curmatch
378;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
379;;; esi = windowbestlen - i.e., (window + bestlen)
380;;; edi = prev
381;;; ebp = limit
382*/
383.balign 16
384LookupLoop:
385 and r8d, edx
386
387 movzx r8d, word ptr [rdi + r8*2]
388 cmp r8d, ebp
389 BEFORE_JMP
390 jbe LeaveNow
391 AFTER_JMP
392 sub edx, 0x00010000
393 BEFORE_JMP
394 js LeaveNow
395 AFTER_JMP
396
397LoopEntry:
398
399 cmp bx,word ptr [rsi + r8 - 1]
400 BEFORE_JMP
401 jnz LookupLoop1
402 AFTER_JMP
403LookupLoopIsZero:
404 cmp r12w, word ptr [r10 + r8]
405 BEFORE_JMP
406 jnz LookupLoop1
407 AFTER_JMP
408
409
410//;;; Store the current value of chainlen.
411 mov [chainlenwmask], edx
412/*
413;;; Point edi to the string under scrutiny, and esi to the string we
414;;; are hoping to match it up with. In actuality, esi and edi are
415;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
416;;; initialized to -(MAX_MATCH_8 - scanalign).
417*/
418 lea rsi,[r8+r10]
419 mov rdx, 0xfffffffffffffef8 //; -(MAX_MATCH_8)
420 lea rsi, [rsi + r13 + 0x0108] //;MAX_MATCH_8]
421 lea rdi, [r9 + r13 + 0x0108] //;MAX_MATCH_8]
422
423 prefetcht1 [rsi+rdx]
424 prefetcht1 [rdi+rdx]
425
426/*
427;;; Test the strings for equality, 8 bytes at a time. At the end,
428;;; adjust rdx so that it is offset to the exact byte that mismatched.
429;;;
430;;; We already know at this point that the first three bytes of the
431;;; strings match each other, and they can be safely passed over before
432;;; starting the compare loop. So what this code does is skip over 0-3
433;;; bytes, as much as necessary in order to dword-align the edi
434;;; pointer. (rsi will still be misaligned three times out of four.)
435;;;
436;;; It should be confessed that this loop usually does not represent
437;;; much of the total running time. Replacing it with a more
438;;; straightforward "rep cmpsb" would not drastically degrade
439;;; performance.
440*/
441
442LoopCmps:
443 mov rax, [rsi + rdx]
444 xor rax, [rdi + rdx]
445 jnz LeaveLoopCmps
446
447 mov rax, [rsi + rdx + 8]
448 xor rax, [rdi + rdx + 8]
449 jnz LeaveLoopCmps8
450
451
452 mov rax, [rsi + rdx + 8+8]
453 xor rax, [rdi + rdx + 8+8]
454 jnz LeaveLoopCmps16
455
456 add rdx,8+8+8
457
458 BEFORE_JMP
459 jnz LoopCmps
460 jmp LenMaximum
461 AFTER_JMP
462
463LeaveLoopCmps16: add rdx,8
464LeaveLoopCmps8: add rdx,8
465LeaveLoopCmps:
466
467 test eax, 0x0000FFFF
468 jnz LenLower
469
470 test eax,0xffffffff
471
472 jnz LenLower32
473
474 add rdx,4