diff options
Diffstat (limited to '')
43 files changed, 0 insertions, 17555 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/CMakeLists.txt b/libraries/irrlicht-1.8/source/Irrlicht/zlib/CMakeLists.txt deleted file mode 100644 index 7ee3bc4..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/CMakeLists.txt +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | cmake_minimum_required(VERSION 2.4.4) | ||
2 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) | ||
3 | |||
4 | project(zlib C) | ||
5 | |||
6 | set(VERSION "1.2.7") | ||
7 | |||
8 | set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") | ||
9 | set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") | ||
10 | set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") | ||
11 | set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") | ||
12 | set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") | ||
13 | |||
14 | include(CheckTypeSize) | ||
15 | include(CheckFunctionExists) | ||
16 | include(CheckIncludeFile) | ||
17 | include(CheckCSourceCompiles) | ||
18 | enable_testing() | ||
19 | |||
20 | check_include_file(sys/types.h HAVE_SYS_TYPES_H) | ||
21 | check_include_file(stdint.h HAVE_STDINT_H) | ||
22 | check_include_file(stddef.h HAVE_STDDEF_H) | ||
23 | |||
24 | # | ||
25 | # Check to see if we have large file support | ||
26 | # | ||
27 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) | ||
28 | # We add these other definitions here because CheckTypeSize.cmake | ||
29 | # in CMake 2.4.x does not automatically do so and we want | ||
30 | # compatibility with CMake 2.4.x. | ||
31 | if(HAVE_SYS_TYPES_H) | ||
32 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) | ||
33 | endif() | ||
34 | if(HAVE_STDINT_H) | ||
35 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) | ||
36 | endif() | ||
37 | if(HAVE_STDDEF_H) | ||
38 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) | ||
39 | endif() | ||
40 | check_type_size(off64_t OFF64_T) | ||
41 | if(HAVE_OFF64_T) | ||
42 | add_definitions(-D_LARGEFILE64_SOURCE=1) | ||
43 | endif() | ||
44 | set(CMAKE_REQUIRED_DEFINITIONS) # clear variable | ||
45 | |||
46 | # | ||
47 | # Check for fseeko | ||
48 | # | ||
49 | check_function_exists(fseeko HAVE_FSEEKO) | ||
50 | if(NOT HAVE_FSEEKO) | ||
51 | add_definitions(-DNO_FSEEKO) | ||
52 | endif() | ||
53 | |||
54 | # | ||
55 | # Check for unistd.h | ||
56 | # | ||
57 | check_include_file(unistd.h Z_HAVE_UNISTD_H) | ||
58 | |||
59 | if(MSVC) | ||
60 | set(CMAKE_DEBUG_POSTFIX "d") | ||
61 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE) | ||
62 | add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) | ||
63 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
64 | endif() | ||
65 | |||
66 | if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) | ||
67 | # If we're doing an out of source build and the user has a zconf.h | ||
68 | # in their source tree... | ||
69 | if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) | ||
70 | message(STATUS "Renaming") | ||
71 | message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") | ||
72 | message(STATUS "to 'zconf.h.included' because this file is included with zlib") | ||
73 | message(STATUS "but CMake generates it automatically in the build directory.") | ||
74 | file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) | ||
75 | endif() | ||
76 | endif() | ||
77 | |||
78 | set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) | ||
79 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein | ||
80 | ${ZLIB_PC} @ONLY) | ||
81 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein | ||
82 | ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) | ||
83 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) | ||
84 | |||
85 | |||
86 | #============================================================================ | ||
87 | # zlib | ||
88 | #============================================================================ | ||
89 | |||
90 | set(ZLIB_PUBLIC_HDRS | ||
91 | ${CMAKE_CURRENT_BINARY_DIR}/zconf.h | ||
92 | zlib.h | ||
93 | ) | ||
94 | set(ZLIB_PRIVATE_HDRS | ||
95 | crc32.h | ||
96 | deflate.h | ||
97 | gzguts.h | ||
98 | inffast.h | ||
99 | inffixed.h | ||
100 | inflate.h | ||
101 | inftrees.h | ||
102 | trees.h | ||
103 | zutil.h | ||
104 | ) | ||
105 | set(ZLIB_SRCS | ||
106 | adler32.c | ||
107 | compress.c | ||
108 | crc32.c | ||
109 | deflate.c | ||
110 | gzclose.c | ||
111 | gzlib.c | ||
112 | gzread.c | ||
113 | gzwrite.c | ||
114 | inflate.c | ||
115 | infback.c | ||
116 | inftrees.c | ||
117 | inffast.c | ||
118 | trees.c | ||
119 | uncompr.c | ||
120 | zutil.c | ||
121 | ) | ||
122 | |||
123 | if(NOT MINGW) | ||
124 | set(ZLIB_SRCS ${ZLIB_SRCS} | ||
125 | win32/zlib1.rc # If present will override custom build rule below. | ||
126 | ) | ||
127 | endif() | ||
128 | |||
129 | # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION | ||
130 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) | ||
131 | string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" | ||
132 | "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) | ||
133 | |||
134 | if(MINGW) | ||
135 | # This gets us DLL resource information when compiling on MinGW. | ||
136 | if(NOT CMAKE_RC_COMPILER) | ||
137 | SET(CMAKE_RC_COMPILER windres.exe) | ||
138 | endif() | ||
139 | |||
140 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj | ||
141 | COMMAND ${CMAKE_RC_COMPILER} | ||
142 | -D GCC_WINDRES | ||
143 | -I ${CMAKE_CURRENT_SOURCE_DIR} | ||
144 | -I ${CMAKE_CURRENT_BINARY_DIR} | ||
145 | -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj | ||
146 | -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) | ||
147 | set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) | ||
148 | endif(MINGW) | ||
149 | |||
150 | add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) | ||
151 | add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) | ||
152 | set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) | ||
153 | set_target_properties(zlib PROPERTIES SOVERSION 1) | ||
154 | |||
155 | if(NOT CYGWIN) | ||
156 | # This property causes shared libraries on Linux to have the full version | ||
157 | # encoded into their final filename. We disable this on Cygwin because | ||
158 | # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll | ||
159 | # seems to be the default. | ||
160 | # | ||
161 | # This has no effect with MSVC, on that platform the version info for | ||
162 | # the DLL comes from the resource file win32/zlib1.rc | ||
163 | set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) | ||
164 | endif() | ||
165 | |||
166 | if(UNIX) | ||
167 | # On unix-like platforms the library is almost always called libz | ||
168 | set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) | ||
169 | set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") | ||
170 | elseif(BUILD_SHARED_LIBS AND WIN32) | ||
171 | # Creates zlib1.dll when building shared library version | ||
172 | set_target_properties(zlib PROPERTIES SUFFIX "1.dll") | ||
173 | endif() | ||
174 | |||
175 | if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) | ||
176 | install(TARGETS zlib zlibstatic | ||
177 | RUNTIME DESTINATION "${INSTALL_BIN_DIR}" | ||
178 | ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" | ||
179 | LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) | ||
180 | endif() | ||
181 | if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) | ||
182 | install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") | ||
183 | endif() | ||
184 | if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) | ||
185 | install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") | ||
186 | endif() | ||
187 | if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) | ||
188 | install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") | ||
189 | endif() | ||
190 | |||
191 | #============================================================================ | ||
192 | # Example binaries | ||
193 | #============================================================================ | ||
194 | |||
195 | add_executable(example test/example.c) | ||
196 | target_link_libraries(example zlib) | ||
197 | add_test(example example) | ||
198 | |||
199 | add_executable(minigzip test/minigzip.c) | ||
200 | target_link_libraries(minigzip zlib) | ||
201 | |||
202 | if(HAVE_OFF64_T) | ||
203 | add_executable(example64 test/example.c) | ||
204 | target_link_libraries(example64 zlib) | ||
205 | set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") | ||
206 | add_test(example64 example64) | ||
207 | |||
208 | add_executable(minigzip64 test/minigzip.c) | ||
209 | target_link_libraries(minigzip64 zlib) | ||
210 | set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") | ||
211 | endif() | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/ChangeLog b/libraries/irrlicht-1.8/source/Irrlicht/zlib/ChangeLog deleted file mode 100644 index c2c643a..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/ChangeLog +++ /dev/null | |||
@@ -1,1409 +0,0 @@ | |||
1 | |||
2 | ChangeLog file for zlib | ||
3 | |||
4 | Changes in 1.2.7 (2 May 2012) | ||
5 | - Replace use of memmove() with a simple copy for portability | ||
6 | - Test for existence of strerror | ||
7 | - Restore gzgetc_ for backward compatibility with 1.2.6 | ||
8 | - Fix build with non-GNU make on Solaris | ||
9 | - Require gcc 4.0 or later on Mac OS X to use the hidden attribute | ||
10 | - Include unistd.h for Watcom C | ||
11 | - Use __WATCOMC__ instead of __WATCOM__ | ||
12 | - Do not use the visibility attribute if NO_VIZ defined | ||
13 | - Improve the detection of no hidden visibility attribute | ||
14 | - Avoid using __int64 for gcc or solo compilation | ||
15 | - Cast to char * in gzprintf to avoid warnings [Zinser] | ||
16 | - Fix make_vms.com for VAX [Zinser] | ||
17 | - Don't use library or built-in byte swaps | ||
18 | - Simplify test and use of gcc hidden attribute | ||
19 | - Fix bug in gzclose_w() when gzwrite() fails to allocate memory | ||
20 | - Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() | ||
21 | - Fix bug in test/minigzip.c for configure --solo | ||
22 | - Fix contrib/vstudio project link errors [Mohanathas] | ||
23 | - Add ability to choose the builder in make_vms.com [Schweda] | ||
24 | - Add DESTDIR support to mingw32 win32/Makefile.gcc | ||
25 | - Fix comments in win32/Makefile.gcc for proper usage | ||
26 | - Allow overriding the default install locations for cmake | ||
27 | - Generate and install the pkg-config file with cmake | ||
28 | - Build both a static and a shared version of zlib with cmake | ||
29 | - Include version symbols for cmake builds | ||
30 | - If using cmake with MSVC, add the source directory to the includes | ||
31 | - Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] | ||
32 | - Move obsolete emx makefile to old [Truta] | ||
33 | - Allow the use of -Wundef when compiling or using zlib | ||
34 | - Avoid the use of the -u option with mktemp | ||
35 | - Improve inflate() documentation on the use of Z_FINISH | ||
36 | - Recognize clang as gcc | ||
37 | - Add gzopen_w() in Windows for wide character path names | ||
38 | - Rename zconf.h in CMakeLists.txt to move it out of the way | ||
39 | - Add source directory in CMakeLists.txt for building examples | ||
40 | - Look in build directory for zlib.pc in CMakeLists.txt | ||
41 | - Remove gzflags from zlibvc.def in vc9 and vc10 | ||
42 | - Fix contrib/minizip compilation in the MinGW environment | ||
43 | - Update ./configure for Solaris, support --64 [Mooney] | ||
44 | - Remove -R. from Solaris shared build (possible security issue) | ||
45 | - Avoid race condition for parallel make (-j) running example | ||
46 | - Fix type mismatch between get_crc_table() and crc_table | ||
47 | - Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] | ||
48 | - Fix the path to zlib.map in CMakeLists.txt | ||
49 | - Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] | ||
50 | - Add instructions to win32/Makefile.gcc for shared install [Torri] | ||
51 | |||
52 | Changes in 1.2.6.1 (12 Feb 2012) | ||
53 | - Avoid the use of the Objective-C reserved name "id" | ||
54 | - Include io.h in gzguts.h for Microsoft compilers | ||
55 | - Fix problem with ./configure --prefix and gzgetc macro | ||
56 | - Include gz_header definition when compiling zlib solo | ||
57 | - Put gzflags() functionality back in zutil.c | ||
58 | - Avoid library header include in crc32.c for Z_SOLO | ||
59 | - Use name in GCC_CLASSIC as C compiler for coverage testing, if set | ||
60 | - Minor cleanup in contrib/minizip/zip.c [Vollant] | ||
61 | - Update make_vms.com [Zinser] | ||
62 | - Remove unnecessary gzgetc_ function | ||
63 | - Use optimized byte swap operations for Microsoft and GNU [Snyder] | ||
64 | - Fix minor typo in zlib.h comments [Rzesniowiecki] | ||
65 | |||
66 | Changes in 1.2.6 (29 Jan 2012) | ||
67 | - Update the Pascal interface in contrib/pascal | ||
68 | - Fix function numbers for gzgetc_ in zlibvc.def files | ||
69 | - Fix configure.ac for contrib/minizip [Schiffer] | ||
70 | - Fix large-entry detection in minizip on 64-bit systems [Schiffer] | ||
71 | - Have ./configure use the compiler return code for error indication | ||
72 | - Fix CMakeLists.txt for cross compilation [McClure] | ||
73 | - Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes] | ||
74 | - Fix compilation of contrib/minizip on FreeBSD [Marquez] | ||
75 | - Correct suggested usages in win32/Makefile.msc [Shachar, Horvath] | ||
76 | - Include io.h for Turbo C / Borland C on all platforms [Truta] | ||
77 | - Make version explicit in contrib/minizip/configure.ac [Bosmans] | ||
78 | - Avoid warning for no encryption in contrib/minizip/zip.c [Vollant] | ||
79 | - Minor cleanup up contrib/minizip/unzip.c [Vollant] | ||
80 | - Fix bug when compiling minizip with C++ [Vollant] | ||
81 | - Protect for long name and extra fields in contrib/minizip [Vollant] | ||
82 | - Avoid some warnings in contrib/minizip [Vollant] | ||
83 | - Add -I../.. -L../.. to CFLAGS for minizip and miniunzip | ||
84 | - Add missing libs to minizip linker command | ||
85 | - Add support for VPATH builds in contrib/minizip | ||
86 | - Add an --enable-demos option to contrib/minizip/configure | ||
87 | - Add the generation of configure.log by ./configure | ||
88 | - Exit when required parameters not provided to win32/Makefile.gcc | ||
89 | - Have gzputc return the character written instead of the argument | ||
90 | - Use the -m option on ldconfig for BSD systems [Tobias] | ||
91 | - Correct in zlib.map when deflateResetKeep was added | ||
92 | |||
93 | Changes in 1.2.5.3 (15 Jan 2012) | ||
94 | - Restore gzgetc function for binary compatibility | ||
95 | - Do not use _lseeki64 under Borland C++ [Truta] | ||
96 | - Update win32/Makefile.msc to build test/*.c [Truta] | ||
97 | - Remove old/visualc6 given CMakefile and other alternatives | ||
98 | - Update AS400 build files and documentation [Monnerat] | ||
99 | - Update win32/Makefile.gcc to build test/*.c [Truta] | ||
100 | - Permit stronger flushes after Z_BLOCK flushes | ||
101 | - Avoid extraneous empty blocks when doing empty flushes | ||
102 | - Permit Z_NULL arguments to deflatePending | ||
103 | - Allow deflatePrime() to insert bits in the middle of a stream | ||
104 | - Remove second empty static block for Z_PARTIAL_FLUSH | ||
105 | - Write out all of the available bits when using Z_BLOCK | ||
106 | - Insert the first two strings in the hash table after a flush | ||
107 | |||
108 | Changes in 1.2.5.2 (17 Dec 2011) | ||
109 | - fix ld error: unable to find version dependency 'ZLIB_1.2.5' | ||
110 | - use relative symlinks for shared libs | ||
111 | - Avoid searching past window for Z_RLE strategy | ||
112 | - Assure that high-water mark initialization is always applied in deflate | ||
113 | - Add assertions to fill_window() in deflate.c to match comments | ||
114 | - Update python link in README | ||
115 | - Correct spelling error in gzread.c | ||
116 | - Fix bug in gzgets() for a concatenated empty gzip stream | ||
117 | - Correct error in comment for gz_make() | ||
118 | - Change gzread() and related to ignore junk after gzip streams | ||
119 | - Allow gzread() and related to continue after gzclearerr() | ||
120 | - Allow gzrewind() and gzseek() after a premature end-of-file | ||
121 | - Simplify gzseek() now that raw after gzip is ignored | ||
122 | - Change gzgetc() to a macro for speed (~40% speedup in testing) | ||
123 | - Fix gzclose() to return the actual error last encountered | ||
124 | - Always add large file support for windows | ||
125 | - Include zconf.h for windows large file support | ||
126 | - Include zconf.h.cmakein for windows large file support | ||
127 | - Update zconf.h.cmakein on make distclean | ||
128 | - Merge vestigial vsnprintf determination from zutil.h to gzguts.h | ||
129 | - Clarify how gzopen() appends in zlib.h comments | ||
130 | - Correct documentation of gzdirect() since junk at end now ignored | ||
131 | - Add a transparent write mode to gzopen() when 'T' is in the mode | ||
132 | - Update python link in zlib man page | ||
133 | - Get inffixed.h and MAKEFIXED result to match | ||
134 | - Add a ./config --solo option to make zlib subset with no libary use | ||
135 | - Add undocumented inflateResetKeep() function for CAB file decoding | ||
136 | - Add --cover option to ./configure for gcc coverage testing | ||
137 | - Add #define ZLIB_CONST option to use const in the z_stream interface | ||
138 | - Add comment to gzdopen() in zlib.h to use dup() when using fileno() | ||
139 | - Note behavior of uncompress() to provide as much data as it can | ||
140 | - Add files in contrib/minizip to aid in building libminizip | ||
141 | - Split off AR options in Makefile.in and configure | ||
142 | - Change ON macro to Z_ARG to avoid application conflicts | ||
143 | - Facilitate compilation with Borland C++ for pragmas and vsnprintf | ||
144 | - Include io.h for Turbo C / Borland C++ | ||
145 | - Move example.c and minigzip.c to test/ | ||
146 | - Simplify incomplete code table filling in inflate_table() | ||
147 | - Remove code from inflate.c and infback.c that is impossible to execute | ||
148 | - Test the inflate code with full coverage | ||
149 | - Allow deflateSetDictionary, inflateSetDictionary at any time (in raw) | ||
150 | - Add deflateResetKeep and fix inflateResetKeep to retain dictionary | ||
151 | - Fix gzwrite.c to accommodate reduced memory zlib compilation | ||
152 | - Have inflate() with Z_FINISH avoid the allocation of a window | ||
153 | - Do not set strm->adler when doing raw inflate | ||
154 | - Fix gzeof() to behave just like feof() when read is not past end of file | ||
155 | - Fix bug in gzread.c when end-of-file is reached | ||
156 | - Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF | ||
157 | - Document gzread() capability to read concurrently written files | ||
158 | - Remove hard-coding of resource compiler in CMakeLists.txt [Blammo] | ||
159 | |||
160 | Changes in 1.2.5.1 (10 Sep 2011) | ||
161 | - Update FAQ entry on shared builds (#13) | ||
162 | - Avoid symbolic argument to chmod in Makefile.in | ||
163 | - Fix bug and add consts in contrib/puff [Oberhumer] | ||
164 | - Update contrib/puff/zeros.raw test file to have all block types | ||
165 | - Add full coverage test for puff in contrib/puff/Makefile | ||
166 | - Fix static-only-build install in Makefile.in | ||
167 | - Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno] | ||
168 | - Add libz.a dependency to shared in Makefile.in for parallel builds | ||
169 | - Spell out "number" (instead of "nb") in zlib.h for total_in, total_out | ||
170 | - Replace $(...) with `...` in configure for non-bash sh [Bowler] | ||
171 | - Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen] | ||
172 | - Add solaris* to Linux* in configure to allow gcc use [Groffen] | ||
173 | - Add *bsd* to Linux* case in configure [Bar-Lev] | ||
174 | - Add inffast.obj to dependencies in win32/Makefile.msc | ||
175 | - Correct spelling error in deflate.h [Kohler] | ||
176 | - Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc | ||
177 | - Add test to configure for GNU C looking for gcc in output of $cc -v | ||
178 | - Add zlib.pc generation to win32/Makefile.gcc [Weigelt] | ||
179 | - Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not | ||
180 | - Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense | ||
181 | - Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser) | ||
182 | - Make stronger test in zconf.h to include unistd.h for LFS | ||
183 | - Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack] | ||
184 | - Fix zlib.h LFS support when Z_PREFIX used | ||
185 | - Add updated as400 support (removed from old) [Monnerat] | ||
186 | - Avoid deflate sensitivity to volatile input data | ||
187 | - Avoid division in adler32_combine for NO_DIVIDE | ||
188 | - Clarify the use of Z_FINISH with deflateBound() amount of space | ||
189 | - Set binary for output file in puff.c | ||
190 | - Use u4 type for crc_table to avoid conversion warnings | ||
191 | - Apply casts in zlib.h to avoid conversion warnings | ||
192 | - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] | ||
193 | - Improve inflateSync() documentation to note indeterminancy | ||
194 | - Add deflatePending() function to return the amount of pending output | ||
195 | - Correct the spelling of "specification" in FAQ [Randers-Pehrson] | ||
196 | - Add a check in configure for stdarg.h, use for gzprintf() | ||
197 | - Check that pointers fit in ints when gzprint() compiled old style | ||
198 | - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] | ||
199 | - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] | ||
200 | - Add debug records in assmebler code [Londer] | ||
201 | - Update RFC references to use http://tools.ietf.org/html/... [Li] | ||
202 | - Add --archs option, use of libtool to configure for Mac OS X [Borstel] | ||
203 | |||
204 | Changes in 1.2.5 (19 Apr 2010) | ||
205 | - Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] | ||
206 | - Default to libdir as sharedlibdir in configure [Nieder] | ||
207 | - Update copyright dates on modified source files | ||
208 | - Update trees.c to be able to generate modified trees.h | ||
209 | - Exit configure for MinGW, suggesting win32/Makefile.gcc | ||
210 | - Check for NULL path in gz_open [Homurlu] | ||
211 | |||
212 | Changes in 1.2.4.5 (18 Apr 2010) | ||
213 | - Set sharedlibdir in configure [Torok] | ||
214 | - Set LDFLAGS in Makefile.in [Bar-Lev] | ||
215 | - Avoid mkdir objs race condition in Makefile.in [Bowler] | ||
216 | - Add ZLIB_INTERNAL in front of internal inter-module functions and arrays | ||
217 | - Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C | ||
218 | - Don't use hidden attribute when it is a warning generator (e.g. Solaris) | ||
219 | |||
220 | Changes in 1.2.4.4 (18 Apr 2010) | ||
221 | - Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok] | ||
222 | - Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty | ||
223 | - Try to use bash or ksh regardless of functionality of /bin/sh | ||
224 | - Fix configure incompatibility with NetBSD sh | ||
225 | - Remove attempt to run under bash or ksh since have better NetBSD fix | ||
226 | - Fix win32/Makefile.gcc for MinGW [Bar-Lev] | ||
227 | - Add diagnostic messages when using CROSS_PREFIX in configure | ||
228 | - Added --sharedlibdir option to configure [Weigelt] | ||
229 | - Use hidden visibility attribute when available [Frysinger] | ||
230 | |||
231 | Changes in 1.2.4.3 (10 Apr 2010) | ||
232 | - Only use CROSS_PREFIX in configure for ar and ranlib if they exist | ||
233 | - Use CROSS_PREFIX for nm [Bar-Lev] | ||
234 | - Assume _LARGEFILE64_SOURCE defined is equivalent to true | ||
235 | - Avoid use of undefined symbols in #if with && and || | ||
236 | - Make *64 prototypes in gzguts.h consistent with functions | ||
237 | - Add -shared load option for MinGW in configure [Bowler] | ||
238 | - Move z_off64_t to public interface, use instead of off64_t | ||
239 | - Remove ! from shell test in configure (not portable to Solaris) | ||
240 | - Change +0 macro tests to -0 for possibly increased portability | ||
241 | |||
242 | Changes in 1.2.4.2 (9 Apr 2010) | ||
243 | - Add consistent carriage returns to readme.txt's in masmx86 and masmx64 | ||
244 | - Really provide prototypes for *64 functions when building without LFS | ||
245 | - Only define unlink() in minigzip.c if unistd.h not included | ||
246 | - Update README to point to contrib/vstudio project files | ||
247 | - Move projects/vc6 to old/ and remove projects/ | ||
248 | - Include stdlib.h in minigzip.c for setmode() definition under WinCE | ||
249 | - Clean up assembler builds in win32/Makefile.msc [Rowe] | ||
250 | - Include sys/types.h for Microsoft for off_t definition | ||
251 | - Fix memory leak on error in gz_open() | ||
252 | - Symbolize nm as $NM in configure [Weigelt] | ||
253 | - Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt] | ||
254 | - Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined | ||
255 | - Fix bug in gzeof() to take into account unused input data | ||
256 | - Avoid initialization of structures with variables in puff.c | ||
257 | - Updated win32/README-WIN32.txt [Rowe] | ||
258 | |||
259 | Changes in 1.2.4.1 (28 Mar 2010) | ||
260 | - Remove the use of [a-z] constructs for sed in configure [gentoo 310225] | ||
261 | - Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech] | ||
262 | - Restore "for debugging" comment on sprintf() in gzlib.c | ||
263 | - Remove fdopen for MVS from gzguts.h | ||
264 | - Put new README-WIN32.txt in win32 [Rowe] | ||
265 | - Add check for shell to configure and invoke another shell if needed | ||
266 | - Fix big fat stinking bug in gzseek() on uncompressed files | ||
267 | - Remove vestigial F_OPEN64 define in zutil.h | ||
268 | - Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE | ||
269 | - Avoid errors on non-LFS systems when applications define LFS macros | ||
270 | - Set EXE to ".exe" in configure for MINGW [Kahle] | ||
271 | - Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill] | ||
272 | - Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev] | ||
273 | - Add DLL install in win32/makefile.gcc [Bar-Lev] | ||
274 | - Allow Linux* or linux* from uname in configure [Bar-Lev] | ||
275 | - Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev] | ||
276 | - Add cross-compilation prefixes to configure [Bar-Lev] | ||
277 | - Match type exactly in gz_load() invocation in gzread.c | ||
278 | - Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func | ||
279 | - Provide prototypes for *64 functions when building zlib without LFS | ||
280 | - Don't use -lc when linking shared library on MinGW | ||
281 | - Remove errno.h check in configure and vestigial errno code in zutil.h | ||
282 | |||
283 | Changes in 1.2.4 (14 Mar 2010) | ||
284 | - Fix VER3 extraction in configure for no fourth subversion | ||
285 | - Update zlib.3, add docs to Makefile.in to make .pdf out of it | ||
286 | - Add zlib.3.pdf to distribution | ||
287 | - Don't set error code in gzerror() if passed pointer is NULL | ||
288 | - Apply destination directory fixes to CMakeLists.txt [Lowman] | ||
289 | - Move #cmakedefine's to a new zconf.in.cmakein | ||
290 | - Restore zconf.h for builds that don't use configure or cmake | ||
291 | - Add distclean to dummy Makefile for convenience | ||
292 | - Update and improve INDEX, README, and FAQ | ||
293 | - Update CMakeLists.txt for the return of zconf.h [Lowman] | ||
294 | - Update contrib/vstudio/vc9 and vc10 [Vollant] | ||
295 | - Change libz.dll.a back to libzdll.a in win32/Makefile.gcc | ||
296 | - Apply license and readme changes to contrib/asm686 [Raiter] | ||
297 | - Check file name lengths and add -c option in minigzip.c [Li] | ||
298 | - Update contrib/amd64 and contrib/masmx86/ [Vollant] | ||
299 | - Avoid use of "eof" parameter in trees.c to not shadow library variable | ||
300 | - Update make_vms.com for removal of zlibdefs.h [Zinser] | ||
301 | - Update assembler code and vstudio projects in contrib [Vollant] | ||
302 | - Remove outdated assembler code contrib/masm686 and contrib/asm586 | ||
303 | - Remove old vc7 and vc8 from contrib/vstudio | ||
304 | - Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe] | ||
305 | - Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open() | ||
306 | - Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant] | ||
307 | - Remove *64 functions from win32/zlib.def (they're not 64-bit yet) | ||
308 | - Fix bug in void-returning vsprintf() case in gzwrite.c | ||
309 | - Fix name change from inflate.h in contrib/inflate86/inffas86.c | ||
310 | - Check if temporary file exists before removing in make_vms.com [Zinser] | ||
311 | - Fix make install and uninstall for --static option | ||
312 | - Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta] | ||
313 | - Update readme.txt in contrib/masmx64 and masmx86 to assemble | ||
314 | |||
315 | Changes in 1.2.3.9 (21 Feb 2010) | ||
316 | - Expunge gzio.c | ||
317 | - Move as400 build information to old | ||
318 | - Fix updates in contrib/minizip and contrib/vstudio | ||
319 | - Add const to vsnprintf test in configure to avoid warnings [Weigelt] | ||
320 | - Delete zconf.h (made by configure) [Weigelt] | ||
321 | - Change zconf.in.h to zconf.h.in per convention [Weigelt] | ||
322 | - Check for NULL buf in gzgets() | ||
323 | - Return empty string for gzgets() with len == 1 (like fgets()) | ||
324 | - Fix description of gzgets() in zlib.h for end-of-file, NULL return | ||
325 | - Update minizip to 1.1 [Vollant] | ||
326 | - Avoid MSVC loss of data warnings in gzread.c, gzwrite.c | ||
327 | - Note in zlib.h that gzerror() should be used to distinguish from EOF | ||
328 | - Remove use of snprintf() from gzlib.c | ||
329 | - Fix bug in gzseek() | ||
330 | - Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant] | ||
331 | - Fix zconf.h generation in CMakeLists.txt [Lowman] | ||
332 | - Improve comments in zconf.h where modified by configure | ||
333 | |||
334 | Changes in 1.2.3.8 (13 Feb 2010) | ||
335 | - Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer] | ||
336 | - Use z_off64_t in gz_zero() and gz_skip() to match state->skip | ||
337 | - Avoid comparison problem when sizeof(int) == sizeof(z_off64_t) | ||
338 | - Revert to Makefile.in from 1.2.3.6 (live with the clutter) | ||
339 | - Fix missing error return in gzflush(), add zlib.h note | ||
340 | - Add *64 functions to zlib.map [Levin] | ||
341 | - Fix signed/unsigned comparison in gz_comp() | ||
342 | - Use SFLAGS when testing shared linking in configure | ||
343 | - Add --64 option to ./configure to use -m64 with gcc | ||
344 | - Fix ./configure --help to correctly name options | ||
345 | - Have make fail if a test fails [Levin] | ||
346 | - Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson] | ||
347 | - Remove assembler object files from contrib | ||
348 | |||
349 | Changes in 1.2.3.7 (24 Jan 2010) | ||
350 | - Always gzopen() with O_LARGEFILE if available | ||
351 | - Fix gzdirect() to work immediately after gzopen() or gzdopen() | ||
352 | - Make gzdirect() more precise when the state changes while reading | ||
353 | - Improve zlib.h documentation in many places | ||
354 | - Catch memory allocation failure in gz_open() | ||
355 | - Complete close operation if seek forward in gzclose_w() fails | ||
356 | - Return Z_ERRNO from gzclose_r() if close() fails | ||
357 | - Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL | ||
358 | - Return zero for gzwrite() errors to match zlib.h description | ||
359 | - Return -1 on gzputs() error to match zlib.h description | ||
360 | - Add zconf.in.h to allow recovery from configure modification [Weigelt] | ||
361 | - Fix static library permissions in Makefile.in [Weigelt] | ||
362 | - Avoid warnings in configure tests that hide functionality [Weigelt] | ||
363 | - Add *BSD and DragonFly to Linux case in configure [gentoo 123571] | ||
364 | - Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212] | ||
365 | - Avoid access of uninitialized data for first inflateReset2 call [Gomes] | ||
366 | - Keep object files in subdirectories to reduce the clutter somewhat | ||
367 | - Remove default Makefile and zlibdefs.h, add dummy Makefile | ||
368 | - Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_ | ||
369 | - Remove zlibdefs.h completely -- modify zconf.h instead | ||
370 | |||
371 | Changes in 1.2.3.6 (17 Jan 2010) | ||
372 | - Avoid void * arithmetic in gzread.c and gzwrite.c | ||
373 | - Make compilers happier with const char * for gz_error message | ||
374 | - Avoid unused parameter warning in inflate.c | ||
375 | - Avoid signed-unsigned comparison warning in inflate.c | ||
376 | - Indent #pragma's for traditional C | ||
377 | - Fix usage of strwinerror() in glib.c, change to gz_strwinerror() | ||
378 | - Correct email address in configure for system options | ||
379 | - Update make_vms.com and add make_vms.com to contrib/minizip [Zinser] | ||
380 | - Update zlib.map [Brown] | ||
381 | - Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok] | ||
382 | - Apply various fixes to CMakeLists.txt [Lowman] | ||
383 | - Add checks on len in gzread() and gzwrite() | ||
384 | - Add error message for no more room for gzungetc() | ||
385 | - Remove zlib version check in gzwrite() | ||
386 | - Defer compression of gzprintf() result until need to | ||
387 | - Use snprintf() in gzdopen() if available | ||
388 | - Remove USE_MMAP configuration determination (only used by minigzip) | ||
389 | - Remove examples/pigz.c (available separately) | ||
390 | - Update examples/gun.c to 1.6 | ||
391 | |||
392 | Changes in 1.2.3.5 (8 Jan 2010) | ||
393 | - Add space after #if in zutil.h for some compilers | ||
394 | - Fix relatively harmless bug in deflate_fast() [Exarevsky] | ||
395 | - Fix same problem in deflate_slow() | ||
396 | - Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown] | ||
397 | - Add deflate_rle() for faster Z_RLE strategy run-length encoding | ||
398 | - Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding | ||
399 | - Change name of "write" variable in inffast.c to avoid library collisions | ||
400 | - Fix premature EOF from gzread() in gzio.c [Brown] | ||
401 | - Use zlib header window size if windowBits is 0 in inflateInit2() | ||
402 | - Remove compressBound() call in deflate.c to avoid linking compress.o | ||
403 | - Replace use of errno in gz* with functions, support WinCE [Alves] | ||
404 | - Provide alternative to perror() in minigzip.c for WinCE [Alves] | ||
405 | - Don't use _vsnprintf on later versions of MSVC [Lowman] | ||
406 | - Add CMake build script and input file [Lowman] | ||
407 | - Update contrib/minizip to 1.1 [Svensson, Vollant] | ||
408 | - Moved nintendods directory from contrib to . | ||
409 | - Replace gzio.c with a new set of routines with the same functionality | ||
410 | - Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above | ||
411 | - Update contrib/minizip to 1.1b | ||
412 | - Change gzeof() to return 0 on error instead of -1 to agree with zlib.h | ||
413 | |||
414 | Changes in 1.2.3.4 (21 Dec 2009) | ||
415 | - Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility | ||
416 | - Update comments in configure and Makefile.in for default --shared | ||
417 | - Fix test -z's in configure [Marquess] | ||
418 | - Build examplesh and minigzipsh when not testing | ||
419 | - Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h | ||
420 | - Import LDFLAGS from the environment in configure | ||
421 | - Fix configure to populate SFLAGS with discovered CFLAGS options | ||
422 | - Adapt make_vms.com to the new Makefile.in [Zinser] | ||
423 | - Add zlib2ansi script for C++ compilation [Marquess] | ||
424 | - Add _FILE_OFFSET_BITS=64 test to make test (when applicable) | ||
425 | - Add AMD64 assembler code for longest match to contrib [Teterin] | ||
426 | - Include options from $SFLAGS when doing $LDSHARED | ||
427 | - Simplify 64-bit file support by introducing z_off64_t type | ||
428 | - Make shared object files in objs directory to work around old Sun cc | ||
429 | - Use only three-part version number for Darwin shared compiles | ||
430 | - Add rc option to ar in Makefile.in for when ./configure not run | ||
431 | - Add -WI,-rpath,. to LDFLAGS for OSF 1 V4* | ||
432 | - Set LD_LIBRARYN32_PATH for SGI IRIX shared compile | ||
433 | - Protect against _FILE_OFFSET_BITS being defined when compiling zlib | ||
434 | - Rename Makefile.in targets allstatic to static and allshared to shared | ||
435 | - Fix static and shared Makefile.in targets to be independent | ||
436 | - Correct error return bug in gz_open() by setting state [Brown] | ||
437 | - Put spaces before ;;'s in configure for better sh compatibility | ||
438 | - Add pigz.c (parallel implementation of gzip) to examples/ | ||
439 | - Correct constant in crc32.c to UL [Leventhal] | ||
440 | - Reject negative lengths in crc32_combine() | ||
441 | - Add inflateReset2() function to work like inflateEnd()/inflateInit2() | ||
442 | - Include sys/types.h for _LARGEFILE64_SOURCE [Brown] | ||
443 | - Correct typo in doc/algorithm.txt [Janik] | ||
444 | - Fix bug in adler32_combine() [Zhu] | ||
445 | - Catch missing-end-of-block-code error in all inflates and in puff | ||
446 | Assures that random input to inflate eventually results in an error | ||
447 | - Added enough.c (calculation of ENOUGH for inftrees.h) to examples/ | ||
448 | - Update ENOUGH and its usage to reflect discovered bounds | ||
449 | - Fix gzerror() error report on empty input file [Brown] | ||
450 | - Add ush casts in trees.c to avoid pedantic runtime errors | ||
451 | - Fix typo in zlib.h uncompress() description [Reiss] | ||
452 | - Correct inflate() comments with regard to automatic header detection | ||
453 | - Remove deprecation comment on Z_PARTIAL_FLUSH (it stays) | ||
454 | - Put new version of gzlog (2.0) in examples with interruption recovery | ||
455 | - Add puff compile option to permit invalid distance-too-far streams | ||
456 | - Add puff TEST command options, ability to read piped input | ||
457 | - Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but | ||
458 | _LARGEFILE64_SOURCE not defined | ||
459 | - Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart | ||
460 | - Fix deflateSetDictionary() to use all 32K for output consistency | ||
461 | - Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h) | ||
462 | - Clear bytes after deflate lookahead to avoid use of uninitialized data | ||
463 | - Change a limit in inftrees.c to be more transparent to Coverity Prevent | ||
464 | - Update win32/zlib.def with exported symbols from zlib.h | ||
465 | - Correct spelling errors in zlib.h [Willem, Sobrado] | ||
466 | - Allow Z_BLOCK for deflate() to force a new block | ||
467 | - Allow negative bits in inflatePrime() to delete existing bit buffer | ||
468 | - Add Z_TREES flush option to inflate() to return at end of trees | ||
469 | - Add inflateMark() to return current state information for random access | ||
470 | - Add Makefile for NintendoDS to contrib [Costa] | ||
471 | - Add -w in configure compile tests to avoid spurious warnings [Beucler] | ||
472 | - Fix typos in zlib.h comments for deflateSetDictionary() | ||
473 | - Fix EOF detection in transparent gzread() [Maier] | ||
474 | |||
475 | Changes in 1.2.3.3 (2 October 2006) | ||
476 | - Make --shared the default for configure, add a --static option | ||
477 | - Add compile option to permit invalid distance-too-far streams | ||
478 | - Add inflateUndermine() function which is required to enable above | ||
479 | - Remove use of "this" variable name for C++ compatibility [Marquess] | ||
480 | - Add testing of shared library in make test, if shared library built | ||
481 | - Use ftello() and fseeko() if available instead of ftell() and fseek() | ||
482 | - Provide two versions of all functions that use the z_off_t type for | ||
483 | binary compatibility -- a normal version and a 64-bit offset version, | ||
484 | per the Large File Support Extension when _LARGEFILE64_SOURCE is | ||
485 | defined; use the 64-bit versions by default when _FILE_OFFSET_BITS | ||
486 | is defined to be 64 | ||
487 | - Add a --uname= option to configure to perhaps help with cross-compiling | ||
488 | |||
489 | Changes in 1.2.3.2 (3 September 2006) | ||
490 | - Turn off silly Borland warnings [Hay] | ||
491 | - Use off64_t and define _LARGEFILE64_SOURCE when present | ||
492 | - Fix missing dependency on inffixed.h in Makefile.in | ||
493 | - Rig configure --shared to build both shared and static [Teredesai, Truta] | ||
494 | - Remove zconf.in.h and instead create a new zlibdefs.h file | ||
495 | - Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant] | ||
496 | - Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt] | ||
497 | |||
498 | Changes in 1.2.3.1 (16 August 2006) | ||
499 | - Add watcom directory with OpenWatcom make files [Daniel] | ||
500 | - Remove #undef of FAR in zconf.in.h for MVS [Fedtke] | ||
501 | - Update make_vms.com [Zinser] | ||
502 | - Use -fPIC for shared build in configure [Teredesai, Nicholson] | ||
503 | - Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] | ||
504 | - Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck] | ||
505 | - Add some FAQ entries about the contrib directory | ||
506 | - Update the MVS question in the FAQ | ||
507 | - Avoid extraneous reads after EOF in gzio.c [Brown] | ||
508 | - Correct spelling of "successfully" in gzio.c [Randers-Pehrson] | ||
509 | - Add comments to zlib.h about gzerror() usage [Brown] | ||
510 | - Set extra flags in gzip header in gzopen() like deflate() does | ||
511 | - Make configure options more compatible with double-dash conventions | ||
512 | [Weigelt] | ||
513 | - Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen] | ||
514 | - Fix uninstall target in Makefile.in [Truta] | ||
515 | - Add pkgconfig support [Weigelt] | ||
516 | - Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt] | ||
517 | - Replace set_data_type() with a more accurate detect_data_type() in | ||
518 | trees.c, according to the txtvsbin.txt document [Truta] | ||
519 | - Swap the order of #include <stdio.h> and #include "zlib.h" in | ||
520 | gzio.c, example.c and minigzip.c [Truta] | ||
521 | - Shut up annoying VS2005 warnings about standard C deprecation [Rowe, | ||
522 | Truta] (where?) | ||
523 | - Fix target "clean" from win32/Makefile.bor [Truta] | ||
524 | - Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe] | ||
525 | - Update zlib www home address in win32/DLL_FAQ.txt [Truta] | ||
526 | - Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove] | ||
527 | - Enable browse info in the "Debug" and "ASM Debug" configurations in | ||
528 | the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta] | ||
529 | - Add pkgconfig support [Weigelt] | ||
530 | - Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h, | ||
531 | for use in win32/zlib1.rc [Polushin, Rowe, Truta] | ||
532 | - Add a document that explains the new text detection scheme to | ||
533 | doc/txtvsbin.txt [Truta] | ||
534 | - Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta] | ||
535 | - Move algorithm.txt into doc/ [Truta] | ||
536 | - Synchronize FAQ with website | ||
537 | - Fix compressBound(), was low for some pathological cases [Fearnley] | ||
538 | - Take into account wrapper variations in deflateBound() | ||
539 | - Set examples/zpipe.c input and output to binary mode for Windows | ||
540 | - Update examples/zlib_how.html with new zpipe.c (also web site) | ||
541 | - Fix some warnings in examples/gzlog.c and examples/zran.c (it seems | ||
542 | that gcc became pickier in 4.0) | ||
543 | - Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain | ||
544 | un-versioned, the patch adds versioning only for symbols introduced in | ||
545 | zlib-1.2.0 or later. It also declares as local those symbols which are | ||
546 | not designed to be exported." [Levin] | ||
547 | - Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure | ||
548 | - Do not initialize global static by default in trees.c, add a response | ||
549 | NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess] | ||
550 | - Don't use strerror() in gzio.c under WinCE [Yakimov] | ||
551 | - Don't use errno.h in zutil.h under WinCE [Yakimov] | ||
552 | - Move arguments for AR to its usage to allow replacing ar [Marot] | ||
553 | - Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson] | ||
554 | - Improve inflateInit() and inflateInit2() documentation | ||
555 | - Fix structure size comment in inflate.h | ||
556 | - Change configure help option from --h* to --help [Santos] | ||
557 | |||
558 | Changes in 1.2.3 (18 July 2005) | ||
559 | - Apply security vulnerability fixes to contrib/infback9 as well | ||
560 | - Clean up some text files (carriage returns, trailing space) | ||
561 | - Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] | ||
562 | |||
563 | Changes in 1.2.2.4 (11 July 2005) | ||
564 | - Add inflatePrime() function for starting inflation at bit boundary | ||
565 | - Avoid some Visual C warnings in deflate.c | ||
566 | - Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit | ||
567 | compile | ||
568 | - Fix some spelling errors in comments [Betts] | ||
569 | - Correct inflateInit2() error return documentation in zlib.h | ||
570 | - Add zran.c example of compressed data random access to examples | ||
571 | directory, shows use of inflatePrime() | ||
572 | - Fix cast for assignments to strm->state in inflate.c and infback.c | ||
573 | - Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] | ||
574 | - Move declarations of gf2 functions to right place in crc32.c [Oberhumer] | ||
575 | - Add cast in trees.c t avoid a warning [Oberhumer] | ||
576 | - Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] | ||
577 | - Update make_vms.com [Zinser] | ||
578 | - Initialize state->write in inflateReset() since copied in inflate_fast() | ||
579 | - Be more strict on incomplete code sets in inflate_table() and increase | ||
580 | ENOUGH and MAXD -- this repairs a possible security vulnerability for | ||
581 | invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for | ||
582 | discovering the vulnerability and providing test cases. | ||
583 | - Add ia64 support to configure for HP-UX [Smith] | ||
584 | - Add error return to gzread() for format or i/o error [Levin] | ||
585 | - Use malloc.h for OS/2 [Necasek] | ||
586 | |||
587 | Changes in 1.2.2.3 (27 May 2005) | ||
588 | - Replace 1U constants in inflate.c and inftrees.c for 64-bit compile | ||
589 | - Typecast fread() return values in gzio.c [Vollant] | ||
590 | - Remove trailing space in minigzip.c outmode (VC++ can't deal with it) | ||
591 | - Fix crc check bug in gzread() after gzungetc() [Heiner] | ||
592 | - Add the deflateTune() function to adjust internal compression parameters | ||
593 | - Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) | ||
594 | - Remove an incorrect assertion in examples/zpipe.c | ||
595 | - Add C++ wrapper in infback9.h [Donais] | ||
596 | - Fix bug in inflateCopy() when decoding fixed codes | ||
597 | - Note in zlib.h how much deflateSetDictionary() actually uses | ||
598 | - Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) | ||
599 | - Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] | ||
600 | - Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] | ||
601 | - Add gzdirect() function to indicate transparent reads | ||
602 | - Update contrib/minizip [Vollant] | ||
603 | - Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] | ||
604 | - Add casts in crc32.c to avoid warnings [Oberhumer] | ||
605 | - Add contrib/masmx64 [Vollant] | ||
606 | - Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] | ||
607 | |||
608 | Changes in 1.2.2.2 (30 December 2004) | ||
609 | - Replace structure assignments in deflate.c and inflate.c with zmemcpy to | ||
610 | avoid implicit memcpy calls (portability for no-library compilation) | ||
611 | - Increase sprintf() buffer size in gzdopen() to allow for large numbers | ||
612 | - Add INFLATE_STRICT to check distances against zlib header | ||
613 | - Improve WinCE errno handling and comments [Chang] | ||
614 | - Remove comment about no gzip header processing in FAQ | ||
615 | - Add Z_FIXED strategy option to deflateInit2() to force fixed trees | ||
616 | - Add updated make_vms.com [Coghlan], update README | ||
617 | - Create a new "examples" directory, move gzappend.c there, add zpipe.c, | ||
618 | fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. | ||
619 | - Add FAQ entry and comments in deflate.c on uninitialized memory access | ||
620 | - Add Solaris 9 make options in configure [Gilbert] | ||
621 | - Allow strerror() usage in gzio.c for STDC | ||
622 | - Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] | ||
623 | - Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] | ||
624 | - Use z_off_t for adler32_combine() and crc32_combine() lengths | ||
625 | - Make adler32() much faster for small len | ||
626 | - Use OS_CODE in deflate() default gzip header | ||
627 | |||
628 | Changes in 1.2.2.1 (31 October 2004) | ||
629 | - Allow inflateSetDictionary() call for raw inflate | ||
630 | - Fix inflate header crc check bug for file names and comments | ||
631 | - Add deflateSetHeader() and gz_header structure for custom gzip headers | ||
632 | - Add inflateGetheader() to retrieve gzip headers | ||
633 | - Add crc32_combine() and adler32_combine() functions | ||
634 | - Add alloc_func, free_func, in_func, out_func to Z_PREFIX list | ||
635 | - Use zstreamp consistently in zlib.h (inflate_back functions) | ||
636 | - Remove GUNZIP condition from definition of inflate_mode in inflate.h | ||
637 | and in contrib/inflate86/inffast.S [Truta, Anderson] | ||
638 | - Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] | ||
639 | - Update projects/README.projects and projects/visualc6 [Truta] | ||
640 | - Update win32/DLL_FAQ.txt [Truta] | ||
641 | - Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] | ||
642 | - Deprecate Z_ASCII; use Z_TEXT instead [Truta] | ||
643 | - Use a new algorithm for setting strm->data_type in trees.c [Truta] | ||
644 | - Do not define an exit() prototype in zutil.c unless DEBUG defined | ||
645 | - Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] | ||
646 | - Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() | ||
647 | - Fix Darwin build version identification [Peterson] | ||
648 | |||
649 | Changes in 1.2.2 (3 October 2004) | ||
650 | - Update zlib.h comments on gzip in-memory processing | ||
651 | - Set adler to 1 in inflateReset() to support Java test suite [Walles] | ||
652 | - Add contrib/dotzlib [Ravn] | ||
653 | - Update win32/DLL_FAQ.txt [Truta] | ||
654 | - Update contrib/minizip [Vollant] | ||
655 | - Move contrib/visual-basic.txt to old/ [Truta] | ||
656 | - Fix assembler builds in projects/visualc6/ [Truta] | ||
657 | |||
658 | Changes in 1.2.1.2 (9 September 2004) | ||
659 | - Update INDEX file | ||
660 | - Fix trees.c to update strm->data_type (no one ever noticed!) | ||
661 | - Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] | ||
662 | - Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) | ||
663 | - Add limited multitasking protection to DYNAMIC_CRC_TABLE | ||
664 | - Add NO_vsnprintf for VMS in zutil.h [Mozilla] | ||
665 | - Don't declare strerror() under VMS [Mozilla] | ||
666 | - Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize | ||
667 | - Update contrib/ada [Anisimkov] | ||
668 | - Update contrib/minizip [Vollant] | ||
669 | - Fix configure to not hardcode directories for Darwin [Peterson] | ||
670 | - Fix gzio.c to not return error on empty files [Brown] | ||
671 | - Fix indentation; update version in contrib/delphi/ZLib.pas and | ||
672 | contrib/pascal/zlibpas.pas [Truta] | ||
673 | - Update mkasm.bat in contrib/masmx86 [Truta] | ||
674 | - Update contrib/untgz [Truta] | ||
675 | - Add projects/README.projects [Truta] | ||
676 | - Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] | ||
677 | - Update win32/DLL_FAQ.txt [Truta] | ||
678 | - Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] | ||
679 | - Remove an unnecessary assignment to curr in inftrees.c [Truta] | ||
680 | - Add OS/2 to exe builds in configure [Poltorak] | ||
681 | - Remove err dummy parameter in zlib.h [Kientzle] | ||
682 | |||
683 | Changes in 1.2.1.1 (9 January 2004) | ||
684 | - Update email address in README | ||
685 | - Several FAQ updates | ||
686 | - Fix a big fat bug in inftrees.c that prevented decoding valid | ||
687 | dynamic blocks with only literals and no distance codes -- | ||
688 | Thanks to "Hot Emu" for the bug report and sample file | ||
689 | - Add a note to puff.c on no distance codes case. | ||
690 | |||
691 | Changes in 1.2.1 (17 November 2003) | ||
692 | - Remove a tab in contrib/gzappend/gzappend.c | ||
693 | - Update some interfaces in contrib for new zlib functions | ||
694 | - Update zlib version number in some contrib entries | ||
695 | - Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] | ||
696 | - Support shared libraries on Hurd and KFreeBSD [Brown] | ||
697 | - Fix error in NO_DIVIDE option of adler32.c | ||
698 | |||
699 | Changes in 1.2.0.8 (4 November 2003) | ||
700 | - Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas | ||
701 | - Add experimental NO_DIVIDE #define in adler32.c | ||
702 | - Possibly faster on some processors (let me know if it is) | ||
703 | - Correct Z_BLOCK to not return on first inflate call if no wrap | ||
704 | - Fix strm->data_type on inflate() return to correctly indicate EOB | ||
705 | - Add deflatePrime() function for appending in the middle of a byte | ||
706 | - Add contrib/gzappend for an example of appending to a stream | ||
707 | - Update win32/DLL_FAQ.txt [Truta] | ||
708 | - Delete Turbo C comment in README [Truta] | ||
709 | - Improve some indentation in zconf.h [Truta] | ||
710 | - Fix infinite loop on bad input in configure script [Church] | ||
711 | - Fix gzeof() for concatenated gzip files [Johnson] | ||
712 | - Add example to contrib/visual-basic.txt [Michael B.] | ||
713 | - Add -p to mkdir's in Makefile.in [vda] | ||
714 | - Fix configure to properly detect presence or lack of printf functions | ||
715 | - Add AS400 support [Monnerat] | ||
716 | - Add a little Cygwin support [Wilson] | ||
717 | |||
718 | Changes in 1.2.0.7 (21 September 2003) | ||
719 | - Correct some debug formats in contrib/infback9 | ||
720 | - Cast a type in a debug statement in trees.c | ||
721 | - Change search and replace delimiter in configure from % to # [Beebe] | ||
722 | - Update contrib/untgz to 0.2 with various fixes [Truta] | ||
723 | - Add build support for Amiga [Nikl] | ||
724 | - Remove some directories in old that have been updated to 1.2 | ||
725 | - Add dylib building for Mac OS X in configure and Makefile.in | ||
726 | - Remove old distribution stuff from Makefile | ||
727 | - Update README to point to DLL_FAQ.txt, and add comment on Mac OS X | ||
728 | - Update links in README | ||
729 | |||
730 | Changes in 1.2.0.6 (13 September 2003) | ||
731 | - Minor FAQ updates | ||
732 | - Update contrib/minizip to 1.00 [Vollant] | ||
733 | - Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] | ||
734 | - Update POSTINC comment for 68060 [Nikl] | ||
735 | - Add contrib/infback9 with deflate64 decoding (unsupported) | ||
736 | - For MVS define NO_vsnprintf and undefine FAR [van Burik] | ||
737 | - Add pragma for fdopen on MVS [van Burik] | ||
738 | |||
739 | Changes in 1.2.0.5 (8 September 2003) | ||
740 | - Add OF to inflateBackEnd() declaration in zlib.h | ||
741 | - Remember start when using gzdopen in the middle of a file | ||
742 | - Use internal off_t counters in gz* functions to properly handle seeks | ||
743 | - Perform more rigorous check for distance-too-far in inffast.c | ||
744 | - Add Z_BLOCK flush option to return from inflate at block boundary | ||
745 | - Set strm->data_type on return from inflate | ||
746 | - Indicate bits unused, if at block boundary, and if in last block | ||
747 | - Replace size_t with ptrdiff_t in crc32.c, and check for correct size | ||
748 | - Add condition so old NO_DEFLATE define still works for compatibility | ||
749 | - FAQ update regarding the Windows DLL [Truta] | ||
750 | - INDEX update: add qnx entry, remove aix entry [Truta] | ||
751 | - Install zlib.3 into mandir [Wilson] | ||
752 | - Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] | ||
753 | - Adapt the zlib interface to the new DLL convention guidelines [Truta] | ||
754 | - Introduce ZLIB_WINAPI macro to allow the export of functions using | ||
755 | the WINAPI calling convention, for Visual Basic [Vollant, Truta] | ||
756 | - Update msdos and win32 scripts and makefiles [Truta] | ||
757 | - Export symbols by name, not by ordinal, in win32/zlib.def [Truta] | ||
758 | - Add contrib/ada [Anisimkov] | ||
759 | - Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] | ||
760 | - Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] | ||
761 | - Add contrib/masm686 [Truta] | ||
762 | - Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm | ||
763 | [Truta, Vollant] | ||
764 | - Update contrib/delphi; rename to contrib/pascal; add example [Truta] | ||
765 | - Remove contrib/delphi2; add a new contrib/delphi [Truta] | ||
766 | - Avoid inclusion of the nonstandard <memory.h> in contrib/iostream, | ||
767 | and fix some method prototypes [Truta] | ||
768 | - Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip | ||
769 | [Truta] | ||
770 | - Avoid the use of backslash (\) in contrib/minizip [Vollant] | ||
771 | - Fix file time handling in contrib/untgz; update makefiles [Truta] | ||
772 | - Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines | ||
773 | [Vollant] | ||
774 | - Remove contrib/vstudio/vc15_16 [Vollant] | ||
775 | - Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] | ||
776 | - Update README.contrib [Truta] | ||
777 | - Invert the assignment order of match_head and s->prev[...] in | ||
778 | INSERT_STRING [Truta] | ||
779 | - Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings | ||
780 | [Truta] | ||
781 | - Compare function pointers with 0, not with NULL or Z_NULL [Truta] | ||
782 | - Fix prototype of syncsearch in inflate.c [Truta] | ||
783 | - Introduce ASMINF macro to be enabled when using an ASM implementation | ||
784 | of inflate_fast [Truta] | ||
785 | - Change NO_DEFLATE to NO_GZCOMPRESS [Truta] | ||
786 | - Modify test_gzio in example.c to take a single file name as a | ||
787 | parameter [Truta] | ||
788 | - Exit the example.c program if gzopen fails [Truta] | ||
789 | - Add type casts around strlen in example.c [Truta] | ||
790 | - Remove casting to sizeof in minigzip.c; give a proper type | ||
791 | to the variable compared with SUFFIX_LEN [Truta] | ||
792 | - Update definitions of STDC and STDC99 in zconf.h [Truta] | ||
793 | - Synchronize zconf.h with the new Windows DLL interface [Truta] | ||
794 | - Use SYS16BIT instead of __32BIT__ to distinguish between | ||
795 | 16- and 32-bit platforms [Truta] | ||
796 | - Use far memory allocators in small 16-bit memory models for | ||
797 | Turbo C [Truta] | ||
798 | - Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in | ||
799 | zlibCompileFlags [Truta] | ||
800 | - Cygwin has vsnprintf [Wilson] | ||
801 | - In Windows16, OS_CODE is 0, as in MSDOS [Truta] | ||
802 | - In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] | ||
803 | |||
804 | Changes in 1.2.0.4 (10 August 2003) | ||
805 | - Minor FAQ updates | ||
806 | - Be more strict when checking inflateInit2's windowBits parameter | ||
807 | - Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well | ||
808 | - Add gzip wrapper option to deflateInit2 using windowBits | ||
809 | - Add updated QNX rule in configure and qnx directory [Bonnefoy] | ||
810 | - Make inflate distance-too-far checks more rigorous | ||
811 | - Clean up FAR usage in inflate | ||
812 | - Add casting to sizeof() in gzio.c and minigzip.c | ||
813 | |||
814 | Changes in 1.2.0.3 (19 July 2003) | ||
815 | - Fix silly error in gzungetc() implementation [Vollant] | ||
816 | - Update contrib/minizip and contrib/vstudio [Vollant] | ||
817 | - Fix printf format in example.c | ||
818 | - Correct cdecl support in zconf.in.h [Anisimkov] | ||
819 | - Minor FAQ updates | ||
820 | |||
821 | Changes in 1.2.0.2 (13 July 2003) | ||
822 | - Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons | ||
823 | - Attempt to avoid warnings in crc32.c for pointer-int conversion | ||
824 | - Add AIX to configure, remove aix directory [Bakker] | ||
825 | - Add some casts to minigzip.c | ||
826 | - Improve checking after insecure sprintf() or vsprintf() calls | ||
827 | - Remove #elif's from crc32.c | ||
828 | - Change leave label to inf_leave in inflate.c and infback.c to avoid | ||
829 | library conflicts | ||
830 | - Remove inflate gzip decoding by default--only enable gzip decoding by | ||
831 | special request for stricter backward compatibility | ||
832 | - Add zlibCompileFlags() function to return compilation information | ||
833 | - More typecasting in deflate.c to avoid warnings | ||
834 | - Remove leading underscore from _Capital #defines [Truta] | ||
835 | - Fix configure to link shared library when testing | ||
836 | - Add some Windows CE target adjustments [Mai] | ||
837 | - Remove #define ZLIB_DLL in zconf.h [Vollant] | ||
838 | - Add zlib.3 [Rodgers] | ||
839 | - Update RFC URL in deflate.c and algorithm.txt [Mai] | ||
840 | - Add zlib_dll_FAQ.txt to contrib [Truta] | ||
841 | - Add UL to some constants [Truta] | ||
842 | - Update minizip and vstudio [Vollant] | ||
843 | - Remove vestigial NEED_DUMMY_RETURN from zconf.in.h | ||
844 | - Expand use of NO_DUMMY_DECL to avoid all dummy structures | ||
845 | - Added iostream3 to contrib [Schwardt] | ||
846 | - Replace rewind() with fseek() for WinCE [Truta] | ||
847 | - Improve setting of zlib format compression level flags | ||
848 | - Report 0 for huffman and rle strategies and for level == 0 or 1 | ||
849 | - Report 2 only for level == 6 | ||
850 | - Only deal with 64K limit when necessary at compile time [Truta] | ||
851 | - Allow TOO_FAR check to be turned off at compile time [Truta] | ||
852 | - Add gzclearerr() function [Souza] | ||
853 | - Add gzungetc() function | ||
854 | |||
855 | Changes in 1.2.0.1 (17 March 2003) | ||
856 | - Add Z_RLE strategy for run-length encoding [Truta] | ||
857 | - When Z_RLE requested, restrict matches to distance one | ||
858 | - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE | ||
859 | - Correct FASTEST compilation to allow level == 0 | ||
860 | - Clean up what gets compiled for FASTEST | ||
861 | - Incorporate changes to zconf.in.h [Vollant] | ||
862 | - Refine detection of Turbo C need for dummy returns | ||
863 | - Refine ZLIB_DLL compilation | ||
864 | - Include additional header file on VMS for off_t typedef | ||
865 | - Try to use _vsnprintf where it supplants vsprintf [Vollant] | ||
866 | - Add some casts in inffast.c | ||
867 | - Enchance comments in zlib.h on what happens if gzprintf() tries to | ||
868 | write more than 4095 bytes before compression | ||
869 | - Remove unused state from inflateBackEnd() | ||
870 | - Remove exit(0) from minigzip.c, example.c | ||
871 | - Get rid of all those darn tabs | ||
872 | - Add "check" target to Makefile.in that does the same thing as "test" | ||
873 | - Add "mostlyclean" and "maintainer-clean" targets to Makefile.in | ||
874 | - Update contrib/inflate86 [Anderson] | ||
875 | - Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] | ||
876 | - Add msdos and win32 directories with makefiles [Truta] | ||
877 | - More additions and improvements to the FAQ | ||
878 | |||
879 | Changes in 1.2.0 (9 March 2003) | ||
880 | - New and improved inflate code | ||
881 | - About 20% faster | ||
882 | - Does not allocate 32K window unless and until needed | ||
883 | - Automatically detects and decompresses gzip streams | ||
884 | - Raw inflate no longer needs an extra dummy byte at end | ||
885 | - Added inflateBack functions using a callback interface--even faster | ||
886 | than inflate, useful for file utilities (gzip, zip) | ||
887 | - Added inflateCopy() function to record state for random access on | ||
888 | externally generated deflate streams (e.g. in gzip files) | ||
889 | - More readable code (I hope) | ||
890 | - New and improved crc32() | ||
891 | - About 50% faster, thanks to suggestions from Rodney Brown | ||
892 | - Add deflateBound() and compressBound() functions | ||
893 | - Fix memory leak in deflateInit2() | ||
894 | - Permit setting dictionary for raw deflate (for parallel deflate) | ||
895 | - Fix const declaration for gzwrite() | ||
896 | - Check for some malloc() failures in gzio.c | ||
897 | - Fix bug in gzopen() on single-byte file 0x1f | ||
898 | - Fix bug in gzread() on concatenated file with 0x1f at end of buffer | ||
899 | and next buffer doesn't start with 0x8b | ||
900 | - Fix uncompress() to return Z_DATA_ERROR on truncated input | ||
901 | - Free memory at end of example.c | ||
902 | - Remove MAX #define in trees.c (conflicted with some libraries) | ||
903 | - Fix static const's in deflate.c, gzio.c, and zutil.[ch] | ||
904 | - Declare malloc() and free() in gzio.c if STDC not defined | ||
905 | - Use malloc() instead of calloc() in zutil.c if int big enough | ||
906 | - Define STDC for AIX | ||
907 | - Add aix/ with approach for compiling shared library on AIX | ||
908 | - Add HP-UX support for shared libraries in configure | ||
909 | - Add OpenUNIX support for shared libraries in configure | ||
910 | - Use $cc instead of gcc to build shared library | ||
911 | - Make prefix directory if needed when installing | ||
912 | - Correct Macintosh avoidance of typedef Byte in zconf.h | ||
913 | - Correct Turbo C memory allocation when under Linux | ||
914 | - Use libz.a instead of -lz in Makefile (assure use of compiled library) | ||
915 | - Update configure to check for snprintf or vsnprintf functions and their | ||
916 | return value, warn during make if using an insecure function | ||
917 | - Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that | ||
918 | is lost when library is used--resolution is to build new zconf.h | ||
919 | - Documentation improvements (in zlib.h): | ||
920 | - Document raw deflate and inflate | ||
921 | - Update RFCs URL | ||
922 | - Point out that zlib and gzip formats are different | ||
923 | - Note that Z_BUF_ERROR is not fatal | ||
924 | - Document string limit for gzprintf() and possible buffer overflow | ||
925 | - Note requirement on avail_out when flushing | ||
926 | - Note permitted values of flush parameter of inflate() | ||
927 | - Add some FAQs (and even answers) to the FAQ | ||
928 | - Add contrib/inflate86/ for x86 faster inflate | ||
929 | - Add contrib/blast/ for PKWare Data Compression Library decompression | ||
930 | - Add contrib/puff/ simple inflate for deflate format description | ||
931 | |||
932 | Changes in 1.1.4 (11 March 2002) | ||
933 | - ZFREE was repeated on same allocation on some error conditions. | ||
934 | This creates a security problem described in | ||
935 | http://www.zlib.org/advisory-2002-03-11.txt | ||
936 | - Returned incorrect error (Z_MEM_ERROR) on some invalid data | ||
937 | - Avoid accesses before window for invalid distances with inflate window | ||
938 | less than 32K. | ||
939 | - force windowBits > 8 to avoid a bug in the encoder for a window size | ||
940 | of 256 bytes. (A complete fix will be available in 1.1.5). | ||
941 | |||
942 | Changes in 1.1.3 (9 July 1998) | ||
943 | - fix "an inflate input buffer bug that shows up on rare but persistent | ||
944 | occasions" (Mark) | ||
945 | - fix gzread and gztell for concatenated .gz files (Didier Le Botlan) | ||
946 | - fix gzseek(..., SEEK_SET) in write mode | ||
947 | - fix crc check after a gzeek (Frank Faubert) | ||
948 | - fix miniunzip when the last entry in a zip file is itself a zip file | ||
949 | (J Lillge) | ||
950 | - add contrib/asm586 and contrib/asm686 (Brian Raiter) | ||
951 | See http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
952 | - add support for Delphi 3 in contrib/delphi (Bob Dellaca) | ||
953 | - add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) | ||
954 | - do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) | ||
955 | - use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) | ||
956 | - added a FAQ file | ||
957 | |||
958 | - Support gzdopen on Mac with Metrowerks (Jason Linhart) | ||
959 | - Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) | ||
960 | - define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) | ||
961 | - avoid some warnings with Borland C (Tom Tanner) | ||
962 | - fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) | ||
963 | - emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) | ||
964 | - allow several arguments to configure (Tim Mooney, Frodo Looijaard) | ||
965 | - use libdir and includedir in Makefile.in (Tim Mooney) | ||
966 | - support shared libraries on OSF1 V4 (Tim Mooney) | ||
967 | - remove so_locations in "make clean" (Tim Mooney) | ||
968 | - fix maketree.c compilation error (Glenn, Mark) | ||
969 | - Python interface to zlib now in Python 1.5 (Jeremy Hylton) | ||
970 | - new Makefile.riscos (Rich Walker) | ||
971 | - initialize static descriptors in trees.c for embedded targets (Nick Smith) | ||
972 | - use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) | ||
973 | - add the OS/2 files in Makefile.in too (Andrew Zabolotny) | ||
974 | - fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) | ||
975 | - fix maketree.c to allow clean compilation of inffixed.h (Mark) | ||
976 | - fix parameter check in deflateCopy (Gunther Nikl) | ||
977 | - cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) | ||
978 | - Many portability patches by Christian Spieler: | ||
979 | . zutil.c, zutil.h: added "const" for zmem* | ||
980 | . Make_vms.com: fixed some typos | ||
981 | . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists | ||
982 | . msdos/Makefile.msc: remove "default rtl link library" info from obj files | ||
983 | . msdos/Makefile.*: use model-dependent name for the built zlib library | ||
984 | . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: | ||
985 | new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) | ||
986 | - use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) | ||
987 | - replace __far with _far for better portability (Christian Spieler, Tom Lane) | ||
988 | - fix test for errno.h in configure (Tim Newsham) | ||
989 | |||
990 | Changes in 1.1.2 (19 March 98) | ||
991 | - added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) | ||
992 | See http://www.winimage.com/zLibDll/unzip.html | ||
993 | - preinitialize the inflate tables for fixed codes, to make the code | ||
994 | completely thread safe (Mark) | ||
995 | - some simplifications and slight speed-up to the inflate code (Mark) | ||
996 | - fix gzeof on non-compressed files (Allan Schrum) | ||
997 | - add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) | ||
998 | - use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) | ||
999 | - added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) | ||
1000 | - add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) | ||
1001 | - do not wrap extern "C" around system includes (Tom Lane) | ||
1002 | - mention zlib binding for TCL in README (Andreas Kupries) | ||
1003 | - added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) | ||
1004 | - allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) | ||
1005 | - allow "configure --prefix $HOME" (Tim Mooney) | ||
1006 | - remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) | ||
1007 | - move Makefile.sas to amiga/Makefile.sas | ||
1008 | |||
1009 | Changes in 1.1.1 (27 Feb 98) | ||
1010 | - fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) | ||
1011 | - remove block truncation heuristic which had very marginal effect for zlib | ||
1012 | (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the | ||
1013 | compression ratio on some files. This also allows inlining _tr_tally for | ||
1014 | matches in deflate_slow. | ||
1015 | - added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) | ||
1016 | |||
1017 | Changes in 1.1.0 (24 Feb 98) | ||
1018 | - do not return STREAM_END prematurely in inflate (John Bowler) | ||
1019 | - revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) | ||
1020 | - compile with -DFASTEST to get compression code optimized for speed only | ||
1021 | - in minigzip, try mmap'ing the input file first (Miguel Albrecht) | ||
1022 | - increase size of I/O buffers in minigzip.c and gzio.c (not a big gain | ||
1023 | on Sun but significant on HP) | ||
1024 | |||
1025 | - add a pointer to experimental unzip library in README (Gilles Vollant) | ||
1026 | - initialize variable gcc in configure (Chris Herborth) | ||
1027 | |||
1028 | Changes in 1.0.9 (17 Feb 1998) | ||
1029 | - added gzputs and gzgets functions | ||
1030 | - do not clear eof flag in gzseek (Mark Diekhans) | ||
1031 | - fix gzseek for files in transparent mode (Mark Diekhans) | ||
1032 | - do not assume that vsprintf returns the number of bytes written (Jens Krinke) | ||
1033 | - replace EXPORT with ZEXPORT to avoid conflict with other programs | ||
1034 | - added compress2 in zconf.h, zlib.def, zlib.dnt | ||
1035 | - new asm code from Gilles Vollant in contrib/asm386 | ||
1036 | - simplify the inflate code (Mark): | ||
1037 | . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() | ||
1038 | . ZALLOC the length list in inflate_trees_fixed() instead of using stack | ||
1039 | . ZALLOC the value area for huft_build() instead of using stack | ||
1040 | . Simplify Z_FINISH check in inflate() | ||
1041 | |||
1042 | - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 | ||
1043 | - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) | ||
1044 | - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with | ||
1045 | the declaration of FAR (Gilles VOllant) | ||
1046 | - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) | ||
1047 | - read_buf buf parameter of type Bytef* instead of charf* | ||
1048 | - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) | ||
1049 | - do not redeclare unlink in minigzip.c for WIN32 (John Bowler) | ||
1050 | - fix check for presence of directories in "make install" (Ian Willis) | ||
1051 | |||
1052 | Changes in 1.0.8 (27 Jan 1998) | ||
1053 | - fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) | ||
1054 | - fix gzgetc and gzputc for big endian systems (Markus Oberhumer) | ||
1055 | - added compress2() to allow setting the compression level | ||
1056 | - include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) | ||
1057 | - use constant arrays for the static trees in trees.c instead of computing | ||
1058 | them at run time (thanks to Ken Raeburn for this suggestion). To create | ||
1059 | trees.h, compile with GEN_TREES_H and run "make test". | ||
1060 | - check return code of example in "make test" and display result | ||
1061 | - pass minigzip command line options to file_compress | ||
1062 | - simplifying code of inflateSync to avoid gcc 2.8 bug | ||
1063 | |||
1064 | - support CC="gcc -Wall" in configure -s (QingLong) | ||
1065 | - avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) | ||
1066 | - fix test for shared library support to avoid compiler warnings | ||
1067 | - zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) | ||
1068 | - check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) | ||
1069 | - do not use fdopen for Metrowerks on Mac (Brad Pettit)) | ||
1070 | - add checks for gzputc and gzputc in example.c | ||
1071 | - avoid warnings in gzio.c and deflate.c (Andreas Kleinert) | ||
1072 | - use const for the CRC table (Ken Raeburn) | ||
1073 | - fixed "make uninstall" for shared libraries | ||
1074 | - use Tracev instead of Trace in infblock.c | ||
1075 | - in example.c use correct compressed length for test_sync | ||
1076 | - suppress +vnocompatwarnings in configure for HPUX (not always supported) | ||
1077 | |||
1078 | Changes in 1.0.7 (20 Jan 1998) | ||
1079 | - fix gzseek which was broken in write mode | ||
1080 | - return error for gzseek to negative absolute position | ||
1081 | - fix configure for Linux (Chun-Chung Chen) | ||
1082 | - increase stack space for MSC (Tim Wegner) | ||
1083 | - get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) | ||
1084 | - define EXPORTVA for gzprintf (Gilles Vollant) | ||
1085 | - added man page zlib.3 (Rick Rodgers) | ||
1086 | - for contrib/untgz, fix makedir() and improve Makefile | ||
1087 | |||
1088 | - check gzseek in write mode in example.c | ||
1089 | - allocate extra buffer for seeks only if gzseek is actually called | ||
1090 | - avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) | ||
1091 | - add inflateSyncPoint in zconf.h | ||
1092 | - fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def | ||
1093 | |||
1094 | Changes in 1.0.6 (19 Jan 1998) | ||
1095 | - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and | ||
1096 | gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) | ||
1097 | - Fix a deflate bug occurring only with compression level 0 (thanks to | ||
1098 | Andy Buckler for finding this one). | ||
1099 | - In minigzip, pass transparently also the first byte for .Z files. | ||
1100 | - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() | ||
1101 | - check Z_FINISH in inflate (thanks to Marc Schluper) | ||
1102 | - Implement deflateCopy (thanks to Adam Costello) | ||
1103 | - make static libraries by default in configure, add --shared option. | ||
1104 | - move MSDOS or Windows specific files to directory msdos | ||
1105 | - suppress the notion of partial flush to simplify the interface | ||
1106 | (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) | ||
1107 | - suppress history buffer provided by application to simplify the interface | ||
1108 | (this feature was not implemented anyway in 1.0.4) | ||
1109 | - next_in and avail_in must be initialized before calling inflateInit or | ||
1110 | inflateInit2 | ||
1111 | - add EXPORT in all exported functions (for Windows DLL) | ||
1112 | - added Makefile.nt (thanks to Stephen Williams) | ||
1113 | - added the unsupported "contrib" directory: | ||
1114 | contrib/asm386/ by Gilles Vollant <info@winimage.com> | ||
1115 | 386 asm code replacing longest_match(). | ||
1116 | contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> | ||
1117 | A C++ I/O streams interface to the zlib gz* functions | ||
1118 | contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no> | ||
1119 | Another C++ I/O streams interface | ||
1120 | contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es> | ||
1121 | A very simple tar.gz file extractor using zlib | ||
1122 | contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl> | ||
1123 | How to use compress(), uncompress() and the gz* functions from VB. | ||
1124 | - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression | ||
1125 | level) in minigzip (thanks to Tom Lane) | ||
1126 | |||
1127 | - use const for rommable constants in deflate | ||
1128 | - added test for gzseek and gztell in example.c | ||
1129 | - add undocumented function inflateSyncPoint() (hack for Paul Mackerras) | ||
1130 | - add undocumented function zError to convert error code to string | ||
1131 | (for Tim Smithers) | ||
1132 | - Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. | ||
1133 | - Use default memcpy for Symantec MSDOS compiler. | ||
1134 | - Add EXPORT keyword for check_func (needed for Windows DLL) | ||
1135 | - add current directory to LD_LIBRARY_PATH for "make test" | ||
1136 | - create also a link for libz.so.1 | ||
1137 | - added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) | ||
1138 | - use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) | ||
1139 | - added -soname for Linux in configure (Chun-Chung Chen, | ||
1140 | - assign numbers to the exported functions in zlib.def (for Windows DLL) | ||
1141 | - add advice in zlib.h for best usage of deflateSetDictionary | ||
1142 | - work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) | ||
1143 | - allow compilation with ANSI keywords only enabled for TurboC in large model | ||
1144 | - avoid "versionString"[0] (Borland bug) | ||
1145 | - add NEED_DUMMY_RETURN for Borland | ||
1146 | - use variable z_verbose for tracing in debug mode (L. Peter Deutsch). | ||
1147 | - allow compilation with CC | ||
1148 | - defined STDC for OS/2 (David Charlap) | ||
1149 | - limit external names to 8 chars for MVS (Thomas Lund) | ||
1150 | - in minigzip.c, use static buffers only for 16-bit systems | ||
1151 | - fix suffix check for "minigzip -d foo.gz" | ||
1152 | - do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) | ||
1153 | - use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) | ||
1154 | - added makelcc.bat for lcc-win32 (Tom St Denis) | ||
1155 | - in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) | ||
1156 | - Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. | ||
1157 | - check for unistd.h in configure (for off_t) | ||
1158 | - remove useless check parameter in inflate_blocks_free | ||
1159 | - avoid useless assignment of s->check to itself in inflate_blocks_new | ||
1160 | - do not flush twice in gzclose (thanks to Ken Raeburn) | ||
1161 | - rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h | ||
1162 | - use NO_ERRNO_H instead of enumeration of operating systems with errno.h | ||
1163 | - work around buggy fclose on pipes for HP/UX | ||
1164 | - support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) | ||
1165 | - fix configure if CC is already equal to gcc | ||
1166 | |||
1167 | Changes in 1.0.5 (3 Jan 98) | ||
1168 | - Fix inflate to terminate gracefully when fed corrupted or invalid data | ||
1169 | - Use const for rommable constants in inflate | ||
1170 | - Eliminate memory leaks on error conditions in inflate | ||
1171 | - Removed some vestigial code in inflate | ||
1172 | - Update web address in README | ||
1173 | |||
1174 | Changes in 1.0.4 (24 Jul 96) | ||
1175 | - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF | ||
1176 | bit, so the decompressor could decompress all the correct data but went | ||
1177 | on to attempt decompressing extra garbage data. This affected minigzip too. | ||
1178 | - zlibVersion and gzerror return const char* (needed for DLL) | ||
1179 | - port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) | ||
1180 | - use z_error only for DEBUG (avoid problem with DLLs) | ||
1181 | |||
1182 | Changes in 1.0.3 (2 Jul 96) | ||
1183 | - use z_streamp instead of z_stream *, which is now a far pointer in MSDOS | ||
1184 | small and medium models; this makes the library incompatible with previous | ||
1185 | versions for these models. (No effect in large model or on other systems.) | ||
1186 | - return OK instead of BUF_ERROR if previous deflate call returned with | ||
1187 | avail_out as zero but there is nothing to do | ||
1188 | - added memcmp for non STDC compilers | ||
1189 | - define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) | ||
1190 | - define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) | ||
1191 | - better check for 16-bit mode MSC (avoids problem with Symantec) | ||
1192 | |||
1193 | Changes in 1.0.2 (23 May 96) | ||
1194 | - added Windows DLL support | ||
1195 | - added a function zlibVersion (for the DLL support) | ||
1196 | - fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) | ||
1197 | - Bytef is define's instead of typedef'd only for Borland C | ||
1198 | - avoid reading uninitialized memory in example.c | ||
1199 | - mention in README that the zlib format is now RFC1950 | ||
1200 | - updated Makefile.dj2 | ||
1201 | - added algorithm.doc | ||
1202 | |||
1203 | Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] | ||
1204 | - fix array overlay in deflate.c which sometimes caused bad compressed data | ||
1205 | - fix inflate bug with empty stored block | ||
1206 | - fix MSDOS medium model which was broken in 0.99 | ||
1207 | - fix deflateParams() which could generated bad compressed data. | ||
1208 | - Bytef is define'd instead of typedef'ed (work around Borland bug) | ||
1209 | - added an INDEX file | ||
1210 | - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), | ||
1211 | Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) | ||
1212 | - speed up adler32 for modern machines without auto-increment | ||
1213 | - added -ansi for IRIX in configure | ||
1214 | - static_init_done in trees.c is an int | ||
1215 | - define unlink as delete for VMS | ||
1216 | - fix configure for QNX | ||
1217 | - add configure branch for SCO and HPUX | ||
1218 | - avoid many warnings (unused variables, dead assignments, etc...) | ||
1219 | - no fdopen for BeOS | ||
1220 | - fix the Watcom fix for 32 bit mode (define FAR as empty) | ||
1221 | - removed redefinition of Byte for MKWERKS | ||
1222 | - work around an MWKERKS bug (incorrect merge of all .h files) | ||
1223 | |||
1224 | Changes in 0.99 (27 Jan 96) | ||
1225 | - allow preset dictionary shared between compressor and decompressor | ||
1226 | - allow compression level 0 (no compression) | ||
1227 | - add deflateParams in zlib.h: allow dynamic change of compression level | ||
1228 | and compression strategy. | ||
1229 | - test large buffers and deflateParams in example.c | ||
1230 | - add optional "configure" to build zlib as a shared library | ||
1231 | - suppress Makefile.qnx, use configure instead | ||
1232 | - fixed deflate for 64-bit systems (detected on Cray) | ||
1233 | - fixed inflate_blocks for 64-bit systems (detected on Alpha) | ||
1234 | - declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) | ||
1235 | - always return Z_BUF_ERROR when deflate() has nothing to do | ||
1236 | - deflateInit and inflateInit are now macros to allow version checking | ||
1237 | - prefix all global functions and types with z_ with -DZ_PREFIX | ||
1238 | - make falloc completely reentrant (inftrees.c) | ||
1239 | - fixed very unlikely race condition in ct_static_init | ||
1240 | - free in reverse order of allocation to help memory manager | ||
1241 | - use zlib-1.0/* instead of zlib/* inside the tar.gz | ||
1242 | - make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith | ||
1243 | -Wconversion -Wstrict-prototypes -Wmissing-prototypes" | ||
1244 | - allow gzread on concatenated .gz files | ||
1245 | - deflateEnd now returns Z_DATA_ERROR if it was premature | ||
1246 | - deflate is finally (?) fully deterministic (no matches beyond end of input) | ||
1247 | - Document Z_SYNC_FLUSH | ||
1248 | - add uninstall in Makefile | ||
1249 | - Check for __cpluplus in zlib.h | ||
1250 | - Better test in ct_align for partial flush | ||
1251 | - avoid harmless warnings for Borland C++ | ||
1252 | - initialize hash_head in deflate.c | ||
1253 | - avoid warning on fdopen (gzio.c) for HP cc -Aa | ||
1254 | - include stdlib.h for STDC compilers | ||
1255 | - include errno.h for Cray | ||
1256 | - ignore error if ranlib doesn't exist | ||
1257 | - call ranlib twice for NeXTSTEP | ||
1258 | - use exec_prefix instead of prefix for libz.a | ||
1259 | - renamed ct_* as _tr_* to avoid conflict with applications | ||
1260 | - clear z->msg in inflateInit2 before any error return | ||
1261 | - initialize opaque in example.c, gzio.c, deflate.c and inflate.c | ||
1262 | - fixed typo in zconf.h (_GNUC__ => __GNUC__) | ||
1263 | - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) | ||
1264 | - fix typo in Make_vms.com (f$trnlnm -> f$getsyi) | ||
1265 | - in fcalloc, normalize pointer if size > 65520 bytes | ||
1266 | - don't use special fcalloc for 32 bit Borland C++ | ||
1267 | - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... | ||
1268 | - use Z_BINARY instead of BINARY | ||
1269 | - document that gzclose after gzdopen will close the file | ||
1270 | - allow "a" as mode in gzopen. | ||
1271 | - fix error checking in gzread | ||
1272 | - allow skipping .gz extra-field on pipes | ||
1273 | - added reference to Perl interface in README | ||
1274 | - put the crc table in FAR data (I dislike more and more the medium model :) | ||
1275 | - added get_crc_table | ||
1276 | - added a dimension to all arrays (Borland C can't count). | ||
1277 | - workaround Borland C bug in declaration of inflate_codes_new & inflate_fast | ||
1278 | - guard against multiple inclusion of *.h (for precompiled header on Mac) | ||
1279 | - Watcom C pretends to be Microsoft C small model even in 32 bit mode. | ||
1280 | - don't use unsized arrays to avoid silly warnings by Visual C++: | ||
1281 | warning C4746: 'inflate_mask' : unsized array treated as '__far' | ||
1282 | (what's wrong with far data in far model?). | ||
1283 | - define enum out of inflate_blocks_state to allow compilation with C++ | ||
1284 | |||
1285 | Changes in 0.95 (16 Aug 95) | ||
1286 | - fix MSDOS small and medium model (now easier to adapt to any compiler) | ||
1287 | - inlined send_bits | ||
1288 | - fix the final (:-) bug for deflate with flush (output was correct but | ||
1289 | not completely flushed in rare occasions). | ||
1290 | - default window size is same for compression and decompression | ||
1291 | (it's now sufficient to set MAX_WBITS in zconf.h). | ||
1292 | - voidp -> voidpf and voidnp -> voidp (for consistency with other | ||
1293 | typedefs and because voidnp was not near in large model). | ||
1294 | |||
1295 | Changes in 0.94 (13 Aug 95) | ||
1296 | - support MSDOS medium model | ||
1297 | - fix deflate with flush (could sometimes generate bad output) | ||
1298 | - fix deflateReset (zlib header was incorrectly suppressed) | ||
1299 | - added support for VMS | ||
1300 | - allow a compression level in gzopen() | ||
1301 | - gzflush now calls fflush | ||
1302 | - For deflate with flush, flush even if no more input is provided. | ||
1303 | - rename libgz.a as libz.a | ||
1304 | - avoid complex expression in infcodes.c triggering Turbo C bug | ||
1305 | - work around a problem with gcc on Alpha (in INSERT_STRING) | ||
1306 | - don't use inline functions (problem with some gcc versions) | ||
1307 | - allow renaming of Byte, uInt, etc... with #define. | ||
1308 | - avoid warning about (unused) pointer before start of array in deflate.c | ||
1309 | - avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c | ||
1310 | - avoid reserved word 'new' in trees.c | ||
1311 | |||
1312 | Changes in 0.93 (25 June 95) | ||
1313 | - temporarily disable inline functions | ||
1314 | - make deflate deterministic | ||
1315 | - give enough lookahead for PARTIAL_FLUSH | ||
1316 | - Set binary mode for stdin/stdout in minigzip.c for OS/2 | ||
1317 | - don't even use signed char in inflate (not portable enough) | ||
1318 | - fix inflate memory leak for segmented architectures | ||
1319 | |||
1320 | Changes in 0.92 (3 May 95) | ||
1321 | - don't assume that char is signed (problem on SGI) | ||
1322 | - Clear bit buffer when starting a stored block | ||
1323 | - no memcpy on Pyramid | ||
1324 | - suppressed inftest.c | ||
1325 | - optimized fill_window, put longest_match inline for gcc | ||
1326 | - optimized inflate on stored blocks. | ||
1327 | - untabify all sources to simplify patches | ||
1328 | |||
1329 | Changes in 0.91 (2 May 95) | ||
1330 | - Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h | ||
1331 | - Document the memory requirements in zconf.h | ||
1332 | - added "make install" | ||
1333 | - fix sync search logic in inflateSync | ||
1334 | - deflate(Z_FULL_FLUSH) now works even if output buffer too short | ||
1335 | - after inflateSync, don't scare people with just "lo world" | ||
1336 | - added support for DJGPP | ||
1337 | |||
1338 | Changes in 0.9 (1 May 95) | ||
1339 | - don't assume that zalloc clears the allocated memory (the TurboC bug | ||
1340 | was Mark's bug after all :) | ||
1341 | - let again gzread copy uncompressed data unchanged (was working in 0.71) | ||
1342 | - deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented | ||
1343 | - added a test of inflateSync in example.c | ||
1344 | - moved MAX_WBITS to zconf.h because users might want to change that. | ||
1345 | - document explicitly that zalloc(64K) on MSDOS must return a normalized | ||
1346 | pointer (zero offset) | ||
1347 | - added Makefiles for Microsoft C, Turbo C, Borland C++ | ||
1348 | - faster crc32() | ||
1349 | |||
1350 | Changes in 0.8 (29 April 95) | ||
1351 | - added fast inflate (inffast.c) | ||
1352 | - deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this | ||
1353 | is incompatible with previous versions of zlib which returned Z_OK. | ||
1354 | - work around a TurboC compiler bug (bad code for b << 0, see infutil.h) | ||
1355 | (actually that was not a compiler bug, see 0.81 above) | ||
1356 | - gzread no longer reads one extra byte in certain cases | ||
1357 | - In gzio destroy(), don't reference a freed structure | ||
1358 | - avoid many warnings for MSDOS | ||
1359 | - avoid the ERROR symbol which is used by MS Windows | ||
1360 | |||
1361 | Changes in 0.71 (14 April 95) | ||
1362 | - Fixed more MSDOS compilation problems :( There is still a bug with | ||
1363 | TurboC large model. | ||
1364 | |||
1365 | Changes in 0.7 (14 April 95) | ||
1366 | - Added full inflate support. | ||
1367 | - Simplified the crc32() interface. The pre- and post-conditioning | ||
1368 | (one's complement) is now done inside crc32(). WARNING: this is | ||
1369 | incompatible with previous versions; see zlib.h for the new usage. | ||
1370 | |||
1371 | Changes in 0.61 (12 April 95) | ||
1372 | - workaround for a bug in TurboC. example and minigzip now work on MSDOS. | ||
1373 | |||
1374 | Changes in 0.6 (11 April 95) | ||
1375 | - added minigzip.c | ||
1376 | - added gzdopen to reopen a file descriptor as gzFile | ||
1377 | - added transparent reading of non-gziped files in gzread. | ||
1378 | - fixed bug in gzread (don't read crc as data) | ||
1379 | - fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). | ||
1380 | - don't allocate big arrays in the stack (for MSDOS) | ||
1381 | - fix some MSDOS compilation problems | ||
1382 | |||
1383 | Changes in 0.5: | ||
1384 | - do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but | ||
1385 | not yet Z_FULL_FLUSH. | ||
1386 | - support decompression but only in a single step (forced Z_FINISH) | ||
1387 | - added opaque object for zalloc and zfree. | ||
1388 | - added deflateReset and inflateReset | ||
1389 | - added a variable zlib_version for consistency checking. | ||
1390 | - renamed the 'filter' parameter of deflateInit2 as 'strategy'. | ||
1391 | Added Z_FILTERED and Z_HUFFMAN_ONLY constants. | ||
1392 | |||
1393 | Changes in 0.4: | ||
1394 | - avoid "zip" everywhere, use zlib instead of ziplib. | ||
1395 | - suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush | ||
1396 | if compression method == 8. | ||
1397 | - added adler32 and crc32 | ||
1398 | - renamed deflateOptions as deflateInit2, call one or the other but not both | ||
1399 | - added the method parameter for deflateInit2. | ||
1400 | - added inflateInit2 | ||
1401 | - simplied considerably deflateInit and inflateInit by not supporting | ||
1402 | user-provided history buffer. This is supported only in deflateInit2 | ||
1403 | and inflateInit2. | ||
1404 | |||
1405 | Changes in 0.3: | ||
1406 | - prefix all macro names with Z_ | ||
1407 | - use Z_FINISH instead of deflateEnd to finish compression. | ||
1408 | - added Z_HUFFMAN_ONLY | ||
1409 | - added gzerror() | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/FAQ b/libraries/irrlicht-1.8/source/Irrlicht/zlib/FAQ deleted file mode 100644 index 99b7cf9..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/FAQ +++ /dev/null | |||
@@ -1,368 +0,0 @@ | |||
1 | |||
2 | Frequently Asked Questions about zlib | ||
3 | |||
4 | |||
5 | If your question is not there, please check the zlib home page | ||
6 | http://zlib.net/ which may have more recent information. | ||
7 | The lastest zlib FAQ is at http://zlib.net/zlib_faq.html | ||
8 | |||
9 | |||
10 | 1. Is zlib Y2K-compliant? | ||
11 | |||
12 | Yes. zlib doesn't handle dates. | ||
13 | |||
14 | 2. Where can I get a Windows DLL version? | ||
15 | |||
16 | The zlib sources can be compiled without change to produce a DLL. See the | ||
17 | file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the | ||
18 | precompiled DLL are found in the zlib web site at http://zlib.net/ . | ||
19 | |||
20 | 3. Where can I get a Visual Basic interface to zlib? | ||
21 | |||
22 | See | ||
23 | * http://marknelson.us/1997/01/01/zlib-engine/ | ||
24 | * win32/DLL_FAQ.txt in the zlib distribution | ||
25 | |||
26 | 4. compress() returns Z_BUF_ERROR. | ||
27 | |||
28 | Make sure that before the call of compress(), the length of the compressed | ||
29 | buffer is equal to the available size of the compressed buffer and not | ||
30 | zero. For Visual Basic, check that this parameter is passed by reference | ||
31 | ("as any"), not by value ("as long"). | ||
32 | |||
33 | 5. deflate() or inflate() returns Z_BUF_ERROR. | ||
34 | |||
35 | Before making the call, make sure that avail_in and avail_out are not zero. | ||
36 | When setting the parameter flush equal to Z_FINISH, also make sure that | ||
37 | avail_out is big enough to allow processing all pending input. Note that a | ||
38 | Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be | ||
39 | made with more input or output space. A Z_BUF_ERROR may in fact be | ||
40 | unavoidable depending on how the functions are used, since it is not | ||
41 | possible to tell whether or not there is more output pending when | ||
42 | strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a | ||
43 | heavily annotated example. | ||
44 | |||
45 | 6. Where's the zlib documentation (man pages, etc.)? | ||
46 | |||
47 | It's in zlib.h . Examples of zlib usage are in the files test/example.c | ||
48 | and test/minigzip.c, with more in examples/ . | ||
49 | |||
50 | 7. Why don't you use GNU autoconf or libtool or ...? | ||
51 | |||
52 | Because we would like to keep zlib as a very small and simple package. | ||
53 | zlib is rather portable and doesn't need much configuration. | ||
54 | |||
55 | 8. I found a bug in zlib. | ||
56 | |||
57 | Most of the time, such problems are due to an incorrect usage of zlib. | ||
58 | Please try to reproduce the problem with a small program and send the | ||
59 | corresponding source to us at zlib@gzip.org . Do not send multi-megabyte | ||
60 | data files without prior agreement. | ||
61 | |||
62 | 9. Why do I get "undefined reference to gzputc"? | ||
63 | |||
64 | If "make test" produces something like | ||
65 | |||
66 | example.o(.text+0x154): undefined reference to `gzputc' | ||
67 | |||
68 | check that you don't have old files libz.* in /usr/lib, /usr/local/lib or | ||
69 | /usr/X11R6/lib. Remove any old versions, then do "make install". | ||
70 | |||
71 | 10. I need a Delphi interface to zlib. | ||
72 | |||
73 | See the contrib/delphi directory in the zlib distribution. | ||
74 | |||
75 | 11. Can zlib handle .zip archives? | ||
76 | |||
77 | Not by itself, no. See the directory contrib/minizip in the zlib | ||
78 | distribution. | ||
79 | |||
80 | 12. Can zlib handle .Z files? | ||
81 | |||
82 | No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt | ||
83 | the code of uncompress on your own. | ||
84 | |||
85 | 13. How can I make a Unix shared library? | ||
86 | |||
87 | By default a shared (and a static) library is built for Unix. So: | ||
88 | |||
89 | make distclean | ||
90 | ./configure | ||
91 | make | ||
92 | |||
93 | 14. How do I install a shared zlib library on Unix? | ||
94 | |||
95 | After the above, then: | ||
96 | |||
97 | make install | ||
98 | |||
99 | However, many flavors of Unix come with a shared zlib already installed. | ||
100 | Before going to the trouble of compiling a shared version of zlib and | ||
101 | trying to install it, you may want to check if it's already there! If you | ||
102 | can #include <zlib.h>, it's there. The -lz option will probably link to | ||
103 | it. You can check the version at the top of zlib.h or with the | ||
104 | ZLIB_VERSION symbol defined in zlib.h . | ||
105 | |||
106 | 15. I have a question about OttoPDF. | ||
107 | |||
108 | We are not the authors of OttoPDF. The real author is on the OttoPDF web | ||
109 | site: Joel Hainley, jhainley@myndkryme.com. | ||
110 | |||
111 | 16. Can zlib decode Flate data in an Adobe PDF file? | ||
112 | |||
113 | Yes. See http://www.pdflib.com/ . To modify PDF forms, see | ||
114 | http://sourceforge.net/projects/acroformtool/ . | ||
115 | |||
116 | 17. Why am I getting this "register_frame_info not found" error on Solaris? | ||
117 | |||
118 | After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib | ||
119 | generates an error such as: | ||
120 | |||
121 | ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: | ||
122 | symbol __register_frame_info: referenced symbol not found | ||
123 | |||
124 | The symbol __register_frame_info is not part of zlib, it is generated by | ||
125 | the C compiler (cc or gcc). You must recompile applications using zlib | ||
126 | which have this problem. This problem is specific to Solaris. See | ||
127 | http://www.sunfreeware.com for Solaris versions of zlib and applications | ||
128 | using zlib. | ||
129 | |||
130 | 18. Why does gzip give an error on a file I make with compress/deflate? | ||
131 | |||
132 | The compress and deflate functions produce data in the zlib format, which | ||
133 | is different and incompatible with the gzip format. The gz* functions in | ||
134 | zlib on the other hand use the gzip format. Both the zlib and gzip formats | ||
135 | use the same compressed data format internally, but have different headers | ||
136 | and trailers around the compressed data. | ||
137 | |||
138 | 19. Ok, so why are there two different formats? | ||
139 | |||
140 | The gzip format was designed to retain the directory information about a | ||
141 | single file, such as the name and last modification date. The zlib format | ||
142 | on the other hand was designed for in-memory and communication channel | ||
143 | applications, and has a much more compact header and trailer and uses a | ||
144 | faster integrity check than gzip. | ||
145 | |||
146 | 20. Well that's nice, but how do I make a gzip file in memory? | ||
147 | |||
148 | You can request that deflate write the gzip format instead of the zlib | ||
149 | format using deflateInit2(). You can also request that inflate decode the | ||
150 | gzip format using inflateInit2(). Read zlib.h for more details. | ||
151 | |||
152 | 21. Is zlib thread-safe? | ||
153 | |||
154 | Yes. However any library routines that zlib uses and any application- | ||
155 | provided memory allocation routines must also be thread-safe. zlib's gz* | ||
156 | functions use stdio library routines, and most of zlib's functions use the | ||
157 | library memory allocation routines by default. zlib's *Init* functions | ||
158 | allow for the application to provide custom memory allocation routines. | ||
159 | |||
160 | Of course, you should only operate on any given zlib or gzip stream from a | ||
161 | single thread at a time. | ||
162 | |||
163 | 22. Can I use zlib in my commercial application? | ||
164 | |||
165 | Yes. Please read the license in zlib.h. | ||
166 | |||
167 | 23. Is zlib under the GNU license? | ||
168 | |||
169 | No. Please read the license in zlib.h. | ||
170 | |||
171 | 24. The license says that altered source versions must be "plainly marked". So | ||
172 | what exactly do I need to do to meet that requirement? | ||
173 | |||
174 | You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In | ||
175 | particular, the final version number needs to be changed to "f", and an | ||
176 | identification string should be appended to ZLIB_VERSION. Version numbers | ||
177 | x.x.x.f are reserved for modifications to zlib by others than the zlib | ||
178 | maintainers. For example, if the version of the base zlib you are altering | ||
179 | is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and | ||
180 | ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also | ||
181 | update the version strings in deflate.c and inftrees.c. | ||
182 | |||
183 | For altered source distributions, you should also note the origin and | ||
184 | nature of the changes in zlib.h, as well as in ChangeLog and README, along | ||
185 | with the dates of the alterations. The origin should include at least your | ||
186 | name (or your company's name), and an email address to contact for help or | ||
187 | issues with the library. | ||
188 | |||
189 | Note that distributing a compiled zlib library along with zlib.h and | ||
190 | zconf.h is also a source distribution, and so you should change | ||
191 | ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes | ||
192 | in zlib.h as you would for a full source distribution. | ||
193 | |||
194 | 25. Will zlib work on a big-endian or little-endian architecture, and can I | ||
195 | exchange compressed data between them? | ||
196 | |||
197 | Yes and yes. | ||
198 | |||
199 | 26. Will zlib work on a 64-bit machine? | ||
200 | |||
201 | Yes. It has been tested on 64-bit machines, and has no dependence on any | ||
202 | data types being limited to 32-bits in length. If you have any | ||
203 | difficulties, please provide a complete problem report to zlib@gzip.org | ||
204 | |||
205 | 27. Will zlib decompress data from the PKWare Data Compression Library? | ||
206 | |||
207 | No. The PKWare DCL uses a completely different compressed data format than | ||
208 | does PKZIP and zlib. However, you can look in zlib's contrib/blast | ||
209 | directory for a possible solution to your problem. | ||
210 | |||
211 | 28. Can I access data randomly in a compressed stream? | ||
212 | |||
213 | No, not without some preparation. If when compressing you periodically use | ||
214 | Z_FULL_FLUSH, carefully write all the pending data at those points, and | ||
215 | keep an index of those locations, then you can start decompression at those | ||
216 | points. You have to be careful to not use Z_FULL_FLUSH too often, since it | ||
217 | can significantly degrade compression. Alternatively, you can scan a | ||
218 | deflate stream once to generate an index, and then use that index for | ||
219 | random access. See examples/zran.c . | ||
220 | |||
221 | 29. Does zlib work on MVS, OS/390, CICS, etc.? | ||
222 | |||
223 | It has in the past, but we have not heard of any recent evidence. There | ||
224 | were working ports of zlib 1.1.4 to MVS, but those links no longer work. | ||
225 | If you know of recent, successful applications of zlib on these operating | ||
226 | systems, please let us know. Thanks. | ||
227 | |||
228 | 30. Is there some simpler, easier to read version of inflate I can look at to | ||
229 | understand the deflate format? | ||
230 | |||
231 | First off, you should read RFC 1951. Second, yes. Look in zlib's | ||
232 | contrib/puff directory. | ||
233 | |||
234 | 31. Does zlib infringe on any patents? | ||
235 | |||
236 | As far as we know, no. In fact, that was originally the whole point behind | ||
237 | zlib. Look here for some more information: | ||
238 | |||
239 | http://www.gzip.org/#faq11 | ||
240 | |||
241 | 32. Can zlib work with greater than 4 GB of data? | ||
242 | |||
243 | Yes. inflate() and deflate() will process any amount of data correctly. | ||
244 | Each call of inflate() or deflate() is limited to input and output chunks | ||
245 | of the maximum value that can be stored in the compiler's "unsigned int" | ||
246 | type, but there is no limit to the number of chunks. Note however that the | ||
247 | strm.total_in and strm_total_out counters may be limited to 4 GB. These | ||
248 | counters are provided as a convenience and are not used internally by | ||
249 | inflate() or deflate(). The application can easily set up its own counters | ||
250 | updated after each call of inflate() or deflate() to count beyond 4 GB. | ||
251 | compress() and uncompress() may be limited to 4 GB, since they operate in a | ||
252 | single call. gzseek() and gztell() may be limited to 4 GB depending on how | ||
253 | zlib is compiled. See the zlibCompileFlags() function in zlib.h. | ||
254 | |||
255 | The word "may" appears several times above since there is a 4 GB limit only | ||
256 | if the compiler's "long" type is 32 bits. If the compiler's "long" type is | ||
257 | 64 bits, then the limit is 16 exabytes. | ||
258 | |||
259 | 33. Does zlib have any security vulnerabilities? | ||
260 | |||
261 | The only one that we are aware of is potentially in gzprintf(). If zlib is | ||
262 | compiled to use sprintf() or vsprintf(), then there is no protection | ||
263 | against a buffer overflow of an 8K string space (or other value as set by | ||
264 | gzbuffer()), other than the caller of gzprintf() assuring that the output | ||
265 | will not exceed 8K. On the other hand, if zlib is compiled to use | ||
266 | snprintf() or vsnprintf(), which should normally be the case, then there is | ||
267 | no vulnerability. The ./configure script will display warnings if an | ||
268 | insecure variation of sprintf() will be used by gzprintf(). Also the | ||
269 | zlibCompileFlags() function will return information on what variant of | ||
270 | sprintf() is used by gzprintf(). | ||
271 | |||
272 | If you don't have snprintf() or vsnprintf() and would like one, you can | ||
273 | find a portable implementation here: | ||
274 | |||
275 | http://www.ijs.si/software/snprintf/ | ||
276 | |||
277 | Note that you should be using the most recent version of zlib. Versions | ||
278 | 1.1.3 and before were subject to a double-free vulnerability, and versions | ||
279 | 1.2.1 and 1.2.2 were subject to an access exception when decompressing | ||
280 | invalid compressed data. | ||
281 | |||
282 | 34. Is there a Java version of zlib? | ||
283 | |||
284 | Probably what you want is to use zlib in Java. zlib is already included | ||
285 | as part of the Java SDK in the java.util.zip package. If you really want | ||
286 | a version of zlib written in the Java language, look on the zlib home | ||
287 | page for links: http://zlib.net/ . | ||
288 | |||
289 | 35. I get this or that compiler or source-code scanner warning when I crank it | ||
290 | up to maximally-pedantic. Can't you guys write proper code? | ||
291 | |||
292 | Many years ago, we gave up attempting to avoid warnings on every compiler | ||
293 | in the universe. It just got to be a waste of time, and some compilers | ||
294 | were downright silly as well as contradicted each other. So now, we simply | ||
295 | make sure that the code always works. | ||
296 | |||
297 | 36. Valgrind (or some similar memory access checker) says that deflate is | ||
298 | performing a conditional jump that depends on an uninitialized value. | ||
299 | Isn't that a bug? | ||
300 | |||
301 | No. That is intentional for performance reasons, and the output of deflate | ||
302 | is not affected. This only started showing up recently since zlib 1.2.x | ||
303 | uses malloc() by default for allocations, whereas earlier versions used | ||
304 | calloc(), which zeros out the allocated memory. Even though the code was | ||
305 | correct, versions 1.2.4 and later was changed to not stimulate these | ||
306 | checkers. | ||
307 | |||
308 | 37. Will zlib read the (insert any ancient or arcane format here) compressed | ||
309 | data format? | ||
310 | |||
311 | Probably not. Look in the comp.compression FAQ for pointers to various | ||
312 | formats and associated software. | ||
313 | |||
314 | 38. How can I encrypt/decrypt zip files with zlib? | ||
315 | |||
316 | zlib doesn't support encryption. The original PKZIP encryption is very | ||
317 | weak and can be broken with freely available programs. To get strong | ||
318 | encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib | ||
319 | compression. For PKZIP compatible "encryption", look at | ||
320 | http://www.info-zip.org/ | ||
321 | |||
322 | 39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? | ||
323 | |||
324 | "gzip" is the gzip format, and "deflate" is the zlib format. They should | ||
325 | probably have called the second one "zlib" instead to avoid confusion with | ||
326 | the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 | ||
327 | correctly points to the zlib specification in RFC 1950 for the "deflate" | ||
328 | transfer encoding, there have been reports of servers and browsers that | ||
329 | incorrectly produce or expect raw deflate data per the deflate | ||
330 | specification in RFC 1951, most notably Microsoft. So even though the | ||
331 | "deflate" transfer encoding using the zlib format would be the more | ||
332 | efficient approach (and in fact exactly what the zlib format was designed | ||
333 | for), using the "gzip" transfer encoding is probably more reliable due to | ||
334 | an unfortunate choice of name on the part of the HTTP 1.1 authors. | ||
335 | |||
336 | Bottom line: use the gzip format for HTTP 1.1 encoding. | ||
337 | |||
338 | 40. Does zlib support the new "Deflate64" format introduced by PKWare? | ||
339 | |||
340 | No. PKWare has apparently decided to keep that format proprietary, since | ||
341 | they have not documented it as they have previous compression formats. In | ||
342 | any case, the compression improvements are so modest compared to other more | ||
343 | modern approaches, that it's not worth the effort to implement. | ||
344 | |||
345 | 41. I'm having a problem with the zip functions in zlib, can you help? | ||
346 | |||
347 | There are no zip functions in zlib. You are probably using minizip by | ||
348 | Giles Vollant, which is found in the contrib directory of zlib. It is not | ||
349 | part of zlib. In fact none of the stuff in contrib is part of zlib. The | ||
350 | files in there are not supported by the zlib authors. You need to contact | ||
351 | the authors of the respective contribution for help. | ||
352 | |||
353 | 42. The match.asm code in contrib is under the GNU General Public License. | ||
354 | Since it's part of zlib, doesn't that mean that all of zlib falls under the | ||
355 | GNU GPL? | ||
356 | |||
357 | No. The files in contrib are not part of zlib. They were contributed by | ||
358 | other authors and are provided as a convenience to the user within the zlib | ||
359 | distribution. Each item in contrib has its own license. | ||
360 | |||
361 | 43. Is zlib subject to export controls? What is its ECCN? | ||
362 | |||
363 | zlib is not subject to export controls, and so is classified as EAR99. | ||
364 | |||
365 | 44. Can you please sign these lengthy legal documents and fax them back to us | ||
366 | so that we can use your software in our product? | ||
367 | |||
368 | No. Go away. Shoo. | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/INDEX b/libraries/irrlicht-1.8/source/Irrlicht/zlib/INDEX deleted file mode 100644 index 2ba0641..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/INDEX +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | CMakeLists.txt cmake build file | ||
2 | ChangeLog history of changes | ||
3 | FAQ Frequently Asked Questions about zlib | ||
4 | INDEX this file | ||
5 | Makefile dummy Makefile that tells you to ./configure | ||
6 | Makefile.in template for Unix Makefile | ||
7 | README guess what | ||
8 | configure configure script for Unix | ||
9 | make_vms.com makefile for VMS | ||
10 | test/example.c zlib usages examples for build testing | ||
11 | test/minigzip.c minimal gzip-like functionality for build testing | ||
12 | test/infcover.c inf*.c code coverage for build coverage testing | ||
13 | treebuild.xml XML description of source file dependencies | ||
14 | zconf.h.cmakein zconf.h template for cmake | ||
15 | zconf.h.in zconf.h template for configure | ||
16 | zlib.3 Man page for zlib | ||
17 | zlib.3.pdf Man page in PDF format | ||
18 | zlib.map Linux symbol information | ||
19 | zlib.pc.in Template for pkg-config descriptor | ||
20 | zlib.pc.cmakein zlib.pc template for cmake | ||
21 | zlib2ansi perl script to convert source files for C++ compilation | ||
22 | |||
23 | amiga/ makefiles for Amiga SAS C | ||
24 | as400/ makefiles for AS/400 | ||
25 | doc/ documentation for formats and algorithms | ||
26 | msdos/ makefiles for MSDOS | ||
27 | nintendods/ makefile for Nintendo DS | ||
28 | old/ makefiles for various architectures and zlib documentation | ||
29 | files that have not yet been updated for zlib 1.2.x | ||
30 | qnx/ makefiles for QNX | ||
31 | watcom/ makefiles for OpenWatcom | ||
32 | win32/ makefiles for Windows | ||
33 | |||
34 | zlib public header files (required for library use): | ||
35 | zconf.h | ||
36 | zlib.h | ||
37 | |||
38 | private source files used to build the zlib library: | ||
39 | adler32.c | ||
40 | compress.c | ||
41 | crc32.c | ||
42 | crc32.h | ||
43 | deflate.c | ||
44 | deflate.h | ||
45 | gzclose.c | ||
46 | gzguts.h | ||
47 | gzlib.c | ||
48 | gzread.c | ||
49 | gzwrite.c | ||
50 | infback.c | ||
51 | inffast.c | ||
52 | inffast.h | ||
53 | inffixed.h | ||
54 | inflate.c | ||
55 | inflate.h | ||
56 | inftrees.c | ||
57 | inftrees.h | ||
58 | trees.c | ||
59 | trees.h | ||
60 | uncompr.c | ||
61 | zutil.c | ||
62 | zutil.h | ||
63 | |||
64 | source files for sample programs | ||
65 | See examples/README.examples | ||
66 | |||
67 | unsupported contributions by third parties | ||
68 | See contrib/README.contrib | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile b/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile deleted file mode 100644 index 6bba86c..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | all: | ||
2 | -@echo "Please use ./configure first. Thank you." | ||
3 | |||
4 | distclean: | ||
5 | make -f Makefile.in distclean | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile.in b/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile.in deleted file mode 100644 index 241deed..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/Makefile.in +++ /dev/null | |||
@@ -1,288 +0,0 @@ | |||
1 | # Makefile for zlib | ||
2 | # Copyright (C) 1995-2011 Jean-loup Gailly. | ||
3 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | |||
5 | # To compile and test, type: | ||
6 | # ./configure; make test | ||
7 | # Normally configure builds both a static and a shared library. | ||
8 | # If you want to build just a static library, use: ./configure --static | ||
9 | |||
10 | # To use the asm code, type: | ||
11 | # cp contrib/asm?86/match.S ./match.S | ||
12 | # make LOC=-DASMV OBJA=match.o | ||
13 | |||
14 | # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: | ||
15 | # make install | ||
16 | # To install in $HOME instead of /usr/local, use: | ||
17 | # make install prefix=$HOME | ||
18 | |||
19 | CC=cc | ||
20 | |||
21 | CFLAGS=-O | ||
22 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
23 | #CFLAGS=-g -DDEBUG | ||
24 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
25 | # -Wstrict-prototypes -Wmissing-prototypes | ||
26 | |||
27 | SFLAGS=-O | ||
28 | LDFLAGS= | ||
29 | TEST_LDFLAGS=-L. libz.a | ||
30 | LDSHARED=$(CC) | ||
31 | CPP=$(CC) -E | ||
32 | |||
33 | STATICLIB=libz.a | ||
34 | SHAREDLIB=libz.so | ||
35 | SHAREDLIBV=libz.so.1.2.7 | ||
36 | SHAREDLIBM=libz.so.1 | ||
37 | LIBS=$(STATICLIB) $(SHAREDLIBV) | ||
38 | |||
39 | AR=ar | ||
40 | ARFLAGS=rc | ||
41 | RANLIB=ranlib | ||
42 | LDCONFIG=ldconfig | ||
43 | LDSHAREDLIBC=-lc | ||
44 | TAR=tar | ||
45 | SHELL=/bin/sh | ||
46 | EXE= | ||
47 | |||
48 | prefix = /usr/local | ||
49 | exec_prefix = ${prefix} | ||
50 | libdir = ${exec_prefix}/lib | ||
51 | sharedlibdir = ${libdir} | ||
52 | includedir = ${prefix}/include | ||
53 | mandir = ${prefix}/share/man | ||
54 | man3dir = ${mandir}/man3 | ||
55 | pkgconfigdir = ${libdir}/pkgconfig | ||
56 | |||
57 | OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o | ||
58 | OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o | ||
59 | OBJC = $(OBJZ) $(OBJG) | ||
60 | |||
61 | PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo | ||
62 | PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo | ||
63 | PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) | ||
64 | |||
65 | # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo | ||
66 | OBJA = | ||
67 | PIC_OBJA = | ||
68 | |||
69 | OBJS = $(OBJC) $(OBJA) | ||
70 | |||
71 | PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) | ||
72 | |||
73 | all: static shared | ||
74 | |||
75 | static: example$(EXE) minigzip$(EXE) | ||
76 | |||
77 | shared: examplesh$(EXE) minigzipsh$(EXE) | ||
78 | |||
79 | all64: example64$(EXE) minigzip64$(EXE) | ||
80 | |||
81 | check: test | ||
82 | |||
83 | test: all teststatic testshared | ||
84 | |||
85 | teststatic: static | ||
86 | @TMPST=`mktemp fooXXXXXX`; \ | ||
87 | if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ | ||
88 | echo ' *** zlib test OK ***'; \ | ||
89 | else \ | ||
90 | echo ' *** zlib test FAILED ***'; false; \ | ||
91 | fi; \ | ||
92 | rm -f $$TMPST | ||
93 | |||
94 | testshared: shared | ||
95 | @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||
96 | LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ | ||
97 | DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ | ||
98 | SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ | ||
99 | TMPSH=`mktemp fooXXXXXX`; \ | ||
100 | if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ | ||
101 | echo ' *** zlib shared test OK ***'; \ | ||
102 | else \ | ||
103 | echo ' *** zlib shared test FAILED ***'; false; \ | ||
104 | fi; \ | ||
105 | rm -f $$TMPSH | ||
106 | |||
107 | test64: all64 | ||
108 | @TMP64=`mktemp fooXXXXXX`; \ | ||
109 | if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ | ||
110 | echo ' *** zlib 64-bit test OK ***'; \ | ||
111 | else \ | ||
112 | echo ' *** zlib 64-bit test FAILED ***'; false; \ | ||
113 | fi; \ | ||
114 | rm -f $$TMP64 | ||
115 | |||
116 | infcover.o: test/infcover.c zlib.h zconf.h | ||
117 | $(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c | ||
118 | |||
119 | infcover: infcover.o libz.a | ||
120 | $(CC) $(CFLAGS) -o $@ infcover.o libz.a | ||
121 | |||
122 | cover: infcover | ||
123 | rm -f *.gcda | ||
124 | ./infcover | ||
125 | gcov inf*.c | ||
126 | |||
127 | libz.a: $(OBJS) | ||
128 | $(AR) $(ARFLAGS) $@ $(OBJS) | ||
129 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | ||
130 | |||
131 | match.o: match.S | ||
132 | $(CPP) match.S > _match.s | ||
133 | $(CC) -c _match.s | ||
134 | mv _match.o match.o | ||
135 | rm -f _match.s | ||
136 | |||
137 | match.lo: match.S | ||
138 | $(CPP) match.S > _match.s | ||
139 | $(CC) -c -fPIC _match.s | ||
140 | mv _match.o match.lo | ||
141 | rm -f _match.s | ||
142 | |||
143 | example.o: test/example.c zlib.h zconf.h | ||
144 | $(CC) $(CFLAGS) -I. -c -o $@ test/example.c | ||
145 | |||
146 | minigzip.o: test/minigzip.c zlib.h zconf.h | ||
147 | $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c | ||
148 | |||
149 | example64.o: test/example.c zlib.h zconf.h | ||
150 | $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c | ||
151 | |||
152 | minigzip64.o: test/minigzip.c zlib.h zconf.h | ||
153 | $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c | ||
154 | |||
155 | .SUFFIXES: .lo | ||
156 | |||
157 | .c.lo: | ||
158 | -@mkdir objs 2>/dev/null || test -d objs | ||
159 | $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $< | ||
160 | -@mv objs/$*.o $@ | ||
161 | |||
162 | placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a | ||
163 | $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) | ||
164 | rm -f $(SHAREDLIB) $(SHAREDLIBM) | ||
165 | ln -s $@ $(SHAREDLIB) | ||
166 | ln -s $@ $(SHAREDLIBM) | ||
167 | -@rmdir objs | ||
168 | |||
169 | example$(EXE): example.o $(STATICLIB) | ||
170 | $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) | ||
171 | |||
172 | minigzip$(EXE): minigzip.o $(STATICLIB) | ||
173 | $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) | ||
174 | |||
175 | examplesh$(EXE): example.o $(SHAREDLIBV) | ||
176 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) | ||
177 | |||
178 | minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) | ||
179 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) | ||
180 | |||
181 | example64$(EXE): example64.o $(STATICLIB) | ||
182 | $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) | ||
183 | |||
184 | minigzip64$(EXE): minigzip64.o $(STATICLIB) | ||
185 | $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) | ||
186 | |||
187 | install-libs: $(LIBS) | ||
188 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi | ||
189 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi | ||
190 | -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi | ||
191 | -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi | ||
192 | -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi | ||
193 | cp $(STATICLIB) $(DESTDIR)$(libdir) | ||
194 | chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB) | ||
195 | -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1 | ||
196 | -@if test -n "$(SHAREDLIBV)"; then \ | ||
197 | cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \ | ||
198 | echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \ | ||
199 | chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ | ||
200 | echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \ | ||
201 | rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ | ||
202 | ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \ | ||
203 | ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ | ||
204 | ($(LDCONFIG) || true) >/dev/null 2>&1; \ | ||
205 | fi | ||
206 | cp zlib.3 $(DESTDIR)$(man3dir) | ||
207 | chmod 644 $(DESTDIR)$(man3dir)/zlib.3 | ||
208 | cp zlib.pc $(DESTDIR)$(pkgconfigdir) | ||
209 | chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc | ||
210 | # The ranlib in install is needed on NeXTSTEP which checks file times | ||
211 | # ldconfig is for Linux | ||
212 | |||
213 | install: install-libs | ||
214 | -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi | ||
215 | cp zlib.h zconf.h $(DESTDIR)$(includedir) | ||
216 | chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h | ||
217 | |||
218 | uninstall: | ||
219 | cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h | ||
220 | cd $(DESTDIR)$(libdir); rm -f libz.a; \ | ||
221 | if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ | ||
222 | rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ | ||
223 | fi | ||
224 | cd $(DESTDIR)$(man3dir); rm -f zlib.3 | ||
225 | cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc | ||
226 | |||
227 | docs: zlib.3.pdf | ||
228 | |||
229 | zlib.3.pdf: zlib.3 | ||
230 | groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf | ||
231 | |||
232 | zconf.h.cmakein: zconf.h.in | ||
233 | -@ TEMPFILE=`mktemp __XXXXXX`; \ | ||
234 | echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ | ||
235 | sed -f $$TEMPFILE zconf.h.in > zconf.h.cmakein &&\ | ||
236 | touch -r zconf.h.in zconf.h.cmakein &&\ | ||
237 | rm $$TEMPFILE | ||
238 | |||
239 | zconf: zconf.h.in | ||
240 | cp -p zconf.h.in zconf.h | ||
241 | |||
242 | mostlyclean: clean | ||
243 | clean: | ||
244 | rm -f *.o *.lo *~ \ | ||
245 | example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ | ||
246 | example64$(EXE) minigzip64$(EXE) \ | ||
247 | infcover \ | ||
248 | libz.* foo.gz so_locations \ | ||
249 | _match.s maketree contrib/infback9/*.o | ||
250 | rm -rf objs | ||
251 | rm -f *.gcda *.gcno *.gcov | ||
252 | rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov | ||
253 | |||
254 | maintainer-clean: distclean | ||
255 | distclean: clean zconf zconf.h.cmakein docs | ||
256 | rm -f Makefile zlib.pc configure.log | ||
257 | -@rm -f .DS_Store | ||
258 | -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile | ||
259 | -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile | ||
260 | -@touch -r Makefile.in Makefile | ||
261 | |||
262 | tags: | ||
263 | etags *.[ch] | ||
264 | |||
265 | depend: | ||
266 | makedepend -- $(CFLAGS) -- *.[ch] | ||
267 | |||
268 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
269 | |||
270 | adler32.o zutil.o: zutil.h zlib.h zconf.h | ||
271 | gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h | ||
272 | compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h | ||
273 | crc32.o: zutil.h zlib.h zconf.h crc32.h | ||
274 | deflate.o: deflate.h zutil.h zlib.h zconf.h | ||
275 | infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h | ||
276 | inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | ||
277 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h | ||
278 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | ||
279 | |||
280 | adler32.lo zutil.lo: zutil.h zlib.h zconf.h | ||
281 | gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h | ||
282 | compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h | ||
283 | crc32.lo: zutil.h zlib.h zconf.h crc32.h | ||
284 | deflate.lo: deflate.h zutil.h zlib.h zconf.h | ||
285 | infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h | ||
286 | inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | ||
287 | inftrees.lo: zutil.h zlib.h zconf.h inftrees.h | ||
288 | trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/README b/libraries/irrlicht-1.8/source/Irrlicht/zlib/README deleted file mode 100644 index 6f1255f..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/README +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | ZLIB DATA COMPRESSION LIBRARY | ||
2 | |||
3 | zlib 1.2.7 is a general purpose data compression library. All the code is | ||
4 | thread safe. The data format used by the zlib library is described by RFCs | ||
5 | (Request for Comments) 1950 to 1952 in the files | ||
6 | http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and | ||
7 | rfc1952 (gzip format). | ||
8 | |||
9 | All functions of the compression library are documented in the file zlib.h | ||
10 | (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example | ||
11 | of the library is given in the file test/example.c which also tests that | ||
12 | the library is working correctly. Another example is given in the file | ||
13 | test/minigzip.c. The compression library itself is composed of all source | ||
14 | files in the root directory. | ||
15 | |||
16 | To compile all files and run the test program, follow the instructions given at | ||
17 | the top of Makefile.in. In short "./configure; make test", and if that goes | ||
18 | well, "make install" should work for most flavors of Unix. For Windows, use | ||
19 | one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use | ||
20 | make_vms.com. | ||
21 | |||
22 | Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant | ||
23 | <info@winimage.com> for the Windows DLL version. The zlib home page is | ||
24 | http://zlib.net/ . Before reporting a problem, please check this site to | ||
25 | verify that you have the latest version of zlib; otherwise get the latest | ||
26 | version and check whether the problem still exists or not. | ||
27 | |||
28 | PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. | ||
29 | |||
30 | Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 | ||
31 | issue of Dr. Dobb's Journal; a copy of the article is available at | ||
32 | http://marknelson.us/1997/01/01/zlib-engine/ . | ||
33 | |||
34 | The changes made in version 1.2.7 are documented in the file ChangeLog. | ||
35 | |||
36 | Unsupported third party contributions are provided in directory contrib/ . | ||
37 | |||
38 | zlib is available in Java using the java.util.zip package, documented at | ||
39 | http://java.sun.com/developer/technicalArticles/Programming/compression/ . | ||
40 | |||
41 | A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available | ||
42 | at CPAN (Comprehensive Perl Archive Network) sites, including | ||
43 | http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . | ||
44 | |||
45 | A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is | ||
46 | available in Python 1.5 and later versions, see | ||
47 | http://docs.python.org/library/zlib.html . | ||
48 | |||
49 | zlib is built into tcl: http://wiki.tcl.tk/4610 . | ||
50 | |||
51 | An experimental package to read and write files in .zip format, written on top | ||
52 | of zlib by Gilles Vollant <info@winimage.com>, is available in the | ||
53 | contrib/minizip directory of zlib. | ||
54 | |||
55 | |||
56 | Notes for some targets: | ||
57 | |||
58 | - For Windows DLL versions, please see win32/DLL_FAQ.txt | ||
59 | |||
60 | - For 64-bit Irix, deflate.c must be compiled without any optimization. With | ||
61 | -O, one libpng test fails. The test works in 32 bit mode (with the -n32 | ||
62 | compiler flag). The compiler bug has been reported to SGI. | ||
63 | |||
64 | - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works | ||
65 | when compiled with cc. | ||
66 | |||
67 | - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is | ||
68 | necessary to get gzprintf working correctly. This is done by configure. | ||
69 | |||
70 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with | ||
71 | other compilers. Use "make test" to check your compiler. | ||
72 | |||
73 | - gzdopen is not supported on RISCOS or BEOS. | ||
74 | |||
75 | - For PalmOs, see http://palmzlib.sourceforge.net/ | ||
76 | |||
77 | |||
78 | Acknowledgments: | ||
79 | |||
80 | The deflate format used by zlib was defined by Phil Katz. The deflate and | ||
81 | zlib specifications were written by L. Peter Deutsch. Thanks to all the | ||
82 | people who reported problems and suggested various improvements in zlib; they | ||
83 | are too numerous to cite here. | ||
84 | |||
85 | Copyright notice: | ||
86 | |||
87 | (C) 1995-2012 Jean-loup Gailly and Mark Adler | ||
88 | |||
89 | This software is provided 'as-is', without any express or implied | ||
90 | warranty. In no event will the authors be held liable for any damages | ||
91 | arising from the use of this software. | ||
92 | |||
93 | Permission is granted to anyone to use this software for any purpose, | ||
94 | including commercial applications, and to alter it and redistribute it | ||
95 | freely, subject to the following restrictions: | ||
96 | |||
97 | 1. The origin of this software must not be misrepresented; you must not | ||
98 | claim that you wrote the original software. If you use this software | ||
99 | in a product, an acknowledgment in the product documentation would be | ||
100 | appreciated but is not required. | ||
101 | 2. Altered source versions must be plainly marked as such, and must not be | ||
102 | misrepresented as being the original software. | ||
103 | 3. This notice may not be removed or altered from any source distribution. | ||
104 | |||
105 | Jean-loup Gailly Mark Adler | ||
106 | jloup@gzip.org madler@alumni.caltech.edu | ||
107 | |||
108 | If you use the zlib library in a product, we would appreciate *not* receiving | ||
109 | lengthy legal documents to sign. The sources are provided for free but without | ||
110 | warranty of any kind. The library has been entirely written by Jean-loup | ||
111 | Gailly and Mark Adler; it does not include third-party code. | ||
112 | |||
113 | If you redistribute modified sources, we would appreciate that you include in | ||
114 | the file ChangeLog history information documenting your changes. Please read | ||
115 | the FAQ for more information on the distribution of modified source versions. | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/adler32.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/adler32.c deleted file mode 100644 index a868f07..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/adler32.c +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | /* adler32.c -- compute the Adler-32 checksum of a data stream | ||
2 | * Copyright (C) 1995-2011 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #include "zutil.h" | ||
9 | |||
10 | #define local static | ||
11 | |||
12 | local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); | ||
13 | |||
14 | #define BASE 65521 /* largest prime smaller than 65536 */ | ||
15 | #define NMAX 5552 | ||
16 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ | ||
17 | |||
18 | #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} | ||
19 | #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); | ||
20 | #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); | ||
21 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); | ||
22 | #define DO16(buf) DO8(buf,0); DO8(buf,8); | ||
23 | |||
24 | /* use NO_DIVIDE if your processor does not do division in hardware -- | ||
25 | try it both ways to see which is faster */ | ||
26 | #ifdef NO_DIVIDE | ||
27 | /* note that this assumes BASE is 65521, where 65536 % 65521 == 15 | ||
28 | (thank you to John Reiser for pointing this out) */ | ||
29 | # define CHOP(a) \ | ||
30 | do { \ | ||
31 | unsigned long tmp = a >> 16; \ | ||
32 | a &= 0xffffUL; \ | ||
33 | a += (tmp << 4) - tmp; \ | ||
34 | } while (0) | ||
35 | # define MOD28(a) \ | ||
36 | do { \ | ||
37 | CHOP(a); \ | ||
38 | if (a >= BASE) a -= BASE; \ | ||
39 | } while (0) | ||
40 | # define MOD(a) \ | ||
41 | do { \ | ||
42 | CHOP(a); \ | ||
43 | MOD28(a); \ | ||
44 | } while (0) | ||
45 | # define MOD63(a) \ | ||
46 | do { /* this assumes a is not negative */ \ | ||
47 | z_off64_t tmp = a >> 32; \ | ||
48 | a &= 0xffffffffL; \ | ||
49 | a += (tmp << 8) - (tmp << 5) + tmp; \ | ||
50 | tmp = a >> 16; \ | ||
51 | a &= 0xffffL; \ | ||
52 | a += (tmp << 4) - tmp; \ | ||
53 | tmp = a >> 16; \ | ||
54 | a &= 0xffffL; \ | ||
55 | a += (tmp << 4) - tmp; \ | ||
56 | if (a >= BASE) a -= BASE; \ | ||
57 | } while (0) | ||
58 | #else | ||
59 | # define MOD(a) a %= BASE | ||
60 | # define MOD28(a) a %= BASE | ||
61 | # define MOD63(a) a %= BASE | ||
62 | #endif | ||
63 | |||
64 | /* ========================================================================= */ | ||
65 | uLong ZEXPORT adler32(adler, buf, len) | ||
66 | uLong adler; | ||
67 | const Bytef *buf; | ||
68 | uInt len; | ||
69 | { | ||
70 | unsigned long sum2; | ||
71 | unsigned n; | ||
72 | |||
73 | /* split Adler-32 into component sums */ | ||
74 | sum2 = (adler >> 16) & 0xffff; | ||
75 | adler &= 0xffff; | ||
76 | |||
77 | /* in case user likes doing a byte at a time, keep it fast */ | ||
78 | if (len == 1) { | ||
79 | adler += buf[0]; | ||
80 | if (adler >= BASE) | ||
81 | adler -= BASE; | ||
82 | sum2 += adler; | ||
83 | if (sum2 >= BASE) | ||
84 | sum2 -= BASE; | ||
85 | return adler | (sum2 << 16); | ||
86 | } | ||
87 | |||
88 | /* initial Adler-32 value (deferred check for len == 1 speed) */ | ||
89 | if (buf == Z_NULL) | ||
90 | return 1L; | ||
91 | |||
92 | /* in case short lengths are provided, keep it somewhat fast */ | ||
93 | if (len < 16) { | ||
94 | while (len--) { | ||
95 | adler += *buf++; | ||
96 | sum2 += adler; | ||
97 | } | ||
98 | if (adler >= BASE) | ||
99 | adler -= BASE; | ||
100 | MOD28(sum2); /* only added so many BASE's */ | ||
101 | return adler | (sum2 << 16); | ||
102 | } | ||
103 | |||
104 | /* do length NMAX blocks -- requires just one modulo operation */ | ||
105 | while (len >= NMAX) { | ||
106 | len -= NMAX; | ||
107 | n = NMAX / 16; /* NMAX is divisible by 16 */ | ||
108 | do { | ||
109 | DO16(buf); /* 16 sums unrolled */ | ||
110 | buf += 16; | ||
111 | } while (--n); | ||
112 | MOD(adler); | ||
113 | MOD(sum2); | ||
114 | } | ||
115 | |||
116 | /* do remaining bytes (less than NMAX, still just one modulo) */ | ||
117 | if (len) { /* avoid modulos if none remaining */ | ||
118 | while (len >= 16) { | ||
119 | len -= 16; | ||
120 | DO16(buf); | ||
121 | buf += 16; | ||
122 | } | ||
123 | while (len--) { | ||
124 | adler += *buf++; | ||
125 | sum2 += adler; | ||
126 | } | ||
127 | MOD(adler); | ||
128 | MOD(sum2); | ||
129 | } | ||
130 | |||
131 | /* return recombined sums */ | ||
132 | return adler | (sum2 << 16); | ||
133 | } | ||
134 | |||
135 | /* ========================================================================= */ | ||
136 | local uLong adler32_combine_(adler1, adler2, len2) | ||
137 | uLong adler1; | ||
138 | uLong adler2; | ||
139 | z_off64_t len2; | ||
140 | { | ||
141 | unsigned long sum1; | ||
142 | unsigned long sum2; | ||
143 | unsigned rem; | ||
144 | |||
145 | /* for negative len, return invalid adler32 as a clue for debugging */ | ||
146 | if (len2 < 0) | ||
147 | return 0xffffffffUL; | ||
148 | |||
149 | /* the derivation of this formula is left as an exercise for the reader */ | ||
150 | MOD63(len2); /* assumes len2 >= 0 */ | ||
151 | rem = (unsigned)len2; | ||
152 | sum1 = adler1 & 0xffff; | ||
153 | sum2 = rem * sum1; | ||
154 | MOD(sum2); | ||
155 | sum1 += (adler2 & 0xffff) + BASE - 1; | ||
156 | sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; | ||
157 | if (sum1 >= BASE) sum1 -= BASE; | ||
158 | if (sum1 >= BASE) sum1 -= BASE; | ||
159 | if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); | ||
160 | if (sum2 >= BASE) sum2 -= BASE; | ||
161 | return sum1 | (sum2 << 16); | ||
162 | } | ||
163 | |||
164 | /* ========================================================================= */ | ||
165 | uLong ZEXPORT adler32_combine(adler1, adler2, len2) | ||
166 | uLong adler1; | ||
167 | uLong adler2; | ||
168 | z_off_t len2; | ||
169 | { | ||
170 | return adler32_combine_(adler1, adler2, len2); | ||
171 | } | ||
172 | |||
173 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2) | ||
174 | uLong adler1; | ||
175 | uLong adler2; | ||
176 | z_off64_t len2; | ||
177 | { | ||
178 | return adler32_combine_(adler1, adler2, len2); | ||
179 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/compress.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/compress.c deleted file mode 100644 index ea4dfbe..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/compress.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* compress.c -- compress a memory buffer | ||
2 | * Copyright (C) 1995-2005 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #define ZLIB_INTERNAL | ||
9 | #include "zlib.h" | ||
10 | |||
11 | /* =========================================================================== | ||
12 | Compresses the source buffer into the destination buffer. The level | ||
13 | parameter has the same meaning as in deflateInit. sourceLen is the byte | ||
14 | length of the source buffer. Upon entry, destLen is the total size of the | ||
15 | destination buffer, which must be at least 0.1% larger than sourceLen plus | ||
16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. | ||
17 | |||
18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, | ||
20 | Z_STREAM_ERROR if the level parameter is invalid. | ||
21 | */ | ||
22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) | ||
23 | Bytef *dest; | ||
24 | uLongf *destLen; | ||
25 | const Bytef *source; | ||
26 | uLong sourceLen; | ||
27 | int level; | ||
28 | { | ||
29 | z_stream stream; | ||
30 | int err; | ||
31 | |||
32 | stream.next_in = (Bytef*)source; | ||
33 | stream.avail_in = (uInt)sourceLen; | ||
34 | #ifdef MAXSEG_64K | ||
35 | /* Check for source > 64K on 16-bit machine: */ | ||
36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; | ||
37 | #endif | ||
38 | stream.next_out = dest; | ||
39 | stream.avail_out = (uInt)*destLen; | ||
40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; | ||
41 | |||
42 | stream.zalloc = (alloc_func)0; | ||
43 | stream.zfree = (free_func)0; | ||
44 | stream.opaque = (voidpf)0; | ||
45 | |||
46 | err = deflateInit(&stream, level); | ||
47 | if (err != Z_OK) return err; | ||
48 | |||
49 | err = deflate(&stream, Z_FINISH); | ||
50 | if (err != Z_STREAM_END) { | ||
51 | deflateEnd(&stream); | ||
52 | return err == Z_OK ? Z_BUF_ERROR : err; | ||
53 | } | ||
54 | *destLen = stream.total_out; | ||
55 | |||
56 | err = deflateEnd(&stream); | ||
57 | return err; | ||
58 | } | ||
59 | |||
60 | /* =========================================================================== | ||
61 | */ | ||
62 | int ZEXPORT compress (dest, destLen, source, sourceLen) | ||
63 | Bytef *dest; | ||
64 | uLongf *destLen; | ||
65 | const Bytef *source; | ||
66 | uLong sourceLen; | ||
67 | { | ||
68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); | ||
69 | } | ||
70 | |||
71 | /* =========================================================================== | ||
72 | If the default memLevel or windowBits for deflateInit() is changed, then | ||
73 | this function needs to be updated. | ||
74 | */ | ||
75 | uLong ZEXPORT compressBound (sourceLen) | ||
76 | uLong sourceLen; | ||
77 | { | ||
78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + | ||
79 | (sourceLen >> 25) + 13; | ||
80 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/configure b/libraries/irrlicht-1.8/source/Irrlicht/zlib/configure deleted file mode 100644 index 36c7d8e..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/configure +++ /dev/null | |||
@@ -1,818 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # configure script for zlib. | ||
3 | # | ||
4 | # Normally configure builds both a static and a shared library. | ||
5 | # If you want to build just a static library, use: ./configure --static | ||
6 | # | ||
7 | # To impose specific compiler or flags or install directory, use for example: | ||
8 | # prefix=$HOME CC=cc CFLAGS="-O4" ./configure | ||
9 | # or for csh/tcsh users: | ||
10 | # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) | ||
11 | |||
12 | # Incorrect settings of CC or CFLAGS may prevent creating a shared library. | ||
13 | # If you have problems, try without defining CC and CFLAGS before reporting | ||
14 | # an error. | ||
15 | |||
16 | # start off configure.log | ||
17 | echo -------------------- >> configure.log | ||
18 | echo $0 $* >> configure.log | ||
19 | date >> configure.log | ||
20 | |||
21 | # set command prefix for cross-compilation | ||
22 | if [ -n "${CHOST}" ]; then | ||
23 | uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" | ||
24 | CROSS_PREFIX="${CHOST}-" | ||
25 | fi | ||
26 | |||
27 | # destination name for static library | ||
28 | STATICLIB=libz.a | ||
29 | |||
30 | # extract zlib version numbers from zlib.h | ||
31 | VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | ||
32 | VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h` | ||
33 | VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` | ||
34 | VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` | ||
35 | |||
36 | # establish commands for library building | ||
37 | if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then | ||
38 | AR=${AR-"${CROSS_PREFIX}ar"} | ||
39 | test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log | ||
40 | else | ||
41 | AR=${AR-"ar"} | ||
42 | test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log | ||
43 | fi | ||
44 | ARFLAGS=${ARFLAGS-"rc"} | ||
45 | if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then | ||
46 | RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} | ||
47 | test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log | ||
48 | else | ||
49 | RANLIB=${RANLIB-"ranlib"} | ||
50 | fi | ||
51 | if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then | ||
52 | NM=${NM-"${CROSS_PREFIX}nm"} | ||
53 | test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log | ||
54 | else | ||
55 | NM=${NM-"nm"} | ||
56 | fi | ||
57 | |||
58 | # set defaults before processing command line options | ||
59 | LDCONFIG=${LDCONFIG-"ldconfig"} | ||
60 | LDSHAREDLIBC="${LDSHAREDLIBC--lc}" | ||
61 | ARCHS= | ||
62 | prefix=${prefix-/usr/local} | ||
63 | exec_prefix=${exec_prefix-'${prefix}'} | ||
64 | libdir=${libdir-'${exec_prefix}/lib'} | ||
65 | sharedlibdir=${sharedlibdir-'${libdir}'} | ||
66 | includedir=${includedir-'${prefix}/include'} | ||
67 | mandir=${mandir-'${prefix}/share/man'} | ||
68 | shared_ext='.so' | ||
69 | shared=1 | ||
70 | solo=0 | ||
71 | cover=0 | ||
72 | zprefix=0 | ||
73 | build64=0 | ||
74 | gcc=0 | ||
75 | old_cc="$CC" | ||
76 | old_cflags="$CFLAGS" | ||
77 | OBJC='$(OBJZ) $(OBJG)' | ||
78 | PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' | ||
79 | |||
80 | # process command line options | ||
81 | while test $# -ge 1 | ||
82 | do | ||
83 | case "$1" in | ||
84 | -h* | --help) | ||
85 | echo 'usage:' | tee -a configure.log | ||
86 | echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log | ||
87 | echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log | ||
88 | echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log | ||
89 | exit 0 ;; | ||
90 | -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; | ||
91 | -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; | ||
92 | -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; | ||
93 | --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; | ||
94 | -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; | ||
95 | -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; | ||
96 | -p* | --prefix) prefix="$2"; shift; shift ;; | ||
97 | -e* | --eprefix) exec_prefix="$2"; shift; shift ;; | ||
98 | -l* | --libdir) libdir="$2"; shift; shift ;; | ||
99 | -i* | --includedir) includedir="$2"; shift; shift ;; | ||
100 | -s* | --shared | --enable-shared) shared=1; shift ;; | ||
101 | -t | --static) shared=0; shift ;; | ||
102 | --solo) solo=1; shift ;; | ||
103 | --cover) cover=1; shift ;; | ||
104 | -z* | --zprefix) zprefix=1; shift ;; | ||
105 | -6* | --64) build64=1; shift ;; | ||
106 | -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; | ||
107 | --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; | ||
108 | --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; | ||
109 | *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a configure.log; exit 1 ;; | ||
110 | esac | ||
111 | done | ||
112 | |||
113 | # define functions for testing compiler and library characteristics and logging the results | ||
114 | test=ztest$$ | ||
115 | |||
116 | show() | ||
117 | { | ||
118 | case "$*" in | ||
119 | *$test.c*) | ||
120 | echo === $test.c === >> configure.log | ||
121 | cat $test.c >> configure.log | ||
122 | echo === >> configure.log;; | ||
123 | esac | ||
124 | echo $* >> configure.log | ||
125 | } | ||
126 | |||
127 | cat > $test.c <<EOF | ||
128 | #error error | ||
129 | EOF | ||
130 | if ($CC -c $CFLAGS $test.c) 2>/dev/null; then | ||
131 | try() | ||
132 | { | ||
133 | show $* | ||
134 | test "`( $* ) 2>&1 | tee -a configure.log`" = "" | ||
135 | } | ||
136 | echo - using any output from compiler to indicate an error >> configure.log | ||
137 | else | ||
138 | try() | ||
139 | { | ||
140 | show $* | ||
141 | ( $* ) >> configure.log 2>&1 | ||
142 | ret=$? | ||
143 | if test $ret -ne 0; then | ||
144 | echo "(exit code "$ret")" >> configure.log | ||
145 | fi | ||
146 | return $ret | ||
147 | } | ||
148 | fi | ||
149 | |||
150 | tryboth() | ||
151 | { | ||
152 | show $* | ||
153 | got=`( $* ) 2>&1` | ||
154 | ret=$? | ||
155 | printf %s "$got" >> configure.log | ||
156 | if test $ret -ne 0; then | ||
157 | return $ret | ||
158 | fi | ||
159 | test "$got" = "" | ||
160 | } | ||
161 | |||
162 | echo >> configure.log | ||
163 | |||
164 | # check for gcc vs. cc and set compile and link flags based on the system identified by uname | ||
165 | cat > $test.c <<EOF | ||
166 | extern int getchar(); | ||
167 | int hello() {return getchar();} | ||
168 | EOF | ||
169 | |||
170 | test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log | ||
171 | cc=${CC-${CROSS_PREFIX}gcc} | ||
172 | cflags=${CFLAGS-"-O3"} | ||
173 | # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure | ||
174 | case "$cc" in | ||
175 | *gcc*) gcc=1 ;; | ||
176 | *clang*) gcc=1 ;; | ||
177 | esac | ||
178 | case `$cc -v 2>&1` in | ||
179 | *gcc*) gcc=1 ;; | ||
180 | esac | ||
181 | |||
182 | show $cc -c $cflags $test.c | ||
183 | if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then | ||
184 | echo ... using gcc >> configure.log | ||
185 | CC="$cc" | ||
186 | CFLAGS="${CFLAGS--O3} ${ARCHS}" | ||
187 | SFLAGS="${CFLAGS--O3} -fPIC" | ||
188 | LDFLAGS="${LDFLAGS} ${ARCHS}" | ||
189 | if test $build64 -eq 1; then | ||
190 | CFLAGS="${CFLAGS} -m64" | ||
191 | SFLAGS="${SFLAGS} -m64" | ||
192 | fi | ||
193 | if test "${ZLIBGCCWARN}" = "YES"; then | ||
194 | CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" | ||
195 | fi | ||
196 | if test -z "$uname"; then | ||
197 | uname=`(uname -s || echo unknown) 2>/dev/null` | ||
198 | fi | ||
199 | case "$uname" in | ||
200 | Linux* | linux* | GNU | GNU/* | solaris*) | ||
201 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;; | ||
202 | *BSD | *bsd* | DragonFly) | ||
203 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} | ||
204 | LDCONFIG="ldconfig -m" ;; | ||
205 | CYGWIN* | Cygwin* | cygwin* | OS/2*) | ||
206 | EXE='.exe' ;; | ||
207 | MINGW* | mingw*) | ||
208 | # temporary bypass | ||
209 | rm -f $test.[co] $test $test$shared_ext | ||
210 | echo "Please use win32/Makefile.gcc instead." | tee -a configure.log | ||
211 | exit 1 | ||
212 | LDSHARED=${LDSHARED-"$cc -shared"} | ||
213 | LDSHAREDLIBC="" | ||
214 | EXE='.exe' ;; | ||
215 | QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 | ||
216 | # (alain.bonnefoy@icbt.com) | ||
217 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; | ||
218 | HP-UX*) | ||
219 | LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} | ||
220 | case `(uname -m || echo unknown) 2>/dev/null` in | ||
221 | ia64) | ||
222 | shared_ext='.so' | ||
223 | SHAREDLIB='libz.so' ;; | ||
224 | *) | ||
225 | shared_ext='.sl' | ||
226 | SHAREDLIB='libz.sl' ;; | ||
227 | esac ;; | ||
228 | Darwin* | darwin*) | ||
229 | shared_ext='.dylib' | ||
230 | SHAREDLIB=libz$shared_ext | ||
231 | SHAREDLIBV=libz.$VER$shared_ext | ||
232 | SHAREDLIBM=libz.$VER1$shared_ext | ||
233 | LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} | ||
234 | AR="/usr/bin/libtool" | ||
235 | ARFLAGS="-o" ;; | ||
236 | *) LDSHARED=${LDSHARED-"$cc -shared"} ;; | ||
237 | esac | ||
238 | else | ||
239 | # find system name and corresponding cc options | ||
240 | CC=${CC-cc} | ||
241 | gcc=0 | ||
242 | echo ... using $CC >> configure.log | ||
243 | if test -z "$uname"; then | ||
244 | uname=`(uname -sr || echo unknown) 2>/dev/null` | ||
245 | fi | ||
246 | case "$uname" in | ||
247 | HP-UX*) SFLAGS=${CFLAGS-"-O +z"} | ||
248 | CFLAGS=${CFLAGS-"-O"} | ||
249 | # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} | ||
250 | LDSHARED=${LDSHARED-"ld -b"} | ||
251 | case `(uname -m || echo unknown) 2>/dev/null` in | ||
252 | ia64) | ||
253 | shared_ext='.so' | ||
254 | SHAREDLIB='libz.so' ;; | ||
255 | *) | ||
256 | shared_ext='.sl' | ||
257 | SHAREDLIB='libz.sl' ;; | ||
258 | esac ;; | ||
259 | IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} | ||
260 | CFLAGS=${CFLAGS-"-ansi -O2"} | ||
261 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; | ||
262 | OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} | ||
263 | CFLAGS=${CFLAGS-"-O -std1"} | ||
264 | LDFLAGS="${LDFLAGS} -Wl,-rpath,." | ||
265 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; | ||
266 | OSF1*) SFLAGS=${CFLAGS-"-O -std1"} | ||
267 | CFLAGS=${CFLAGS-"-O -std1"} | ||
268 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; | ||
269 | QNX*) SFLAGS=${CFLAGS-"-4 -O"} | ||
270 | CFLAGS=${CFLAGS-"-4 -O"} | ||
271 | LDSHARED=${LDSHARED-"cc"} | ||
272 | RANLIB=${RANLIB-"true"} | ||
273 | AR="cc" | ||
274 | ARFLAGS="-A" ;; | ||
275 | SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} | ||
276 | CFLAGS=${CFLAGS-"-O3"} | ||
277 | LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; | ||
278 | SunOS\ 5* | solaris*) | ||
279 | LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"} | ||
280 | SFLAGS=${CFLAGS-"-fast -KPIC"} | ||
281 | CFLAGS=${CFLAGS-"-fast"} | ||
282 | if test $build64 -eq 1; then | ||
283 | # old versions of SunPRO/Workshop/Studio don't support -m64, | ||
284 | # but newer ones do. Check for it. | ||
285 | flag64=`$CC -flags | egrep -- '^-m64'` | ||
286 | if test x"$flag64" != x"" ; then | ||
287 | CFLAGS="${CFLAGS} -m64" | ||
288 | SFLAGS="${SFLAGS} -m64" | ||
289 | else | ||
290 | case `(uname -m || echo unknown) 2>/dev/null` in | ||
291 | i86*) | ||
292 | SFLAGS="$SFLAGS -xarch=amd64" | ||
293 | CFLAGS="$CFLAGS -xarch=amd64" ;; | ||
294 | *) | ||
295 | SFLAGS="$SFLAGS -xarch=v9" | ||
296 | CFLAGS="$CFLAGS -xarch=v9" ;; | ||
297 | esac | ||
298 | fi | ||
299 | fi | ||
300 | ;; | ||
301 | SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} | ||
302 | CFLAGS=${CFLAGS-"-O2"} | ||
303 | LDSHARED=${LDSHARED-"ld"} ;; | ||
304 | SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} | ||
305 | CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} | ||
306 | LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; | ||
307 | UNIX_System_V\ 4.2.0) | ||
308 | SFLAGS=${CFLAGS-"-KPIC -O"} | ||
309 | CFLAGS=${CFLAGS-"-O"} | ||
310 | LDSHARED=${LDSHARED-"cc -G"} ;; | ||
311 | UNIX_SV\ 4.2MP) | ||
312 | SFLAGS=${CFLAGS-"-Kconform_pic -O"} | ||
313 | CFLAGS=${CFLAGS-"-O"} | ||
314 | LDSHARED=${LDSHARED-"cc -G"} ;; | ||
315 | OpenUNIX\ 5) | ||
316 | SFLAGS=${CFLAGS-"-KPIC -O"} | ||
317 | CFLAGS=${CFLAGS-"-O"} | ||
318 | LDSHARED=${LDSHARED-"cc -G"} ;; | ||
319 | AIX*) # Courtesy of dbakker@arrayasolutions.com | ||
320 | SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||
321 | CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||
322 | LDSHARED=${LDSHARED-"xlc -G"} ;; | ||
323 | # send working options for other systems to zlib@gzip.org | ||
324 | *) SFLAGS=${CFLAGS-"-O"} | ||
325 | CFLAGS=${CFLAGS-"-O"} | ||
326 | LDSHARED=${LDSHARED-"cc -shared"} ;; | ||
327 | esac | ||
328 | fi | ||
329 | |||
330 | # destination names for shared library if not defined above | ||
331 | SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} | ||
332 | SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} | ||
333 | SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} | ||
334 | |||
335 | echo >> configure.log | ||
336 | |||
337 | # see if shared library build supported | ||
338 | if test $shared -eq 1; then | ||
339 | echo Checking for shared library support... | tee -a configure.log | ||
340 | # we must test in two steps (cc then ld), required at least on SunOS 4.x | ||
341 | if try $CC -w -c $SFLAGS $test.c && | ||
342 | try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then | ||
343 | echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log | ||
344 | elif test -z "$old_cc" -a -z "$old_cflags"; then | ||
345 | echo No shared library support. | tee -a configure.log | ||
346 | shared=0; | ||
347 | else | ||
348 | echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log | ||
349 | shared=0; | ||
350 | fi | ||
351 | fi | ||
352 | if test $shared -eq 0; then | ||
353 | LDSHARED="$CC" | ||
354 | ALL="static" | ||
355 | TEST="all teststatic" | ||
356 | SHAREDLIB="" | ||
357 | SHAREDLIBV="" | ||
358 | SHAREDLIBM="" | ||
359 | echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log | ||
360 | else | ||
361 | ALL="static shared" | ||
362 | TEST="all teststatic testshared" | ||
363 | fi | ||
364 | |||
365 | echo >> configure.log | ||
366 | |||
367 | # check for underscores in external names for use by assembler code | ||
368 | CPP=${CPP-"$CC -E"} | ||
369 | case $CFLAGS in | ||
370 | *ASMV*) | ||
371 | echo >> configure.log | ||
372 | show "$NM $test.o | grep _hello" | ||
373 | if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then | ||
374 | CPP="$CPP -DNO_UNDERLINE" | ||
375 | echo Checking for underline in external names... No. | tee -a configure.log | ||
376 | else | ||
377 | echo Checking for underline in external names... Yes. | tee -a configure.log | ||
378 | fi ;; | ||
379 | esac | ||
380 | |||
381 | echo >> configure.log | ||
382 | |||
383 | # check for large file support, and if none, check for fseeko() | ||
384 | cat > $test.c <<EOF | ||
385 | #include <sys/types.h> | ||
386 | off64_t dummy = 0; | ||
387 | EOF | ||
388 | if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then | ||
389 | CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" | ||
390 | SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" | ||
391 | ALL="${ALL} all64" | ||
392 | TEST="${TEST} test64" | ||
393 | echo "Checking for off64_t... Yes." | tee -a configure.log | ||
394 | echo "Checking for fseeko... Yes." | tee -a configure.log | ||
395 | else | ||
396 | echo "Checking for off64_t... No." | tee -a configure.log | ||
397 | echo >> configure.log | ||
398 | cat > $test.c <<EOF | ||
399 | #include <stdio.h> | ||
400 | int main(void) { | ||
401 | fseeko(NULL, 0, 0); | ||
402 | return 0; | ||
403 | } | ||
404 | EOF | ||
405 | if try $CC $CFLAGS -o $test $test.c; then | ||
406 | echo "Checking for fseeko... Yes." | tee -a configure.log | ||
407 | else | ||
408 | CFLAGS="${CFLAGS} -DNO_FSEEKO" | ||
409 | SFLAGS="${SFLAGS} -DNO_FSEEKO" | ||
410 | echo "Checking for fseeko... No." | tee -a configure.log | ||
411 | fi | ||
412 | fi | ||
413 | |||
414 | echo >> configure.log | ||
415 | |||
416 | # check for strerror() for use by gz* functions | ||
417 | cat > $test.c <<EOF | ||
418 | #include <string.h> | ||
419 | #include <errno.h> | ||
420 | int main() { return strlen(strerror(errno)); } | ||
421 | EOF | ||
422 | if try $CC $CFLAGS -o $test $test.c; then | ||
423 | echo "Checking for strerror... Yes." | tee -a configure.log | ||
424 | else | ||
425 | CFLAGS="${CFLAGS} -DNO_STRERROR" | ||
426 | SFLAGS="${SFLAGS} -DNO_STRERROR" | ||
427 | echo "Checking for strerror... No." | tee -a configure.log | ||
428 | fi | ||
429 | |||
430 | # copy clean zconf.h for subsequent edits | ||
431 | cp -p zconf.h.in zconf.h | ||
432 | |||
433 | echo >> configure.log | ||
434 | |||
435 | # check for unistd.h and save result in zconf.h | ||
436 | cat > $test.c <<EOF | ||
437 | #include <unistd.h> | ||
438 | int main() { return 0; } | ||
439 | EOF | ||
440 | if try $CC -c $CFLAGS $test.c; then | ||
441 | sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h | ||
442 | mv zconf.temp.h zconf.h | ||
443 | echo "Checking for unistd.h... Yes." | tee -a configure.log | ||
444 | else | ||
445 | echo "Checking for unistd.h... No." | tee -a configure.log | ||
446 | fi | ||
447 | |||
448 | echo >> configure.log | ||
449 | |||
450 | # check for stdarg.h and save result in zconf.h | ||
451 | cat > $test.c <<EOF | ||
452 | #include <stdarg.h> | ||
453 | int main() { return 0; } | ||
454 | EOF | ||
455 | if try $CC -c $CFLAGS $test.c; then | ||
456 | sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h | ||
457 | mv zconf.temp.h zconf.h | ||
458 | echo "Checking for stdarg.h... Yes." | tee -a configure.log | ||
459 | else | ||
460 | echo "Checking for stdarg.h... No." | tee -a configure.log | ||
461 | fi | ||
462 | |||
463 | # if the z_ prefix was requested, save that in zconf.h | ||
464 | if test $zprefix -eq 1; then | ||
465 | sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h | ||
466 | mv zconf.temp.h zconf.h | ||
467 | echo >> configure.log | ||
468 | echo "Using z_ prefix on all symbols." | tee -a configure.log | ||
469 | fi | ||
470 | |||
471 | # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists | ||
472 | if test $solo -eq 1; then | ||
473 | sed '/#define ZCONF_H/a\ | ||
474 | #define Z_SOLO | ||
475 | |||
476 | ' < zconf.h > zconf.temp.h | ||
477 | mv zconf.temp.h zconf.h | ||
478 | OBJC='$(OBJZ)' | ||
479 | PIC_OBJC='$(PIC_OBJZ)' | ||
480 | fi | ||
481 | |||
482 | # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X | ||
483 | if test $cover -eq 1; then | ||
484 | CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" | ||
485 | if test -n "$GCC_CLASSIC"; then | ||
486 | CC=$GCC_CLASSIC | ||
487 | fi | ||
488 | fi | ||
489 | |||
490 | echo >> configure.log | ||
491 | |||
492 | # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions | ||
493 | # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a | ||
494 | # return value. The most secure result is vsnprintf() with a return value. snprintf() with a | ||
495 | # return value is secure as well, but then gzprintf() will be limited to 20 arguments. | ||
496 | cat > $test.c <<EOF | ||
497 | #include <stdio.h> | ||
498 | #include <stdarg.h> | ||
499 | #include "zconf.h" | ||
500 | int main() | ||
501 | { | ||
502 | #ifndef STDC | ||
503 | choke me | ||
504 | #endif | ||
505 | return 0; | ||
506 | } | ||
507 | EOF | ||
508 | if try $CC -c $CFLAGS $test.c; then | ||
509 | echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log | ||
510 | |||
511 | echo >> configure.log | ||
512 | cat > $test.c <<EOF | ||
513 | #include <stdio.h> | ||
514 | #include <stdarg.h> | ||
515 | int mytest(const char *fmt, ...) | ||
516 | { | ||
517 | char buf[20]; | ||
518 | va_list ap; | ||
519 | va_start(ap, fmt); | ||
520 | vsnprintf(buf, sizeof(buf), fmt, ap); | ||
521 | va_end(ap); | ||
522 | return 0; | ||
523 | } | ||
524 | int main() | ||
525 | { | ||
526 | return (mytest("Hello%d\n", 1)); | ||
527 | } | ||
528 | EOF | ||
529 | if try $CC $CFLAGS -o $test $test.c; then | ||
530 | echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log | ||
531 | |||
532 | echo >> configure.log | ||
533 | cat >$test.c <<EOF | ||
534 | #include <stdio.h> | ||
535 | #include <stdarg.h> | ||
536 | int mytest(const char *fmt, ...) | ||
537 | { | ||
538 | int n; | ||
539 | char buf[20]; | ||
540 | va_list ap; | ||
541 | va_start(ap, fmt); | ||
542 | n = vsnprintf(buf, sizeof(buf), fmt, ap); | ||
543 | va_end(ap); | ||
544 | return n; | ||
545 | } | ||
546 | int main() | ||
547 | { | ||
548 | return (mytest("Hello%d\n", 1)); | ||
549 | } | ||
550 | EOF | ||
551 | |||
552 | if try $CC -c $CFLAGS $test.c; then | ||
553 | echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log | ||
554 | else | ||
555 | CFLAGS="$CFLAGS -DHAS_vsnprintf_void" | ||
556 | SFLAGS="$SFLAGS -DHAS_vsnprintf_void" | ||
557 | echo "Checking for return value of vsnprintf()... No." | tee -a configure.log | ||
558 | echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log | ||
559 | echo " can build but will be open to possible string-format security" | tee -a configure.log | ||
560 | echo " vulnerabilities." | tee -a configure.log | ||
561 | fi | ||
562 | else | ||
563 | CFLAGS="$CFLAGS -DNO_vsnprintf" | ||
564 | SFLAGS="$SFLAGS -DNO_vsnprintf" | ||
565 | echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log | ||
566 | echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log | ||
567 | echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log | ||
568 | echo " vulnerabilities." | tee -a configure.log | ||
569 | |||
570 | echo >> configure.log | ||
571 | cat >$test.c <<EOF | ||
572 | #include <stdio.h> | ||
573 | #include <stdarg.h> | ||
574 | int mytest(const char *fmt, ...) | ||
575 | { | ||
576 | int n; | ||
577 | char buf[20]; | ||
578 | va_list ap; | ||
579 | va_start(ap, fmt); | ||
580 | n = vsprintf(buf, fmt, ap); | ||
581 | va_end(ap); | ||
582 | return n; | ||
583 | } | ||
584 | int main() | ||
585 | { | ||
586 | return (mytest("Hello%d\n", 1)); | ||
587 | } | ||
588 | EOF | ||
589 | |||
590 | if try $CC -c $CFLAGS $test.c; then | ||
591 | echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log | ||
592 | else | ||
593 | CFLAGS="$CFLAGS -DHAS_vsprintf_void" | ||
594 | SFLAGS="$SFLAGS -DHAS_vsprintf_void" | ||
595 | echo "Checking for return value of vsprintf()... No." | tee -a configure.log | ||
596 | echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log | ||
597 | echo " can build but will be open to possible string-format security" | tee -a configure.log | ||
598 | echo " vulnerabilities." | tee -a configure.log | ||
599 | fi | ||
600 | fi | ||
601 | else | ||
602 | echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log | ||
603 | |||
604 | echo >> configure.log | ||
605 | cat >$test.c <<EOF | ||
606 | #include <stdio.h> | ||
607 | int mytest() | ||
608 | { | ||
609 | char buf[20]; | ||
610 | snprintf(buf, sizeof(buf), "%s", "foo"); | ||
611 | return 0; | ||
612 | } | ||
613 | int main() | ||
614 | { | ||
615 | return (mytest()); | ||
616 | } | ||
617 | EOF | ||
618 | |||
619 | if try $CC $CFLAGS -o $test $test.c; then | ||
620 | echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log | ||
621 | |||
622 | echo >> configure.log | ||
623 | cat >$test.c <<EOF | ||
624 | #include <stdio.h> | ||
625 | int mytest() | ||
626 | { | ||
627 | char buf[20]; | ||
628 | return snprintf(buf, sizeof(buf), "%s", "foo"); | ||
629 | } | ||
630 | int main() | ||
631 | { | ||
632 | return (mytest()); | ||
633 | } | ||
634 | EOF | ||
635 | |||
636 | if try $CC -c $CFLAGS $test.c; then | ||
637 | echo "Checking for return value of snprintf()... Yes." | tee -a configure.log | ||
638 | else | ||
639 | CFLAGS="$CFLAGS -DHAS_snprintf_void" | ||
640 | SFLAGS="$SFLAGS -DHAS_snprintf_void" | ||
641 | echo "Checking for return value of snprintf()... No." | tee -a configure.log | ||
642 | echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log | ||
643 | echo " can build but will be open to possible string-format security" | tee -a configure.log | ||
644 | echo " vulnerabilities." | tee -a configure.log | ||
645 | fi | ||
646 | else | ||
647 | CFLAGS="$CFLAGS -DNO_snprintf" | ||
648 | SFLAGS="$SFLAGS -DNO_snprintf" | ||
649 | echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log | ||
650 | echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log | ||
651 | echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log | ||
652 | echo " vulnerabilities." | tee -a configure.log | ||
653 | |||
654 | echo >> configure.log | ||
655 | cat >$test.c <<EOF | ||
656 | #include <stdio.h> | ||
657 | int mytest() | ||
658 | { | ||
659 | char buf[20]; | ||
660 | return sprintf(buf, "%s", "foo"); | ||
661 | } | ||
662 | int main() | ||
663 | { | ||
664 | return (mytest()); | ||
665 | } | ||
666 | EOF | ||
667 | |||
668 | if try $CC -c $CFLAGS $test.c; then | ||
669 | echo "Checking for return value of sprintf()... Yes." | tee -a configure.log | ||
670 | else | ||
671 | CFLAGS="$CFLAGS -DHAS_sprintf_void" | ||
672 | SFLAGS="$SFLAGS -DHAS_sprintf_void" | ||
673 | echo "Checking for return value of sprintf()... No." | tee -a configure.log | ||
674 | echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log | ||
675 | echo " can build but will be open to possible string-format security" | tee -a configure.log | ||
676 | echo " vulnerabilities." | tee -a configure.log | ||
677 | fi | ||
678 | fi | ||
679 | fi | ||
680 | |||
681 | # see if we can hide zlib internal symbols that are linked between separate source files | ||
682 | if test "$gcc" -eq 1; then | ||
683 | echo >> configure.log | ||
684 | cat > $test.c <<EOF | ||
685 | #define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) | ||
686 | int ZLIB_INTERNAL foo; | ||
687 | int main() | ||
688 | { | ||
689 | return 0; | ||
690 | } | ||
691 | EOF | ||
692 | if tryboth $CC -c $CFLAGS $test.c; then | ||
693 | CFLAGS="$CFLAGS -DHAVE_HIDDEN" | ||
694 | SFLAGS="$SFLAGS -DHAVE_HIDDEN" | ||
695 | echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log | ||
696 | else | ||
697 | echo "Checking for attribute(visibility) support... No." | tee -a configure.log | ||
698 | fi | ||
699 | fi | ||
700 | |||
701 | echo >> configure.log | ||
702 | |||
703 | # find a four-byte unsiged integer type for crc calculations | ||
704 | cat > $test.c <<EOF | ||
705 | #include <stdio.h> | ||
706 | #define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;} | ||
707 | int main() { | ||
708 | int k; | ||
709 | unsigned i; | ||
710 | unsigned long l; | ||
711 | unsigned short s; | ||
712 | is32(i, "unsigned") | ||
713 | is32(l, "unsigned long") | ||
714 | is32(s, "unsigned short") | ||
715 | return 1; | ||
716 | } | ||
717 | EOF | ||
718 | Z_U4="" | ||
719 | if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then | ||
720 | sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h | ||
721 | mv zconf.temp.h zconf.h | ||
722 | echo "Looking for a four-byte integer type... Found." | tee -a configure.log | ||
723 | else | ||
724 | echo "Looking for a four-byte integer type... Not found." | tee -a configure.log | ||
725 | fi | ||
726 | |||
727 | # clean up files produced by running the compiler and linker | ||
728 | rm -f $test.[co] $test $test$shared_ext $test.gcno | ||
729 | |||
730 | # show the results in the log | ||
731 | echo >> configure.log | ||
732 | echo ALL = $ALL >> configure.log | ||
733 | echo AR = $AR >> configure.log | ||
734 | echo ARFLAGS = $ARFLAGS >> configure.log | ||
735 | echo CC = $CC >> configure.log | ||
736 | echo CFLAGS = $CFLAGS >> configure.log | ||
737 | echo CPP = $CPP >> configure.log | ||
738 | echo EXE = $EXE >> configure.log | ||
739 | echo LDCONFIG = $LDCONFIG >> configure.log | ||
740 | echo LDFLAGS = $LDFLAGS >> configure.log | ||
741 | echo LDSHARED = $LDSHARED >> configure.log | ||
742 | echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log | ||
743 | echo OBJC = $OBJC >> configure.log | ||
744 | echo PIC_OBJC = $PIC_OBJC >> configure.log | ||
745 | echo RANLIB = $RANLIB >> configure.log | ||
746 | echo SFLAGS = $SFLAGS >> configure.log | ||
747 | echo SHAREDLIB = $SHAREDLIB >> configure.log | ||
748 | echo SHAREDLIBM = $SHAREDLIBM >> configure.log | ||
749 | echo SHAREDLIBV = $SHAREDLIBV >> configure.log | ||
750 | echo STATICLIB = $STATICLIB >> configure.log | ||
751 | echo TEST = $TEST >> configure.log | ||
752 | echo VER = $VER >> configure.log | ||
753 | echo Z_U4 = $Z_U4 >> configure.log | ||
754 | echo exec_prefix = $exec_prefix >> configure.log | ||
755 | echo includedir = $includedir >> configure.log | ||
756 | echo libdir = $libdir >> configure.log | ||
757 | echo mandir = $mandir >> configure.log | ||
758 | echo prefix = $prefix >> configure.log | ||
759 | echo sharedlibdir = $sharedlibdir >> configure.log | ||
760 | echo uname = $uname >> configure.log | ||
761 | echo -------------------- >> configure.log | ||
762 | echo >> configure.log | ||
763 | echo >> configure.log | ||
764 | |||
765 | # udpate Makefile with the configure results | ||
766 | sed < Makefile.in " | ||
767 | /^CC *=/s#=.*#=$CC# | ||
768 | /^CFLAGS *=/s#=.*#=$CFLAGS# | ||
769 | /^SFLAGS *=/s#=.*#=$SFLAGS# | ||
770 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# | ||
771 | /^LDSHARED *=/s#=.*#=$LDSHARED# | ||
772 | /^CPP *=/s#=.*#=$CPP# | ||
773 | /^STATICLIB *=/s#=.*#=$STATICLIB# | ||
774 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# | ||
775 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# | ||
776 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# | ||
777 | /^AR *=/s#=.*#=$AR# | ||
778 | /^ARFLAGS *=/s#=.*#=$ARFLAGS# | ||
779 | /^RANLIB *=/s#=.*#=$RANLIB# | ||
780 | /^LDCONFIG *=/s#=.*#=$LDCONFIG# | ||
781 | /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# | ||
782 | /^EXE *=/s#=.*#=$EXE# | ||
783 | /^prefix *=/s#=.*#=$prefix# | ||
784 | /^exec_prefix *=/s#=.*#=$exec_prefix# | ||
785 | /^libdir *=/s#=.*#=$libdir# | ||
786 | /^sharedlibdir *=/s#=.*#=$sharedlibdir# | ||
787 | /^includedir *=/s#=.*#=$includedir# | ||
788 | /^mandir *=/s#=.*#=$mandir# | ||
789 | /^OBJC *=/s#=.*#= $OBJC# | ||
790 | /^PIC_OBJC *=/s#=.*#= $PIC_OBJC# | ||
791 | /^all: */s#:.*#: $ALL# | ||
792 | /^test: */s#:.*#: $TEST# | ||
793 | " > Makefile | ||
794 | |||
795 | # create zlib.pc with the configure results | ||
796 | sed < zlib.pc.in " | ||
797 | /^CC *=/s#=.*#=$CC# | ||
798 | /^CFLAGS *=/s#=.*#=$CFLAGS# | ||
799 | /^CPP *=/s#=.*#=$CPP# | ||
800 | /^LDSHARED *=/s#=.*#=$LDSHARED# | ||
801 | /^STATICLIB *=/s#=.*#=$STATICLIB# | ||
802 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# | ||
803 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# | ||
804 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# | ||
805 | /^AR *=/s#=.*#=$AR# | ||
806 | /^ARFLAGS *=/s#=.*#=$ARFLAGS# | ||
807 | /^RANLIB *=/s#=.*#=$RANLIB# | ||
808 | /^EXE *=/s#=.*#=$EXE# | ||
809 | /^prefix *=/s#=.*#=$prefix# | ||
810 | /^exec_prefix *=/s#=.*#=$exec_prefix# | ||
811 | /^libdir *=/s#=.*#=$libdir# | ||
812 | /^sharedlibdir *=/s#=.*#=$sharedlibdir# | ||
813 | /^includedir *=/s#=.*#=$includedir# | ||
814 | /^mandir *=/s#=.*#=$mandir# | ||
815 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# | ||
816 | " | sed -e " | ||
817 | s/\@VERSION\@/$VER/g; | ||
818 | " > zlib.pc | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.c deleted file mode 100644 index 979a719..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.c +++ /dev/null | |||
@@ -1,425 +0,0 @@ | |||
1 | /* crc32.c -- compute the CRC-32 of a data stream | ||
2 | * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | * | ||
5 | * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster | ||
6 | * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing | ||
7 | * tables for updating the shift register in one step with three exclusive-ors | ||
8 | * instead of four steps with four exclusive-ors. This results in about a | ||
9 | * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. | ||
10 | */ | ||
11 | |||
12 | /* @(#) $Id$ */ | ||
13 | |||
14 | /* | ||
15 | Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore | ||
16 | protection on the static variables used to control the first-use generation | ||
17 | of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should | ||
18 | first call get_crc_table() to initialize the tables before allowing more than | ||
19 | one thread to use crc32(). | ||
20 | |||
21 | DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. | ||
22 | */ | ||
23 | |||
24 | #ifdef MAKECRCH | ||
25 | # include <stdio.h> | ||
26 | # ifndef DYNAMIC_CRC_TABLE | ||
27 | # define DYNAMIC_CRC_TABLE | ||
28 | # endif /* !DYNAMIC_CRC_TABLE */ | ||
29 | #endif /* MAKECRCH */ | ||
30 | |||
31 | #include "zutil.h" /* for STDC and FAR definitions */ | ||
32 | |||
33 | #define local static | ||
34 | |||
35 | /* Definitions for doing the crc four data bytes at a time. */ | ||
36 | #if !defined(NOBYFOUR) && defined(Z_U4) | ||
37 | # define BYFOUR | ||
38 | #endif | ||
39 | #ifdef BYFOUR | ||
40 | local unsigned long crc32_little OF((unsigned long, | ||
41 | const unsigned char FAR *, unsigned)); | ||
42 | local unsigned long crc32_big OF((unsigned long, | ||
43 | const unsigned char FAR *, unsigned)); | ||
44 | # define TBLS 8 | ||
45 | #else | ||
46 | # define TBLS 1 | ||
47 | #endif /* BYFOUR */ | ||
48 | |||
49 | /* Local functions for crc concatenation */ | ||
50 | local unsigned long gf2_matrix_times OF((unsigned long *mat, | ||
51 | unsigned long vec)); | ||
52 | local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); | ||
53 | local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); | ||
54 | |||
55 | |||
56 | #ifdef DYNAMIC_CRC_TABLE | ||
57 | |||
58 | local volatile int crc_table_empty = 1; | ||
59 | local z_crc_t FAR crc_table[TBLS][256]; | ||
60 | local void make_crc_table OF((void)); | ||
61 | #ifdef MAKECRCH | ||
62 | local void write_table OF((FILE *, const z_crc_t FAR *)); | ||
63 | #endif /* MAKECRCH */ | ||
64 | /* | ||
65 | Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: | ||
66 | x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. | ||
67 | |||
68 | Polynomials over GF(2) are represented in binary, one bit per coefficient, | ||
69 | with the lowest powers in the most significant bit. Then adding polynomials | ||
70 | is just exclusive-or, and multiplying a polynomial by x is a right shift by | ||
71 | one. If we call the above polynomial p, and represent a byte as the | ||
72 | polynomial q, also with the lowest power in the most significant bit (so the | ||
73 | byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, | ||
74 | where a mod b means the remainder after dividing a by b. | ||
75 | |||
76 | This calculation is done using the shift-register method of multiplying and | ||
77 | taking the remainder. The register is initialized to zero, and for each | ||
78 | incoming bit, x^32 is added mod p to the register if the bit is a one (where | ||
79 | x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by | ||
80 | x (which is shifting right by one and adding x^32 mod p if the bit shifted | ||
81 | out is a one). We start with the highest power (least significant bit) of | ||
82 | q and repeat for all eight bits of q. | ||
83 | |||
84 | The first table is simply the CRC of all possible eight bit values. This is | ||
85 | all the information needed to generate CRCs on data a byte at a time for all | ||
86 | combinations of CRC register values and incoming bytes. The remaining tables | ||
87 | allow for word-at-a-time CRC calculation for both big-endian and little- | ||
88 | endian machines, where a word is four bytes. | ||
89 | */ | ||
90 | local void make_crc_table() | ||
91 | { | ||
92 | z_crc_t c; | ||
93 | int n, k; | ||
94 | z_crc_t poly; /* polynomial exclusive-or pattern */ | ||
95 | /* terms of polynomial defining this crc (except x^32): */ | ||
96 | static volatile int first = 1; /* flag to limit concurrent making */ | ||
97 | static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | ||
98 | |||
99 | /* See if another task is already doing this (not thread-safe, but better | ||
100 | than nothing -- significantly reduces duration of vulnerability in | ||
101 | case the advice about DYNAMIC_CRC_TABLE is ignored) */ | ||
102 | if (first) { | ||
103 | first = 0; | ||
104 | |||
105 | /* make exclusive-or pattern from polynomial (0xedb88320UL) */ | ||
106 | poly = 0; | ||
107 | for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) | ||
108 | poly |= (z_crc_t)1 << (31 - p[n]); | ||
109 | |||
110 | /* generate a crc for every 8-bit value */ | ||
111 | for (n = 0; n < 256; n++) { | ||
112 | c = (z_crc_t)n; | ||
113 | for (k = 0; k < 8; k++) | ||
114 | c = c & 1 ? poly ^ (c >> 1) : c >> 1; | ||
115 | crc_table[0][n] = c; | ||
116 | } | ||
117 | |||
118 | #ifdef BYFOUR | ||
119 | /* generate crc for each value followed by one, two, and three zeros, | ||
120 | and then the byte reversal of those as well as the first table */ | ||
121 | for (n = 0; n < 256; n++) { | ||
122 | c = crc_table[0][n]; | ||
123 | crc_table[4][n] = ZSWAP32(c); | ||
124 | for (k = 1; k < 4; k++) { | ||
125 | c = crc_table[0][c & 0xff] ^ (c >> 8); | ||
126 | crc_table[k][n] = c; | ||
127 | crc_table[k + 4][n] = ZSWAP32(c); | ||
128 | } | ||
129 | } | ||
130 | #endif /* BYFOUR */ | ||
131 | |||
132 | crc_table_empty = 0; | ||
133 | } | ||
134 | else { /* not first */ | ||
135 | /* wait for the other guy to finish (not efficient, but rare) */ | ||
136 | while (crc_table_empty) | ||
137 | ; | ||
138 | } | ||
139 | |||
140 | #ifdef MAKECRCH | ||
141 | /* write out CRC tables to crc32.h */ | ||
142 | { | ||
143 | FILE *out; | ||
144 | |||
145 | out = fopen("crc32.h", "w"); | ||
146 | if (out == NULL) return; | ||
147 | fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); | ||
148 | fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); | ||
149 | fprintf(out, "local const z_crc_t FAR "); | ||
150 | fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); | ||
151 | write_table(out, crc_table[0]); | ||
152 | # ifdef BYFOUR | ||
153 | fprintf(out, "#ifdef BYFOUR\n"); | ||
154 | for (k = 1; k < 8; k++) { | ||
155 | fprintf(out, " },\n {\n"); | ||
156 | write_table(out, crc_table[k]); | ||
157 | } | ||
158 | fprintf(out, "#endif\n"); | ||
159 | # endif /* BYFOUR */ | ||
160 | fprintf(out, " }\n};\n"); | ||
161 | fclose(out); | ||
162 | } | ||
163 | #endif /* MAKECRCH */ | ||
164 | } | ||
165 | |||
166 | #ifdef MAKECRCH | ||
167 | local void write_table(out, table) | ||
168 | FILE *out; | ||
169 | const z_crc_t FAR *table; | ||
170 | { | ||
171 | int n; | ||
172 | |||
173 | for (n = 0; n < 256; n++) | ||
174 | fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", | ||
175 | (unsigned long)(table[n]), | ||
176 | n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); | ||
177 | } | ||
178 | #endif /* MAKECRCH */ | ||
179 | |||
180 | #else /* !DYNAMIC_CRC_TABLE */ | ||
181 | /* ======================================================================== | ||
182 | * Tables of CRC-32s of all single-byte values, made by make_crc_table(). | ||
183 | */ | ||
184 | #include "crc32.h" | ||
185 | #endif /* DYNAMIC_CRC_TABLE */ | ||
186 | |||
187 | /* ========================================================================= | ||
188 | * This function can be used by asm versions of crc32() | ||
189 | */ | ||
190 | const z_crc_t FAR * ZEXPORT get_crc_table() | ||
191 | { | ||
192 | #ifdef DYNAMIC_CRC_TABLE | ||
193 | if (crc_table_empty) | ||
194 | make_crc_table(); | ||
195 | #endif /* DYNAMIC_CRC_TABLE */ | ||
196 | return (const z_crc_t FAR *)crc_table; | ||
197 | } | ||
198 | |||
199 | /* ========================================================================= */ | ||
200 | #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) | ||
201 | #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 | ||
202 | |||
203 | /* ========================================================================= */ | ||
204 | unsigned long ZEXPORT crc32(crc, buf, len) | ||
205 | unsigned long crc; | ||
206 | const unsigned char FAR *buf; | ||
207 | uInt len; | ||
208 | { | ||
209 | if (buf == Z_NULL) return 0UL; | ||
210 | |||
211 | #ifdef DYNAMIC_CRC_TABLE | ||
212 | if (crc_table_empty) | ||
213 | make_crc_table(); | ||
214 | #endif /* DYNAMIC_CRC_TABLE */ | ||
215 | |||
216 | #ifdef BYFOUR | ||
217 | if (sizeof(void *) == sizeof(ptrdiff_t)) { | ||
218 | z_crc_t endian; | ||
219 | |||
220 | endian = 1; | ||
221 | if (*((unsigned char *)(&endian))) | ||
222 | return crc32_little(crc, buf, len); | ||
223 | else | ||
224 | return crc32_big(crc, buf, len); | ||
225 | } | ||
226 | #endif /* BYFOUR */ | ||
227 | crc = crc ^ 0xffffffffUL; | ||
228 | while (len >= 8) { | ||
229 | DO8; | ||
230 | len -= 8; | ||
231 | } | ||
232 | if (len) do { | ||
233 | DO1; | ||
234 | } while (--len); | ||
235 | return crc ^ 0xffffffffUL; | ||
236 | } | ||
237 | |||
238 | #ifdef BYFOUR | ||
239 | |||
240 | /* ========================================================================= */ | ||
241 | #define DOLIT4 c ^= *buf4++; \ | ||
242 | c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ | ||
243 | crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] | ||
244 | #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 | ||
245 | |||
246 | /* ========================================================================= */ | ||
247 | local unsigned long crc32_little(crc, buf, len) | ||
248 | unsigned long crc; | ||
249 | const unsigned char FAR *buf; | ||
250 | unsigned len; | ||
251 | { | ||
252 | register z_crc_t c; | ||
253 | register const z_crc_t FAR *buf4; | ||
254 | |||
255 | c = (z_crc_t)crc; | ||
256 | c = ~c; | ||
257 | while (len && ((ptrdiff_t)buf & 3)) { | ||
258 | c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); | ||
259 | len--; | ||
260 | } | ||
261 | |||
262 | buf4 = (const z_crc_t FAR *)(const void FAR *)buf; | ||
263 | while (len >= 32) { | ||
264 | DOLIT32; | ||
265 | len -= 32; | ||
266 | } | ||
267 | while (len >= 4) { | ||
268 | DOLIT4; | ||
269 | len -= 4; | ||
270 | } | ||
271 | buf = (const unsigned char FAR *)buf4; | ||
272 | |||
273 | if (len) do { | ||
274 | c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); | ||
275 | } while (--len); | ||
276 | c = ~c; | ||
277 | return (unsigned long)c; | ||
278 | } | ||
279 | |||
280 | /* ========================================================================= */ | ||
281 | #define DOBIG4 c ^= *++buf4; \ | ||
282 | c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ | ||
283 | crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] | ||
284 | #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 | ||
285 | |||
286 | /* ========================================================================= */ | ||
287 | local unsigned long crc32_big(crc, buf, len) | ||
288 | unsigned long crc; | ||
289 | const unsigned char FAR *buf; | ||
290 | unsigned len; | ||
291 | { | ||
292 | register z_crc_t c; | ||
293 | register const z_crc_t FAR *buf4; | ||
294 | |||
295 | c = ZSWAP32((z_crc_t)crc); | ||
296 | c = ~c; | ||
297 | while (len && ((ptrdiff_t)buf & 3)) { | ||
298 | c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); | ||
299 | len--; | ||
300 | } | ||
301 | |||
302 | buf4 = (const z_crc_t FAR *)(const void FAR *)buf; | ||
303 | buf4--; | ||
304 | while (len >= 32) { | ||
305 | DOBIG32; | ||
306 | len -= 32; | ||
307 | } | ||
308 | while (len >= 4) { | ||
309 | DOBIG4; | ||
310 | len -= 4; | ||
311 | } | ||
312 | buf4++; | ||
313 | buf = (const unsigned char FAR *)buf4; | ||
314 | |||
315 | if (len) do { | ||
316 | c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); | ||
317 | } while (--len); | ||
318 | c = ~c; | ||
319 | return (unsigned long)(ZSWAP32(c)); | ||
320 | } | ||
321 | |||
322 | #endif /* BYFOUR */ | ||
323 | |||
324 | #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ | ||
325 | |||
326 | /* ========================================================================= */ | ||
327 | local unsigned long gf2_matrix_times(mat, vec) | ||
328 | unsigned long *mat; | ||
329 | unsigned long vec; | ||
330 | { | ||
331 | unsigned long sum; | ||
332 | |||
333 | sum = 0; | ||
334 | while (vec) { | ||
335 | if (vec & 1) | ||
336 | sum ^= *mat; | ||
337 | vec >>= 1; | ||
338 | mat++; | ||
339 | } | ||
340 | return sum; | ||
341 | } | ||
342 | |||
343 | /* ========================================================================= */ | ||
344 | local void gf2_matrix_square(square, mat) | ||
345 | unsigned long *square; | ||
346 | unsigned long *mat; | ||
347 | { | ||
348 | int n; | ||
349 | |||
350 | for (n = 0; n < GF2_DIM; n++) | ||
351 | square[n] = gf2_matrix_times(mat, mat[n]); | ||
352 | } | ||
353 | |||
354 | /* ========================================================================= */ | ||
355 | local uLong crc32_combine_(crc1, crc2, len2) | ||
356 | uLong crc1; | ||
357 | uLong crc2; | ||
358 | z_off64_t len2; | ||
359 | { | ||
360 | int n; | ||
361 | unsigned long row; | ||
362 | unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ | ||
363 | unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ | ||
364 | |||
365 | /* degenerate case (also disallow negative lengths) */ | ||
366 | if (len2 <= 0) | ||
367 | return crc1; | ||
368 | |||
369 | /* put operator for one zero bit in odd */ | ||
370 | odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ | ||
371 | row = 1; | ||
372 | for (n = 1; n < GF2_DIM; n++) { | ||
373 | odd[n] = row; | ||
374 | row <<= 1; | ||
375 | } | ||
376 | |||
377 | /* put operator for two zero bits in even */ | ||
378 | gf2_matrix_square(even, odd); | ||
379 | |||
380 | /* put operator for four zero bits in odd */ | ||
381 | gf2_matrix_square(odd, even); | ||
382 | |||
383 | /* apply len2 zeros to crc1 (first square will put the operator for one | ||
384 | zero byte, eight zero bits, in even) */ | ||
385 | do { | ||
386 | /* apply zeros operator for this bit of len2 */ | ||
387 | gf2_matrix_square(even, odd); | ||
388 | if (len2 & 1) | ||
389 | crc1 = gf2_matrix_times(even, crc1); | ||
390 | len2 >>= 1; | ||
391 | |||
392 | /* if no more bits set, then done */ | ||
393 | if (len2 == 0) | ||
394 | break; | ||
395 | |||
396 | /* another iteration of the loop with odd and even swapped */ | ||
397 | gf2_matrix_square(odd, even); | ||
398 | if (len2 & 1) | ||
399 | crc1 = gf2_matrix_times(odd, crc1); | ||
400 | len2 >>= 1; | ||
401 | |||
402 | /* if no more bits set, then done */ | ||
403 | } while (len2 != 0); | ||
404 | |||
405 | /* return combined crc */ | ||
406 | crc1 ^= crc2; | ||
407 | return crc1; | ||
408 | } | ||
409 | |||
410 | /* ========================================================================= */ | ||
411 | uLong ZEXPORT crc32_combine(crc1, crc2, len2) | ||
412 | uLong crc1; | ||
413 | uLong crc2; | ||
414 | z_off_t len2; | ||
415 | { | ||
416 | return crc32_combine_(crc1, crc2, len2); | ||
417 | } | ||
418 | |||
419 | uLong ZEXPORT crc32_combine64(crc1, crc2, len2) | ||
420 | uLong crc1; | ||
421 | uLong crc2; | ||
422 | z_off64_t len2; | ||
423 | { | ||
424 | return crc32_combine_(crc1, crc2, len2); | ||
425 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.h deleted file mode 100644 index 9e0c778..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/crc32.h +++ /dev/null | |||
@@ -1,441 +0,0 @@ | |||
1 | /* crc32.h -- tables for rapid CRC calculation | ||
2 | * Generated automatically by crc32.c | ||
3 | */ | ||
4 | |||
5 | local const z_crc_t FAR crc_table[TBLS][256] = | ||
6 | { | ||
7 | { | ||
8 | 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, | ||
9 | 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, | ||
10 | 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, | ||
11 | 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, | ||
12 | 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, | ||
13 | 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, | ||
14 | 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, | ||
15 | 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, | ||
16 | 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, | ||
17 | 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, | ||
18 | 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, | ||
19 | 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, | ||
20 | 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, | ||
21 | 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, | ||
22 | 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, | ||
23 | 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, | ||
24 | 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, | ||
25 | 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, | ||
26 | 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, | ||
27 | 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, | ||
28 | 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, | ||
29 | 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, | ||
30 | 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, | ||
31 | 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, | ||
32 | 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, | ||
33 | 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, | ||
34 | 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, | ||
35 | 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, | ||
36 | 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, | ||
37 | 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, | ||
38 | 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, | ||
39 | 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, | ||
40 | 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, | ||
41 | 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, | ||
42 | 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, | ||
43 | 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, | ||
44 | 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, | ||
45 | 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, | ||
46 | 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, | ||
47 | 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, | ||
48 | 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, | ||
49 | 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, | ||
50 | 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, | ||
51 | 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, | ||
52 | 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, | ||
53 | 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, | ||
54 | 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, | ||
55 | 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, | ||
56 | 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, | ||
57 | 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, | ||
58 | 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, | ||
59 | 0x2d02ef8dUL | ||
60 | #ifdef BYFOUR | ||
61 | }, | ||
62 | { | ||
63 | 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, | ||
64 | 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, | ||
65 | 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, | ||
66 | 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, | ||
67 | 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, | ||
68 | 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, | ||
69 | 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, | ||
70 | 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, | ||
71 | 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, | ||
72 | 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, | ||
73 | 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, | ||
74 | 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, | ||
75 | 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, | ||
76 | 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, | ||
77 | 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, | ||
78 | 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, | ||
79 | 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, | ||
80 | 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, | ||
81 | 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, | ||
82 | 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, | ||
83 | 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, | ||
84 | 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, | ||
85 | 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, | ||
86 | 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, | ||
87 | 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, | ||
88 | 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, | ||
89 | 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, | ||
90 | 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, | ||
91 | 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, | ||
92 | 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, | ||
93 | 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, | ||
94 | 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, | ||
95 | 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, | ||
96 | 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, | ||
97 | 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, | ||
98 | 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, | ||
99 | 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, | ||
100 | 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, | ||
101 | 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, | ||
102 | 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, | ||
103 | 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, | ||
104 | 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, | ||
105 | 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, | ||
106 | 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, | ||
107 | 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, | ||
108 | 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, | ||
109 | 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, | ||
110 | 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, | ||
111 | 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, | ||
112 | 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, | ||
113 | 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, | ||
114 | 0x9324fd72UL | ||
115 | }, | ||
116 | { | ||
117 | 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, | ||
118 | 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, | ||
119 | 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, | ||
120 | 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, | ||
121 | 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, | ||
122 | 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, | ||
123 | 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, | ||
124 | 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, | ||
125 | 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, | ||
126 | 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, | ||
127 | 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, | ||
128 | 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, | ||
129 | 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, | ||
130 | 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, | ||
131 | 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, | ||
132 | 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, | ||
133 | 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, | ||
134 | 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, | ||
135 | 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, | ||
136 | 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, | ||
137 | 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, | ||
138 | 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, | ||
139 | 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, | ||
140 | 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, | ||
141 | 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, | ||
142 | 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, | ||
143 | 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, | ||
144 | 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, | ||
145 | 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, | ||
146 | 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, | ||
147 | 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, | ||
148 | 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, | ||
149 | 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, | ||
150 | 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, | ||
151 | 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, | ||
152 | 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, | ||
153 | 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, | ||
154 | 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, | ||
155 | 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, | ||
156 | 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, | ||
157 | 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, | ||
158 | 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, | ||
159 | 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, | ||
160 | 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, | ||
161 | 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, | ||
162 | 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, | ||
163 | 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, | ||
164 | 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, | ||
165 | 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, | ||
166 | 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, | ||
167 | 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, | ||
168 | 0xbe9834edUL | ||
169 | }, | ||
170 | { | ||
171 | 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, | ||
172 | 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, | ||
173 | 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, | ||
174 | 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, | ||
175 | 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, | ||
176 | 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, | ||
177 | 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, | ||
178 | 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, | ||
179 | 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, | ||
180 | 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, | ||
181 | 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, | ||
182 | 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, | ||
183 | 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, | ||
184 | 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, | ||
185 | 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, | ||
186 | 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, | ||
187 | 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, | ||
188 | 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, | ||
189 | 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, | ||
190 | 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, | ||
191 | 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, | ||
192 | 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, | ||
193 | 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, | ||
194 | 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, | ||
195 | 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, | ||
196 | 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, | ||
197 | 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, | ||
198 | 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, | ||
199 | 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, | ||
200 | 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, | ||
201 | 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, | ||
202 | 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, | ||
203 | 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, | ||
204 | 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, | ||
205 | 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, | ||
206 | 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, | ||
207 | 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, | ||
208 | 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, | ||
209 | 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, | ||
210 | 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, | ||
211 | 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, | ||
212 | 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, | ||
213 | 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, | ||
214 | 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, | ||
215 | 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, | ||
216 | 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, | ||
217 | 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, | ||
218 | 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, | ||
219 | 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, | ||
220 | 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, | ||
221 | 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, | ||
222 | 0xde0506f1UL | ||
223 | }, | ||
224 | { | ||
225 | 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, | ||
226 | 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, | ||
227 | 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, | ||
228 | 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, | ||
229 | 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, | ||
230 | 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, | ||
231 | 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, | ||
232 | 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, | ||
233 | 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, | ||
234 | 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, | ||
235 | 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, | ||
236 | 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, | ||
237 | 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, | ||
238 | 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, | ||
239 | 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, | ||
240 | 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, | ||
241 | 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, | ||
242 | 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, | ||
243 | 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, | ||
244 | 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, | ||
245 | 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, | ||
246 | 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, | ||
247 | 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, | ||
248 | 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, | ||
249 | 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, | ||
250 | 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, | ||
251 | 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, | ||
252 | 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, | ||
253 | 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, | ||
254 | 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, | ||
255 | 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, | ||
256 | 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, | ||
257 | 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, | ||
258 | 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, | ||
259 | 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, | ||
260 | 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, | ||
261 | 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, | ||
262 | 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, | ||
263 | 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, | ||
264 | 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, | ||
265 | 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, | ||
266 | 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, | ||
267 | 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, | ||
268 | 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, | ||
269 | 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, | ||
270 | 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, | ||
271 | 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, | ||
272 | 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, | ||
273 | 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, | ||
274 | 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, | ||
275 | 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, | ||
276 | 0x8def022dUL | ||
277 | }, | ||
278 | { | ||
279 | 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, | ||
280 | 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, | ||
281 | 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, | ||
282 | 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, | ||
283 | 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, | ||
284 | 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, | ||
285 | 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, | ||
286 | 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, | ||
287 | 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, | ||
288 | 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, | ||
289 | 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, | ||
290 | 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, | ||
291 | 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, | ||
292 | 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, | ||
293 | 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, | ||
294 | 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, | ||
295 | 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, | ||
296 | 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, | ||
297 | 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, | ||
298 | 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, | ||
299 | 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, | ||
300 | 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, | ||
301 | 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, | ||
302 | 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, | ||
303 | 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, | ||
304 | 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, | ||
305 | 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, | ||
306 | 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, | ||
307 | 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, | ||
308 | 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, | ||
309 | 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, | ||
310 | 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, | ||
311 | 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, | ||
312 | 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, | ||
313 | 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, | ||
314 | 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, | ||
315 | 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, | ||
316 | 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, | ||
317 | 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, | ||
318 | 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, | ||
319 | 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, | ||
320 | 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, | ||
321 | 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, | ||
322 | 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, | ||
323 | 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, | ||
324 | 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, | ||
325 | 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, | ||
326 | 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, | ||
327 | 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, | ||
328 | 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, | ||
329 | 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, | ||
330 | 0x72fd2493UL | ||
331 | }, | ||
332 | { | ||
333 | 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, | ||
334 | 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, | ||
335 | 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, | ||
336 | 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, | ||
337 | 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, | ||
338 | 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, | ||
339 | 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, | ||
340 | 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, | ||
341 | 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, | ||
342 | 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, | ||
343 | 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, | ||
344 | 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, | ||
345 | 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, | ||
346 | 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, | ||
347 | 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, | ||
348 | 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, | ||
349 | 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, | ||
350 | 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, | ||
351 | 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, | ||
352 | 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, | ||
353 | 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, | ||
354 | 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, | ||
355 | 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, | ||
356 | 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, | ||
357 | 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, | ||
358 | 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, | ||
359 | 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, | ||
360 | 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, | ||
361 | 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, | ||
362 | 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, | ||
363 | 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, | ||
364 | 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, | ||
365 | 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, | ||
366 | 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, | ||
367 | 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, | ||
368 | 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, | ||
369 | 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, | ||
370 | 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, | ||
371 | 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, | ||
372 | 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, | ||
373 | 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, | ||
374 | 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, | ||
375 | 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, | ||
376 | 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, | ||
377 | 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, | ||
378 | 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, | ||
379 | 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, | ||
380 | 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, | ||
381 | 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, | ||
382 | 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, | ||
383 | 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, | ||
384 | 0xed3498beUL | ||
385 | }, | ||
386 | { | ||
387 | 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, | ||
388 | 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, | ||
389 | 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, | ||
390 | 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, | ||
391 | 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, | ||
392 | 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, | ||
393 | 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, | ||
394 | 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, | ||
395 | 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, | ||
396 | 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, | ||
397 | 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, | ||
398 | 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, | ||
399 | 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, | ||
400 | 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, | ||
401 | 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, | ||
402 | 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, | ||
403 | 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, | ||
404 | 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, | ||
405 | 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, | ||
406 | 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, | ||
407 | 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, | ||
408 | 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, | ||
409 | 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, | ||
410 | 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, | ||
411 | 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, | ||
412 | 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, | ||
413 | 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, | ||
414 | 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, | ||
415 | 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, | ||
416 | 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, | ||
417 | 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, | ||
418 | 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, | ||
419 | 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, | ||
420 | 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, | ||
421 | 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, | ||
422 | 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, | ||
423 | 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, | ||
424 | 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, | ||
425 | 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, | ||
426 | 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, | ||
427 | 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, | ||
428 | 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, | ||
429 | 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, | ||
430 | 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, | ||
431 | 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, | ||
432 | 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, | ||
433 | 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, | ||
434 | 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, | ||
435 | 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, | ||
436 | 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, | ||
437 | 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, | ||
438 | 0xf10605deUL | ||
439 | #endif | ||
440 | } | ||
441 | }; | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.c deleted file mode 100644 index 89778e5..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.c +++ /dev/null | |||
@@ -1,1965 +0,0 @@ | |||
1 | /* deflate.c -- compress data using the deflation algorithm | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * ALGORITHM | ||
8 | * | ||
9 | * The "deflation" process depends on being able to identify portions | ||
10 | * of the input text which are identical to earlier input (within a | ||
11 | * sliding window trailing behind the input currently being processed). | ||
12 | * | ||
13 | * The most straightforward technique turns out to be the fastest for | ||
14 | * most input files: try all possible matches and select the longest. | ||
15 | * The key feature of this algorithm is that insertions into the string | ||
16 | * dictionary are very simple and thus fast, and deletions are avoided | ||
17 | * completely. Insertions are performed at each input character, whereas | ||
18 | * string matches are performed only when the previous match ends. So it | ||
19 | * is preferable to spend more time in matches to allow very fast string | ||
20 | * insertions and avoid deletions. The matching algorithm for small | ||
21 | * strings is inspired from that of Rabin & Karp. A brute force approach | ||
22 | * is used to find longer strings when a small match has been found. | ||
23 | * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze | ||
24 | * (by Leonid Broukhis). | ||
25 | * A previous version of this file used a more sophisticated algorithm | ||
26 | * (by Fiala and Greene) which is guaranteed to run in linear amortized | ||
27 | * time, but has a larger average cost, uses more memory and is patented. | ||
28 | * However the F&G algorithm may be faster for some highly redundant | ||
29 | * files if the parameter max_chain_length (described below) is too large. | ||
30 | * | ||
31 | * ACKNOWLEDGEMENTS | ||
32 | * | ||
33 | * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and | ||
34 | * I found it in 'freeze' written by Leonid Broukhis. | ||
35 | * Thanks to many people for bug reports and testing. | ||
36 | * | ||
37 | * REFERENCES | ||
38 | * | ||
39 | * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". | ||
40 | * Available in http://tools.ietf.org/html/rfc1951 | ||
41 | * | ||
42 | * A description of the Rabin and Karp algorithm is given in the book | ||
43 | * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. | ||
44 | * | ||
45 | * Fiala,E.R., and Greene,D.H. | ||
46 | * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 | ||
47 | * | ||
48 | */ | ||
49 | |||
50 | /* @(#) $Id$ */ | ||
51 | |||
52 | #include "deflate.h" | ||
53 | |||
54 | const char deflate_copyright[] = | ||
55 | " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; | ||
56 | /* | ||
57 | If you use the zlib library in a product, an acknowledgment is welcome | ||
58 | in the documentation of your product. If for some reason you cannot | ||
59 | include such an acknowledgment, I would appreciate that you keep this | ||
60 | copyright string in the executable of your product. | ||
61 | */ | ||
62 | |||
63 | /* =========================================================================== | ||
64 | * Function prototypes. | ||
65 | */ | ||
66 | typedef enum { | ||
67 | need_more, /* block not completed, need more input or more output */ | ||
68 | block_done, /* block flush performed */ | ||
69 | finish_started, /* finish started, need only more output at next deflate */ | ||
70 | finish_done /* finish done, accept no more input or output */ | ||
71 | } block_state; | ||
72 | |||
73 | typedef block_state (*compress_func) OF((deflate_state *s, int flush)); | ||
74 | /* Compression function. Returns the block state after the call. */ | ||
75 | |||
76 | local void fill_window OF((deflate_state *s)); | ||
77 | local block_state deflate_stored OF((deflate_state *s, int flush)); | ||
78 | local block_state deflate_fast OF((deflate_state *s, int flush)); | ||
79 | #ifndef FASTEST | ||
80 | local block_state deflate_slow OF((deflate_state *s, int flush)); | ||
81 | #endif | ||
82 | local block_state deflate_rle OF((deflate_state *s, int flush)); | ||
83 | local block_state deflate_huff OF((deflate_state *s, int flush)); | ||
84 | local void lm_init OF((deflate_state *s)); | ||
85 | local void putShortMSB OF((deflate_state *s, uInt b)); | ||
86 | local void flush_pending OF((z_streamp strm)); | ||
87 | local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); | ||
88 | #ifdef ASMV | ||
89 | void match_init OF((void)); /* asm code initialization */ | ||
90 | uInt longest_match OF((deflate_state *s, IPos cur_match)); | ||
91 | #else | ||
92 | local uInt longest_match OF((deflate_state *s, IPos cur_match)); | ||
93 | #endif | ||
94 | |||
95 | #ifdef DEBUG | ||
96 | local void check_match OF((deflate_state *s, IPos start, IPos match, | ||
97 | int length)); | ||
98 | #endif | ||
99 | |||
100 | /* =========================================================================== | ||
101 | * Local data | ||
102 | */ | ||
103 | |||
104 | #define NIL 0 | ||
105 | /* Tail of hash chains */ | ||
106 | |||
107 | #ifndef TOO_FAR | ||
108 | # define TOO_FAR 4096 | ||
109 | #endif | ||
110 | /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ | ||
111 | |||
112 | /* Values for max_lazy_match, good_match and max_chain_length, depending on | ||
113 | * the desired pack level (0..9). The values given below have been tuned to | ||
114 | * exclude worst case performance for pathological files. Better values may be | ||
115 | * found for specific files. | ||
116 | */ | ||
117 | typedef struct config_s { | ||
118 | ush good_length; /* reduce lazy search above this match length */ | ||
119 | ush max_lazy; /* do not perform lazy search above this match length */ | ||
120 | ush nice_length; /* quit search above this match length */ | ||
121 | ush max_chain; | ||
122 | compress_func func; | ||
123 | } config; | ||
124 | |||
125 | #ifdef FASTEST | ||
126 | local const config configuration_table[2] = { | ||
127 | /* good lazy nice chain */ | ||
128 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ | ||
129 | /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ | ||
130 | #else | ||
131 | local const config configuration_table[10] = { | ||
132 | /* good lazy nice chain */ | ||
133 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ | ||
134 | /* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ | ||
135 | /* 2 */ {4, 5, 16, 8, deflate_fast}, | ||
136 | /* 3 */ {4, 6, 32, 32, deflate_fast}, | ||
137 | |||
138 | /* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ | ||
139 | /* 5 */ {8, 16, 32, 32, deflate_slow}, | ||
140 | /* 6 */ {8, 16, 128, 128, deflate_slow}, | ||
141 | /* 7 */ {8, 32, 128, 256, deflate_slow}, | ||
142 | /* 8 */ {32, 128, 258, 1024, deflate_slow}, | ||
143 | /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ | ||
144 | #endif | ||
145 | |||
146 | /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 | ||
147 | * For deflate_fast() (levels <= 3) good is ignored and lazy has a different | ||
148 | * meaning. | ||
149 | */ | ||
150 | |||
151 | #define EQUAL 0 | ||
152 | /* result of memcmp for equal strings */ | ||
153 | |||
154 | #ifndef NO_DUMMY_DECL | ||
155 | struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | ||
156 | #endif | ||
157 | |||
158 | /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ | ||
159 | #define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) | ||
160 | |||
161 | /* =========================================================================== | ||
162 | * Update a hash value with the given input byte | ||
163 | * IN assertion: all calls to to UPDATE_HASH are made with consecutive | ||
164 | * input characters, so that a running hash key can be computed from the | ||
165 | * previous key instead of complete recalculation each time. | ||
166 | */ | ||
167 | #define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask) | ||
168 | |||
169 | |||
170 | /* =========================================================================== | ||
171 | * Insert string str in the dictionary and set match_head to the previous head | ||
172 | * of the hash chain (the most recent string with same hash key). Return | ||
173 | * the previous length of the hash chain. | ||
174 | * If this file is compiled with -DFASTEST, the compression level is forced | ||
175 | * to 1, and no hash chains are maintained. | ||
176 | * IN assertion: all calls to to INSERT_STRING are made with consecutive | ||
177 | * input characters and the first MIN_MATCH bytes of str are valid | ||
178 | * (except for the last MIN_MATCH-1 bytes of the input file). | ||
179 | */ | ||
180 | #ifdef FASTEST | ||
181 | #define INSERT_STRING(s, str, match_head) \ | ||
182 | (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ | ||
183 | match_head = s->head[s->ins_h], \ | ||
184 | s->head[s->ins_h] = (Pos)(str)) | ||
185 | #else | ||
186 | #define INSERT_STRING(s, str, match_head) \ | ||
187 | (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ | ||
188 | match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ | ||
189 | s->head[s->ins_h] = (Pos)(str)) | ||
190 | #endif | ||
191 | |||
192 | /* =========================================================================== | ||
193 | * Initialize the hash table (avoiding 64K overflow for 16 bit systems). | ||
194 | * prev[] will be initialized on the fly. | ||
195 | */ | ||
196 | #define CLEAR_HASH(s) \ | ||
197 | s->head[s->hash_size-1] = NIL; \ | ||
198 | zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); | ||
199 | |||
200 | /* ========================================================================= */ | ||
201 | int ZEXPORT deflateInit_(strm, level, version, stream_size) | ||
202 | z_streamp strm; | ||
203 | int level; | ||
204 | const char *version; | ||
205 | int stream_size; | ||
206 | { | ||
207 | return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, | ||
208 | Z_DEFAULT_STRATEGY, version, stream_size); | ||
209 | /* To do: ignore strm->next_in if we use it as window */ | ||
210 | } | ||
211 | |||
212 | /* ========================================================================= */ | ||
213 | int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | ||
214 | version, stream_size) | ||
215 | z_streamp strm; | ||
216 | int level; | ||
217 | int method; | ||
218 | int windowBits; | ||
219 | int memLevel; | ||
220 | int strategy; | ||
221 | const char *version; | ||
222 | int stream_size; | ||
223 | { | ||
224 | deflate_state *s; | ||
225 | int wrap = 1; | ||
226 | static const char my_version[] = ZLIB_VERSION; | ||
227 | |||
228 | ushf *overlay; | ||
229 | /* We overlay pending_buf and d_buf+l_buf. This works since the average | ||
230 | * output size for (length,distance) codes is <= 24 bits. | ||
231 | */ | ||
232 | |||
233 | if (version == Z_NULL || version[0] != my_version[0] || | ||
234 | stream_size != sizeof(z_stream)) { | ||
235 | return Z_VERSION_ERROR; | ||
236 | } | ||
237 | if (strm == Z_NULL) return Z_STREAM_ERROR; | ||
238 | |||
239 | strm->msg = Z_NULL; | ||
240 | if (strm->zalloc == (alloc_func)0) { | ||
241 | #ifdef Z_SOLO | ||
242 | return Z_STREAM_ERROR; | ||
243 | #else | ||
244 | strm->zalloc = zcalloc; | ||
245 | strm->opaque = (voidpf)0; | ||
246 | #endif | ||
247 | } | ||
248 | if (strm->zfree == (free_func)0) | ||
249 | #ifdef Z_SOLO | ||
250 | return Z_STREAM_ERROR; | ||
251 | #else | ||
252 | strm->zfree = zcfree; | ||
253 | #endif | ||
254 | |||
255 | #ifdef FASTEST | ||
256 | if (level != 0) level = 1; | ||
257 | #else | ||
258 | if (level == Z_DEFAULT_COMPRESSION) level = 6; | ||
259 | #endif | ||
260 | |||
261 | if (windowBits < 0) { /* suppress zlib wrapper */ | ||
262 | wrap = 0; | ||
263 | windowBits = -windowBits; | ||
264 | } | ||
265 | #ifdef GZIP | ||
266 | else if (windowBits > 15) { | ||
267 | wrap = 2; /* write gzip wrapper instead */ | ||
268 | windowBits -= 16; | ||
269 | } | ||
270 | #endif | ||
271 | if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || | ||
272 | windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || | ||
273 | strategy < 0 || strategy > Z_FIXED) { | ||
274 | return Z_STREAM_ERROR; | ||
275 | } | ||
276 | if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ | ||
277 | s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); | ||
278 | if (s == Z_NULL) return Z_MEM_ERROR; | ||
279 | strm->state = (struct internal_state FAR *)s; | ||
280 | s->strm = strm; | ||
281 | |||
282 | s->wrap = wrap; | ||
283 | s->gzhead = Z_NULL; | ||
284 | s->w_bits = windowBits; | ||
285 | s->w_size = 1 << s->w_bits; | ||
286 | s->w_mask = s->w_size - 1; | ||
287 | |||
288 | s->hash_bits = memLevel + 7; | ||
289 | s->hash_size = 1 << s->hash_bits; | ||
290 | s->hash_mask = s->hash_size - 1; | ||
291 | s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); | ||
292 | |||
293 | s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); | ||
294 | s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); | ||
295 | s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); | ||
296 | |||
297 | s->high_water = 0; /* nothing written to s->window yet */ | ||
298 | |||
299 | s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ | ||
300 | |||
301 | overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); | ||
302 | s->pending_buf = (uchf *) overlay; | ||
303 | s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); | ||
304 | |||
305 | if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || | ||
306 | s->pending_buf == Z_NULL) { | ||
307 | s->status = FINISH_STATE; | ||
308 | strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); | ||
309 | deflateEnd (strm); | ||
310 | return Z_MEM_ERROR; | ||
311 | } | ||
312 | s->d_buf = overlay + s->lit_bufsize/sizeof(ush); | ||
313 | s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; | ||
314 | |||
315 | s->level = level; | ||
316 | s->strategy = strategy; | ||
317 | s->method = (Byte)method; | ||
318 | |||
319 | return deflateReset(strm); | ||
320 | } | ||
321 | |||
322 | /* ========================================================================= */ | ||
323 | int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | ||
324 | z_streamp strm; | ||
325 | const Bytef *dictionary; | ||
326 | uInt dictLength; | ||
327 | { | ||
328 | deflate_state *s; | ||
329 | uInt str, n; | ||
330 | int wrap; | ||
331 | unsigned avail; | ||
332 | unsigned char *next; | ||
333 | |||
334 | if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) | ||
335 | return Z_STREAM_ERROR; | ||
336 | s = strm->state; | ||
337 | wrap = s->wrap; | ||
338 | if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) | ||
339 | return Z_STREAM_ERROR; | ||
340 | |||
341 | /* when using zlib wrappers, compute Adler-32 for provided dictionary */ | ||
342 | if (wrap == 1) | ||
343 | strm->adler = adler32(strm->adler, dictionary, dictLength); | ||
344 | s->wrap = 0; /* avoid computing Adler-32 in read_buf */ | ||
345 | |||
346 | /* if dictionary would fill window, just replace the history */ | ||
347 | if (dictLength >= s->w_size) { | ||
348 | if (wrap == 0) { /* already empty otherwise */ | ||
349 | CLEAR_HASH(s); | ||
350 | s->strstart = 0; | ||
351 | s->block_start = 0L; | ||
352 | s->insert = 0; | ||
353 | } | ||
354 | dictionary += dictLength - s->w_size; /* use the tail */ | ||
355 | dictLength = s->w_size; | ||
356 | } | ||
357 | |||
358 | /* insert dictionary into window and hash */ | ||
359 | avail = strm->avail_in; | ||
360 | next = strm->next_in; | ||
361 | strm->avail_in = dictLength; | ||
362 | strm->next_in = (Bytef *)dictionary; | ||
363 | fill_window(s); | ||
364 | while (s->lookahead >= MIN_MATCH) { | ||
365 | str = s->strstart; | ||
366 | n = s->lookahead - (MIN_MATCH-1); | ||
367 | do { | ||
368 | UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); | ||
369 | #ifndef FASTEST | ||
370 | s->prev[str & s->w_mask] = s->head[s->ins_h]; | ||
371 | #endif | ||
372 | s->head[s->ins_h] = (Pos)str; | ||
373 | str++; | ||
374 | } while (--n); | ||
375 | s->strstart = str; | ||
376 | s->lookahead = MIN_MATCH-1; | ||
377 | fill_window(s); | ||
378 | } | ||
379 | s->strstart += s->lookahead; | ||
380 | s->block_start = (long)s->strstart; | ||
381 | s->insert = s->lookahead; | ||
382 | s->lookahead = 0; | ||
383 | s->match_length = s->prev_length = MIN_MATCH-1; | ||
384 | s->match_available = 0; | ||
385 | strm->next_in = next; | ||
386 | strm->avail_in = avail; | ||
387 | s->wrap = wrap; | ||
388 | return Z_OK; | ||
389 | } | ||
390 | |||
391 | /* ========================================================================= */ | ||
392 | int ZEXPORT deflateResetKeep (strm) | ||
393 | z_streamp strm; | ||
394 | { | ||
395 | deflate_state *s; | ||
396 | |||
397 | if (strm == Z_NULL || strm->state == Z_NULL || | ||
398 | strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { | ||
399 | return Z_STREAM_ERROR; | ||
400 | } | ||
401 | |||
402 | strm->total_in = strm->total_out = 0; | ||
403 | strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ | ||
404 | strm->data_type = Z_UNKNOWN; | ||
405 | |||
406 | s = (deflate_state *)strm->state; | ||
407 | s->pending = 0; | ||
408 | s->pending_out = s->pending_buf; | ||
409 | |||
410 | if (s->wrap < 0) { | ||
411 | s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ | ||
412 | } | ||
413 | s->status = s->wrap ? INIT_STATE : BUSY_STATE; | ||
414 | strm->adler = | ||
415 | #ifdef GZIP | ||
416 | s->wrap == 2 ? crc32(0L, Z_NULL, 0) : | ||
417 | #endif | ||
418 | adler32(0L, Z_NULL, 0); | ||
419 | s->last_flush = Z_NO_FLUSH; | ||
420 | |||
421 | _tr_init(s); | ||
422 | |||
423 | return Z_OK; | ||
424 | } | ||
425 | |||
426 | /* ========================================================================= */ | ||
427 | int ZEXPORT deflateReset (strm) | ||
428 | z_streamp strm; | ||
429 | { | ||
430 | int ret; | ||
431 | |||
432 | ret = deflateResetKeep(strm); | ||
433 | if (ret == Z_OK) | ||
434 | lm_init(strm->state); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
438 | /* ========================================================================= */ | ||
439 | int ZEXPORT deflateSetHeader (strm, head) | ||
440 | z_streamp strm; | ||
441 | gz_headerp head; | ||
442 | { | ||
443 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
444 | if (strm->state->wrap != 2) return Z_STREAM_ERROR; | ||
445 | strm->state->gzhead = head; | ||
446 | return Z_OK; | ||
447 | } | ||
448 | |||
449 | /* ========================================================================= */ | ||
450 | int ZEXPORT deflatePending (strm, pending, bits) | ||
451 | unsigned *pending; | ||
452 | int *bits; | ||
453 | z_streamp strm; | ||
454 | { | ||
455 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
456 | if (pending != Z_NULL) | ||
457 | *pending = strm->state->pending; | ||
458 | if (bits != Z_NULL) | ||
459 | *bits = strm->state->bi_valid; | ||
460 | return Z_OK; | ||
461 | } | ||
462 | |||
463 | /* ========================================================================= */ | ||
464 | int ZEXPORT deflatePrime (strm, bits, value) | ||
465 | z_streamp strm; | ||
466 | int bits; | ||
467 | int value; | ||
468 | { | ||
469 | deflate_state *s; | ||
470 | int put; | ||
471 | |||
472 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
473 | s = strm->state; | ||
474 | if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) | ||
475 | return Z_BUF_ERROR; | ||
476 | do { | ||
477 | put = Buf_size - s->bi_valid; | ||
478 | if (put > bits) | ||
479 | put = bits; | ||
480 | s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); | ||
481 | s->bi_valid += put; | ||
482 | _tr_flush_bits(s); | ||
483 | value >>= put; | ||
484 | bits -= put; | ||
485 | } while (bits); | ||
486 | return Z_OK; | ||
487 | } | ||
488 | |||
489 | /* ========================================================================= */ | ||
490 | int ZEXPORT deflateParams(strm, level, strategy) | ||
491 | z_streamp strm; | ||
492 | int level; | ||
493 | int strategy; | ||
494 | { | ||
495 | deflate_state *s; | ||
496 | compress_func func; | ||
497 | int err = Z_OK; | ||
498 | |||
499 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
500 | s = strm->state; | ||
501 | |||
502 | #ifdef FASTEST | ||
503 | if (level != 0) level = 1; | ||
504 | #else | ||
505 | if (level == Z_DEFAULT_COMPRESSION) level = 6; | ||
506 | #endif | ||
507 | if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { | ||
508 | return Z_STREAM_ERROR; | ||
509 | } | ||
510 | func = configuration_table[s->level].func; | ||
511 | |||
512 | if ((strategy != s->strategy || func != configuration_table[level].func) && | ||
513 | strm->total_in != 0) { | ||
514 | /* Flush the last buffer: */ | ||
515 | err = deflate(strm, Z_BLOCK); | ||
516 | } | ||
517 | if (s->level != level) { | ||
518 | s->level = level; | ||
519 | s->max_lazy_match = configuration_table[level].max_lazy; | ||
520 | s->good_match = configuration_table[level].good_length; | ||
521 | s->nice_match = configuration_table[level].nice_length; | ||
522 | s->max_chain_length = configuration_table[level].max_chain; | ||
523 | } | ||
524 | s->strategy = strategy; | ||
525 | return err; | ||
526 | } | ||
527 | |||
528 | /* ========================================================================= */ | ||
529 | int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) | ||
530 | z_streamp strm; | ||
531 | int good_length; | ||
532 | int max_lazy; | ||
533 | int nice_length; | ||
534 | int max_chain; | ||
535 | { | ||
536 | deflate_state *s; | ||
537 | |||
538 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
539 | s = strm->state; | ||
540 | s->good_match = good_length; | ||
541 | s->max_lazy_match = max_lazy; | ||
542 | s->nice_match = nice_length; | ||
543 | s->max_chain_length = max_chain; | ||
544 | return Z_OK; | ||
545 | } | ||
546 | |||
547 | /* ========================================================================= | ||
548 | * For the default windowBits of 15 and memLevel of 8, this function returns | ||
549 | * a close to exact, as well as small, upper bound on the compressed size. | ||
550 | * They are coded as constants here for a reason--if the #define's are | ||
551 | * changed, then this function needs to be changed as well. The return | ||
552 | * value for 15 and 8 only works for those exact settings. | ||
553 | * | ||
554 | * For any setting other than those defaults for windowBits and memLevel, | ||
555 | * the value returned is a conservative worst case for the maximum expansion | ||
556 | * resulting from using fixed blocks instead of stored blocks, which deflate | ||
557 | * can emit on compressed data for some combinations of the parameters. | ||
558 | * | ||
559 | * This function could be more sophisticated to provide closer upper bounds for | ||
560 | * every combination of windowBits and memLevel. But even the conservative | ||
561 | * upper bound of about 14% expansion does not seem onerous for output buffer | ||
562 | * allocation. | ||
563 | */ | ||
564 | uLong ZEXPORT deflateBound(strm, sourceLen) | ||
565 | z_streamp strm; | ||
566 | uLong sourceLen; | ||
567 | { | ||
568 | deflate_state *s; | ||
569 | uLong complen, wraplen; | ||
570 | Bytef *str; | ||
571 | |||
572 | /* conservative upper bound for compressed data */ | ||
573 | complen = sourceLen + | ||
574 | ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; | ||
575 | |||
576 | /* if can't get parameters, return conservative bound plus zlib wrapper */ | ||
577 | if (strm == Z_NULL || strm->state == Z_NULL) | ||
578 | return complen + 6; | ||
579 | |||
580 | /* compute wrapper length */ | ||
581 | s = strm->state; | ||
582 | switch (s->wrap) { | ||
583 | case 0: /* raw deflate */ | ||
584 | wraplen = 0; | ||
585 | break; | ||
586 | case 1: /* zlib wrapper */ | ||
587 | wraplen = 6 + (s->strstart ? 4 : 0); | ||
588 | break; | ||
589 | case 2: /* gzip wrapper */ | ||
590 | wraplen = 18; | ||
591 | if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ | ||
592 | if (s->gzhead->extra != Z_NULL) | ||
593 | wraplen += 2 + s->gzhead->extra_len; | ||
594 | str = s->gzhead->name; | ||
595 | if (str != Z_NULL) | ||
596 | do { | ||
597 | wraplen++; | ||
598 | } while (*str++); | ||
599 | str = s->gzhead->comment; | ||
600 | if (str != Z_NULL) | ||
601 | do { | ||
602 | wraplen++; | ||
603 | } while (*str++); | ||
604 | if (s->gzhead->hcrc) | ||
605 | wraplen += 2; | ||
606 | } | ||
607 | break; | ||
608 | default: /* for compiler happiness */ | ||
609 | wraplen = 6; | ||
610 | } | ||
611 | |||
612 | /* if not default parameters, return conservative bound */ | ||
613 | if (s->w_bits != 15 || s->hash_bits != 8 + 7) | ||
614 | return complen + wraplen; | ||
615 | |||
616 | /* default settings: return tight bound for that case */ | ||
617 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + | ||
618 | (sourceLen >> 25) + 13 - 6 + wraplen; | ||
619 | } | ||
620 | |||
621 | /* ========================================================================= | ||
622 | * Put a short in the pending buffer. The 16-bit value is put in MSB order. | ||
623 | * IN assertion: the stream state is correct and there is enough room in | ||
624 | * pending_buf. | ||
625 | */ | ||
626 | local void putShortMSB (s, b) | ||
627 | deflate_state *s; | ||
628 | uInt b; | ||
629 | { | ||
630 | put_byte(s, (Byte)(b >> 8)); | ||
631 | put_byte(s, (Byte)(b & 0xff)); | ||
632 | } | ||
633 | |||
634 | /* ========================================================================= | ||
635 | * Flush as much pending output as possible. All deflate() output goes | ||
636 | * through this function so some applications may wish to modify it | ||
637 | * to avoid allocating a large strm->next_out buffer and copying into it. | ||
638 | * (See also read_buf()). | ||
639 | */ | ||
640 | local void flush_pending(strm) | ||
641 | z_streamp strm; | ||
642 | { | ||
643 | unsigned len; | ||
644 | deflate_state *s = strm->state; | ||
645 | |||
646 | _tr_flush_bits(s); | ||
647 | len = s->pending; | ||
648 | if (len > strm->avail_out) len = strm->avail_out; | ||
649 | if (len == 0) return; | ||
650 | |||
651 | zmemcpy(strm->next_out, s->pending_out, len); | ||
652 | strm->next_out += len; | ||
653 | s->pending_out += len; | ||
654 | strm->total_out += len; | ||
655 | strm->avail_out -= len; | ||
656 | s->pending -= len; | ||
657 | if (s->pending == 0) { | ||
658 | s->pending_out = s->pending_buf; | ||
659 | } | ||
660 | } | ||
661 | |||
662 | /* ========================================================================= */ | ||
663 | int ZEXPORT deflate (strm, flush) | ||
664 | z_streamp strm; | ||
665 | int flush; | ||
666 | { | ||
667 | int old_flush; /* value of flush param for previous deflate call */ | ||
668 | deflate_state *s; | ||
669 | |||
670 | if (strm == Z_NULL || strm->state == Z_NULL || | ||
671 | flush > Z_BLOCK || flush < 0) { | ||
672 | return Z_STREAM_ERROR; | ||
673 | } | ||
674 | s = strm->state; | ||
675 | |||
676 | if (strm->next_out == Z_NULL || | ||
677 | (strm->next_in == Z_NULL && strm->avail_in != 0) || | ||
678 | (s->status == FINISH_STATE && flush != Z_FINISH)) { | ||
679 | ERR_RETURN(strm, Z_STREAM_ERROR); | ||
680 | } | ||
681 | if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); | ||
682 | |||
683 | s->strm = strm; /* just in case */ | ||
684 | old_flush = s->last_flush; | ||
685 | s->last_flush = flush; | ||
686 | |||
687 | /* Write the header */ | ||
688 | if (s->status == INIT_STATE) { | ||
689 | #ifdef GZIP | ||
690 | if (s->wrap == 2) { | ||
691 | strm->adler = crc32(0L, Z_NULL, 0); | ||
692 | put_byte(s, 31); | ||
693 | put_byte(s, 139); | ||
694 | put_byte(s, 8); | ||
695 | if (s->gzhead == Z_NULL) { | ||
696 | put_byte(s, 0); | ||
697 | put_byte(s, 0); | ||
698 | put_byte(s, 0); | ||
699 | put_byte(s, 0); | ||
700 | put_byte(s, 0); | ||
701 | put_byte(s, s->level == 9 ? 2 : | ||
702 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? | ||
703 | 4 : 0)); | ||
704 | put_byte(s, OS_CODE); | ||
705 | s->status = BUSY_STATE; | ||
706 | } | ||
707 | else { | ||
708 | put_byte(s, (s->gzhead->text ? 1 : 0) + | ||
709 | (s->gzhead->hcrc ? 2 : 0) + | ||
710 | (s->gzhead->extra == Z_NULL ? 0 : 4) + | ||
711 | (s->gzhead->name == Z_NULL ? 0 : 8) + | ||
712 | (s->gzhead->comment == Z_NULL ? 0 : 16) | ||
713 | ); | ||
714 | put_byte(s, (Byte)(s->gzhead->time & 0xff)); | ||
715 | put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); | ||
716 | put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); | ||
717 | put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); | ||
718 | put_byte(s, s->level == 9 ? 2 : | ||
719 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? | ||
720 | 4 : 0)); | ||
721 | put_byte(s, s->gzhead->os & 0xff); | ||
722 | if (s->gzhead->extra != Z_NULL) { | ||
723 | put_byte(s, s->gzhead->extra_len & 0xff); | ||
724 | put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); | ||
725 | } | ||
726 | if (s->gzhead->hcrc) | ||
727 | strm->adler = crc32(strm->adler, s->pending_buf, | ||
728 | s->pending); | ||
729 | s->gzindex = 0; | ||
730 | s->status = EXTRA_STATE; | ||
731 | } | ||
732 | } | ||
733 | else | ||
734 | #endif | ||
735 | { | ||
736 | uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; | ||
737 | uInt level_flags; | ||
738 | |||
739 | if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) | ||
740 | level_flags = 0; | ||
741 | else if (s->level < 6) | ||
742 | level_flags = 1; | ||
743 | else if (s->level == 6) | ||
744 | level_flags = 2; | ||
745 | else | ||
746 | level_flags = 3; | ||
747 | header |= (level_flags << 6); | ||
748 | if (s->strstart != 0) header |= PRESET_DICT; | ||
749 | header += 31 - (header % 31); | ||
750 | |||
751 | s->status = BUSY_STATE; | ||
752 | putShortMSB(s, header); | ||
753 | |||
754 | /* Save the adler32 of the preset dictionary: */ | ||
755 | if (s->strstart != 0) { | ||
756 | putShortMSB(s, (uInt)(strm->adler >> 16)); | ||
757 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||
758 | } | ||
759 | strm->adler = adler32(0L, Z_NULL, 0); | ||
760 | } | ||
761 | } | ||
762 | #ifdef GZIP | ||
763 | if (s->status == EXTRA_STATE) { | ||
764 | if (s->gzhead->extra != Z_NULL) { | ||
765 | uInt beg = s->pending; /* start of bytes to update crc */ | ||
766 | |||
767 | while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { | ||
768 | if (s->pending == s->pending_buf_size) { | ||
769 | if (s->gzhead->hcrc && s->pending > beg) | ||
770 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
771 | s->pending - beg); | ||
772 | flush_pending(strm); | ||
773 | beg = s->pending; | ||
774 | if (s->pending == s->pending_buf_size) | ||
775 | break; | ||
776 | } | ||
777 | put_byte(s, s->gzhead->extra[s->gzindex]); | ||
778 | s->gzindex++; | ||
779 | } | ||
780 | if (s->gzhead->hcrc && s->pending > beg) | ||
781 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
782 | s->pending - beg); | ||
783 | if (s->gzindex == s->gzhead->extra_len) { | ||
784 | s->gzindex = 0; | ||
785 | s->status = NAME_STATE; | ||
786 | } | ||
787 | } | ||
788 | else | ||
789 | s->status = NAME_STATE; | ||
790 | } | ||
791 | if (s->status == NAME_STATE) { | ||
792 | if (s->gzhead->name != Z_NULL) { | ||
793 | uInt beg = s->pending; /* start of bytes to update crc */ | ||
794 | int val; | ||
795 | |||
796 | do { | ||
797 | if (s->pending == s->pending_buf_size) { | ||
798 | if (s->gzhead->hcrc && s->pending > beg) | ||
799 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
800 | s->pending - beg); | ||
801 | flush_pending(strm); | ||
802 | beg = s->pending; | ||
803 | if (s->pending == s->pending_buf_size) { | ||
804 | val = 1; | ||
805 | break; | ||
806 | } | ||
807 | } | ||
808 | val = s->gzhead->name[s->gzindex++]; | ||
809 | put_byte(s, val); | ||
810 | } while (val != 0); | ||
811 | if (s->gzhead->hcrc && s->pending > beg) | ||
812 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
813 | s->pending - beg); | ||
814 | if (val == 0) { | ||
815 | s->gzindex = 0; | ||
816 | s->status = COMMENT_STATE; | ||
817 | } | ||
818 | } | ||
819 | else | ||
820 | s->status = COMMENT_STATE; | ||
821 | } | ||
822 | if (s->status == COMMENT_STATE) { | ||
823 | if (s->gzhead->comment != Z_NULL) { | ||
824 | uInt beg = s->pending; /* start of bytes to update crc */ | ||
825 | int val; | ||
826 | |||
827 | do { | ||
828 | if (s->pending == s->pending_buf_size) { | ||
829 | if (s->gzhead->hcrc && s->pending > beg) | ||
830 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
831 | s->pending - beg); | ||
832 | flush_pending(strm); | ||
833 | beg = s->pending; | ||
834 | if (s->pending == s->pending_buf_size) { | ||
835 | val = 1; | ||
836 | break; | ||
837 | } | ||
838 | } | ||
839 | val = s->gzhead->comment[s->gzindex++]; | ||
840 | put_byte(s, val); | ||
841 | } while (val != 0); | ||
842 | if (s->gzhead->hcrc && s->pending > beg) | ||
843 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
844 | s->pending - beg); | ||
845 | if (val == 0) | ||
846 | s->status = HCRC_STATE; | ||
847 | } | ||
848 | else | ||
849 | s->status = HCRC_STATE; | ||
850 | } | ||
851 | if (s->status == HCRC_STATE) { | ||
852 | if (s->gzhead->hcrc) { | ||
853 | if (s->pending + 2 > s->pending_buf_size) | ||
854 | flush_pending(strm); | ||
855 | if (s->pending + 2 <= s->pending_buf_size) { | ||
856 | put_byte(s, (Byte)(strm->adler & 0xff)); | ||
857 | put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); | ||
858 | strm->adler = crc32(0L, Z_NULL, 0); | ||
859 | s->status = BUSY_STATE; | ||
860 | } | ||
861 | } | ||
862 | else | ||
863 | s->status = BUSY_STATE; | ||
864 | } | ||
865 | #endif | ||
866 | |||
867 | /* Flush as much pending output as possible */ | ||
868 | if (s->pending != 0) { | ||
869 | flush_pending(strm); | ||
870 | if (strm->avail_out == 0) { | ||
871 | /* Since avail_out is 0, deflate will be called again with | ||
872 | * more output space, but possibly with both pending and | ||
873 | * avail_in equal to zero. There won't be anything to do, | ||
874 | * but this is not an error situation so make sure we | ||
875 | * return OK instead of BUF_ERROR at next call of deflate: | ||
876 | */ | ||
877 | s->last_flush = -1; | ||
878 | return Z_OK; | ||
879 | } | ||
880 | |||
881 | /* Make sure there is something to do and avoid duplicate consecutive | ||
882 | * flushes. For repeated and useless calls with Z_FINISH, we keep | ||
883 | * returning Z_STREAM_END instead of Z_BUF_ERROR. | ||
884 | */ | ||
885 | } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && | ||
886 | flush != Z_FINISH) { | ||
887 | ERR_RETURN(strm, Z_BUF_ERROR); | ||
888 | } | ||
889 | |||
890 | /* User must not provide more input after the first FINISH: */ | ||
891 | if (s->status == FINISH_STATE && strm->avail_in != 0) { | ||
892 | ERR_RETURN(strm, Z_BUF_ERROR); | ||
893 | } | ||
894 | |||
895 | /* Start a new block or continue the current one. | ||
896 | */ | ||
897 | if (strm->avail_in != 0 || s->lookahead != 0 || | ||
898 | (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { | ||
899 | block_state bstate; | ||
900 | |||
901 | bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : | ||
902 | (s->strategy == Z_RLE ? deflate_rle(s, flush) : | ||
903 | (*(configuration_table[s->level].func))(s, flush)); | ||
904 | |||
905 | if (bstate == finish_started || bstate == finish_done) { | ||
906 | s->status = FINISH_STATE; | ||
907 | } | ||
908 | if (bstate == need_more || bstate == finish_started) { | ||
909 | if (strm->avail_out == 0) { | ||
910 | s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ | ||
911 | } | ||
912 | return Z_OK; | ||
913 | /* If flush != Z_NO_FLUSH && avail_out == 0, the next call | ||
914 | * of deflate should use the same flush parameter to make sure | ||
915 | * that the flush is complete. So we don't have to output an | ||
916 | * empty block here, this will be done at next call. This also | ||
917 | * ensures that for a very small output buffer, we emit at most | ||
918 | * one empty block. | ||
919 | */ | ||
920 | } | ||
921 | if (bstate == block_done) { | ||
922 | if (flush == Z_PARTIAL_FLUSH) { | ||
923 | _tr_align(s); | ||
924 | } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ | ||
925 | _tr_stored_block(s, (char*)0, 0L, 0); | ||
926 | /* For a full flush, this empty block will be recognized | ||
927 | * as a special marker by inflate_sync(). | ||
928 | */ | ||
929 | if (flush == Z_FULL_FLUSH) { | ||
930 | CLEAR_HASH(s); /* forget history */ | ||
931 | if (s->lookahead == 0) { | ||
932 | s->strstart = 0; | ||
933 | s->block_start = 0L; | ||
934 | s->insert = 0; | ||
935 | } | ||
936 | } | ||
937 | } | ||
938 | flush_pending(strm); | ||
939 | if (strm->avail_out == 0) { | ||
940 | s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ | ||
941 | return Z_OK; | ||
942 | } | ||
943 | } | ||
944 | } | ||
945 | Assert(strm->avail_out > 0, "bug2"); | ||
946 | |||
947 | if (flush != Z_FINISH) return Z_OK; | ||
948 | if (s->wrap <= 0) return Z_STREAM_END; | ||
949 | |||
950 | /* Write the trailer */ | ||
951 | #ifdef GZIP | ||
952 | if (s->wrap == 2) { | ||
953 | put_byte(s, (Byte)(strm->adler & 0xff)); | ||
954 | put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); | ||
955 | put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); | ||
956 | put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); | ||
957 | put_byte(s, (Byte)(strm->total_in & 0xff)); | ||
958 | put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); | ||
959 | put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); | ||
960 | put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); | ||
961 | } | ||
962 | else | ||
963 | #endif | ||
964 | { | ||
965 | putShortMSB(s, (uInt)(strm->adler >> 16)); | ||
966 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||
967 | } | ||
968 | flush_pending(strm); | ||
969 | /* If avail_out is zero, the application will call deflate again | ||
970 | * to flush the rest. | ||
971 | */ | ||
972 | if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ | ||
973 | return s->pending != 0 ? Z_OK : Z_STREAM_END; | ||
974 | } | ||
975 | |||
976 | /* ========================================================================= */ | ||
977 | int ZEXPORT deflateEnd (strm) | ||
978 | z_streamp strm; | ||
979 | { | ||
980 | int status; | ||
981 | |||
982 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
983 | |||
984 | status = strm->state->status; | ||
985 | if (status != INIT_STATE && | ||
986 | status != EXTRA_STATE && | ||
987 | status != NAME_STATE && | ||
988 | status != COMMENT_STATE && | ||
989 | status != HCRC_STATE && | ||
990 | status != BUSY_STATE && | ||
991 | status != FINISH_STATE) { | ||
992 | return Z_STREAM_ERROR; | ||
993 | } | ||
994 | |||
995 | /* Deallocate in reverse order of allocations: */ | ||
996 | TRY_FREE(strm, strm->state->pending_buf); | ||
997 | TRY_FREE(strm, strm->state->head); | ||
998 | TRY_FREE(strm, strm->state->prev); | ||
999 | TRY_FREE(strm, strm->state->window); | ||
1000 | |||
1001 | ZFREE(strm, strm->state); | ||
1002 | strm->state = Z_NULL; | ||
1003 | |||
1004 | return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; | ||
1005 | } | ||
1006 | |||
1007 | /* ========================================================================= | ||
1008 | * Copy the source state to the destination state. | ||
1009 | * To simplify the source, this is not supported for 16-bit MSDOS (which | ||
1010 | * doesn't have enough memory anyway to duplicate compression states). | ||
1011 | */ | ||
1012 | int ZEXPORT deflateCopy (dest, source) | ||
1013 | z_streamp dest; | ||
1014 | z_streamp source; | ||
1015 | { | ||
1016 | #ifdef MAXSEG_64K | ||
1017 | return Z_STREAM_ERROR; | ||
1018 | #else | ||
1019 | deflate_state *ds; | ||
1020 | deflate_state *ss; | ||
1021 | ushf *overlay; | ||
1022 | |||
1023 | |||
1024 | if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { | ||
1025 | return Z_STREAM_ERROR; | ||
1026 | } | ||
1027 | |||
1028 | ss = source->state; | ||
1029 | |||
1030 | zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); | ||
1031 | |||
1032 | ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); | ||
1033 | if (ds == Z_NULL) return Z_MEM_ERROR; | ||
1034 | dest->state = (struct internal_state FAR *) ds; | ||
1035 | zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); | ||
1036 | ds->strm = dest; | ||
1037 | |||
1038 | ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); | ||
1039 | ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); | ||
1040 | ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); | ||
1041 | overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); | ||
1042 | ds->pending_buf = (uchf *) overlay; | ||
1043 | |||
1044 | if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || | ||
1045 | ds->pending_buf == Z_NULL) { | ||
1046 | deflateEnd (dest); | ||
1047 | return Z_MEM_ERROR; | ||
1048 | } | ||
1049 | /* following zmemcpy do not work for 16-bit MSDOS */ | ||
1050 | zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); | ||
1051 | zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); | ||
1052 | zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); | ||
1053 | zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); | ||
1054 | |||
1055 | ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); | ||
1056 | ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); | ||
1057 | ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; | ||
1058 | |||
1059 | ds->l_desc.dyn_tree = ds->dyn_ltree; | ||
1060 | ds->d_desc.dyn_tree = ds->dyn_dtree; | ||
1061 | ds->bl_desc.dyn_tree = ds->bl_tree; | ||
1062 | |||
1063 | return Z_OK; | ||
1064 | #endif /* MAXSEG_64K */ | ||
1065 | } | ||
1066 | |||
1067 | /* =========================================================================== | ||
1068 | * Read a new buffer from the current input stream, update the adler32 | ||
1069 | * and total number of bytes read. All deflate() input goes through | ||
1070 | * this function so some applications may wish to modify it to avoid | ||
1071 | * allocating a large strm->next_in buffer and copying from it. | ||
1072 | * (See also flush_pending()). | ||
1073 | */ | ||
1074 | local int read_buf(strm, buf, size) | ||
1075 | z_streamp strm; | ||
1076 | Bytef *buf; | ||
1077 | unsigned size; | ||
1078 | { | ||
1079 | unsigned len = strm->avail_in; | ||
1080 | |||
1081 | if (len > size) len = size; | ||
1082 | if (len == 0) return 0; | ||
1083 | |||
1084 | strm->avail_in -= len; | ||
1085 | |||
1086 | zmemcpy(buf, strm->next_in, len); | ||
1087 | if (strm->state->wrap == 1) { | ||
1088 | strm->adler = adler32(strm->adler, buf, len); | ||
1089 | } | ||
1090 | #ifdef GZIP | ||
1091 | else if (strm->state->wrap == 2) { | ||
1092 | strm->adler = crc32(strm->adler, buf, len); | ||
1093 | } | ||
1094 | #endif | ||
1095 | strm->next_in += len; | ||
1096 | strm->total_in += len; | ||
1097 | |||
1098 | return (int)len; | ||
1099 | } | ||
1100 | |||
1101 | /* =========================================================================== | ||
1102 | * Initialize the "longest match" routines for a new zlib stream | ||
1103 | */ | ||
1104 | local void lm_init (s) | ||
1105 | deflate_state *s; | ||
1106 | { | ||
1107 | s->window_size = (ulg)2L*s->w_size; | ||
1108 | |||
1109 | CLEAR_HASH(s); | ||
1110 | |||
1111 | /* Set the default configuration parameters: | ||
1112 | */ | ||
1113 | s->max_lazy_match = configuration_table[s->level].max_lazy; | ||
1114 | s->good_match = configuration_table[s->level].good_length; | ||
1115 | s->nice_match = configuration_table[s->level].nice_length; | ||
1116 | s->max_chain_length = configuration_table[s->level].max_chain; | ||
1117 | |||
1118 | s->strstart = 0; | ||
1119 | s->block_start = 0L; | ||
1120 | s->lookahead = 0; | ||
1121 | s->insert = 0; | ||
1122 | s->match_length = s->prev_length = MIN_MATCH-1; | ||
1123 | s->match_available = 0; | ||
1124 | s->ins_h = 0; | ||
1125 | #ifndef FASTEST | ||
1126 | #ifdef ASMV | ||
1127 | match_init(); /* initialize the asm code */ | ||
1128 | #endif | ||
1129 | #endif | ||
1130 | } | ||
1131 | |||
1132 | #ifndef FASTEST | ||
1133 | /* =========================================================================== | ||
1134 | * Set match_start to the longest match starting at the given string and | ||
1135 | * return its length. Matches shorter or equal to prev_length are discarded, | ||
1136 | * in which case the result is equal to prev_length and match_start is | ||
1137 | * garbage. | ||
1138 | * IN assertions: cur_match is the head of the hash chain for the current | ||
1139 | * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 | ||
1140 | * OUT assertion: the match length is not greater than s->lookahead. | ||
1141 | */ | ||
1142 | #ifndef ASMV | ||
1143 | /* For 80x86 and 680x0, an optimized version will be provided in match.asm or | ||
1144 | * match.S. The code will be functionally equivalent. | ||
1145 | */ | ||
1146 | local uInt longest_match(s, cur_match) | ||
1147 | deflate_state *s; | ||
1148 | IPos cur_match; /* current match */ | ||
1149 | { | ||
1150 | unsigned chain_length = s->max_chain_length;/* max hash chain length */ | ||
1151 | register Bytef *scan = s->window + s->strstart; /* current string */ | ||
1152 | register Bytef *match; /* matched string */ | ||
1153 | register int len; /* length of current match */ | ||
1154 | int best_len = s->prev_length; /* best match length so far */ | ||
1155 | int nice_match = s->nice_match; /* stop if match long enough */ | ||
1156 | IPos limit = s->strstart > (IPos)MAX_DIST(s) ? | ||
1157 | s->strstart - (IPos)MAX_DIST(s) : NIL; | ||
1158 | /* Stop when cur_match becomes <= limit. To simplify the code, | ||
1159 | * we prevent matches with the string of window index 0. | ||
1160 | */ | ||
1161 | Posf *prev = s->prev; | ||
1162 | uInt wmask = s->w_mask; | ||
1163 | |||
1164 | #ifdef UNALIGNED_OK | ||
1165 | /* Compare two bytes at a time. Note: this is not always beneficial. | ||
1166 | * Try with and without -DUNALIGNED_OK to check. | ||
1167 | */ | ||
1168 | register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; | ||
1169 | register ush scan_start = *(ushf*)scan; | ||
1170 | register ush scan_end = *(ushf*)(scan+best_len-1); | ||
1171 | #else | ||
1172 | register Bytef *strend = s->window + s->strstart + MAX_MATCH; | ||
1173 | register Byte scan_end1 = scan[best_len-1]; | ||
1174 | register Byte scan_end = scan[best_len]; | ||
1175 | #endif | ||
1176 | |||
1177 | /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. | ||
1178 | * It is easy to get rid of this optimization if necessary. | ||
1179 | */ | ||
1180 | Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); | ||
1181 | |||
1182 | /* Do not waste too much time if we already have a good match: */ | ||
1183 | if (s->prev_length >= s->good_match) { | ||
1184 | chain_length >>= 2; | ||
1185 | } | ||
1186 | /* Do not look for matches beyond the end of the input. This is necessary | ||
1187 | * to make deflate deterministic. | ||
1188 | */ | ||
1189 | if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; | ||
1190 | |||
1191 | Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); | ||
1192 | |||
1193 | do { | ||
1194 | Assert(cur_match < s->strstart, "no future"); | ||
1195 | match = s->window + cur_match; | ||
1196 | |||
1197 | /* Skip to next match if the match length cannot increase | ||
1198 | * or if the match length is less than 2. Note that the checks below | ||
1199 | * for insufficient lookahead only occur occasionally for performance | ||
1200 | * reasons. Therefore uninitialized memory will be accessed, and | ||
1201 | * conditional jumps will be made that depend on those values. | ||
1202 | * However the length of the match is limited to the lookahead, so | ||
1203 | * the output of deflate is not affected by the uninitialized values. | ||
1204 | */ | ||
1205 | #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) | ||
1206 | /* This code assumes sizeof(unsigned short) == 2. Do not use | ||
1207 | * UNALIGNED_OK if your compiler uses a different size. | ||
1208 | */ | ||
1209 | if (*(ushf*)(match+best_len-1) != scan_end || | ||
1210 | *(ushf*)match != scan_start) continue; | ||
1211 | |||
1212 | /* It is not necessary to compare scan[2] and match[2] since they are | ||
1213 | * always equal when the other bytes match, given that the hash keys | ||
1214 | * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at | ||
1215 | * strstart+3, +5, ... up to strstart+257. We check for insufficient | ||
1216 | * lookahead only every 4th comparison; the 128th check will be made | ||
1217 | * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is | ||
1218 | * necessary to put more guard bytes at the end of the window, or | ||
1219 | * to check more often for insufficient lookahead. | ||
1220 | */ | ||
1221 | Assert(scan[2] == match[2], "scan[2]?"); | ||
1222 | scan++, match++; | ||
1223 | do { | ||
1224 | } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||
1225 | *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||
1226 | *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||
1227 | *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||
1228 | scan < strend); | ||
1229 | /* The funny "do {}" generates better code on most compilers */ | ||
1230 | |||
1231 | /* Here, scan <= window+strstart+257 */ | ||
1232 | Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||
1233 | if (*scan == *match) scan++; | ||
1234 | |||
1235 | len = (MAX_MATCH - 1) - (int)(strend-scan); | ||
1236 | scan = strend - (MAX_MATCH-1); | ||
1237 | |||
1238 | #else /* UNALIGNED_OK */ | ||
1239 | |||
1240 | if (match[best_len] != scan_end || | ||
1241 | match[best_len-1] != scan_end1 || | ||
1242 | *match != *scan || | ||
1243 | *++match != scan[1]) continue; | ||
1244 | |||
1245 | /* The check at best_len-1 can be removed because it will be made | ||
1246 | * again later. (This heuristic is not always a win.) | ||
1247 | * It is not necessary to compare scan[2] and match[2] since they | ||
1248 | * are always equal when the other bytes match, given that | ||
1249 | * the hash keys are equal and that HASH_BITS >= 8. | ||
1250 | */ | ||
1251 | scan += 2, match++; | ||
1252 | Assert(*scan == *match, "match[2]?"); | ||
1253 | |||
1254 | /* We check for insufficient lookahead only every 8th comparison; | ||
1255 | * the 256th check will be made at strstart+258. | ||
1256 | */ | ||
1257 | do { | ||
1258 | } while (*++scan == *++match && *++scan == *++match && | ||
1259 | *++scan == *++match && *++scan == *++match && | ||
1260 | *++scan == *++match && *++scan == *++match && | ||
1261 | *++scan == *++match && *++scan == *++match && | ||
1262 | scan < strend); | ||
1263 | |||
1264 | Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||
1265 | |||
1266 | len = MAX_MATCH - (int)(strend - scan); | ||
1267 | scan = strend - MAX_MATCH; | ||
1268 | |||
1269 | #endif /* UNALIGNED_OK */ | ||
1270 | |||
1271 | if (len > best_len) { | ||
1272 | s->match_start = cur_match; | ||
1273 | best_len = len; | ||
1274 | if (len >= nice_match) break; | ||
1275 | #ifdef UNALIGNED_OK | ||
1276 | scan_end = *(ushf*)(scan+best_len-1); | ||
1277 | #else | ||
1278 | scan_end1 = scan[best_len-1]; | ||
1279 | scan_end = scan[best_len]; | ||
1280 | #endif | ||
1281 | } | ||
1282 | } while ((cur_match = prev[cur_match & wmask]) > limit | ||
1283 | && --chain_length != 0); | ||
1284 | |||
1285 | if ((uInt)best_len <= s->lookahead) return (uInt)best_len; | ||
1286 | return s->lookahead; | ||
1287 | } | ||
1288 | #endif /* ASMV */ | ||
1289 | |||
1290 | #else /* FASTEST */ | ||
1291 | |||
1292 | /* --------------------------------------------------------------------------- | ||
1293 | * Optimized version for FASTEST only | ||
1294 | */ | ||
1295 | local uInt longest_match(s, cur_match) | ||
1296 | deflate_state *s; | ||
1297 | IPos cur_match; /* current match */ | ||
1298 | { | ||
1299 | register Bytef *scan = s->window + s->strstart; /* current string */ | ||
1300 | register Bytef *match; /* matched string */ | ||
1301 | register int len; /* length of current match */ | ||
1302 | register Bytef *strend = s->window + s->strstart + MAX_MATCH; | ||
1303 | |||
1304 | /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. | ||
1305 | * It is easy to get rid of this optimization if necessary. | ||
1306 | */ | ||
1307 | Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); | ||
1308 | |||
1309 | Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); | ||
1310 | |||
1311 | Assert(cur_match < s->strstart, "no future"); | ||
1312 | |||
1313 | match = s->window + cur_match; | ||
1314 | |||
1315 | /* Return failure if the match length is less than 2: | ||
1316 | */ | ||
1317 | if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; | ||
1318 | |||
1319 | /* The check at best_len-1 can be removed because it will be made | ||
1320 | * again later. (This heuristic is not always a win.) | ||
1321 | * It is not necessary to compare scan[2] and match[2] since they | ||
1322 | * are always equal when the other bytes match, given that | ||
1323 | * the hash keys are equal and that HASH_BITS >= 8. | ||
1324 | */ | ||
1325 | scan += 2, match += 2; | ||
1326 | Assert(*scan == *match, "match[2]?"); | ||
1327 | |||
1328 | /* We check for insufficient lookahead only every 8th comparison; | ||
1329 | * the 256th check will be made at strstart+258. | ||
1330 | */ | ||
1331 | do { | ||
1332 | } while (*++scan == *++match && *++scan == *++match && | ||
1333 | *++scan == *++match && *++scan == *++match && | ||
1334 | *++scan == *++match && *++scan == *++match && | ||
1335 | *++scan == *++match && *++scan == *++match && | ||
1336 | scan < strend); | ||
1337 | |||
1338 | Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||
1339 | |||
1340 | len = MAX_MATCH - (int)(strend - scan); | ||
1341 | |||
1342 | if (len < MIN_MATCH) return MIN_MATCH - 1; | ||
1343 | |||
1344 | s->match_start = cur_match; | ||
1345 | return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; | ||
1346 | } | ||
1347 | |||
1348 | #endif /* FASTEST */ | ||
1349 | |||
1350 | #ifdef DEBUG | ||
1351 | /* =========================================================================== | ||
1352 | * Check that the match at match_start is indeed a match. | ||
1353 | */ | ||
1354 | local void check_match(s, start, match, length) | ||
1355 | deflate_state *s; | ||
1356 | IPos start, match; | ||
1357 | int length; | ||
1358 | { | ||
1359 | /* check that the match is indeed a match */ | ||
1360 | if (zmemcmp(s->window + match, | ||
1361 | s->window + start, length) != EQUAL) { | ||
1362 | fprintf(stderr, " start %u, match %u, length %d\n", | ||
1363 | start, match, length); | ||
1364 | do { | ||
1365 | fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); | ||
1366 | } while (--length != 0); | ||
1367 | z_error("invalid match"); | ||
1368 | } | ||
1369 | if (z_verbose > 1) { | ||
1370 | fprintf(stderr,"\\[%d,%d]", start-match, length); | ||
1371 | do { putc(s->window[start++], stderr); } while (--length != 0); | ||
1372 | } | ||
1373 | } | ||
1374 | #else | ||
1375 | # define check_match(s, start, match, length) | ||
1376 | #endif /* DEBUG */ | ||
1377 | |||
1378 | /* =========================================================================== | ||
1379 | * Fill the window when the lookahead becomes insufficient. | ||
1380 | * Updates strstart and lookahead. | ||
1381 | * | ||
1382 | * IN assertion: lookahead < MIN_LOOKAHEAD | ||
1383 | * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD | ||
1384 | * At least one byte has been read, or avail_in == 0; reads are | ||
1385 | * performed for at least two bytes (required for the zip translate_eol | ||
1386 | * option -- not supported here). | ||
1387 | */ | ||
1388 | local void fill_window(s) | ||
1389 | deflate_state *s; | ||
1390 | { | ||
1391 | register unsigned n, m; | ||
1392 | register Posf *p; | ||
1393 | unsigned more; /* Amount of free space at the end of the window. */ | ||
1394 | uInt wsize = s->w_size; | ||
1395 | |||
1396 | Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); | ||
1397 | |||
1398 | do { | ||
1399 | more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); | ||
1400 | |||
1401 | /* Deal with !@#$% 64K limit: */ | ||
1402 | if (sizeof(int) <= 2) { | ||
1403 | if (more == 0 && s->strstart == 0 && s->lookahead == 0) { | ||
1404 | more = wsize; | ||
1405 | |||
1406 | } else if (more == (unsigned)(-1)) { | ||
1407 | /* Very unlikely, but possible on 16 bit machine if | ||
1408 | * strstart == 0 && lookahead == 1 (input done a byte at time) | ||
1409 | */ | ||
1410 | more--; | ||
1411 | } | ||
1412 | } | ||
1413 | |||
1414 | /* If the window is almost full and there is insufficient lookahead, | ||
1415 | * move the upper half to the lower one to make room in the upper half. | ||
1416 | */ | ||
1417 | if (s->strstart >= wsize+MAX_DIST(s)) { | ||
1418 | |||
1419 | zmemcpy(s->window, s->window+wsize, (unsigned)wsize); | ||
1420 | s->match_start -= wsize; | ||
1421 | s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ | ||
1422 | s->block_start -= (long) wsize; | ||
1423 | |||
1424 | /* Slide the hash table (could be avoided with 32 bit values | ||
1425 | at the expense of memory usage). We slide even when level == 0 | ||
1426 | to keep the hash table consistent if we switch back to level > 0 | ||
1427 | later. (Using level 0 permanently is not an optimal usage of | ||
1428 | zlib, so we don't care about this pathological case.) | ||
1429 | */ | ||
1430 | n = s->hash_size; | ||
1431 | p = &s->head[n]; | ||
1432 | do { | ||
1433 | m = *--p; | ||
1434 | *p = (Pos)(m >= wsize ? m-wsize : NIL); | ||
1435 | } while (--n); | ||
1436 | |||
1437 | n = wsize; | ||
1438 | #ifndef FASTEST | ||
1439 | p = &s->prev[n]; | ||
1440 | do { | ||
1441 | m = *--p; | ||
1442 | *p = (Pos)(m >= wsize ? m-wsize : NIL); | ||
1443 | /* If n is not on any hash chain, prev[n] is garbage but | ||
1444 | * its value will never be used. | ||
1445 | */ | ||
1446 | } while (--n); | ||
1447 | #endif | ||
1448 | more += wsize; | ||
1449 | } | ||
1450 | if (s->strm->avail_in == 0) break; | ||
1451 | |||
1452 | /* If there was no sliding: | ||
1453 | * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && | ||
1454 | * more == window_size - lookahead - strstart | ||
1455 | * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) | ||
1456 | * => more >= window_size - 2*WSIZE + 2 | ||
1457 | * In the BIG_MEM or MMAP case (not yet supported), | ||
1458 | * window_size == input_size + MIN_LOOKAHEAD && | ||
1459 | * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. | ||
1460 | * Otherwise, window_size == 2*WSIZE so more >= 2. | ||
1461 | * If there was sliding, more >= WSIZE. So in all cases, more >= 2. | ||
1462 | */ | ||
1463 | Assert(more >= 2, "more < 2"); | ||
1464 | |||
1465 | n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); | ||
1466 | s->lookahead += n; | ||
1467 | |||
1468 | /* Initialize the hash value now that we have some input: */ | ||
1469 | if (s->lookahead + s->insert >= MIN_MATCH) { | ||
1470 | uInt str = s->strstart - s->insert; | ||
1471 | s->ins_h = s->window[str]; | ||
1472 | UPDATE_HASH(s, s->ins_h, s->window[str + 1]); | ||
1473 | #if MIN_MATCH != 3 | ||
1474 | Call UPDATE_HASH() MIN_MATCH-3 more times | ||
1475 | #endif | ||
1476 | while (s->insert) { | ||
1477 | UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); | ||
1478 | #ifndef FASTEST | ||
1479 | s->prev[str & s->w_mask] = s->head[s->ins_h]; | ||
1480 | #endif | ||
1481 | s->head[s->ins_h] = (Pos)str; | ||
1482 | str++; | ||
1483 | s->insert--; | ||
1484 | if (s->lookahead + s->insert < MIN_MATCH) | ||
1485 | break; | ||
1486 | } | ||
1487 | } | ||
1488 | /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, | ||
1489 | * but this is not important since only literal bytes will be emitted. | ||
1490 | */ | ||
1491 | |||
1492 | } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); | ||
1493 | |||
1494 | /* If the WIN_INIT bytes after the end of the current data have never been | ||
1495 | * written, then zero those bytes in order to avoid memory check reports of | ||
1496 | * the use of uninitialized (or uninitialised as Julian writes) bytes by | ||
1497 | * the longest match routines. Update the high water mark for the next | ||
1498 | * time through here. WIN_INIT is set to MAX_MATCH since the longest match | ||
1499 | * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. | ||
1500 | */ | ||
1501 | if (s->high_water < s->window_size) { | ||
1502 | ulg curr = s->strstart + (ulg)(s->lookahead); | ||
1503 | ulg init; | ||
1504 | |||
1505 | if (s->high_water < curr) { | ||
1506 | /* Previous high water mark below current data -- zero WIN_INIT | ||
1507 | * bytes or up to end of window, whichever is less. | ||
1508 | */ | ||
1509 | init = s->window_size - curr; | ||
1510 | if (init > WIN_INIT) | ||
1511 | init = WIN_INIT; | ||
1512 | zmemzero(s->window + curr, (unsigned)init); | ||
1513 | s->high_water = curr + init; | ||
1514 | } | ||
1515 | else if (s->high_water < (ulg)curr + WIN_INIT) { | ||
1516 | /* High water mark at or above current data, but below current data | ||
1517 | * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up | ||
1518 | * to end of window, whichever is less. | ||
1519 | */ | ||
1520 | init = (ulg)curr + WIN_INIT - s->high_water; | ||
1521 | if (init > s->window_size - s->high_water) | ||
1522 | init = s->window_size - s->high_water; | ||
1523 | zmemzero(s->window + s->high_water, (unsigned)init); | ||
1524 | s->high_water += init; | ||
1525 | } | ||
1526 | } | ||
1527 | |||
1528 | Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, | ||
1529 | "not enough room for search"); | ||
1530 | } | ||
1531 | |||
1532 | /* =========================================================================== | ||
1533 | * Flush the current block, with given end-of-file flag. | ||
1534 | * IN assertion: strstart is set to the end of the current match. | ||
1535 | */ | ||
1536 | #define FLUSH_BLOCK_ONLY(s, last) { \ | ||
1537 | _tr_flush_block(s, (s->block_start >= 0L ? \ | ||
1538 | (charf *)&s->window[(unsigned)s->block_start] : \ | ||
1539 | (charf *)Z_NULL), \ | ||
1540 | (ulg)((long)s->strstart - s->block_start), \ | ||
1541 | (last)); \ | ||
1542 | s->block_start = s->strstart; \ | ||
1543 | flush_pending(s->strm); \ | ||
1544 | Tracev((stderr,"[FLUSH]")); \ | ||
1545 | } | ||
1546 | |||
1547 | /* Same but force premature exit if necessary. */ | ||
1548 | #define FLUSH_BLOCK(s, last) { \ | ||
1549 | FLUSH_BLOCK_ONLY(s, last); \ | ||
1550 | if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ | ||
1551 | } | ||
1552 | |||
1553 | /* =========================================================================== | ||
1554 | * Copy without compression as much as possible from the input stream, return | ||
1555 | * the current block state. | ||
1556 | * This function does not insert new strings in the dictionary since | ||
1557 | * uncompressible data is probably not useful. This function is used | ||
1558 | * only for the level=0 compression option. | ||
1559 | * NOTE: this function should be optimized to avoid extra copying from | ||
1560 | * window to pending_buf. | ||
1561 | */ | ||
1562 | local block_state deflate_stored(s, flush) | ||
1563 | deflate_state *s; | ||
1564 | int flush; | ||
1565 | { | ||
1566 | /* Stored blocks are limited to 0xffff bytes, pending_buf is limited | ||
1567 | * to pending_buf_size, and each stored block has a 5 byte header: | ||
1568 | */ | ||
1569 | ulg max_block_size = 0xffff; | ||
1570 | ulg max_start; | ||
1571 | |||
1572 | if (max_block_size > s->pending_buf_size - 5) { | ||
1573 | max_block_size = s->pending_buf_size - 5; | ||
1574 | } | ||
1575 | |||
1576 | /* Copy as much as possible from input to output: */ | ||
1577 | for (;;) { | ||
1578 | /* Fill the window as much as possible: */ | ||
1579 | if (s->lookahead <= 1) { | ||
1580 | |||
1581 | Assert(s->strstart < s->w_size+MAX_DIST(s) || | ||
1582 | s->block_start >= (long)s->w_size, "slide too late"); | ||
1583 | |||
1584 | fill_window(s); | ||
1585 | if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; | ||
1586 | |||
1587 | if (s->lookahead == 0) break; /* flush the current block */ | ||
1588 | } | ||
1589 | Assert(s->block_start >= 0L, "block gone"); | ||
1590 | |||
1591 | s->strstart += s->lookahead; | ||
1592 | s->lookahead = 0; | ||
1593 | |||
1594 | /* Emit a stored block if pending_buf will be full: */ | ||
1595 | max_start = s->block_start + max_block_size; | ||
1596 | if (s->strstart == 0 || (ulg)s->strstart >= max_start) { | ||
1597 | /* strstart == 0 is possible when wraparound on 16-bit machine */ | ||
1598 | s->lookahead = (uInt)(s->strstart - max_start); | ||
1599 | s->strstart = (uInt)max_start; | ||
1600 | FLUSH_BLOCK(s, 0); | ||
1601 | } | ||
1602 | /* Flush if we may have to slide, otherwise block_start may become | ||
1603 | * negative and the data will be gone: | ||
1604 | */ | ||
1605 | if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { | ||
1606 | FLUSH_BLOCK(s, 0); | ||
1607 | } | ||
1608 | } | ||
1609 | s->insert = 0; | ||
1610 | if (flush == Z_FINISH) { | ||
1611 | FLUSH_BLOCK(s, 1); | ||
1612 | return finish_done; | ||
1613 | } | ||
1614 | if ((long)s->strstart > s->block_start) | ||
1615 | FLUSH_BLOCK(s, 0); | ||
1616 | return block_done; | ||
1617 | } | ||
1618 | |||
1619 | /* =========================================================================== | ||
1620 | * Compress as much as possible from the input stream, return the current | ||
1621 | * block state. | ||
1622 | * This function does not perform lazy evaluation of matches and inserts | ||
1623 | * new strings in the dictionary only for unmatched strings or for short | ||
1624 | * matches. It is used only for the fast compression options. | ||
1625 | */ | ||
1626 | local block_state deflate_fast(s, flush) | ||
1627 | deflate_state *s; | ||
1628 | int flush; | ||
1629 | { | ||
1630 | IPos hash_head; /* head of the hash chain */ | ||
1631 | int bflush; /* set if current block must be flushed */ | ||
1632 | |||
1633 | for (;;) { | ||
1634 | /* Make sure that we always have enough lookahead, except | ||
1635 | * at the end of the input file. We need MAX_MATCH bytes | ||
1636 | * for the next match, plus MIN_MATCH bytes to insert the | ||
1637 | * string following the next match. | ||
1638 | */ | ||
1639 | if (s->lookahead < MIN_LOOKAHEAD) { | ||
1640 | fill_window(s); | ||
1641 | if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { | ||
1642 | return need_more; | ||
1643 | } | ||
1644 | if (s->lookahead == 0) break; /* flush the current block */ | ||
1645 | } | ||
1646 | |||
1647 | /* Insert the string window[strstart .. strstart+2] in the | ||
1648 | * dictionary, and set hash_head to the head of the hash chain: | ||
1649 | */ | ||
1650 | hash_head = NIL; | ||
1651 | if (s->lookahead >= MIN_MATCH) { | ||
1652 | INSERT_STRING(s, s->strstart, hash_head); | ||
1653 | } | ||
1654 | |||
1655 | /* Find the longest match, discarding those <= prev_length. | ||
1656 | * At this point we have always match_length < MIN_MATCH | ||
1657 | */ | ||
1658 | if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { | ||
1659 | /* To simplify the code, we prevent matches with the string | ||
1660 | * of window index 0 (in particular we have to avoid a match | ||
1661 | * of the string with itself at the start of the input file). | ||
1662 | */ | ||
1663 | s->match_length = longest_match (s, hash_head); | ||
1664 | /* longest_match() sets match_start */ | ||
1665 | } | ||
1666 | if (s->match_length >= MIN_MATCH) { | ||
1667 | check_match(s, s->strstart, s->match_start, s->match_length); | ||
1668 | |||
1669 | _tr_tally_dist(s, s->strstart - s->match_start, | ||
1670 | s->match_length - MIN_MATCH, bflush); | ||
1671 | |||
1672 | s->lookahead -= s->match_length; | ||
1673 | |||
1674 | /* Insert new strings in the hash table only if the match length | ||
1675 | * is not too large. This saves time but degrades compression. | ||
1676 | */ | ||
1677 | #ifndef FASTEST | ||
1678 | if (s->match_length <= s->max_insert_length && | ||
1679 | s->lookahead >= MIN_MATCH) { | ||
1680 | s->match_length--; /* string at strstart already in table */ | ||
1681 | do { | ||
1682 | s->strstart++; | ||
1683 | INSERT_STRING(s, s->strstart, hash_head); | ||
1684 | /* strstart never exceeds WSIZE-MAX_MATCH, so there are | ||
1685 | * always MIN_MATCH bytes ahead. | ||
1686 | */ | ||
1687 | } while (--s->match_length != 0); | ||
1688 | s->strstart++; | ||
1689 | } else | ||
1690 | #endif | ||
1691 | { | ||
1692 | s->strstart += s->match_length; | ||
1693 | s->match_length = 0; | ||
1694 | s->ins_h = s->window[s->strstart]; | ||
1695 | UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); | ||
1696 | #if MIN_MATCH != 3 | ||
1697 | Call UPDATE_HASH() MIN_MATCH-3 more times | ||
1698 | #endif | ||
1699 | /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not | ||
1700 | * matter since it will be recomputed at next deflate call. | ||
1701 | */ | ||
1702 | } | ||
1703 | } else { | ||
1704 | /* No match, output a literal byte */ | ||
1705 | Tracevv((stderr,"%c", s->window[s->strstart])); | ||
1706 | _tr_tally_lit (s, s->window[s->strstart], bflush); | ||
1707 | s->lookahead--; | ||
1708 | s->strstart++; | ||
1709 | } | ||
1710 | if (bflush) FLUSH_BLOCK(s, 0); | ||
1711 | } | ||
1712 | s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; | ||
1713 | if (flush == Z_FINISH) { | ||
1714 | FLUSH_BLOCK(s, 1); | ||
1715 | return finish_done; | ||
1716 | } | ||
1717 | if (s->last_lit) | ||
1718 | FLUSH_BLOCK(s, 0); | ||
1719 | return block_done; | ||
1720 | } | ||
1721 | |||
1722 | #ifndef FASTEST | ||
1723 | /* =========================================================================== | ||
1724 | * Same as above, but achieves better compression. We use a lazy | ||
1725 | * evaluation for matches: a match is finally adopted only if there is | ||
1726 | * no better match at the next window position. | ||
1727 | */ | ||
1728 | local block_state deflate_slow(s, flush) | ||
1729 | deflate_state *s; | ||
1730 | int flush; | ||
1731 | { | ||
1732 | IPos hash_head; /* head of hash chain */ | ||
1733 | int bflush; /* set if current block must be flushed */ | ||
1734 | |||
1735 | /* Process the input block. */ | ||
1736 | for (;;) { | ||
1737 | /* Make sure that we always have enough lookahead, except | ||
1738 | * at the end of the input file. We need MAX_MATCH bytes | ||
1739 | * for the next match, plus MIN_MATCH bytes to insert the | ||
1740 | * string following the next match. | ||
1741 | */ | ||
1742 | if (s->lookahead < MIN_LOOKAHEAD) { | ||
1743 | fill_window(s); | ||
1744 | if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { | ||
1745 | return need_more; | ||
1746 | } | ||
1747 | if (s->lookahead == 0) break; /* flush the current block */ | ||
1748 | } | ||
1749 | |||
1750 | /* Insert the string window[strstart .. strstart+2] in the | ||
1751 | * dictionary, and set hash_head to the head of the hash chain: | ||
1752 | */ | ||
1753 | hash_head = NIL; | ||
1754 | if (s->lookahead >= MIN_MATCH) { | ||
1755 | INSERT_STRING(s, s->strstart, hash_head); | ||
1756 | } | ||
1757 | |||
1758 | /* Find the longest match, discarding those <= prev_length. | ||
1759 | */ | ||
1760 | s->prev_length = s->match_length, s->prev_match = s->match_start; | ||
1761 | s->match_length = MIN_MATCH-1; | ||
1762 | |||
1763 | if (hash_head != NIL && s->prev_length < s->max_lazy_match && | ||
1764 | s->strstart - hash_head <= MAX_DIST(s)) { | ||
1765 | /* To simplify the code, we prevent matches with the string | ||
1766 | * of window index 0 (in particular we have to avoid a match | ||
1767 | * of the string with itself at the start of the input file). | ||
1768 | */ | ||
1769 | s->match_length = longest_match (s, hash_head); | ||
1770 | /* longest_match() sets match_start */ | ||
1771 | |||
1772 | if (s->match_length <= 5 && (s->strategy == Z_FILTERED | ||
1773 | #if TOO_FAR <= 32767 | ||
1774 | || (s->match_length == MIN_MATCH && | ||
1775 | s->strstart - s->match_start > TOO_FAR) | ||
1776 | #endif | ||
1777 | )) { | ||
1778 | |||
1779 | /* If prev_match is also MIN_MATCH, match_start is garbage | ||
1780 | * but we will ignore the current match anyway. | ||
1781 | */ | ||
1782 | s->match_length = MIN_MATCH-1; | ||
1783 | } | ||
1784 | } | ||
1785 | /* If there was a match at the previous step and the current | ||
1786 | * match is not better, output the previous match: | ||
1787 | */ | ||
1788 | if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { | ||
1789 | uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; | ||
1790 | /* Do not insert strings in hash table beyond this. */ | ||
1791 | |||
1792 | check_match(s, s->strstart-1, s->prev_match, s->prev_length); | ||
1793 | |||
1794 | _tr_tally_dist(s, s->strstart -1 - s->prev_match, | ||
1795 | s->prev_length - MIN_MATCH, bflush); | ||
1796 | |||
1797 | /* Insert in hash table all strings up to the end of the match. | ||
1798 | * strstart-1 and strstart are already inserted. If there is not | ||
1799 | * enough lookahead, the last two strings are not inserted in | ||
1800 | * the hash table. | ||
1801 | */ | ||
1802 | s->lookahead -= s->prev_length-1; | ||
1803 | s->prev_length -= 2; | ||
1804 | do { | ||
1805 | if (++s->strstart <= max_insert) { | ||
1806 | INSERT_STRING(s, s->strstart, hash_head); | ||
1807 | } | ||
1808 | } while (--s->prev_length != 0); | ||
1809 | s->match_available = 0; | ||
1810 | s->match_length = MIN_MATCH-1; | ||
1811 | s->strstart++; | ||
1812 | |||
1813 | if (bflush) FLUSH_BLOCK(s, 0); | ||
1814 | |||
1815 | } else if (s->match_available) { | ||
1816 | /* If there was no match at the previous position, output a | ||
1817 | * single literal. If there was a match but the current match | ||
1818 | * is longer, truncate the previous match to a single literal. | ||
1819 | */ | ||
1820 | Tracevv((stderr,"%c", s->window[s->strstart-1])); | ||
1821 | _tr_tally_lit(s, s->window[s->strstart-1], bflush); | ||
1822 | if (bflush) { | ||
1823 | FLUSH_BLOCK_ONLY(s, 0); | ||
1824 | } | ||
1825 | s->strstart++; | ||
1826 | s->lookahead--; | ||
1827 | if (s->strm->avail_out == 0) return need_more; | ||
1828 | } else { | ||
1829 | /* There is no previous match to compare with, wait for | ||
1830 | * the next step to decide. | ||
1831 | */ | ||
1832 | s->match_available = 1; | ||
1833 | s->strstart++; | ||
1834 | s->lookahead--; | ||
1835 | } | ||
1836 | } | ||
1837 | Assert (flush != Z_NO_FLUSH, "no flush?"); | ||
1838 | if (s->match_available) { | ||
1839 | Tracevv((stderr,"%c", s->window[s->strstart-1])); | ||
1840 | _tr_tally_lit(s, s->window[s->strstart-1], bflush); | ||
1841 | s->match_available = 0; | ||
1842 | } | ||
1843 | s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; | ||
1844 | if (flush == Z_FINISH) { | ||
1845 | FLUSH_BLOCK(s, 1); | ||
1846 | return finish_done; | ||
1847 | } | ||
1848 | if (s->last_lit) | ||
1849 | FLUSH_BLOCK(s, 0); | ||
1850 | return block_done; | ||
1851 | } | ||
1852 | #endif /* FASTEST */ | ||
1853 | |||
1854 | /* =========================================================================== | ||
1855 | * For Z_RLE, simply look for runs of bytes, generate matches only of distance | ||
1856 | * one. Do not maintain a hash table. (It will be regenerated if this run of | ||
1857 | * deflate switches away from Z_RLE.) | ||
1858 | */ | ||
1859 | local block_state deflate_rle(s, flush) | ||
1860 | deflate_state *s; | ||
1861 | int flush; | ||
1862 | { | ||
1863 | int bflush; /* set if current block must be flushed */ | ||
1864 | uInt prev; /* byte at distance one to match */ | ||
1865 | Bytef *scan, *strend; /* scan goes up to strend for length of run */ | ||
1866 | |||
1867 | for (;;) { | ||
1868 | /* Make sure that we always have enough lookahead, except | ||
1869 | * at the end of the input file. We need MAX_MATCH bytes | ||
1870 | * for the longest run, plus one for the unrolled loop. | ||
1871 | */ | ||
1872 | if (s->lookahead <= MAX_MATCH) { | ||
1873 | fill_window(s); | ||
1874 | if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { | ||
1875 | return need_more; | ||
1876 | } | ||
1877 | if (s->lookahead == 0) break; /* flush the current block */ | ||
1878 | } | ||
1879 | |||
1880 | /* See how many times the previous byte repeats */ | ||
1881 | s->match_length = 0; | ||
1882 | if (s->lookahead >= MIN_MATCH && s->strstart > 0) { | ||
1883 | scan = s->window + s->strstart - 1; | ||
1884 | prev = *scan; | ||
1885 | if (prev == *++scan && prev == *++scan && prev == *++scan) { | ||
1886 | strend = s->window + s->strstart + MAX_MATCH; | ||
1887 | do { | ||
1888 | } while (prev == *++scan && prev == *++scan && | ||
1889 | prev == *++scan && prev == *++scan && | ||
1890 | prev == *++scan && prev == *++scan && | ||
1891 | prev == *++scan && prev == *++scan && | ||
1892 | scan < strend); | ||
1893 | s->match_length = MAX_MATCH - (int)(strend - scan); | ||
1894 | if (s->match_length > s->lookahead) | ||
1895 | s->match_length = s->lookahead; | ||
1896 | } | ||
1897 | Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); | ||
1898 | } | ||
1899 | |||
1900 | /* Emit match if have run of MIN_MATCH or longer, else emit literal */ | ||
1901 | if (s->match_length >= MIN_MATCH) { | ||
1902 | check_match(s, s->strstart, s->strstart - 1, s->match_length); | ||
1903 | |||
1904 | _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); | ||
1905 | |||
1906 | s->lookahead -= s->match_length; | ||
1907 | s->strstart += s->match_length; | ||
1908 | s->match_length = 0; | ||
1909 | } else { | ||
1910 | /* No match, output a literal byte */ | ||
1911 | Tracevv((stderr,"%c", s->window[s->strstart])); | ||
1912 | _tr_tally_lit (s, s->window[s->strstart], bflush); | ||
1913 | s->lookahead--; | ||
1914 | s->strstart++; | ||
1915 | } | ||
1916 | if (bflush) FLUSH_BLOCK(s, 0); | ||
1917 | } | ||
1918 | s->insert = 0; | ||
1919 | if (flush == Z_FINISH) { | ||
1920 | FLUSH_BLOCK(s, 1); | ||
1921 | return finish_done; | ||
1922 | } | ||
1923 | if (s->last_lit) | ||
1924 | FLUSH_BLOCK(s, 0); | ||
1925 | return block_done; | ||
1926 | } | ||
1927 | |||
1928 | /* =========================================================================== | ||
1929 | * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. | ||
1930 | * (It will be regenerated if this run of deflate switches away from Huffman.) | ||
1931 | */ | ||
1932 | local block_state deflate_huff(s, flush) | ||
1933 | deflate_state *s; | ||
1934 | int flush; | ||
1935 | { | ||
1936 | int bflush; /* set if current block must be flushed */ | ||
1937 | |||
1938 | for (;;) { | ||
1939 | /* Make sure that we have a literal to write. */ | ||
1940 | if (s->lookahead == 0) { | ||
1941 | fill_window(s); | ||
1942 | if (s->lookahead == 0) { | ||
1943 | if (flush == Z_NO_FLUSH) | ||
1944 | return need_more; | ||
1945 | break; /* flush the current block */ | ||
1946 | } | ||
1947 | } | ||
1948 | |||
1949 | /* Output a literal byte */ | ||
1950 | s->match_length = 0; | ||
1951 | Tracevv((stderr,"%c", s->window[s->strstart])); | ||
1952 | _tr_tally_lit (s, s->window[s->strstart], bflush); | ||
1953 | s->lookahead--; | ||
1954 | s->strstart++; | ||
1955 | if (bflush) FLUSH_BLOCK(s, 0); | ||
1956 | } | ||
1957 | s->insert = 0; | ||
1958 | if (flush == Z_FINISH) { | ||
1959 | FLUSH_BLOCK(s, 1); | ||
1960 | return finish_done; | ||
1961 | } | ||
1962 | if (s->last_lit) | ||
1963 | FLUSH_BLOCK(s, 0); | ||
1964 | return block_done; | ||
1965 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.h deleted file mode 100644 index fbac44d..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/deflate.h +++ /dev/null | |||
@@ -1,346 +0,0 @@ | |||
1 | /* deflate.h -- internal compression state | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* WARNING: this file should *not* be used by applications. It is | ||
7 | part of the implementation of the compression library and is | ||
8 | subject to change. Applications should only use zlib.h. | ||
9 | */ | ||
10 | |||
11 | /* @(#) $Id$ */ | ||
12 | |||
13 | #ifndef DEFLATE_H | ||
14 | #define DEFLATE_H | ||
15 | |||
16 | #include "zutil.h" | ||
17 | |||
18 | /* define NO_GZIP when compiling if you want to disable gzip header and | ||
19 | trailer creation by deflate(). NO_GZIP would be used to avoid linking in | ||
20 | the crc code when it is not needed. For shared libraries, gzip encoding | ||
21 | should be left enabled. */ | ||
22 | #ifndef NO_GZIP | ||
23 | # define GZIP | ||
24 | #endif | ||
25 | |||
26 | /* =========================================================================== | ||
27 | * Internal compression state. | ||
28 | */ | ||
29 | |||
30 | #define LENGTH_CODES 29 | ||
31 | /* number of length codes, not counting the special END_BLOCK code */ | ||
32 | |||
33 | #define LITERALS 256 | ||
34 | /* number of literal bytes 0..255 */ | ||
35 | |||
36 | #define L_CODES (LITERALS+1+LENGTH_CODES) | ||
37 | /* number of Literal or Length codes, including the END_BLOCK code */ | ||
38 | |||
39 | #define D_CODES 30 | ||
40 | /* number of distance codes */ | ||
41 | |||
42 | #define BL_CODES 19 | ||
43 | /* number of codes used to transfer the bit lengths */ | ||
44 | |||
45 | #define HEAP_SIZE (2*L_CODES+1) | ||
46 | /* maximum heap size */ | ||
47 | |||
48 | #define MAX_BITS 15 | ||
49 | /* All codes must not exceed MAX_BITS bits */ | ||
50 | |||
51 | #define Buf_size 16 | ||
52 | /* size of bit buffer in bi_buf */ | ||
53 | |||
54 | #define INIT_STATE 42 | ||
55 | #define EXTRA_STATE 69 | ||
56 | #define NAME_STATE 73 | ||
57 | #define COMMENT_STATE 91 | ||
58 | #define HCRC_STATE 103 | ||
59 | #define BUSY_STATE 113 | ||
60 | #define FINISH_STATE 666 | ||
61 | /* Stream status */ | ||
62 | |||
63 | |||
64 | /* Data structure describing a single value and its code string. */ | ||
65 | typedef struct ct_data_s { | ||
66 | union { | ||
67 | ush freq; /* frequency count */ | ||
68 | ush code; /* bit string */ | ||
69 | } fc; | ||
70 | union { | ||
71 | ush dad; /* father node in Huffman tree */ | ||
72 | ush len; /* length of bit string */ | ||
73 | } dl; | ||
74 | } FAR ct_data; | ||
75 | |||
76 | #define Freq fc.freq | ||
77 | #define Code fc.code | ||
78 | #define Dad dl.dad | ||
79 | #define Len dl.len | ||
80 | |||
81 | typedef struct static_tree_desc_s static_tree_desc; | ||
82 | |||
83 | typedef struct tree_desc_s { | ||
84 | ct_data *dyn_tree; /* the dynamic tree */ | ||
85 | int max_code; /* largest code with non zero frequency */ | ||
86 | static_tree_desc *stat_desc; /* the corresponding static tree */ | ||
87 | } FAR tree_desc; | ||
88 | |||
89 | typedef ush Pos; | ||
90 | typedef Pos FAR Posf; | ||
91 | typedef unsigned IPos; | ||
92 | |||
93 | /* A Pos is an index in the character window. We use short instead of int to | ||
94 | * save space in the various tables. IPos is used only for parameter passing. | ||
95 | */ | ||
96 | |||
97 | typedef struct internal_state { | ||
98 | z_streamp strm; /* pointer back to this zlib stream */ | ||
99 | int status; /* as the name implies */ | ||
100 | Bytef *pending_buf; /* output still pending */ | ||
101 | ulg pending_buf_size; /* size of pending_buf */ | ||
102 | Bytef *pending_out; /* next pending byte to output to the stream */ | ||
103 | uInt pending; /* nb of bytes in the pending buffer */ | ||
104 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ | ||
105 | gz_headerp gzhead; /* gzip header information to write */ | ||
106 | uInt gzindex; /* where in extra, name, or comment */ | ||
107 | Byte method; /* STORED (for zip only) or DEFLATED */ | ||
108 | int last_flush; /* value of flush param for previous deflate call */ | ||
109 | |||
110 | /* used by deflate.c: */ | ||
111 | |||
112 | uInt w_size; /* LZ77 window size (32K by default) */ | ||
113 | uInt w_bits; /* log2(w_size) (8..16) */ | ||
114 | uInt w_mask; /* w_size - 1 */ | ||
115 | |||
116 | Bytef *window; | ||
117 | /* Sliding window. Input bytes are read into the second half of the window, | ||
118 | * and move to the first half later to keep a dictionary of at least wSize | ||
119 | * bytes. With this organization, matches are limited to a distance of | ||
120 | * wSize-MAX_MATCH bytes, but this ensures that IO is always | ||
121 | * performed with a length multiple of the block size. Also, it limits | ||
122 | * the window size to 64K, which is quite useful on MSDOS. | ||
123 | * To do: use the user input buffer as sliding window. | ||
124 | */ | ||
125 | |||
126 | ulg window_size; | ||
127 | /* Actual size of window: 2*wSize, except when the user input buffer | ||
128 | * is directly used as sliding window. | ||
129 | */ | ||
130 | |||
131 | Posf *prev; | ||
132 | /* Link to older string with same hash index. To limit the size of this | ||
133 | * array to 64K, this link is maintained only for the last 32K strings. | ||
134 | * An index in this array is thus a window index modulo 32K. | ||
135 | */ | ||
136 | |||
137 | Posf *head; /* Heads of the hash chains or NIL. */ | ||
138 | |||
139 | uInt ins_h; /* hash index of string to be inserted */ | ||
140 | uInt hash_size; /* number of elements in hash table */ | ||
141 | uInt hash_bits; /* log2(hash_size) */ | ||
142 | uInt hash_mask; /* hash_size-1 */ | ||
143 | |||
144 | uInt hash_shift; | ||
145 | /* Number of bits by which ins_h must be shifted at each input | ||
146 | * step. It must be such that after MIN_MATCH steps, the oldest | ||
147 | * byte no longer takes part in the hash key, that is: | ||
148 | * hash_shift * MIN_MATCH >= hash_bits | ||
149 | */ | ||
150 | |||
151 | long block_start; | ||
152 | /* Window position at the beginning of the current output block. Gets | ||
153 | * negative when the window is moved backwards. | ||
154 | */ | ||
155 | |||
156 | uInt match_length; /* length of best match */ | ||
157 | IPos prev_match; /* previous match */ | ||
158 | int match_available; /* set if previous match exists */ | ||
159 | uInt strstart; /* start of string to insert */ | ||
160 | uInt match_start; /* start of matching string */ | ||
161 | uInt lookahead; /* number of valid bytes ahead in window */ | ||
162 | |||
163 | uInt prev_length; | ||
164 | /* Length of the best match at previous step. Matches not greater than this | ||
165 | * are discarded. This is used in the lazy match evaluation. | ||
166 | */ | ||
167 | |||
168 | uInt max_chain_length; | ||
169 | /* To speed up deflation, hash chains are never searched beyond this | ||
170 | * length. A higher limit improves compression ratio but degrades the | ||
171 | * speed. | ||
172 | */ | ||
173 | |||
174 | uInt max_lazy_match; | ||
175 | /* Attempt to find a better match only when the current match is strictly | ||
176 | * smaller than this value. This mechanism is used only for compression | ||
177 | * levels >= 4. | ||
178 | */ | ||
179 | # define max_insert_length max_lazy_match | ||
180 | /* Insert new strings in the hash table only if the match length is not | ||
181 | * greater than this length. This saves time but degrades compression. | ||
182 | * max_insert_length is used only for compression levels <= 3. | ||
183 | */ | ||
184 | |||
185 | int level; /* compression level (1..9) */ | ||
186 | int strategy; /* favor or force Huffman coding*/ | ||
187 | |||
188 | uInt good_match; | ||
189 | /* Use a faster search when the previous match is longer than this */ | ||
190 | |||
191 | int nice_match; /* Stop searching when current match exceeds this */ | ||
192 | |||
193 | /* used by trees.c: */ | ||
194 | /* Didn't use ct_data typedef below to suppress compiler warning */ | ||
195 | struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ | ||
196 | struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ | ||
197 | struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ | ||
198 | |||
199 | struct tree_desc_s l_desc; /* desc. for literal tree */ | ||
200 | struct tree_desc_s d_desc; /* desc. for distance tree */ | ||
201 | struct tree_desc_s bl_desc; /* desc. for bit length tree */ | ||
202 | |||
203 | ush bl_count[MAX_BITS+1]; | ||
204 | /* number of codes at each bit length for an optimal tree */ | ||
205 | |||
206 | int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ | ||
207 | int heap_len; /* number of elements in the heap */ | ||
208 | int heap_max; /* element of largest frequency */ | ||
209 | /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. | ||
210 | * The same heap array is used to build all trees. | ||
211 | */ | ||
212 | |||
213 | uch depth[2*L_CODES+1]; | ||
214 | /* Depth of each subtree used as tie breaker for trees of equal frequency | ||
215 | */ | ||
216 | |||
217 | uchf *l_buf; /* buffer for literals or lengths */ | ||
218 | |||
219 | uInt lit_bufsize; | ||
220 | /* Size of match buffer for literals/lengths. There are 4 reasons for | ||
221 | * limiting lit_bufsize to 64K: | ||
222 | * - frequencies can be kept in 16 bit counters | ||
223 | * - if compression is not successful for the first block, all input | ||
224 | * data is still in the window so we can still emit a stored block even | ||
225 | * when input comes from standard input. (This can also be done for | ||
226 | * all blocks if lit_bufsize is not greater than 32K.) | ||
227 | * - if compression is not successful for a file smaller than 64K, we can | ||
228 | * even emit a stored file instead of a stored block (saving 5 bytes). | ||
229 | * This is applicable only for zip (not gzip or zlib). | ||
230 | * - creating new Huffman trees less frequently may not provide fast | ||
231 | * adaptation to changes in the input data statistics. (Take for | ||
232 | * example a binary file with poorly compressible code followed by | ||
233 | * a highly compressible string table.) Smaller buffer sizes give | ||
234 | * fast adaptation but have of course the overhead of transmitting | ||
235 | * trees more frequently. | ||
236 | * - I can't count above 4 | ||
237 | */ | ||
238 | |||
239 | uInt last_lit; /* running index in l_buf */ | ||
240 | |||
241 | ushf *d_buf; | ||
242 | /* Buffer for distances. To simplify the code, d_buf and l_buf have | ||
243 | * the same number of elements. To use different lengths, an extra flag | ||
244 | * array would be necessary. | ||
245 | */ | ||
246 | |||
247 | ulg opt_len; /* bit length of current block with optimal trees */ | ||
248 | ulg static_len; /* bit length of current block with static trees */ | ||
249 | uInt matches; /* number of string matches in current block */ | ||
250 | uInt insert; /* bytes at end of window left to insert */ | ||
251 | |||
252 | #ifdef DEBUG | ||
253 | ulg compressed_len; /* total bit length of compressed file mod 2^32 */ | ||
254 | ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ | ||
255 | #endif | ||
256 | |||
257 | ush bi_buf; | ||
258 | /* Output buffer. bits are inserted starting at the bottom (least | ||
259 | * significant bits). | ||
260 | */ | ||
261 | int bi_valid; | ||
262 | /* Number of valid bits in bi_buf. All bits above the last valid bit | ||
263 | * are always zero. | ||
264 | */ | ||
265 | |||
266 | ulg high_water; | ||
267 | /* High water mark offset in window for initialized bytes -- bytes above | ||
268 | * this are set to zero in order to avoid memory check warnings when | ||
269 | * longest match routines access bytes past the input. This is then | ||
270 | * updated to the new high water mark. | ||
271 | */ | ||
272 | |||
273 | } FAR deflate_state; | ||
274 | |||
275 | /* Output a byte on the stream. | ||
276 | * IN assertion: there is enough room in pending_buf. | ||
277 | */ | ||
278 | #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} | ||
279 | |||
280 | |||
281 | #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) | ||
282 | /* Minimum amount of lookahead, except at the end of the input file. | ||
283 | * See deflate.c for comments about the MIN_MATCH+1. | ||
284 | */ | ||
285 | |||
286 | #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) | ||
287 | /* In order to simplify the code, particularly on 16 bit machines, match | ||
288 | * distances are limited to MAX_DIST instead of WSIZE. | ||
289 | */ | ||
290 | |||
291 | #define WIN_INIT MAX_MATCH | ||
292 | /* Number of bytes after end of data in window to initialize in order to avoid | ||
293 | memory checker errors from longest match routines */ | ||
294 | |||
295 | /* in trees.c */ | ||
296 | void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); | ||
297 | int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); | ||
298 | void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, | ||
299 | ulg stored_len, int last)); | ||
300 | void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); | ||
301 | void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); | ||
302 | void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, | ||
303 | ulg stored_len, int last)); | ||
304 | |||
305 | #define d_code(dist) \ | ||
306 | ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) | ||
307 | /* Mapping from a distance to a distance code. dist is the distance - 1 and | ||
308 | * must not have side effects. _dist_code[256] and _dist_code[257] are never | ||
309 | * used. | ||
310 | */ | ||
311 | |||
312 | #ifndef DEBUG | ||
313 | /* Inline versions of _tr_tally for speed: */ | ||
314 | |||
315 | #if defined(GEN_TREES_H) || !defined(STDC) | ||
316 | extern uch ZLIB_INTERNAL _length_code[]; | ||
317 | extern uch ZLIB_INTERNAL _dist_code[]; | ||
318 | #else | ||
319 | extern const uch ZLIB_INTERNAL _length_code[]; | ||
320 | extern const uch ZLIB_INTERNAL _dist_code[]; | ||
321 | #endif | ||
322 | |||
323 | # define _tr_tally_lit(s, c, flush) \ | ||
324 | { uch cc = (c); \ | ||
325 | s->d_buf[s->last_lit] = 0; \ | ||
326 | s->l_buf[s->last_lit++] = cc; \ | ||
327 | s->dyn_ltree[cc].Freq++; \ | ||
328 | flush = (s->last_lit == s->lit_bufsize-1); \ | ||
329 | } | ||
330 | # define _tr_tally_dist(s, distance, length, flush) \ | ||
331 | { uch len = (length); \ | ||
332 | ush dist = (distance); \ | ||
333 | s->d_buf[s->last_lit] = dist; \ | ||
334 | s->l_buf[s->last_lit++] = len; \ | ||
335 | dist--; \ | ||
336 | s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ | ||
337 | s->dyn_dtree[d_code(dist)].Freq++; \ | ||
338 | flush = (s->last_lit == s->lit_bufsize-1); \ | ||
339 | } | ||
340 | #else | ||
341 | # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) | ||
342 | # define _tr_tally_dist(s, distance, length, flush) \ | ||
343 | flush = _tr_tally(s, distance, length) | ||
344 | #endif | ||
345 | |||
346 | #endif /* DEFLATE_H */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzclose.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzclose.c deleted file mode 100644 index caeb99a..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzclose.c +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* gzclose.c -- zlib gzclose() function | ||
2 | * Copyright (C) 2004, 2010 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "gzguts.h" | ||
7 | |||
8 | /* gzclose() is in a separate file so that it is linked in only if it is used. | ||
9 | That way the other gzclose functions can be used instead to avoid linking in | ||
10 | unneeded compression or decompression routines. */ | ||
11 | int ZEXPORT gzclose(file) | ||
12 | gzFile file; | ||
13 | { | ||
14 | #ifndef NO_GZCOMPRESS | ||
15 | gz_statep state; | ||
16 | |||
17 | if (file == NULL) | ||
18 | return Z_STREAM_ERROR; | ||
19 | state = (gz_statep)file; | ||
20 | |||
21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); | ||
22 | #else | ||
23 | return gzclose_r(file); | ||
24 | #endif | ||
25 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzguts.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzguts.h deleted file mode 100644 index ee3f281..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzguts.h +++ /dev/null | |||
@@ -1,193 +0,0 @@ | |||
1 | /* gzguts.h -- zlib internal header definitions for gz* operations | ||
2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #ifdef _LARGEFILE64_SOURCE | ||
7 | # ifndef _LARGEFILE_SOURCE | ||
8 | # define _LARGEFILE_SOURCE 1 | ||
9 | # endif | ||
10 | # ifdef _FILE_OFFSET_BITS | ||
11 | # undef _FILE_OFFSET_BITS | ||
12 | # endif | ||
13 | #endif | ||
14 | |||
15 | #ifdef HAVE_HIDDEN | ||
16 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) | ||
17 | #else | ||
18 | # define ZLIB_INTERNAL | ||
19 | #endif | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include "zlib.h" | ||
23 | #ifdef STDC | ||
24 | # include <string.h> | ||
25 | # include <stdlib.h> | ||
26 | # include <limits.h> | ||
27 | #endif | ||
28 | #include <fcntl.h> | ||
29 | |||
30 | #ifdef _WIN32 | ||
31 | # include <stddef.h> | ||
32 | #endif | ||
33 | |||
34 | #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) | ||
35 | # include <io.h> | ||
36 | #endif | ||
37 | |||
38 | #ifdef NO_DEFLATE /* for compatibility with old definition */ | ||
39 | # define NO_GZCOMPRESS | ||
40 | #endif | ||
41 | |||
42 | #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) | ||
43 | # ifndef HAVE_VSNPRINTF | ||
44 | # define HAVE_VSNPRINTF | ||
45 | # endif | ||
46 | #endif | ||
47 | |||
48 | #if defined(__CYGWIN__) | ||
49 | # ifndef HAVE_VSNPRINTF | ||
50 | # define HAVE_VSNPRINTF | ||
51 | # endif | ||
52 | #endif | ||
53 | |||
54 | #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) | ||
55 | # ifndef HAVE_VSNPRINTF | ||
56 | # define HAVE_VSNPRINTF | ||
57 | # endif | ||
58 | #endif | ||
59 | |||
60 | #ifndef HAVE_VSNPRINTF | ||
61 | # ifdef MSDOS | ||
62 | /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), | ||
63 | but for now we just assume it doesn't. */ | ||
64 | # define NO_vsnprintf | ||
65 | # endif | ||
66 | # ifdef __TURBOC__ | ||
67 | # define NO_vsnprintf | ||
68 | # endif | ||
69 | # ifdef WIN32 | ||
70 | /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ | ||
71 | # if !defined(vsnprintf) && !defined(NO_vsnprintf) | ||
72 | # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) | ||
73 | # define vsnprintf _vsnprintf | ||
74 | # endif | ||
75 | # endif | ||
76 | # endif | ||
77 | # ifdef __SASC | ||
78 | # define NO_vsnprintf | ||
79 | # endif | ||
80 | # ifdef VMS | ||
81 | # define NO_vsnprintf | ||
82 | # endif | ||
83 | # ifdef __OS400__ | ||
84 | # define NO_vsnprintf | ||
85 | # endif | ||
86 | # ifdef __MVS__ | ||
87 | # define NO_vsnprintf | ||
88 | # endif | ||
89 | #endif | ||
90 | |||
91 | #ifndef local | ||
92 | # define local static | ||
93 | #endif | ||
94 | /* compile with -Dlocal if your debugger can't find static symbols */ | ||
95 | |||
96 | /* gz* functions always use library allocation functions */ | ||
97 | #ifndef STDC | ||
98 | extern voidp malloc OF((uInt size)); | ||
99 | extern void free OF((voidpf ptr)); | ||
100 | #endif | ||
101 | |||
102 | /* get errno and strerror definition */ | ||
103 | #if defined UNDER_CE | ||
104 | # include <windows.h> | ||
105 | # define zstrerror() gz_strwinerror((DWORD)GetLastError()) | ||
106 | #else | ||
107 | # ifndef NO_STRERROR | ||
108 | # include <errno.h> | ||
109 | # define zstrerror() strerror(errno) | ||
110 | # else | ||
111 | # define zstrerror() "stdio error (consult errno)" | ||
112 | # endif | ||
113 | #endif | ||
114 | |||
115 | /* provide prototypes for these when building zlib without LFS */ | ||
116 | #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 | ||
117 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||
118 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); | ||
119 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | ||
120 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | ||
121 | #endif | ||
122 | |||
123 | /* default memLevel */ | ||
124 | #if MAX_MEM_LEVEL >= 8 | ||
125 | # define DEF_MEM_LEVEL 8 | ||
126 | #else | ||
127 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
128 | #endif | ||
129 | |||
130 | /* default i/o buffer size -- double this for output when reading */ | ||
131 | #define GZBUFSIZE 8192 | ||
132 | |||
133 | /* gzip modes, also provide a little integrity check on the passed structure */ | ||
134 | #define GZ_NONE 0 | ||
135 | #define GZ_READ 7247 | ||
136 | #define GZ_WRITE 31153 | ||
137 | #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ | ||
138 | |||
139 | /* values for gz_state how */ | ||
140 | #define LOOK 0 /* look for a gzip header */ | ||
141 | #define COPY 1 /* copy input directly */ | ||
142 | #define GZIP 2 /* decompress a gzip stream */ | ||
143 | |||
144 | /* internal gzip file state data structure */ | ||
145 | typedef struct { | ||
146 | /* exposed contents for gzgetc() macro */ | ||
147 | struct gzFile_s x; /* "x" for exposed */ | ||
148 | /* x.have: number of bytes available at x.next */ | ||
149 | /* x.next: next output data to deliver or write */ | ||
150 | /* x.pos: current position in uncompressed data */ | ||
151 | /* used for both reading and writing */ | ||
152 | int mode; /* see gzip modes above */ | ||
153 | int fd; /* file descriptor */ | ||
154 | char *path; /* path or fd for error messages */ | ||
155 | unsigned size; /* buffer size, zero if not allocated yet */ | ||
156 | unsigned want; /* requested buffer size, default is GZBUFSIZE */ | ||
157 | unsigned char *in; /* input buffer */ | ||
158 | unsigned char *out; /* output buffer (double-sized when reading) */ | ||
159 | int direct; /* 0 if processing gzip, 1 if transparent */ | ||
160 | /* just for reading */ | ||
161 | int how; /* 0: get header, 1: copy, 2: decompress */ | ||
162 | z_off64_t start; /* where the gzip data started, for rewinding */ | ||
163 | int eof; /* true if end of input file reached */ | ||
164 | int past; /* true if read requested past end */ | ||
165 | /* just for writing */ | ||
166 | int level; /* compression level */ | ||
167 | int strategy; /* compression strategy */ | ||
168 | /* seek request */ | ||
169 | z_off64_t skip; /* amount to skip (already rewound if backwards) */ | ||
170 | int seek; /* true if seek request pending */ | ||
171 | /* error information */ | ||
172 | int err; /* error code */ | ||
173 | char *msg; /* error message */ | ||
174 | /* zlib inflate or deflate stream */ | ||
175 | z_stream strm; /* stream structure in-place (not a pointer) */ | ||
176 | } gz_state; | ||
177 | typedef gz_state FAR *gz_statep; | ||
178 | |||
179 | /* shared functions */ | ||
180 | void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); | ||
181 | #if defined UNDER_CE | ||
182 | char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); | ||
183 | #endif | ||
184 | |||
185 | /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t | ||
186 | value -- needed when comparing unsigned to z_off64_t, which is signed | ||
187 | (possible z_off64_t types off_t, off64_t, and long are all signed) */ | ||
188 | #ifdef INT_MAX | ||
189 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) | ||
190 | #else | ||
191 | unsigned ZLIB_INTERNAL gz_intmax OF((void)); | ||
192 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) | ||
193 | #endif | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzlib.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzlib.c deleted file mode 100644 index ca55c6e..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzlib.c +++ /dev/null | |||
@@ -1,620 +0,0 @@ | |||
1 | /* gzlib.c -- zlib functions common to reading and writing gzip files | ||
2 | * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "gzguts.h" | ||
7 | |||
8 | #if defined(_WIN32) && !defined(__BORLANDC__) | ||
9 | # define LSEEK _lseeki64 | ||
10 | #else | ||
11 | #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 | ||
12 | # define LSEEK lseek64 | ||
13 | #else | ||
14 | # define LSEEK lseek | ||
15 | #endif | ||
16 | #endif | ||
17 | |||
18 | /* Local functions */ | ||
19 | local void gz_reset OF((gz_statep)); | ||
20 | local gzFile gz_open OF((const void *, int, const char *)); | ||
21 | |||
22 | #if defined UNDER_CE | ||
23 | |||
24 | /* Map the Windows error number in ERROR to a locale-dependent error message | ||
25 | string and return a pointer to it. Typically, the values for ERROR come | ||
26 | from GetLastError. | ||
27 | |||
28 | The string pointed to shall not be modified by the application, but may be | ||
29 | overwritten by a subsequent call to gz_strwinerror | ||
30 | |||
31 | The gz_strwinerror function does not change the current setting of | ||
32 | GetLastError. */ | ||
33 | char ZLIB_INTERNAL *gz_strwinerror (error) | ||
34 | DWORD error; | ||
35 | { | ||
36 | static char buf[1024]; | ||
37 | |||
38 | wchar_t *msgbuf; | ||
39 | DWORD lasterr = GetLastError(); | ||
40 | DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | ||
41 | | FORMAT_MESSAGE_ALLOCATE_BUFFER, | ||
42 | NULL, | ||
43 | error, | ||
44 | 0, /* Default language */ | ||
45 | (LPVOID)&msgbuf, | ||
46 | 0, | ||
47 | NULL); | ||
48 | if (chars != 0) { | ||
49 | /* If there is an \r\n appended, zap it. */ | ||
50 | if (chars >= 2 | ||
51 | && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { | ||
52 | chars -= 2; | ||
53 | msgbuf[chars] = 0; | ||
54 | } | ||
55 | |||
56 | if (chars > sizeof (buf) - 1) { | ||
57 | chars = sizeof (buf) - 1; | ||
58 | msgbuf[chars] = 0; | ||
59 | } | ||
60 | |||
61 | wcstombs(buf, msgbuf, chars + 1); | ||
62 | LocalFree(msgbuf); | ||
63 | } | ||
64 | else { | ||
65 | sprintf(buf, "unknown win32 error (%ld)", error); | ||
66 | } | ||
67 | |||
68 | SetLastError(lasterr); | ||
69 | return buf; | ||
70 | } | ||
71 | |||
72 | #endif /* UNDER_CE */ | ||
73 | |||
74 | /* Reset gzip file state */ | ||
75 | local void gz_reset(state) | ||
76 | gz_statep state; | ||
77 | { | ||
78 | state->x.have = 0; /* no output data available */ | ||
79 | if (state->mode == GZ_READ) { /* for reading ... */ | ||
80 | state->eof = 0; /* not at end of file */ | ||
81 | state->past = 0; /* have not read past end yet */ | ||
82 | state->how = LOOK; /* look for gzip header */ | ||
83 | } | ||
84 | state->seek = 0; /* no seek request pending */ | ||
85 | gz_error(state, Z_OK, NULL); /* clear error */ | ||
86 | state->x.pos = 0; /* no uncompressed data yet */ | ||
87 | state->strm.avail_in = 0; /* no input data yet */ | ||
88 | } | ||
89 | |||
90 | /* Open a gzip file either by name or file descriptor. */ | ||
91 | local gzFile gz_open(path, fd, mode) | ||
92 | const void *path; | ||
93 | int fd; | ||
94 | const char *mode; | ||
95 | { | ||
96 | gz_statep state; | ||
97 | size_t len; | ||
98 | int oflag; | ||
99 | #ifdef O_CLOEXEC | ||
100 | int cloexec = 0; | ||
101 | #endif | ||
102 | #ifdef O_EXCL | ||
103 | int exclusive = 0; | ||
104 | #endif | ||
105 | |||
106 | /* check input */ | ||
107 | if (path == NULL) | ||
108 | return NULL; | ||
109 | |||
110 | /* allocate gzFile structure to return */ | ||
111 | state = malloc(sizeof(gz_state)); | ||
112 | if (state == NULL) | ||
113 | return NULL; | ||
114 | state->size = 0; /* no buffers allocated yet */ | ||
115 | state->want = GZBUFSIZE; /* requested buffer size */ | ||
116 | state->msg = NULL; /* no error message yet */ | ||
117 | |||
118 | /* interpret mode */ | ||
119 | state->mode = GZ_NONE; | ||
120 | state->level = Z_DEFAULT_COMPRESSION; | ||
121 | state->strategy = Z_DEFAULT_STRATEGY; | ||
122 | state->direct = 0; | ||
123 | while (*mode) { | ||
124 | if (*mode >= '0' && *mode <= '9') | ||
125 | state->level = *mode - '0'; | ||
126 | else | ||
127 | switch (*mode) { | ||
128 | case 'r': | ||
129 | state->mode = GZ_READ; | ||
130 | break; | ||
131 | #ifndef NO_GZCOMPRESS | ||
132 | case 'w': | ||
133 | state->mode = GZ_WRITE; | ||
134 | break; | ||
135 | case 'a': | ||
136 | state->mode = GZ_APPEND; | ||
137 | break; | ||
138 | #endif | ||
139 | case '+': /* can't read and write at the same time */ | ||
140 | free(state); | ||
141 | return NULL; | ||
142 | case 'b': /* ignore -- will request binary anyway */ | ||
143 | break; | ||
144 | #ifdef O_CLOEXEC | ||
145 | case 'e': | ||
146 | cloexec = 1; | ||
147 | break; | ||
148 | #endif | ||
149 | #ifdef O_EXCL | ||
150 | case 'x': | ||
151 | exclusive = 1; | ||
152 | break; | ||
153 | #endif | ||
154 | case 'f': | ||
155 | state->strategy = Z_FILTERED; | ||
156 | break; | ||
157 | case 'h': | ||
158 | state->strategy = Z_HUFFMAN_ONLY; | ||
159 | break; | ||
160 | case 'R': | ||
161 | state->strategy = Z_RLE; | ||
162 | break; | ||
163 | case 'F': | ||
164 | state->strategy = Z_FIXED; | ||
165 | case 'T': | ||
166 | state->direct = 1; | ||
167 | default: /* could consider as an error, but just ignore */ | ||
168 | ; | ||
169 | } | ||
170 | mode++; | ||
171 | } | ||
172 | |||
173 | /* must provide an "r", "w", or "a" */ | ||
174 | if (state->mode == GZ_NONE) { | ||
175 | free(state); | ||
176 | return NULL; | ||
177 | } | ||
178 | |||
179 | /* can't force transparent read */ | ||
180 | if (state->mode == GZ_READ) { | ||
181 | if (state->direct) { | ||
182 | free(state); | ||
183 | return NULL; | ||
184 | } | ||
185 | state->direct = 1; /* for empty file */ | ||
186 | } | ||
187 | |||
188 | /* save the path name for error messages */ | ||
189 | #ifdef _WIN32 | ||
190 | if (fd == -2) { | ||
191 | len = wcstombs(NULL, path, 0); | ||
192 | if (len == (size_t)-1) | ||
193 | len = 0; | ||
194 | } | ||
195 | else | ||
196 | #endif | ||
197 | len = strlen(path); | ||
198 | state->path = malloc(len + 1); | ||
199 | if (state->path == NULL) { | ||
200 | free(state); | ||
201 | return NULL; | ||
202 | } | ||
203 | #ifdef _WIN32 | ||
204 | if (fd == -2) | ||
205 | if (len) | ||
206 | wcstombs(state->path, path, len + 1); | ||
207 | else | ||
208 | *(state->path) = 0; | ||
209 | else | ||
210 | #endif | ||
211 | strcpy(state->path, path); | ||
212 | |||
213 | /* compute the flags for open() */ | ||
214 | oflag = | ||
215 | #ifdef O_LARGEFILE | ||
216 | O_LARGEFILE | | ||
217 | #endif | ||
218 | #ifdef O_BINARY | ||
219 | O_BINARY | | ||
220 | #endif | ||
221 | #ifdef O_CLOEXEC | ||
222 | (cloexec ? O_CLOEXEC : 0) | | ||
223 | #endif | ||
224 | (state->mode == GZ_READ ? | ||
225 | O_RDONLY : | ||
226 | (O_WRONLY | O_CREAT | | ||
227 | #ifdef O_EXCL | ||
228 | (exclusive ? O_EXCL : 0) | | ||
229 | #endif | ||
230 | (state->mode == GZ_WRITE ? | ||
231 | O_TRUNC : | ||
232 | O_APPEND))); | ||
233 | |||
234 | /* open the file with the appropriate flags (or just use fd) */ | ||
235 | state->fd = fd > -1 ? fd : ( | ||
236 | #ifdef _WIN32 | ||
237 | fd == -2 ? _wopen(path, oflag, 0666) : | ||
238 | #endif | ||
239 | open(path, oflag, 0666)); | ||
240 | if (state->fd == -1) { | ||
241 | free(state->path); | ||
242 | free(state); | ||
243 | return NULL; | ||
244 | } | ||
245 | if (state->mode == GZ_APPEND) | ||
246 | state->mode = GZ_WRITE; /* simplify later checks */ | ||
247 | |||
248 | /* save the current position for rewinding (only if reading) */ | ||
249 | if (state->mode == GZ_READ) { | ||
250 | state->start = LSEEK(state->fd, 0, SEEK_CUR); | ||
251 | if (state->start == -1) state->start = 0; | ||
252 | } | ||
253 | |||
254 | /* initialize stream */ | ||
255 | gz_reset(state); | ||
256 | |||
257 | /* return stream */ | ||
258 | return (gzFile)state; | ||
259 | } | ||
260 | |||
261 | /* -- see zlib.h -- */ | ||
262 | gzFile ZEXPORT gzopen(path, mode) | ||
263 | const char *path; | ||
264 | const char *mode; | ||
265 | { | ||
266 | return gz_open(path, -1, mode); | ||
267 | } | ||
268 | |||
269 | /* -- see zlib.h -- */ | ||
270 | gzFile ZEXPORT gzopen64(path, mode) | ||
271 | const char *path; | ||
272 | const char *mode; | ||
273 | { | ||
274 | return gz_open(path, -1, mode); | ||
275 | } | ||
276 | |||
277 | /* -- see zlib.h -- */ | ||
278 | gzFile ZEXPORT gzdopen(fd, mode) | ||
279 | int fd; | ||
280 | const char *mode; | ||
281 | { | ||
282 | char *path; /* identifier for error messages */ | ||
283 | gzFile gz; | ||
284 | |||
285 | if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) | ||
286 | return NULL; | ||
287 | sprintf(path, "<fd:%d>", fd); /* for debugging */ | ||
288 | gz = gz_open(path, fd, mode); | ||
289 | free(path); | ||
290 | return gz; | ||
291 | } | ||
292 | |||
293 | /* -- see zlib.h -- */ | ||
294 | #ifdef _WIN32 | ||
295 | gzFile ZEXPORT gzopen_w(path, mode) | ||
296 | const wchar_t *path; | ||
297 | const char *mode; | ||
298 | { | ||
299 | return gz_open(path, -2, mode); | ||
300 | } | ||
301 | #endif | ||
302 | |||
303 | /* -- see zlib.h -- */ | ||
304 | int ZEXPORT gzbuffer(file, size) | ||
305 | gzFile file; | ||
306 | unsigned size; | ||
307 | { | ||
308 | gz_statep state; | ||
309 | |||
310 | /* get internal structure and check integrity */ | ||
311 | if (file == NULL) | ||
312 | return -1; | ||
313 | state = (gz_statep)file; | ||
314 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
315 | return -1; | ||
316 | |||
317 | /* make sure we haven't already allocated memory */ | ||
318 | if (state->size != 0) | ||
319 | return -1; | ||
320 | |||
321 | /* check and set requested size */ | ||
322 | if (size < 2) | ||
323 | size = 2; /* need two bytes to check magic header */ | ||
324 | state->want = size; | ||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | /* -- see zlib.h -- */ | ||
329 | int ZEXPORT gzrewind(file) | ||
330 | gzFile file; | ||
331 | { | ||
332 | gz_statep state; | ||
333 | |||
334 | /* get internal structure */ | ||
335 | if (file == NULL) | ||
336 | return -1; | ||
337 | state = (gz_statep)file; | ||
338 | |||
339 | /* check that we're reading and that there's no error */ | ||
340 | if (state->mode != GZ_READ || | ||
341 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | ||
342 | return -1; | ||
343 | |||
344 | /* back up and start over */ | ||
345 | if (LSEEK(state->fd, state->start, SEEK_SET) == -1) | ||
346 | return -1; | ||
347 | gz_reset(state); | ||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | /* -- see zlib.h -- */ | ||
352 | z_off64_t ZEXPORT gzseek64(file, offset, whence) | ||
353 | gzFile file; | ||
354 | z_off64_t offset; | ||
355 | int whence; | ||
356 | { | ||
357 | unsigned n; | ||
358 | z_off64_t ret; | ||
359 | gz_statep state; | ||
360 | |||
361 | /* get internal structure and check integrity */ | ||
362 | if (file == NULL) | ||
363 | return -1; | ||
364 | state = (gz_statep)file; | ||
365 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
366 | return -1; | ||
367 | |||
368 | /* check that there's no error */ | ||
369 | if (state->err != Z_OK && state->err != Z_BUF_ERROR) | ||
370 | return -1; | ||
371 | |||
372 | /* can only seek from start or relative to current position */ | ||
373 | if (whence != SEEK_SET && whence != SEEK_CUR) | ||
374 | return -1; | ||
375 | |||
376 | /* normalize offset to a SEEK_CUR specification */ | ||
377 | if (whence == SEEK_SET) | ||
378 | offset -= state->x.pos; | ||
379 | else if (state->seek) | ||
380 | offset += state->skip; | ||
381 | state->seek = 0; | ||
382 | |||
383 | /* if within raw area while reading, just go there */ | ||
384 | if (state->mode == GZ_READ && state->how == COPY && | ||
385 | state->x.pos + offset >= 0) { | ||
386 | ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); | ||
387 | if (ret == -1) | ||
388 | return -1; | ||
389 | state->x.have = 0; | ||
390 | state->eof = 0; | ||
391 | state->past = 0; | ||
392 | state->seek = 0; | ||
393 | gz_error(state, Z_OK, NULL); | ||
394 | state->strm.avail_in = 0; | ||
395 | state->x.pos += offset; | ||
396 | return state->x.pos; | ||
397 | } | ||
398 | |||
399 | /* calculate skip amount, rewinding if needed for back seek when reading */ | ||
400 | if (offset < 0) { | ||
401 | if (state->mode != GZ_READ) /* writing -- can't go backwards */ | ||
402 | return -1; | ||
403 | offset += state->x.pos; | ||
404 | if (offset < 0) /* before start of file! */ | ||
405 | return -1; | ||
406 | if (gzrewind(file) == -1) /* rewind, then skip to offset */ | ||
407 | return -1; | ||
408 | } | ||
409 | |||
410 | /* if reading, skip what's in output buffer (one less gzgetc() check) */ | ||
411 | if (state->mode == GZ_READ) { | ||
412 | n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ? | ||
413 | (unsigned)offset : state->x.have; | ||
414 | state->x.have -= n; | ||
415 | state->x.next += n; | ||
416 | state->x.pos += n; | ||
417 | offset -= n; | ||
418 | } | ||
419 | |||
420 | /* request skip (if not zero) */ | ||
421 | if (offset) { | ||
422 | state->seek = 1; | ||
423 | state->skip = offset; | ||
424 | } | ||
425 | return state->x.pos + offset; | ||
426 | } | ||
427 | |||
428 | /* -- see zlib.h -- */ | ||
429 | z_off_t ZEXPORT gzseek(file, offset, whence) | ||
430 | gzFile file; | ||
431 | z_off_t offset; | ||
432 | int whence; | ||
433 | { | ||
434 | z_off64_t ret; | ||
435 | |||
436 | ret = gzseek64(file, (z_off64_t)offset, whence); | ||
437 | return ret == (z_off_t)ret ? (z_off_t)ret : -1; | ||
438 | } | ||
439 | |||
440 | /* -- see zlib.h -- */ | ||
441 | z_off64_t ZEXPORT gztell64(file) | ||
442 | gzFile file; | ||
443 | { | ||
444 | gz_statep state; | ||
445 | |||
446 | /* get internal structure and check integrity */ | ||
447 | if (file == NULL) | ||
448 | return -1; | ||
449 | state = (gz_statep)file; | ||
450 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
451 | return -1; | ||
452 | |||
453 | /* return position */ | ||
454 | return state->x.pos + (state->seek ? state->skip : 0); | ||
455 | } | ||
456 | |||
457 | /* -- see zlib.h -- */ | ||
458 | z_off_t ZEXPORT gztell(file) | ||
459 | gzFile file; | ||
460 | { | ||
461 | z_off64_t ret; | ||
462 | |||
463 | ret = gztell64(file); | ||
464 | return ret == (z_off_t)ret ? (z_off_t)ret : -1; | ||
465 | } | ||
466 | |||
467 | /* -- see zlib.h -- */ | ||
468 | z_off64_t ZEXPORT gzoffset64(file) | ||
469 | gzFile file; | ||
470 | { | ||
471 | z_off64_t offset; | ||
472 | gz_statep state; | ||
473 | |||
474 | /* get internal structure and check integrity */ | ||
475 | if (file == NULL) | ||
476 | return -1; | ||
477 | state = (gz_statep)file; | ||
478 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
479 | return -1; | ||
480 | |||
481 | /* compute and return effective offset in file */ | ||
482 | offset = LSEEK(state->fd, 0, SEEK_CUR); | ||
483 | if (offset == -1) | ||
484 | return -1; | ||
485 | if (state->mode == GZ_READ) /* reading */ | ||
486 | offset -= state->strm.avail_in; /* don't count buffered input */ | ||
487 | return offset; | ||
488 | } | ||
489 | |||
490 | /* -- see zlib.h -- */ | ||
491 | z_off_t ZEXPORT gzoffset(file) | ||
492 | gzFile file; | ||
493 | { | ||
494 | z_off64_t ret; | ||
495 | |||
496 | ret = gzoffset64(file); | ||
497 | return ret == (z_off_t)ret ? (z_off_t)ret : -1; | ||
498 | } | ||
499 | |||
500 | /* -- see zlib.h -- */ | ||
501 | int ZEXPORT gzeof(file) | ||
502 | gzFile file; | ||
503 | { | ||
504 | gz_statep state; | ||
505 | |||
506 | /* get internal structure and check integrity */ | ||
507 | if (file == NULL) | ||
508 | return 0; | ||
509 | state = (gz_statep)file; | ||
510 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
511 | return 0; | ||
512 | |||
513 | /* return end-of-file state */ | ||
514 | return state->mode == GZ_READ ? state->past : 0; | ||
515 | } | ||
516 | |||
517 | /* -- see zlib.h -- */ | ||
518 | const char * ZEXPORT gzerror(file, errnum) | ||
519 | gzFile file; | ||
520 | int *errnum; | ||
521 | { | ||
522 | gz_statep state; | ||
523 | |||
524 | /* get internal structure and check integrity */ | ||
525 | if (file == NULL) | ||
526 | return NULL; | ||
527 | state = (gz_statep)file; | ||
528 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
529 | return NULL; | ||
530 | |||
531 | /* return error information */ | ||
532 | if (errnum != NULL) | ||
533 | *errnum = state->err; | ||
534 | return state->msg == NULL ? "" : state->msg; | ||
535 | } | ||
536 | |||
537 | /* -- see zlib.h -- */ | ||
538 | void ZEXPORT gzclearerr(file) | ||
539 | gzFile file; | ||
540 | { | ||
541 | gz_statep state; | ||
542 | |||
543 | /* get internal structure and check integrity */ | ||
544 | if (file == NULL) | ||
545 | return; | ||
546 | state = (gz_statep)file; | ||
547 | if (state->mode != GZ_READ && state->mode != GZ_WRITE) | ||
548 | return; | ||
549 | |||
550 | /* clear error and end-of-file */ | ||
551 | if (state->mode == GZ_READ) { | ||
552 | state->eof = 0; | ||
553 | state->past = 0; | ||
554 | } | ||
555 | gz_error(state, Z_OK, NULL); | ||
556 | } | ||
557 | |||
558 | /* Create an error message in allocated memory and set state->err and | ||
559 | state->msg accordingly. Free any previous error message already there. Do | ||
560 | not try to free or allocate space if the error is Z_MEM_ERROR (out of | ||
561 | memory). Simply save the error message as a static string. If there is an | ||
562 | allocation failure constructing the error message, then convert the error to | ||
563 | out of memory. */ | ||
564 | void ZLIB_INTERNAL gz_error(state, err, msg) | ||
565 | gz_statep state; | ||
566 | int err; | ||
567 | const char *msg; | ||
568 | { | ||
569 | /* free previously allocated message and clear */ | ||
570 | if (state->msg != NULL) { | ||
571 | if (state->err != Z_MEM_ERROR) | ||
572 | free(state->msg); | ||
573 | state->msg = NULL; | ||
574 | } | ||
575 | |||
576 | /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ | ||
577 | if (err != Z_OK && err != Z_BUF_ERROR) | ||
578 | state->x.have = 0; | ||
579 | |||
580 | /* set error code, and if no message, then done */ | ||
581 | state->err = err; | ||
582 | if (msg == NULL) | ||
583 | return; | ||
584 | |||
585 | /* for an out of memory error, save as static string */ | ||
586 | if (err == Z_MEM_ERROR) { | ||
587 | state->msg = (char *)msg; | ||
588 | return; | ||
589 | } | ||
590 | |||
591 | /* construct error message with path */ | ||
592 | if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { | ||
593 | state->err = Z_MEM_ERROR; | ||
594 | state->msg = (char *)"out of memory"; | ||
595 | return; | ||
596 | } | ||
597 | strcpy(state->msg, state->path); | ||
598 | strcat(state->msg, ": "); | ||
599 | strcat(state->msg, msg); | ||
600 | return; | ||
601 | } | ||
602 | |||
603 | #ifndef INT_MAX | ||
604 | /* portably return maximum value for an int (when limits.h presumed not | ||
605 | available) -- we need to do this to cover cases where 2's complement not | ||
606 | used, since C standard permits 1's complement and sign-bit representations, | ||
607 | otherwise we could just use ((unsigned)-1) >> 1 */ | ||
608 | unsigned ZLIB_INTERNAL gz_intmax() | ||
609 | { | ||
610 | unsigned p, q; | ||
611 | |||
612 | p = 1; | ||
613 | do { | ||
614 | q = p; | ||
615 | p <<= 1; | ||
616 | p++; | ||
617 | } while (p > q); | ||
618 | return q >> 1; | ||
619 | } | ||
620 | #endif | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzread.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzread.c deleted file mode 100644 index 3493d34..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzread.c +++ /dev/null | |||
@@ -1,589 +0,0 @@ | |||
1 | /* gzread.c -- zlib functions for reading gzip files | ||
2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "gzguts.h" | ||
7 | |||
8 | /* Local functions */ | ||
9 | local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); | ||
10 | local int gz_avail OF((gz_statep)); | ||
11 | local int gz_look OF((gz_statep)); | ||
12 | local int gz_decomp OF((gz_statep)); | ||
13 | local int gz_fetch OF((gz_statep)); | ||
14 | local int gz_skip OF((gz_statep, z_off64_t)); | ||
15 | |||
16 | /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from | ||
17 | state->fd, and update state->eof, state->err, and state->msg as appropriate. | ||
18 | This function needs to loop on read(), since read() is not guaranteed to | ||
19 | read the number of bytes requested, depending on the type of descriptor. */ | ||
20 | local int gz_load(state, buf, len, have) | ||
21 | gz_statep state; | ||
22 | unsigned char *buf; | ||
23 | unsigned len; | ||
24 | unsigned *have; | ||
25 | { | ||
26 | int ret; | ||
27 | |||
28 | *have = 0; | ||
29 | do { | ||
30 | ret = read(state->fd, buf + *have, len - *have); | ||
31 | if (ret <= 0) | ||
32 | break; | ||
33 | *have += ret; | ||
34 | } while (*have < len); | ||
35 | if (ret < 0) { | ||
36 | gz_error(state, Z_ERRNO, zstrerror()); | ||
37 | return -1; | ||
38 | } | ||
39 | if (ret == 0) | ||
40 | state->eof = 1; | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | /* Load up input buffer and set eof flag if last data loaded -- return -1 on | ||
45 | error, 0 otherwise. Note that the eof flag is set when the end of the input | ||
46 | file is reached, even though there may be unused data in the buffer. Once | ||
47 | that data has been used, no more attempts will be made to read the file. | ||
48 | If strm->avail_in != 0, then the current data is moved to the beginning of | ||
49 | the input buffer, and then the remainder of the buffer is loaded with the | ||
50 | available data from the input file. */ | ||
51 | local int gz_avail(state) | ||
52 | gz_statep state; | ||
53 | { | ||
54 | unsigned got; | ||
55 | z_streamp strm = &(state->strm); | ||
56 | |||
57 | if (state->err != Z_OK && state->err != Z_BUF_ERROR) | ||
58 | return -1; | ||
59 | if (state->eof == 0) { | ||
60 | if (strm->avail_in) { /* copy what's there to the start */ | ||
61 | unsigned char *p = state->in, *q = strm->next_in; | ||
62 | unsigned n = strm->avail_in; | ||
63 | do { | ||
64 | *p++ = *q++; | ||
65 | } while (--n); | ||
66 | } | ||
67 | if (gz_load(state, state->in + strm->avail_in, | ||
68 | state->size - strm->avail_in, &got) == -1) | ||
69 | return -1; | ||
70 | strm->avail_in += got; | ||
71 | strm->next_in = state->in; | ||
72 | } | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | /* Look for gzip header, set up for inflate or copy. state->x.have must be 0. | ||
77 | If this is the first time in, allocate required memory. state->how will be | ||
78 | left unchanged if there is no more input data available, will be set to COPY | ||
79 | if there is no gzip header and direct copying will be performed, or it will | ||
80 | be set to GZIP for decompression. If direct copying, then leftover input | ||
81 | data from the input buffer will be copied to the output buffer. In that | ||
82 | case, all further file reads will be directly to either the output buffer or | ||
83 | a user buffer. If decompressing, the inflate state will be initialized. | ||
84 | gz_look() will return 0 on success or -1 on failure. */ | ||
85 | local int gz_look(state) | ||
86 | gz_statep state; | ||
87 | { | ||
88 | z_streamp strm = &(state->strm); | ||
89 | |||
90 | /* allocate read buffers and inflate memory */ | ||
91 | if (state->size == 0) { | ||
92 | /* allocate buffers */ | ||
93 | state->in = malloc(state->want); | ||
94 | state->out = malloc(state->want << 1); | ||
95 | if (state->in == NULL || state->out == NULL) { | ||
96 | if (state->out != NULL) | ||
97 | free(state->out); | ||
98 | if (state->in != NULL) | ||
99 | free(state->in); | ||
100 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
101 | return -1; | ||
102 | } | ||
103 | state->size = state->want; | ||
104 | |||
105 | /* allocate inflate memory */ | ||
106 | state->strm.zalloc = Z_NULL; | ||
107 | state->strm.zfree = Z_NULL; | ||
108 | state->strm.opaque = Z_NULL; | ||
109 | state->strm.avail_in = 0; | ||
110 | state->strm.next_in = Z_NULL; | ||
111 | if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */ | ||
112 | free(state->out); | ||
113 | free(state->in); | ||
114 | state->size = 0; | ||
115 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
116 | return -1; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /* get at least the magic bytes in the input buffer */ | ||
121 | if (strm->avail_in < 2) { | ||
122 | if (gz_avail(state) == -1) | ||
123 | return -1; | ||
124 | if (strm->avail_in == 0) | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | /* look for gzip magic bytes -- if there, do gzip decoding (note: there is | ||
129 | a logical dilemma here when considering the case of a partially written | ||
130 | gzip file, to wit, if a single 31 byte is written, then we cannot tell | ||
131 | whether this is a single-byte file, or just a partially written gzip | ||
132 | file -- for here we assume that if a gzip file is being written, then | ||
133 | the header will be written in a single operation, so that reading a | ||
134 | single byte is sufficient indication that it is not a gzip file) */ | ||
135 | if (strm->avail_in > 1 && | ||
136 | strm->next_in[0] == 31 && strm->next_in[1] == 139) { | ||
137 | inflateReset(strm); | ||
138 | state->how = GZIP; | ||
139 | state->direct = 0; | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | /* no gzip header -- if we were decoding gzip before, then this is trailing | ||
144 | garbage. Ignore the trailing garbage and finish. */ | ||
145 | if (state->direct == 0) { | ||
146 | strm->avail_in = 0; | ||
147 | state->eof = 1; | ||
148 | state->x.have = 0; | ||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | /* doing raw i/o, copy any leftover input to output -- this assumes that | ||
153 | the output buffer is larger than the input buffer, which also assures | ||
154 | space for gzungetc() */ | ||
155 | state->x.next = state->out; | ||
156 | if (strm->avail_in) { | ||
157 | memcpy(state->x.next, strm->next_in, strm->avail_in); | ||
158 | state->x.have = strm->avail_in; | ||
159 | strm->avail_in = 0; | ||
160 | } | ||
161 | state->how = COPY; | ||
162 | state->direct = 1; | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | /* Decompress from input to the provided next_out and avail_out in the state. | ||
167 | On return, state->x.have and state->x.next point to the just decompressed | ||
168 | data. If the gzip stream completes, state->how is reset to LOOK to look for | ||
169 | the next gzip stream or raw data, once state->x.have is depleted. Returns 0 | ||
170 | on success, -1 on failure. */ | ||
171 | local int gz_decomp(state) | ||
172 | gz_statep state; | ||
173 | { | ||
174 | int ret = Z_OK; | ||
175 | unsigned had; | ||
176 | z_streamp strm = &(state->strm); | ||
177 | |||
178 | /* fill output buffer up to end of deflate stream */ | ||
179 | had = strm->avail_out; | ||
180 | do { | ||
181 | /* get more input for inflate() */ | ||
182 | if (strm->avail_in == 0 && gz_avail(state) == -1) | ||
183 | return -1; | ||
184 | if (strm->avail_in == 0) { | ||
185 | gz_error(state, Z_BUF_ERROR, "unexpected end of file"); | ||
186 | break; | ||
187 | } | ||
188 | |||
189 | /* decompress and handle errors */ | ||
190 | ret = inflate(strm, Z_NO_FLUSH); | ||
191 | if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { | ||
192 | gz_error(state, Z_STREAM_ERROR, | ||
193 | "internal error: inflate stream corrupt"); | ||
194 | return -1; | ||
195 | } | ||
196 | if (ret == Z_MEM_ERROR) { | ||
197 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
198 | return -1; | ||
199 | } | ||
200 | if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ | ||
201 | gz_error(state, Z_DATA_ERROR, | ||
202 | strm->msg == NULL ? "compressed data error" : strm->msg); | ||
203 | return -1; | ||
204 | } | ||
205 | } while (strm->avail_out && ret != Z_STREAM_END); | ||
206 | |||
207 | /* update available output */ | ||
208 | state->x.have = had - strm->avail_out; | ||
209 | state->x.next = strm->next_out - state->x.have; | ||
210 | |||
211 | /* if the gzip stream completed successfully, look for another */ | ||
212 | if (ret == Z_STREAM_END) | ||
213 | state->how = LOOK; | ||
214 | |||
215 | /* good decompression */ | ||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | /* Fetch data and put it in the output buffer. Assumes state->x.have is 0. | ||
220 | Data is either copied from the input file or decompressed from the input | ||
221 | file depending on state->how. If state->how is LOOK, then a gzip header is | ||
222 | looked for to determine whether to copy or decompress. Returns -1 on error, | ||
223 | otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the | ||
224 | end of the input file has been reached and all data has been processed. */ | ||
225 | local int gz_fetch(state) | ||
226 | gz_statep state; | ||
227 | { | ||
228 | z_streamp strm = &(state->strm); | ||
229 | |||
230 | do { | ||
231 | switch(state->how) { | ||
232 | case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ | ||
233 | if (gz_look(state) == -1) | ||
234 | return -1; | ||
235 | if (state->how == LOOK) | ||
236 | return 0; | ||
237 | break; | ||
238 | case COPY: /* -> COPY */ | ||
239 | if (gz_load(state, state->out, state->size << 1, &(state->x.have)) | ||
240 | == -1) | ||
241 | return -1; | ||
242 | state->x.next = state->out; | ||
243 | return 0; | ||
244 | case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */ | ||
245 | strm->avail_out = state->size << 1; | ||
246 | strm->next_out = state->out; | ||
247 | if (gz_decomp(state) == -1) | ||
248 | return -1; | ||
249 | } | ||
250 | } while (state->x.have == 0 && (!state->eof || strm->avail_in)); | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | /* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ | ||
255 | local int gz_skip(state, len) | ||
256 | gz_statep state; | ||
257 | z_off64_t len; | ||
258 | { | ||
259 | unsigned n; | ||
260 | |||
261 | /* skip over len bytes or reach end-of-file, whichever comes first */ | ||
262 | while (len) | ||
263 | /* skip over whatever is in output buffer */ | ||
264 | if (state->x.have) { | ||
265 | n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ? | ||
266 | (unsigned)len : state->x.have; | ||
267 | state->x.have -= n; | ||
268 | state->x.next += n; | ||
269 | state->x.pos += n; | ||
270 | len -= n; | ||
271 | } | ||
272 | |||
273 | /* output buffer empty -- return if we're at the end of the input */ | ||
274 | else if (state->eof && state->strm.avail_in == 0) | ||
275 | break; | ||
276 | |||
277 | /* need more data to skip -- load up output buffer */ | ||
278 | else { | ||
279 | /* get more output, looking for header if required */ | ||
280 | if (gz_fetch(state) == -1) | ||
281 | return -1; | ||
282 | } | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | /* -- see zlib.h -- */ | ||
287 | int ZEXPORT gzread(file, buf, len) | ||
288 | gzFile file; | ||
289 | voidp buf; | ||
290 | unsigned len; | ||
291 | { | ||
292 | unsigned got, n; | ||
293 | gz_statep state; | ||
294 | z_streamp strm; | ||
295 | |||
296 | /* get internal structure */ | ||
297 | if (file == NULL) | ||
298 | return -1; | ||
299 | state = (gz_statep)file; | ||
300 | strm = &(state->strm); | ||
301 | |||
302 | /* check that we're reading and that there's no (serious) error */ | ||
303 | if (state->mode != GZ_READ || | ||
304 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | ||
305 | return -1; | ||
306 | |||
307 | /* since an int is returned, make sure len fits in one, otherwise return | ||
308 | with an error (this avoids the flaw in the interface) */ | ||
309 | if ((int)len < 0) { | ||
310 | gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); | ||
311 | return -1; | ||
312 | } | ||
313 | |||
314 | /* if len is zero, avoid unnecessary operations */ | ||
315 | if (len == 0) | ||
316 | return 0; | ||
317 | |||
318 | /* process a skip request */ | ||
319 | if (state->seek) { | ||
320 | state->seek = 0; | ||
321 | if (gz_skip(state, state->skip) == -1) | ||
322 | return -1; | ||
323 | } | ||
324 | |||
325 | /* get len bytes to buf, or less than len if at the end */ | ||
326 | got = 0; | ||
327 | do { | ||
328 | /* first just try copying data from the output buffer */ | ||
329 | if (state->x.have) { | ||
330 | n = state->x.have > len ? len : state->x.have; | ||
331 | memcpy(buf, state->x.next, n); | ||
332 | state->x.next += n; | ||
333 | state->x.have -= n; | ||
334 | } | ||
335 | |||
336 | /* output buffer empty -- return if we're at the end of the input */ | ||
337 | else if (state->eof && strm->avail_in == 0) { | ||
338 | state->past = 1; /* tried to read past end */ | ||
339 | break; | ||
340 | } | ||
341 | |||
342 | /* need output data -- for small len or new stream load up our output | ||
343 | buffer */ | ||
344 | else if (state->how == LOOK || len < (state->size << 1)) { | ||
345 | /* get more output, looking for header if required */ | ||
346 | if (gz_fetch(state) == -1) | ||
347 | return -1; | ||
348 | continue; /* no progress yet -- go back to copy above */ | ||
349 | /* the copy above assures that we will leave with space in the | ||
350 | output buffer, allowing at least one gzungetc() to succeed */ | ||
351 | } | ||
352 | |||
353 | /* large len -- read directly into user buffer */ | ||
354 | else if (state->how == COPY) { /* read directly */ | ||
355 | if (gz_load(state, buf, len, &n) == -1) | ||
356 | return -1; | ||
357 | } | ||
358 | |||
359 | /* large len -- decompress directly into user buffer */ | ||
360 | else { /* state->how == GZIP */ | ||
361 | strm->avail_out = len; | ||
362 | strm->next_out = buf; | ||
363 | if (gz_decomp(state) == -1) | ||
364 | return -1; | ||
365 | n = state->x.have; | ||
366 | state->x.have = 0; | ||
367 | } | ||
368 | |||
369 | /* update progress */ | ||
370 | len -= n; | ||
371 | buf = (char *)buf + n; | ||
372 | got += n; | ||
373 | state->x.pos += n; | ||
374 | } while (len); | ||
375 | |||
376 | /* return number of bytes read into user buffer (will fit in int) */ | ||
377 | return (int)got; | ||
378 | } | ||
379 | |||
380 | /* -- see zlib.h -- */ | ||
381 | #undef gzgetc | ||
382 | int ZEXPORT gzgetc(file) | ||
383 | gzFile file; | ||
384 | { | ||
385 | int ret; | ||
386 | unsigned char buf[1]; | ||
387 | gz_statep state; | ||
388 | |||
389 | /* get internal structure */ | ||
390 | if (file == NULL) | ||
391 | return -1; | ||
392 | state = (gz_statep)file; | ||
393 | |||
394 | /* check that we're reading and that there's no (serious) error */ | ||
395 | if (state->mode != GZ_READ || | ||
396 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | ||
397 | return -1; | ||
398 | |||
399 | /* try output buffer (no need to check for skip request) */ | ||
400 | if (state->x.have) { | ||
401 | state->x.have--; | ||
402 | state->x.pos++; | ||
403 | return *(state->x.next)++; | ||
404 | } | ||
405 | |||
406 | /* nothing there -- try gzread() */ | ||
407 | ret = gzread(file, buf, 1); | ||
408 | return ret < 1 ? -1 : buf[0]; | ||
409 | } | ||
410 | |||
411 | int ZEXPORT gzgetc_(file) | ||
412 | gzFile file; | ||
413 | { | ||
414 | return gzgetc(file); | ||
415 | } | ||
416 | |||
417 | /* -- see zlib.h -- */ | ||
418 | int ZEXPORT gzungetc(c, file) | ||
419 | int c; | ||
420 | gzFile file; | ||
421 | { | ||
422 | gz_statep state; | ||
423 | |||
424 | /* get internal structure */ | ||
425 | if (file == NULL) | ||
426 | return -1; | ||
427 | state = (gz_statep)file; | ||
428 | |||
429 | /* check that we're reading and that there's no (serious) error */ | ||
430 | if (state->mode != GZ_READ || | ||
431 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | ||
432 | return -1; | ||
433 | |||
434 | /* process a skip request */ | ||
435 | if (state->seek) { | ||
436 | state->seek = 0; | ||
437 | if (gz_skip(state, state->skip) == -1) | ||
438 | return -1; | ||
439 | } | ||
440 | |||
441 | /* can't push EOF */ | ||
442 | if (c < 0) | ||
443 | return -1; | ||
444 | |||
445 | /* if output buffer empty, put byte at end (allows more pushing) */ | ||
446 | if (state->x.have == 0) { | ||
447 | state->x.have = 1; | ||
448 | state->x.next = state->out + (state->size << 1) - 1; | ||
449 | state->x.next[0] = c; | ||
450 | state->x.pos--; | ||
451 | state->past = 0; | ||
452 | return c; | ||
453 | } | ||
454 | |||
455 | /* if no room, give up (must have already done a gzungetc()) */ | ||
456 | if (state->x.have == (state->size << 1)) { | ||
457 | gz_error(state, Z_DATA_ERROR, "out of room to push characters"); | ||
458 | return -1; | ||
459 | } | ||
460 | |||
461 | /* slide output data if needed and insert byte before existing data */ | ||
462 | if (state->x.next == state->out) { | ||
463 | unsigned char *src = state->out + state->x.have; | ||
464 | unsigned char *dest = state->out + (state->size << 1); | ||
465 | while (src > state->out) | ||
466 | *--dest = *--src; | ||
467 | state->x.next = dest; | ||
468 | } | ||
469 | state->x.have++; | ||
470 | state->x.next--; | ||
471 | state->x.next[0] = c; | ||
472 | state->x.pos--; | ||
473 | state->past = 0; | ||
474 | return c; | ||
475 | } | ||
476 | |||
477 | /* -- see zlib.h -- */ | ||
478 | char * ZEXPORT gzgets(file, buf, len) | ||
479 | gzFile file; | ||
480 | char *buf; | ||
481 | int len; | ||
482 | { | ||
483 | unsigned left, n; | ||
484 | char *str; | ||
485 | unsigned char *eol; | ||
486 | gz_statep state; | ||
487 | |||
488 | /* check parameters and get internal structure */ | ||
489 | if (file == NULL || buf == NULL || len < 1) | ||
490 | return NULL; | ||
491 | state = (gz_statep)file; | ||
492 | |||
493 | /* check that we're reading and that there's no (serious) error */ | ||
494 | if (state->mode != GZ_READ || | ||
495 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | ||
496 | return NULL; | ||
497 | |||
498 | /* process a skip request */ | ||
499 | if (state->seek) { | ||
500 | state->seek = 0; | ||
501 | if (gz_skip(state, state->skip) == -1) | ||
502 | return NULL; | ||
503 | } | ||
504 | |||
505 | /* copy output bytes up to new line or len - 1, whichever comes first -- | ||
506 | append a terminating zero to the string (we don't check for a zero in | ||
507 | the contents, let the user worry about that) */ | ||
508 | str = buf; | ||
509 | left = (unsigned)len - 1; | ||
510 | if (left) do { | ||
511 | /* assure that something is in the output buffer */ | ||
512 | if (state->x.have == 0 && gz_fetch(state) == -1) | ||
513 | return NULL; /* error */ | ||
514 | if (state->x.have == 0) { /* end of file */ | ||
515 | state->past = 1; /* read past end */ | ||
516 | break; /* return what we have */ | ||
517 | } | ||
518 | |||
519 | /* look for end-of-line in current output buffer */ | ||
520 | n = state->x.have > left ? left : state->x.have; | ||
521 | eol = memchr(state->x.next, '\n', n); | ||
522 | if (eol != NULL) | ||
523 | n = (unsigned)(eol - state->x.next) + 1; | ||
524 | |||
525 | /* copy through end-of-line, or remainder if not found */ | ||
526 | memcpy(buf, state->x.next, n); | ||
527 | state->x.have -= n; | ||
528 | state->x.next += n; | ||
529 | state->x.pos += n; | ||
530 | left -= n; | ||
531 | buf += n; | ||
532 | } while (left && eol == NULL); | ||
533 | |||
534 | /* return terminated string, or if nothing, end of file */ | ||
535 | if (buf == str) | ||
536 | return NULL; | ||
537 | buf[0] = 0; | ||
538 | return str; | ||
539 | } | ||
540 | |||
541 | /* -- see zlib.h -- */ | ||
542 | int ZEXPORT gzdirect(file) | ||
543 | gzFile file; | ||
544 | { | ||
545 | gz_statep state; | ||
546 | |||
547 | /* get internal structure */ | ||
548 | if (file == NULL) | ||
549 | return 0; | ||
550 | state = (gz_statep)file; | ||
551 | |||
552 | /* if the state is not known, but we can find out, then do so (this is | ||
553 | mainly for right after a gzopen() or gzdopen()) */ | ||
554 | if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) | ||
555 | (void)gz_look(state); | ||
556 | |||
557 | /* return 1 if transparent, 0 if processing a gzip stream */ | ||
558 | return state->direct; | ||
559 | } | ||
560 | |||
561 | /* -- see zlib.h -- */ | ||
562 | int ZEXPORT gzclose_r(file) | ||
563 | gzFile file; | ||
564 | { | ||
565 | int ret, err; | ||
566 | gz_statep state; | ||
567 | |||
568 | /* get internal structure */ | ||
569 | if (file == NULL) | ||
570 | return Z_STREAM_ERROR; | ||
571 | state = (gz_statep)file; | ||
572 | |||
573 | /* check that we're reading */ | ||
574 | if (state->mode != GZ_READ) | ||
575 | return Z_STREAM_ERROR; | ||
576 | |||
577 | /* free memory and close file */ | ||
578 | if (state->size) { | ||
579 | inflateEnd(&(state->strm)); | ||
580 | free(state->out); | ||
581 | free(state->in); | ||
582 | } | ||
583 | err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK; | ||
584 | gz_error(state, Z_OK, NULL); | ||
585 | free(state->path); | ||
586 | ret = close(state->fd); | ||
587 | free(state); | ||
588 | return ret ? Z_ERRNO : err; | ||
589 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzwrite.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzwrite.c deleted file mode 100644 index 27cb342..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/gzwrite.c +++ /dev/null | |||
@@ -1,565 +0,0 @@ | |||
1 | /* gzwrite.c -- zlib functions for writing gzip files | ||
2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "gzguts.h" | ||
7 | |||
8 | /* Local functions */ | ||
9 | local int gz_init OF((gz_statep)); | ||
10 | local int gz_comp OF((gz_statep, int)); | ||
11 | local int gz_zero OF((gz_statep, z_off64_t)); | ||
12 | |||
13 | /* Initialize state for writing a gzip file. Mark initialization by setting | ||
14 | state->size to non-zero. Return -1 on failure or 0 on success. */ | ||
15 | local int gz_init(state) | ||
16 | gz_statep state; | ||
17 | { | ||
18 | int ret; | ||
19 | z_streamp strm = &(state->strm); | ||
20 | |||
21 | /* allocate input buffer */ | ||
22 | state->in = malloc(state->want); | ||
23 | if (state->in == NULL) { | ||
24 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
25 | return -1; | ||
26 | } | ||
27 | |||
28 | /* only need output buffer and deflate state if compressing */ | ||
29 | if (!state->direct) { | ||
30 | /* allocate output buffer */ | ||
31 | state->out = malloc(state->want); | ||
32 | if (state->out == NULL) { | ||
33 | free(state->in); | ||
34 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
35 | return -1; | ||
36 | } | ||
37 | |||
38 | /* allocate deflate memory, set up for gzip compression */ | ||
39 | strm->zalloc = Z_NULL; | ||
40 | strm->zfree = Z_NULL; | ||
41 | strm->opaque = Z_NULL; | ||
42 | ret = deflateInit2(strm, state->level, Z_DEFLATED, | ||
43 | MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); | ||
44 | if (ret != Z_OK) { | ||
45 | free(state->out); | ||
46 | free(state->in); | ||
47 | gz_error(state, Z_MEM_ERROR, "out of memory"); | ||
48 | return -1; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /* mark state as initialized */ | ||
53 | state->size = state->want; | ||
54 | |||
55 | /* initialize write buffer if compressing */ | ||
56 | if (!state->direct) { | ||
57 | strm->avail_out = state->size; | ||
58 | strm->next_out = state->out; | ||
59 | state->x.next = strm->next_out; | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* Compress whatever is at avail_in and next_in and write to the output file. | ||
65 | Return -1 if there is an error writing to the output file, otherwise 0. | ||
66 | flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, | ||
67 | then the deflate() state is reset to start a new gzip stream. If gz->direct | ||
68 | is true, then simply write to the output file without compressing, and | ||
69 | ignore flush. */ | ||
70 | local int gz_comp(state, flush) | ||
71 | gz_statep state; | ||
72 | int flush; | ||
73 | { | ||
74 | int ret, got; | ||
75 | unsigned have; | ||
76 | z_streamp strm = &(state->strm); | ||
77 | |||
78 | /* allocate memory if this is the first time through */ | ||
79 | if (state->size == 0 && gz_init(state) == -1) | ||
80 | return -1; | ||
81 | |||
82 | /* write directly if requested */ | ||
83 | if (state->direct) { | ||
84 | got = write(state->fd, strm->next_in, strm->avail_in); | ||
85 | if (got < 0 || (unsigned)got != strm->avail_in) { | ||
86 | gz_error(state, Z_ERRNO, zstrerror()); | ||
87 | return -1; | ||
88 | } | ||
89 | strm->avail_in = 0; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | /* run deflate() on provided input until it produces no more output */ | ||
94 | ret = Z_OK; | ||
95 | do { | ||
96 | /* write out current buffer contents if full, or if flushing, but if | ||
97 | doing Z_FINISH then don't write until we get to Z_STREAM_END */ | ||
98 | if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && | ||
99 | (flush != Z_FINISH || ret == Z_STREAM_END))) { | ||
100 | have = (unsigned)(strm->next_out - state->x.next); | ||
101 | if (have && ((got = write(state->fd, state->x.next, have)) < 0 || | ||
102 | (unsigned)got != have)) { | ||
103 | gz_error(state, Z_ERRNO, zstrerror()); | ||
104 | return -1; | ||
105 | } | ||
106 | if (strm->avail_out == 0) { | ||
107 | strm->avail_out = state->size; | ||
108 | strm->next_out = state->out; | ||
109 | } | ||
110 | state->x.next = strm->next_out; | ||
111 | } | ||
112 | |||
113 | /* compress */ | ||
114 | have = strm->avail_out; | ||
115 | ret = deflate(strm, flush); | ||
116 | if (ret == Z_STREAM_ERROR) { | ||
117 | gz_error(state, Z_STREAM_ERROR, | ||
118 | "internal error: deflate stream corrupt"); | ||
119 | return -1; | ||
120 | } | ||
121 | have -= strm->avail_out; | ||
122 | } while (have); | ||
123 | |||
124 | /* if that completed a deflate stream, allow another to start */ | ||
125 | if (flush == Z_FINISH) | ||
126 | deflateReset(strm); | ||
127 | |||
128 | /* all done, no errors */ | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | /* Compress len zeros to output. Return -1 on error, 0 on success. */ | ||
133 | local int gz_zero(state, len) | ||
134 | gz_statep state; | ||
135 | z_off64_t len; | ||
136 | { | ||
137 | int first; | ||
138 | unsigned n; | ||
139 | z_streamp strm = &(state->strm); | ||
140 | |||
141 | /* consume whatever's left in the input buffer */ | ||
142 | if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) | ||
143 | return -1; | ||
144 | |||
145 | /* compress len zeros (len guaranteed > 0) */ | ||
146 | first = 1; | ||
147 | while (len) { | ||
148 | n = GT_OFF(state->size) || (z_off64_t)state->size > len ? | ||
149 | (unsigned)len : state->size; | ||
150 | if (first) { | ||
151 | memset(state->in, 0, n); | ||
152 | first = 0; | ||
153 | } | ||
154 | strm->avail_in = n; | ||
155 | strm->next_in = state->in; | ||
156 | state->x.pos += n; | ||
157 | if (gz_comp(state, Z_NO_FLUSH) == -1) | ||
158 | return -1; | ||
159 | len -= n; | ||
160 | } | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | /* -- see zlib.h -- */ | ||
165 | int ZEXPORT gzwrite(file, buf, len) | ||
166 | gzFile file; | ||
167 | voidpc buf; | ||
168 | unsigned len; | ||
169 | { | ||
170 | unsigned put = len; | ||
171 | unsigned n; | ||
172 | gz_statep state; | ||
173 | z_streamp strm; | ||
174 | |||
175 | /* get internal structure */ | ||
176 | if (file == NULL) | ||
177 | return 0; | ||
178 | state = (gz_statep)file; | ||
179 | strm = &(state->strm); | ||
180 | |||
181 | /* check that we're writing and that there's no error */ | ||
182 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
183 | return 0; | ||
184 | |||
185 | /* since an int is returned, make sure len fits in one, otherwise return | ||
186 | with an error (this avoids the flaw in the interface) */ | ||
187 | if ((int)len < 0) { | ||
188 | gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | /* if len is zero, avoid unnecessary operations */ | ||
193 | if (len == 0) | ||
194 | return 0; | ||
195 | |||
196 | /* allocate memory if this is the first time through */ | ||
197 | if (state->size == 0 && gz_init(state) == -1) | ||
198 | return 0; | ||
199 | |||
200 | /* check for seek request */ | ||
201 | if (state->seek) { | ||
202 | state->seek = 0; | ||
203 | if (gz_zero(state, state->skip) == -1) | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | /* for small len, copy to input buffer, otherwise compress directly */ | ||
208 | if (len < state->size) { | ||
209 | /* copy to input buffer, compress when full */ | ||
210 | do { | ||
211 | if (strm->avail_in == 0) | ||
212 | strm->next_in = state->in; | ||
213 | n = state->size - strm->avail_in; | ||
214 | if (n > len) | ||
215 | n = len; | ||
216 | memcpy(strm->next_in + strm->avail_in, buf, n); | ||
217 | strm->avail_in += n; | ||
218 | state->x.pos += n; | ||
219 | buf = (char *)buf + n; | ||
220 | len -= n; | ||
221 | if (len && gz_comp(state, Z_NO_FLUSH) == -1) | ||
222 | return 0; | ||
223 | } while (len); | ||
224 | } | ||
225 | else { | ||
226 | /* consume whatever's left in the input buffer */ | ||
227 | if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) | ||
228 | return 0; | ||
229 | |||
230 | /* directly compress user buffer to file */ | ||
231 | strm->avail_in = len; | ||
232 | strm->next_in = (voidp)buf; | ||
233 | state->x.pos += len; | ||
234 | if (gz_comp(state, Z_NO_FLUSH) == -1) | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | /* input was all buffered or compressed (put will fit in int) */ | ||
239 | return (int)put; | ||
240 | } | ||
241 | |||
242 | /* -- see zlib.h -- */ | ||
243 | int ZEXPORT gzputc(file, c) | ||
244 | gzFile file; | ||
245 | int c; | ||
246 | { | ||
247 | unsigned char buf[1]; | ||
248 | gz_statep state; | ||
249 | z_streamp strm; | ||
250 | |||
251 | /* get internal structure */ | ||
252 | if (file == NULL) | ||
253 | return -1; | ||
254 | state = (gz_statep)file; | ||
255 | strm = &(state->strm); | ||
256 | |||
257 | /* check that we're writing and that there's no error */ | ||
258 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
259 | return -1; | ||
260 | |||
261 | /* check for seek request */ | ||
262 | if (state->seek) { | ||
263 | state->seek = 0; | ||
264 | if (gz_zero(state, state->skip) == -1) | ||
265 | return -1; | ||
266 | } | ||
267 | |||
268 | /* try writing to input buffer for speed (state->size == 0 if buffer not | ||
269 | initialized) */ | ||
270 | if (strm->avail_in < state->size) { | ||
271 | if (strm->avail_in == 0) | ||
272 | strm->next_in = state->in; | ||
273 | strm->next_in[strm->avail_in++] = c; | ||
274 | state->x.pos++; | ||
275 | return c & 0xff; | ||
276 | } | ||
277 | |||
278 | /* no room in buffer or not initialized, use gz_write() */ | ||
279 | buf[0] = c; | ||
280 | if (gzwrite(file, buf, 1) != 1) | ||
281 | return -1; | ||
282 | return c & 0xff; | ||
283 | } | ||
284 | |||
285 | /* -- see zlib.h -- */ | ||
286 | int ZEXPORT gzputs(file, str) | ||
287 | gzFile file; | ||
288 | const char *str; | ||
289 | { | ||
290 | int ret; | ||
291 | unsigned len; | ||
292 | |||
293 | /* write string */ | ||
294 | len = (unsigned)strlen(str); | ||
295 | ret = gzwrite(file, str, len); | ||
296 | return ret == 0 && len != 0 ? -1 : ret; | ||
297 | } | ||
298 | |||
299 | #if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
300 | #include <stdarg.h> | ||
301 | |||
302 | /* -- see zlib.h -- */ | ||
303 | int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) | ||
304 | { | ||
305 | int size, len; | ||
306 | gz_statep state; | ||
307 | z_streamp strm; | ||
308 | va_list va; | ||
309 | |||
310 | /* get internal structure */ | ||
311 | if (file == NULL) | ||
312 | return -1; | ||
313 | state = (gz_statep)file; | ||
314 | strm = &(state->strm); | ||
315 | |||
316 | /* check that we're writing and that there's no error */ | ||
317 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
318 | return 0; | ||
319 | |||
320 | /* make sure we have some buffer space */ | ||
321 | if (state->size == 0 && gz_init(state) == -1) | ||
322 | return 0; | ||
323 | |||
324 | /* check for seek request */ | ||
325 | if (state->seek) { | ||
326 | state->seek = 0; | ||
327 | if (gz_zero(state, state->skip) == -1) | ||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | /* consume whatever's left in the input buffer */ | ||
332 | if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) | ||
333 | return 0; | ||
334 | |||
335 | /* do the printf() into the input buffer, put length in len */ | ||
336 | size = (int)(state->size); | ||
337 | state->in[size - 1] = 0; | ||
338 | va_start(va, format); | ||
339 | #ifdef NO_vsnprintf | ||
340 | # ifdef HAS_vsprintf_void | ||
341 | (void)vsprintf((char *)(state->in), format, va); | ||
342 | va_end(va); | ||
343 | for (len = 0; len < size; len++) | ||
344 | if (state->in[len] == 0) break; | ||
345 | # else | ||
346 | len = vsprintf((char *)(state->in), format, va); | ||
347 | va_end(va); | ||
348 | # endif | ||
349 | #else | ||
350 | # ifdef HAS_vsnprintf_void | ||
351 | (void)vsnprintf((char *)(state->in), size, format, va); | ||
352 | va_end(va); | ||
353 | len = strlen((char *)(state->in)); | ||
354 | # else | ||
355 | len = vsnprintf((char *)(state->in), size, format, va); | ||
356 | va_end(va); | ||
357 | # endif | ||
358 | #endif | ||
359 | |||
360 | /* check that printf() results fit in buffer */ | ||
361 | if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) | ||
362 | return 0; | ||
363 | |||
364 | /* update buffer and position, defer compression until needed */ | ||
365 | strm->avail_in = (unsigned)len; | ||
366 | strm->next_in = state->in; | ||
367 | state->x.pos += len; | ||
368 | return len; | ||
369 | } | ||
370 | |||
371 | #else /* !STDC && !Z_HAVE_STDARG_H */ | ||
372 | |||
373 | /* -- see zlib.h -- */ | ||
374 | int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | ||
375 | a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) | ||
376 | gzFile file; | ||
377 | const char *format; | ||
378 | int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | ||
379 | a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; | ||
380 | { | ||
381 | int size, len; | ||
382 | gz_statep state; | ||
383 | z_streamp strm; | ||
384 | |||
385 | /* get internal structure */ | ||
386 | if (file == NULL) | ||
387 | return -1; | ||
388 | state = (gz_statep)file; | ||
389 | strm = &(state->strm); | ||
390 | |||
391 | /* check that can really pass pointer in ints */ | ||
392 | if (sizeof(int) != sizeof(void *)) | ||
393 | return 0; | ||
394 | |||
395 | /* check that we're writing and that there's no error */ | ||
396 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
397 | return 0; | ||
398 | |||
399 | /* make sure we have some buffer space */ | ||
400 | if (state->size == 0 && gz_init(state) == -1) | ||
401 | return 0; | ||
402 | |||
403 | /* check for seek request */ | ||
404 | if (state->seek) { | ||
405 | state->seek = 0; | ||
406 | if (gz_zero(state, state->skip) == -1) | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | /* consume whatever's left in the input buffer */ | ||
411 | if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) | ||
412 | return 0; | ||
413 | |||
414 | /* do the printf() into the input buffer, put length in len */ | ||
415 | size = (int)(state->size); | ||
416 | state->in[size - 1] = 0; | ||
417 | #ifdef NO_snprintf | ||
418 | # ifdef HAS_sprintf_void | ||
419 | sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, | ||
420 | a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||
421 | for (len = 0; len < size; len++) | ||
422 | if (state->in[len] == 0) break; | ||
423 | # else | ||
424 | len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, | ||
425 | a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||
426 | # endif | ||
427 | #else | ||
428 | # ifdef HAS_snprintf_void | ||
429 | snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8, | ||
430 | a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||
431 | len = strlen((char *)(state->in)); | ||
432 | # else | ||
433 | len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, | ||
434 | a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, | ||
435 | a19, a20); | ||
436 | # endif | ||
437 | #endif | ||
438 | |||
439 | /* check that printf() results fit in buffer */ | ||
440 | if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) | ||
441 | return 0; | ||
442 | |||
443 | /* update buffer and position, defer compression until needed */ | ||
444 | strm->avail_in = (unsigned)len; | ||
445 | strm->next_in = state->in; | ||
446 | state->x.pos += len; | ||
447 | return len; | ||
448 | } | ||
449 | |||
450 | #endif | ||
451 | |||
452 | /* -- see zlib.h -- */ | ||
453 | int ZEXPORT gzflush(file, flush) | ||
454 | gzFile file; | ||
455 | int flush; | ||
456 | { | ||
457 | gz_statep state; | ||
458 | |||
459 | /* get internal structure */ | ||
460 | if (file == NULL) | ||
461 | return -1; | ||
462 | state = (gz_statep)file; | ||
463 | |||
464 | /* check that we're writing and that there's no error */ | ||
465 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
466 | return Z_STREAM_ERROR; | ||
467 | |||
468 | /* check flush parameter */ | ||
469 | if (flush < 0 || flush > Z_FINISH) | ||
470 | return Z_STREAM_ERROR; | ||
471 | |||
472 | /* check for seek request */ | ||
473 | if (state->seek) { | ||
474 | state->seek = 0; | ||
475 | if (gz_zero(state, state->skip) == -1) | ||
476 | return -1; | ||
477 | } | ||
478 | |||
479 | /* compress remaining data with requested flush */ | ||
480 | gz_comp(state, flush); | ||
481 | return state->err; | ||
482 | } | ||
483 | |||
484 | /* -- see zlib.h -- */ | ||
485 | int ZEXPORT gzsetparams(file, level, strategy) | ||
486 | gzFile file; | ||
487 | int level; | ||
488 | int strategy; | ||
489 | { | ||
490 | gz_statep state; | ||
491 | z_streamp strm; | ||
492 | |||
493 | /* get internal structure */ | ||
494 | if (file == NULL) | ||
495 | return Z_STREAM_ERROR; | ||
496 | state = (gz_statep)file; | ||
497 | strm = &(state->strm); | ||
498 | |||
499 | /* check that we're writing and that there's no error */ | ||
500 | if (state->mode != GZ_WRITE || state->err != Z_OK) | ||
501 | return Z_STREAM_ERROR; | ||
502 | |||
503 | /* if no change is requested, then do nothing */ | ||
504 | if (level == state->level && strategy == state->strategy) | ||
505 | return Z_OK; | ||
506 | |||
507 | /* check for seek request */ | ||
508 | if (state->seek) { | ||
509 | state->seek = 0; | ||
510 | if (gz_zero(state, state->skip) == -1) | ||
511 | return -1; | ||
512 | } | ||
513 | |||
514 | /* change compression parameters for subsequent input */ | ||
515 | if (state->size) { | ||
516 | /* flush previous input with previous parameters before changing */ | ||
517 | if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) | ||
518 | return state->err; | ||
519 | deflateParams(strm, level, strategy); | ||
520 | } | ||
521 | state->level = level; | ||
522 | state->strategy = strategy; | ||
523 | return Z_OK; | ||
524 | } | ||
525 | |||
526 | /* -- see zlib.h -- */ | ||
527 | int ZEXPORT gzclose_w(file) | ||
528 | gzFile file; | ||
529 | { | ||
530 | int ret = Z_OK; | ||
531 | gz_statep state; | ||
532 | |||
533 | /* get internal structure */ | ||
534 | if (file == NULL) | ||
535 | return Z_STREAM_ERROR; | ||
536 | state = (gz_statep)file; | ||
537 | |||
538 | /* check that we're writing */ | ||
539 | if (state->mode != GZ_WRITE) | ||
540 | return Z_STREAM_ERROR; | ||
541 | |||
542 | /* check for seek request */ | ||
543 | if (state->seek) { | ||
544 | state->seek = 0; | ||
545 | if (gz_zero(state, state->skip) == -1) | ||
546 | ret = state->err; | ||
547 | } | ||
548 | |||
549 | /* flush, free memory, and close file */ | ||
550 | if (state->size) { | ||
551 | if (gz_comp(state, Z_FINISH) == -1) | ||
552 | ret = state->err; | ||
553 | if (!state->direct) { | ||
554 | (void)deflateEnd(&(state->strm)); | ||
555 | free(state->out); | ||
556 | } | ||
557 | free(state->in); | ||
558 | } | ||
559 | gz_error(state, Z_OK, NULL); | ||
560 | free(state->path); | ||
561 | if (close(state->fd) == -1) | ||
562 | ret = Z_ERRNO; | ||
563 | free(state); | ||
564 | return ret; | ||
565 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/infback.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/infback.c deleted file mode 100644 index 981aff1..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/infback.c +++ /dev/null | |||
@@ -1,640 +0,0 @@ | |||
1 | /* infback.c -- inflate using a call-back interface | ||
2 | * Copyright (C) 1995-2011 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | This code is largely copied from inflate.c. Normally either infback.o or | ||
8 | inflate.o would be linked into an application--not both. The interface | ||
9 | with inffast.c is retained so that optimized assembler-coded versions of | ||
10 | inflate_fast() can be used with either inflate.c or infback.c. | ||
11 | */ | ||
12 | |||
13 | #include "zutil.h" | ||
14 | #include "inftrees.h" | ||
15 | #include "inflate.h" | ||
16 | #include "inffast.h" | ||
17 | |||
18 | /* function prototypes */ | ||
19 | local void fixedtables OF((struct inflate_state FAR *state)); | ||
20 | |||
21 | /* | ||
22 | strm provides memory allocation functions in zalloc and zfree, or | ||
23 | Z_NULL to use the library memory allocation functions. | ||
24 | |||
25 | windowBits is in the range 8..15, and window is a user-supplied | ||
26 | window and output buffer that is 2**windowBits bytes. | ||
27 | */ | ||
28 | int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) | ||
29 | z_streamp strm; | ||
30 | int windowBits; | ||
31 | unsigned char FAR *window; | ||
32 | const char *version; | ||
33 | int stream_size; | ||
34 | { | ||
35 | struct inflate_state FAR *state; | ||
36 | |||
37 | if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || | ||
38 | stream_size != (int)(sizeof(z_stream))) | ||
39 | return Z_VERSION_ERROR; | ||
40 | if (strm == Z_NULL || window == Z_NULL || | ||
41 | windowBits < 8 || windowBits > 15) | ||
42 | return Z_STREAM_ERROR; | ||
43 | strm->msg = Z_NULL; /* in case we return an error */ | ||
44 | if (strm->zalloc == (alloc_func)0) { | ||
45 | #ifdef Z_SOLO | ||
46 | return Z_STREAM_ERROR; | ||
47 | #else | ||
48 | strm->zalloc = zcalloc; | ||
49 | strm->opaque = (voidpf)0; | ||
50 | #endif | ||
51 | } | ||
52 | if (strm->zfree == (free_func)0) | ||
53 | #ifdef Z_SOLO | ||
54 | return Z_STREAM_ERROR; | ||
55 | #else | ||
56 | strm->zfree = zcfree; | ||
57 | #endif | ||
58 | state = (struct inflate_state FAR *)ZALLOC(strm, 1, | ||
59 | sizeof(struct inflate_state)); | ||
60 | if (state == Z_NULL) return Z_MEM_ERROR; | ||
61 | Tracev((stderr, "inflate: allocated\n")); | ||
62 | strm->state = (struct internal_state FAR *)state; | ||
63 | state->dmax = 32768U; | ||
64 | state->wbits = windowBits; | ||
65 | state->wsize = 1U << windowBits; | ||
66 | state->window = window; | ||
67 | state->wnext = 0; | ||
68 | state->whave = 0; | ||
69 | return Z_OK; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | Return state with length and distance decoding tables and index sizes set to | ||
74 | fixed code decoding. Normally this returns fixed tables from inffixed.h. | ||
75 | If BUILDFIXED is defined, then instead this routine builds the tables the | ||
76 | first time it's called, and returns those tables the first time and | ||
77 | thereafter. This reduces the size of the code by about 2K bytes, in | ||
78 | exchange for a little execution time. However, BUILDFIXED should not be | ||
79 | used for threaded applications, since the rewriting of the tables and virgin | ||
80 | may not be thread-safe. | ||
81 | */ | ||
82 | local void fixedtables(state) | ||
83 | struct inflate_state FAR *state; | ||
84 | { | ||
85 | #ifdef BUILDFIXED | ||
86 | static int virgin = 1; | ||
87 | static code *lenfix, *distfix; | ||
88 | static code fixed[544]; | ||
89 | |||
90 | /* build fixed huffman tables if first call (may not be thread safe) */ | ||
91 | if (virgin) { | ||
92 | unsigned sym, bits; | ||
93 | static code *next; | ||
94 | |||
95 | /* literal/length table */ | ||
96 | sym = 0; | ||
97 | while (sym < 144) state->lens[sym++] = 8; | ||
98 | while (sym < 256) state->lens[sym++] = 9; | ||
99 | while (sym < 280) state->lens[sym++] = 7; | ||
100 | while (sym < 288) state->lens[sym++] = 8; | ||
101 | next = fixed; | ||
102 | lenfix = next; | ||
103 | bits = 9; | ||
104 | inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); | ||
105 | |||
106 | /* distance table */ | ||
107 | sym = 0; | ||
108 | while (sym < 32) state->lens[sym++] = 5; | ||
109 | distfix = next; | ||
110 | bits = 5; | ||
111 | inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); | ||
112 | |||
113 | /* do this just once */ | ||
114 | virgin = 0; | ||
115 | } | ||
116 | #else /* !BUILDFIXED */ | ||
117 | # include "inffixed.h" | ||
118 | #endif /* BUILDFIXED */ | ||
119 | state->lencode = lenfix; | ||
120 | state->lenbits = 9; | ||
121 | state->distcode = distfix; | ||
122 | state->distbits = 5; | ||
123 | } | ||
124 | |||
125 | /* Macros for inflateBack(): */ | ||
126 | |||
127 | /* Load returned state from inflate_fast() */ | ||
128 | #define LOAD() \ | ||
129 | do { \ | ||
130 | put = strm->next_out; \ | ||
131 | left = strm->avail_out; \ | ||
132 | next = strm->next_in; \ | ||
133 | have = strm->avail_in; \ | ||
134 | hold = state->hold; \ | ||
135 | bits = state->bits; \ | ||
136 | } while (0) | ||
137 | |||
138 | /* Set state from registers for inflate_fast() */ | ||
139 | #define RESTORE() \ | ||
140 | do { \ | ||
141 | strm->next_out = put; \ | ||
142 | strm->avail_out = left; \ | ||
143 | strm->next_in = next; \ | ||
144 | strm->avail_in = have; \ | ||
145 | state->hold = hold; \ | ||
146 | state->bits = bits; \ | ||
147 | } while (0) | ||
148 | |||
149 | /* Clear the input bit accumulator */ | ||
150 | #define INITBITS() \ | ||
151 | do { \ | ||
152 | hold = 0; \ | ||
153 | bits = 0; \ | ||
154 | } while (0) | ||
155 | |||
156 | /* Assure that some input is available. If input is requested, but denied, | ||
157 | then return a Z_BUF_ERROR from inflateBack(). */ | ||
158 | #define PULL() \ | ||
159 | do { \ | ||
160 | if (have == 0) { \ | ||
161 | have = in(in_desc, &next); \ | ||
162 | if (have == 0) { \ | ||
163 | next = Z_NULL; \ | ||
164 | ret = Z_BUF_ERROR; \ | ||
165 | goto inf_leave; \ | ||
166 | } \ | ||
167 | } \ | ||
168 | } while (0) | ||
169 | |||
170 | /* Get a byte of input into the bit accumulator, or return from inflateBack() | ||
171 | with an error if there is no input available. */ | ||
172 | #define PULLBYTE() \ | ||
173 | do { \ | ||
174 | PULL(); \ | ||
175 | have--; \ | ||
176 | hold += (unsigned long)(*next++) << bits; \ | ||
177 | bits += 8; \ | ||
178 | } while (0) | ||
179 | |||
180 | /* Assure that there are at least n bits in the bit accumulator. If there is | ||
181 | not enough available input to do that, then return from inflateBack() with | ||
182 | an error. */ | ||
183 | #define NEEDBITS(n) \ | ||
184 | do { \ | ||
185 | while (bits < (unsigned)(n)) \ | ||
186 | PULLBYTE(); \ | ||
187 | } while (0) | ||
188 | |||
189 | /* Return the low n bits of the bit accumulator (n < 16) */ | ||
190 | #define BITS(n) \ | ||
191 | ((unsigned)hold & ((1U << (n)) - 1)) | ||
192 | |||
193 | /* Remove n bits from the bit accumulator */ | ||
194 | #define DROPBITS(n) \ | ||
195 | do { \ | ||
196 | hold >>= (n); \ | ||
197 | bits -= (unsigned)(n); \ | ||
198 | } while (0) | ||
199 | |||
200 | /* Remove zero to seven bits as needed to go to a byte boundary */ | ||
201 | #define BYTEBITS() \ | ||
202 | do { \ | ||
203 | hold >>= bits & 7; \ | ||
204 | bits -= bits & 7; \ | ||
205 | } while (0) | ||
206 | |||
207 | /* Assure that some output space is available, by writing out the window | ||
208 | if it's full. If the write fails, return from inflateBack() with a | ||
209 | Z_BUF_ERROR. */ | ||
210 | #define ROOM() \ | ||
211 | do { \ | ||
212 | if (left == 0) { \ | ||
213 | put = state->window; \ | ||
214 | left = state->wsize; \ | ||
215 | state->whave = left; \ | ||
216 | if (out(out_desc, put, left)) { \ | ||
217 | ret = Z_BUF_ERROR; \ | ||
218 | goto inf_leave; \ | ||
219 | } \ | ||
220 | } \ | ||
221 | } while (0) | ||
222 | |||
223 | /* | ||
224 | strm provides the memory allocation functions and window buffer on input, | ||
225 | and provides information on the unused input on return. For Z_DATA_ERROR | ||
226 | returns, strm will also provide an error message. | ||
227 | |||
228 | in() and out() are the call-back input and output functions. When | ||
229 | inflateBack() needs more input, it calls in(). When inflateBack() has | ||
230 | filled the window with output, or when it completes with data in the | ||
231 | window, it calls out() to write out the data. The application must not | ||
232 | change the provided input until in() is called again or inflateBack() | ||
233 | returns. The application must not change the window/output buffer until | ||
234 | inflateBack() returns. | ||
235 | |||
236 | in() and out() are called with a descriptor parameter provided in the | ||
237 | inflateBack() call. This parameter can be a structure that provides the | ||
238 | information required to do the read or write, as well as accumulated | ||
239 | information on the input and output such as totals and check values. | ||
240 | |||
241 | in() should return zero on failure. out() should return non-zero on | ||
242 | failure. If either in() or out() fails, than inflateBack() returns a | ||
243 | Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it | ||
244 | was in() or out() that caused in the error. Otherwise, inflateBack() | ||
245 | returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format | ||
246 | error, or Z_MEM_ERROR if it could not allocate memory for the state. | ||
247 | inflateBack() can also return Z_STREAM_ERROR if the input parameters | ||
248 | are not correct, i.e. strm is Z_NULL or the state was not initialized. | ||
249 | */ | ||
250 | int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) | ||
251 | z_streamp strm; | ||
252 | in_func in; | ||
253 | void FAR *in_desc; | ||
254 | out_func out; | ||
255 | void FAR *out_desc; | ||
256 | { | ||
257 | struct inflate_state FAR *state; | ||
258 | unsigned char FAR *next; /* next input */ | ||
259 | unsigned char FAR *put; /* next output */ | ||
260 | unsigned have, left; /* available input and output */ | ||
261 | unsigned long hold; /* bit buffer */ | ||
262 | unsigned bits; /* bits in bit buffer */ | ||
263 | unsigned copy; /* number of stored or match bytes to copy */ | ||
264 | unsigned char FAR *from; /* where to copy match bytes from */ | ||
265 | code here; /* current decoding table entry */ | ||
266 | code last; /* parent table entry */ | ||
267 | unsigned len; /* length to copy for repeats, bits to drop */ | ||
268 | int ret; /* return code */ | ||
269 | static const unsigned short order[19] = /* permutation of code lengths */ | ||
270 | {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; | ||
271 | |||
272 | /* Check that the strm exists and that the state was initialized */ | ||
273 | if (strm == Z_NULL || strm->state == Z_NULL) | ||
274 | return Z_STREAM_ERROR; | ||
275 | state = (struct inflate_state FAR *)strm->state; | ||
276 | |||
277 | /* Reset the state */ | ||
278 | strm->msg = Z_NULL; | ||
279 | state->mode = TYPE; | ||
280 | state->last = 0; | ||
281 | state->whave = 0; | ||
282 | next = strm->next_in; | ||
283 | have = next != Z_NULL ? strm->avail_in : 0; | ||
284 | hold = 0; | ||
285 | bits = 0; | ||
286 | put = state->window; | ||
287 | left = state->wsize; | ||
288 | |||
289 | /* Inflate until end of block marked as last */ | ||
290 | for (;;) | ||
291 | switch (state->mode) { | ||
292 | case TYPE: | ||
293 | /* determine and dispatch block type */ | ||
294 | if (state->last) { | ||
295 | BYTEBITS(); | ||
296 | state->mode = DONE; | ||
297 | break; | ||
298 | } | ||
299 | NEEDBITS(3); | ||
300 | state->last = BITS(1); | ||
301 | DROPBITS(1); | ||
302 | switch (BITS(2)) { | ||
303 | case 0: /* stored block */ | ||
304 | Tracev((stderr, "inflate: stored block%s\n", | ||
305 | state->last ? " (last)" : "")); | ||
306 | state->mode = STORED; | ||
307 | break; | ||
308 | case 1: /* fixed block */ | ||
309 | fixedtables(state); | ||
310 | Tracev((stderr, "inflate: fixed codes block%s\n", | ||
311 | state->last ? " (last)" : "")); | ||
312 | state->mode = LEN; /* decode codes */ | ||
313 | break; | ||
314 | case 2: /* dynamic block */ | ||
315 | Tracev((stderr, "inflate: dynamic codes block%s\n", | ||
316 | state->last ? " (last)" : "")); | ||
317 | state->mode = TABLE; | ||
318 | break; | ||
319 | case 3: | ||
320 | strm->msg = (char *)"invalid block type"; | ||
321 | state->mode = BAD; | ||
322 | } | ||
323 | DROPBITS(2); | ||
324 | break; | ||
325 | |||
326 | case STORED: | ||
327 | /* get and verify stored block length */ | ||
328 | BYTEBITS(); /* go to byte boundary */ | ||
329 | NEEDBITS(32); | ||
330 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { | ||
331 | strm->msg = (char *)"invalid stored block lengths"; | ||
332 | state->mode = BAD; | ||
333 | break; | ||
334 | } | ||
335 | state->length = (unsigned)hold & 0xffff; | ||
336 | Tracev((stderr, "inflate: stored length %u\n", | ||
337 | state->length)); | ||
338 | INITBITS(); | ||
339 | |||
340 | /* copy stored block from input to output */ | ||
341 | while (state->length != 0) { | ||
342 | copy = state->length; | ||
343 | PULL(); | ||
344 | ROOM(); | ||
345 | if (copy > have) copy = have; | ||
346 | if (copy > left) copy = left; | ||
347 | zmemcpy(put, next, copy); | ||
348 | have -= copy; | ||
349 | next += copy; | ||
350 | left -= copy; | ||
351 | put += copy; | ||
352 | state->length -= copy; | ||
353 | } | ||
354 | Tracev((stderr, "inflate: stored end\n")); | ||
355 | state->mode = TYPE; | ||
356 | break; | ||
357 | |||
358 | case TABLE: | ||
359 | /* get dynamic table entries descriptor */ | ||
360 | NEEDBITS(14); | ||
361 | state->nlen = BITS(5) + 257; | ||
362 | DROPBITS(5); | ||
363 | state->ndist = BITS(5) + 1; | ||
364 | DROPBITS(5); | ||
365 | state->ncode = BITS(4) + 4; | ||
366 | DROPBITS(4); | ||
367 | #ifndef PKZIP_BUG_WORKAROUND | ||
368 | if (state->nlen > 286 || state->ndist > 30) { | ||
369 | strm->msg = (char *)"too many length or distance symbols"; | ||
370 | state->mode = BAD; | ||
371 | break; | ||
372 | } | ||
373 | #endif | ||
374 | Tracev((stderr, "inflate: table sizes ok\n")); | ||
375 | |||
376 | /* get code length code lengths (not a typo) */ | ||
377 | state->have = 0; | ||
378 | while (state->have < state->ncode) { | ||
379 | NEEDBITS(3); | ||
380 | state->lens[order[state->have++]] = (unsigned short)BITS(3); | ||
381 | DROPBITS(3); | ||
382 | } | ||
383 | while (state->have < 19) | ||
384 | state->lens[order[state->have++]] = 0; | ||
385 | state->next = state->codes; | ||
386 | state->lencode = (code const FAR *)(state->next); | ||
387 | state->lenbits = 7; | ||
388 | ret = inflate_table(CODES, state->lens, 19, &(state->next), | ||
389 | &(state->lenbits), state->work); | ||
390 | if (ret) { | ||
391 | strm->msg = (char *)"invalid code lengths set"; | ||
392 | state->mode = BAD; | ||
393 | break; | ||
394 | } | ||
395 | Tracev((stderr, "inflate: code lengths ok\n")); | ||
396 | |||
397 | /* get length and distance code code lengths */ | ||
398 | state->have = 0; | ||
399 | while (state->have < state->nlen + state->ndist) { | ||
400 | for (;;) { | ||
401 | here = state->lencode[BITS(state->lenbits)]; | ||
402 | if ((unsigned)(here.bits) <= bits) break; | ||
403 | PULLBYTE(); | ||
404 | } | ||
405 | if (here.val < 16) { | ||
406 | DROPBITS(here.bits); | ||
407 | state->lens[state->have++] = here.val; | ||
408 | } | ||
409 | else { | ||
410 | if (here.val == 16) { | ||
411 | NEEDBITS(here.bits + 2); | ||
412 | DROPBITS(here.bits); | ||
413 | if (state->have == 0) { | ||
414 | strm->msg = (char *)"invalid bit length repeat"; | ||
415 | state->mode = BAD; | ||
416 | break; | ||
417 | } | ||
418 | len = (unsigned)(state->lens[state->have - 1]); | ||
419 | copy = 3 + BITS(2); | ||
420 | DROPBITS(2); | ||
421 | } | ||
422 | else if (here.val == 17) { | ||
423 | NEEDBITS(here.bits + 3); | ||
424 | DROPBITS(here.bits); | ||
425 | len = 0; | ||
426 | copy = 3 + BITS(3); | ||
427 | DROPBITS(3); | ||
428 | } | ||
429 | else { | ||
430 | NEEDBITS(here.bits + 7); | ||
431 | DROPBITS(here.bits); | ||
432 | len = 0; | ||
433 | copy = 11 + BITS(7); | ||
434 | DROPBITS(7); | ||
435 | } | ||
436 | if (state->have + copy > state->nlen + state->ndist) { | ||
437 | strm->msg = (char *)"invalid bit length repeat"; | ||
438 | state->mode = BAD; | ||
439 | break; | ||
440 | } | ||
441 | while (copy--) | ||
442 | state->lens[state->have++] = (unsigned short)len; | ||
443 | } | ||
444 | } | ||
445 | |||
446 | /* handle error breaks in while */ | ||
447 | if (state->mode == BAD) break; | ||
448 | |||
449 | /* check for end-of-block code (better have one) */ | ||
450 | if (state->lens[256] == 0) { | ||
451 | strm->msg = (char *)"invalid code -- missing end-of-block"; | ||
452 | state->mode = BAD; | ||
453 | break; | ||
454 | } | ||
455 | |||
456 | /* build code tables -- note: do not change the lenbits or distbits | ||
457 | values here (9 and 6) without reading the comments in inftrees.h | ||
458 | concerning the ENOUGH constants, which depend on those values */ | ||
459 | state->next = state->codes; | ||
460 | state->lencode = (code const FAR *)(state->next); | ||
461 | state->lenbits = 9; | ||
462 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), | ||
463 | &(state->lenbits), state->work); | ||
464 | if (ret) { | ||
465 | strm->msg = (char *)"invalid literal/lengths set"; | ||
466 | state->mode = BAD; | ||
467 | break; | ||
468 | } | ||
469 | state->distcode = (code const FAR *)(state->next); | ||
470 | state->distbits = 6; | ||
471 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, | ||
472 | &(state->next), &(state->distbits), state->work); | ||
473 | if (ret) { | ||
474 | strm->msg = (char *)"invalid distances set"; | ||
475 | state->mode = BAD; | ||
476 | break; | ||
477 | } | ||
478 | Tracev((stderr, "inflate: codes ok\n")); | ||
479 | state->mode = LEN; | ||
480 | |||
481 | case LEN: | ||
482 | /* use inflate_fast() if we have enough input and output */ | ||
483 | if (have >= 6 && left >= 258) { | ||
484 | RESTORE(); | ||
485 | if (state->whave < state->wsize) | ||
486 | state->whave = state->wsize - left; | ||
487 | inflate_fast(strm, state->wsize); | ||
488 | LOAD(); | ||
489 | break; | ||
490 | } | ||
491 | |||
492 | /* get a literal, length, or end-of-block code */ | ||
493 | for (;;) { | ||
494 | here = state->lencode[BITS(state->lenbits)]; | ||
495 | if ((unsigned)(here.bits) <= bits) break; | ||
496 | PULLBYTE(); | ||
497 | } | ||
498 | if (here.op && (here.op & 0xf0) == 0) { | ||
499 | last = here; | ||
500 | for (;;) { | ||
501 | here = state->lencode[last.val + | ||
502 | (BITS(last.bits + last.op) >> last.bits)]; | ||
503 | if ((unsigned)(last.bits + here.bits) <= bits) break; | ||
504 | PULLBYTE(); | ||
505 | } | ||
506 | DROPBITS(last.bits); | ||
507 | } | ||
508 | DROPBITS(here.bits); | ||
509 | state->length = (unsigned)here.val; | ||
510 | |||
511 | /* process literal */ | ||
512 | if (here.op == 0) { | ||
513 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? | ||
514 | "inflate: literal '%c'\n" : | ||
515 | "inflate: literal 0x%02x\n", here.val)); | ||
516 | ROOM(); | ||
517 | *put++ = (unsigned char)(state->length); | ||
518 | left--; | ||
519 | state->mode = LEN; | ||
520 | break; | ||
521 | } | ||
522 | |||
523 | /* process end of block */ | ||
524 | if (here.op & 32) { | ||
525 | Tracevv((stderr, "inflate: end of block\n")); | ||
526 | state->mode = TYPE; | ||
527 | break; | ||
528 | } | ||
529 | |||
530 | /* invalid code */ | ||
531 | if (here.op & 64) { | ||
532 | strm->msg = (char *)"invalid literal/length code"; | ||
533 | state->mode = BAD; | ||
534 | break; | ||
535 | } | ||
536 | |||
537 | /* length code -- get extra bits, if any */ | ||
538 | state->extra = (unsigned)(here.op) & 15; | ||
539 | if (state->extra != 0) { | ||
540 | NEEDBITS(state->extra); | ||
541 | state->length += BITS(state->extra); | ||
542 | DROPBITS(state->extra); | ||
543 | } | ||
544 | Tracevv((stderr, "inflate: length %u\n", state->length)); | ||
545 | |||
546 | /* get distance code */ | ||
547 | for (;;) { | ||
548 | here = state->distcode[BITS(state->distbits)]; | ||
549 | if ((unsigned)(here.bits) <= bits) break; | ||
550 | PULLBYTE(); | ||
551 | } | ||
552 | if ((here.op & 0xf0) == 0) { | ||
553 | last = here; | ||
554 | for (;;) { | ||
555 | here = state->distcode[last.val + | ||
556 | (BITS(last.bits + last.op) >> last.bits)]; | ||
557 | if ((unsigned)(last.bits + here.bits) <= bits) break; | ||
558 | PULLBYTE(); | ||
559 | } | ||
560 | DROPBITS(last.bits); | ||
561 | } | ||
562 | DROPBITS(here.bits); | ||
563 | if (here.op & 64) { | ||
564 | strm->msg = (char *)"invalid distance code"; | ||
565 | state->mode = BAD; | ||
566 | break; | ||
567 | } | ||
568 | state->offset = (unsigned)here.val; | ||
569 | |||
570 | /* get distance extra bits, if any */ | ||
571 | state->extra = (unsigned)(here.op) & 15; | ||
572 | if (state->extra != 0) { | ||
573 | NEEDBITS(state->extra); | ||
574 | state->offset += BITS(state->extra); | ||
575 | DROPBITS(state->extra); | ||
576 | } | ||
577 | if (state->offset > state->wsize - (state->whave < state->wsize ? | ||
578 | left : 0)) { | ||
579 | strm->msg = (char *)"invalid distance too far back"; | ||
580 | state->mode = BAD; | ||
581 | break; | ||
582 | } | ||
583 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); | ||
584 | |||
585 | /* copy match from window to output */ | ||
586 | do { | ||
587 | ROOM(); | ||
588 | copy = state->wsize - state->offset; | ||
589 | if (copy < left) { | ||
590 | from = put + copy; | ||
591 | copy = left - copy; | ||
592 | } | ||
593 | else { | ||
594 | from = put - state->offset; | ||
595 | copy = left; | ||
596 | } | ||
597 | if (copy > state->length) copy = state->length; | ||
598 | state->length -= copy; | ||
599 | left -= copy; | ||
600 | do { | ||
601 | *put++ = *from++; | ||
602 | } while (--copy); | ||
603 | } while (state->length != 0); | ||
604 | break; | ||
605 | |||
606 | case DONE: | ||
607 | /* inflate stream terminated properly -- write leftover output */ | ||
608 | ret = Z_STREAM_END; | ||
609 | if (left < state->wsize) { | ||
610 | if (out(out_desc, state->window, state->wsize - left)) | ||
611 | ret = Z_BUF_ERROR; | ||
612 | } | ||
613 | goto inf_leave; | ||
614 | |||
615 | case BAD: | ||
616 | ret = Z_DATA_ERROR; | ||
617 | goto inf_leave; | ||
618 | |||
619 | default: /* can't happen, but makes compilers happy */ | ||
620 | ret = Z_STREAM_ERROR; | ||
621 | goto inf_leave; | ||
622 | } | ||
623 | |||
624 | /* Return unused input */ | ||
625 | inf_leave: | ||
626 | strm->next_in = next; | ||
627 | strm->avail_in = have; | ||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | int ZEXPORT inflateBackEnd(strm) | ||
632 | z_streamp strm; | ||
633 | { | ||
634 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) | ||
635 | return Z_STREAM_ERROR; | ||
636 | ZFREE(strm, strm->state); | ||
637 | strm->state = Z_NULL; | ||
638 | Tracev((stderr, "inflate: end\n")); | ||
639 | return Z_OK; | ||
640 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.c deleted file mode 100644 index 2f1d60b..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.c +++ /dev/null | |||
@@ -1,340 +0,0 @@ | |||
1 | /* inffast.c -- fast decoding | ||
2 | * Copyright (C) 1995-2008, 2010 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "zutil.h" | ||
7 | #include "inftrees.h" | ||
8 | #include "inflate.h" | ||
9 | #include "inffast.h" | ||
10 | |||
11 | #ifndef ASMINF | ||
12 | |||
13 | /* Allow machine dependent optimization for post-increment or pre-increment. | ||
14 | Based on testing to date, | ||
15 | Pre-increment preferred for: | ||
16 | - PowerPC G3 (Adler) | ||
17 | - MIPS R5000 (Randers-Pehrson) | ||
18 | Post-increment preferred for: | ||
19 | - none | ||
20 | No measurable difference: | ||
21 | - Pentium III (Anderson) | ||
22 | - M68060 (Nikl) | ||
23 | */ | ||
24 | #ifdef POSTINC | ||
25 | # define OFF 0 | ||
26 | # define PUP(a) *(a)++ | ||
27 | #else | ||
28 | # define OFF 1 | ||
29 | # define PUP(a) *++(a) | ||
30 | #endif | ||
31 | |||
32 | /* | ||
33 | Decode literal, length, and distance codes and write out the resulting | ||
34 | literal and match bytes until either not enough input or output is | ||
35 | available, an end-of-block is encountered, or a data error is encountered. | ||
36 | When large enough input and output buffers are supplied to inflate(), for | ||
37 | example, a 16K input buffer and a 64K output buffer, more than 95% of the | ||
38 | inflate execution time is spent in this routine. | ||
39 | |||
40 | Entry assumptions: | ||
41 | |||
42 | state->mode == LEN | ||
43 | strm->avail_in >= 6 | ||
44 | strm->avail_out >= 258 | ||
45 | start >= strm->avail_out | ||
46 | state->bits < 8 | ||
47 | |||
48 | On return, state->mode is one of: | ||
49 | |||
50 | LEN -- ran out of enough output space or enough available input | ||
51 | TYPE -- reached end of block code, inflate() to interpret next block | ||
52 | BAD -- error in block data | ||
53 | |||
54 | Notes: | ||
55 | |||
56 | - The maximum input bits used by a length/distance pair is 15 bits for the | ||
57 | length code, 5 bits for the length extra, 15 bits for the distance code, | ||
58 | and 13 bits for the distance extra. This totals 48 bits, or six bytes. | ||
59 | Therefore if strm->avail_in >= 6, then there is enough input to avoid | ||
60 | checking for available input while decoding. | ||
61 | |||
62 | - The maximum bytes that a single length/distance pair can output is 258 | ||
63 | bytes, which is the maximum length that can be coded. inflate_fast() | ||
64 | requires strm->avail_out >= 258 for each loop to avoid checking for | ||
65 | output space. | ||
66 | */ | ||
67 | void ZLIB_INTERNAL inflate_fast(strm, start) | ||
68 | z_streamp strm; | ||
69 | unsigned start; /* inflate()'s starting value for strm->avail_out */ | ||
70 | { | ||
71 | struct inflate_state FAR *state; | ||
72 | unsigned char FAR *in; /* local strm->next_in */ | ||
73 | unsigned char FAR *last; /* while in < last, enough input available */ | ||
74 | unsigned char FAR *out; /* local strm->next_out */ | ||
75 | unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ | ||
76 | unsigned char FAR *end; /* while out < end, enough space available */ | ||
77 | #ifdef INFLATE_STRICT | ||
78 | unsigned dmax; /* maximum distance from zlib header */ | ||
79 | #endif | ||
80 | unsigned wsize; /* window size or zero if not using window */ | ||
81 | unsigned whave; /* valid bytes in the window */ | ||
82 | unsigned wnext; /* window write index */ | ||
83 | unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ | ||
84 | unsigned long hold; /* local strm->hold */ | ||
85 | unsigned bits; /* local strm->bits */ | ||
86 | code const FAR *lcode; /* local strm->lencode */ | ||
87 | code const FAR *dcode; /* local strm->distcode */ | ||
88 | unsigned lmask; /* mask for first level of length codes */ | ||
89 | unsigned dmask; /* mask for first level of distance codes */ | ||
90 | code here; /* retrieved table entry */ | ||
91 | unsigned op; /* code bits, operation, extra bits, or */ | ||
92 | /* window position, window bytes to copy */ | ||
93 | unsigned len; /* match length, unused bytes */ | ||
94 | unsigned dist; /* match distance */ | ||
95 | unsigned char FAR *from; /* where to copy match from */ | ||
96 | |||
97 | /* copy state to local variables */ | ||
98 | state = (struct inflate_state FAR *)strm->state; | ||
99 | in = strm->next_in - OFF; | ||
100 | last = in + (strm->avail_in - 5); | ||
101 | out = strm->next_out - OFF; | ||
102 | beg = out - (start - strm->avail_out); | ||
103 | end = out + (strm->avail_out - 257); | ||
104 | #ifdef INFLATE_STRICT | ||
105 | dmax = state->dmax; | ||
106 | #endif | ||
107 | wsize = state->wsize; | ||
108 | whave = state->whave; | ||
109 | wnext = state->wnext; | ||
110 | window = state->window; | ||
111 | hold = state->hold; | ||
112 | bits = state->bits; | ||
113 | lcode = state->lencode; | ||
114 | dcode = state->distcode; | ||
115 | lmask = (1U << state->lenbits) - 1; | ||
116 | dmask = (1U << state->distbits) - 1; | ||
117 | |||
118 | /* decode literals and length/distances until end-of-block or not enough | ||
119 | input data or output space */ | ||
120 | do { | ||
121 | if (bits < 15) { | ||
122 | hold += (unsigned long)(PUP(in)) << bits; | ||
123 | bits += 8; | ||
124 | hold += (unsigned long)(PUP(in)) << bits; | ||
125 | bits += 8; | ||
126 | } | ||
127 | here = lcode[hold & lmask]; | ||
128 | dolen: | ||
129 | op = (unsigned)(here.bits); | ||
130 | hold >>= op; | ||
131 | bits -= op; | ||
132 | op = (unsigned)(here.op); | ||
133 | if (op == 0) { /* literal */ | ||
134 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? | ||
135 | "inflate: literal '%c'\n" : | ||
136 | "inflate: literal 0x%02x\n", here.val)); | ||
137 | PUP(out) = (unsigned char)(here.val); | ||
138 | } | ||
139 | else if (op & 16) { /* length base */ | ||
140 | len = (unsigned)(here.val); | ||
141 | op &= 15; /* number of extra bits */ | ||
142 | if (op) { | ||
143 | if (bits < op) { | ||
144 | hold += (unsigned long)(PUP(in)) << bits; | ||
145 | bits += 8; | ||
146 | } | ||
147 | len += (unsigned)hold & ((1U << op) - 1); | ||
148 | hold >>= op; | ||
149 | bits -= op; | ||
150 | } | ||
151 | Tracevv((stderr, "inflate: length %u\n", len)); | ||
152 | if (bits < 15) { | ||
153 | hold += (unsigned long)(PUP(in)) << bits; | ||
154 | bits += 8; | ||
155 | hold += (unsigned long)(PUP(in)) << bits; | ||
156 | bits += 8; | ||
157 | } | ||
158 | here = dcode[hold & dmask]; | ||
159 | dodist: | ||
160 | op = (unsigned)(here.bits); | ||
161 | hold >>= op; | ||
162 | bits -= op; | ||
163 | op = (unsigned)(here.op); | ||
164 | if (op & 16) { /* distance base */ | ||
165 | dist = (unsigned)(here.val); | ||
166 | op &= 15; /* number of extra bits */ | ||
167 | if (bits < op) { | ||
168 | hold += (unsigned long)(PUP(in)) << bits; | ||
169 | bits += 8; | ||
170 | if (bits < op) { | ||
171 | hold += (unsigned long)(PUP(in)) << bits; | ||
172 | bits += 8; | ||
173 | } | ||
174 | } | ||
175 | dist += (unsigned)hold & ((1U << op) - 1); | ||
176 | #ifdef INFLATE_STRICT | ||
177 | if (dist > dmax) { | ||
178 | strm->msg = (char *)"invalid distance too far back"; | ||
179 | state->mode = BAD; | ||
180 | break; | ||
181 | } | ||
182 | #endif | ||
183 | hold >>= op; | ||
184 | bits -= op; | ||
185 | Tracevv((stderr, "inflate: distance %u\n", dist)); | ||
186 | op = (unsigned)(out - beg); /* max distance in output */ | ||
187 | if (dist > op) { /* see if copy from window */ | ||
188 | op = dist - op; /* distance back in window */ | ||
189 | if (op > whave) { | ||
190 | if (state->sane) { | ||
191 | strm->msg = | ||
192 | (char *)"invalid distance too far back"; | ||
193 | state->mode = BAD; | ||
194 | break; | ||
195 | } | ||
196 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
197 | if (len <= op - whave) { | ||
198 | do { | ||
199 | PUP(out) = 0; | ||
200 | } while (--len); | ||
201 | continue; | ||
202 | } | ||
203 | len -= op - whave; | ||
204 | do { | ||
205 | PUP(out) = 0; | ||
206 | } while (--op > whave); | ||
207 | if (op == 0) { | ||
208 | from = out - dist; | ||
209 | do { | ||
210 | PUP(out) = PUP(from); | ||
211 | } while (--len); | ||
212 | continue; | ||
213 | } | ||
214 | #endif | ||
215 | } | ||
216 | from = window - OFF; | ||
217 | if (wnext == 0) { /* very common case */ | ||
218 | from += wsize - op; | ||
219 | if (op < len) { /* some from window */ | ||
220 | len -= op; | ||
221 | do { | ||
222 | PUP(out) = PUP(from); | ||
223 | } while (--op); | ||
224 | from = out - dist; /* rest from output */ | ||
225 | } | ||
226 | } | ||
227 | else if (wnext < op) { /* wrap around window */ | ||
228 | from += wsize + wnext - op; | ||
229 | op -= wnext; | ||
230 | if (op < len) { /* some from end of window */ | ||
231 | len -= op; | ||
232 | do { | ||
233 | PUP(out) = PUP(from); | ||
234 | } while (--op); | ||
235 | from = window - OFF; | ||
236 | if (wnext < len) { /* some from start of window */ | ||
237 | op = wnext; | ||
238 | len -= op; | ||
239 | do { | ||
240 | PUP(out) = PUP(from); | ||
241 | } while (--op); | ||
242 | from = out - dist; /* rest from output */ | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | else { /* contiguous in window */ | ||
247 | from += wnext - op; | ||
248 | if (op < len) { /* some from window */ | ||
249 | len -= op; | ||
250 | do { | ||
251 | PUP(out) = PUP(from); | ||
252 | } while (--op); | ||
253 | from = out - dist; /* rest from output */ | ||
254 | } | ||
255 | } | ||
256 | while (len > 2) { | ||
257 | PUP(out) = PUP(from); | ||
258 | PUP(out) = PUP(from); | ||
259 | PUP(out) = PUP(from); | ||
260 | len -= 3; | ||
261 | } | ||
262 | if (len) { | ||
263 | PUP(out) = PUP(from); | ||
264 | if (len > 1) | ||
265 | PUP(out) = PUP(from); | ||
266 | } | ||
267 | } | ||
268 | else { | ||
269 | from = out - dist; /* copy direct from output */ | ||
270 | do { /* minimum length is three */ | ||
271 | PUP(out) = PUP(from); | ||
272 | PUP(out) = PUP(from); | ||
273 | PUP(out) = PUP(from); | ||
274 | len -= 3; | ||
275 | } while (len > 2); | ||
276 | if (len) { | ||
277 | PUP(out) = PUP(from); | ||
278 | if (len > 1) | ||
279 | PUP(out) = PUP(from); | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | else if ((op & 64) == 0) { /* 2nd level distance code */ | ||
284 | here = dcode[here.val + (hold & ((1U << op) - 1))]; | ||
285 | goto dodist; | ||
286 | } | ||
287 | else { | ||
288 | strm->msg = (char *)"invalid distance code"; | ||
289 | state->mode = BAD; | ||
290 | break; | ||
291 | } | ||
292 | } | ||
293 | else if ((op & 64) == 0) { /* 2nd level length code */ | ||
294 | here = lcode[here.val + (hold & ((1U << op) - 1))]; | ||
295 | goto dolen; | ||
296 | } | ||
297 | else if (op & 32) { /* end-of-block */ | ||
298 | Tracevv((stderr, "inflate: end of block\n")); | ||
299 | state->mode = TYPE; | ||
300 | break; | ||
301 | } | ||
302 | else { | ||
303 | strm->msg = (char *)"invalid literal/length code"; | ||
304 | state->mode = BAD; | ||
305 | break; | ||
306 | } | ||
307 | } while (in < last && out < end); | ||
308 | |||
309 | /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ | ||
310 | len = bits >> 3; | ||
311 | in -= len; | ||
312 | bits -= len << 3; | ||
313 | hold &= (1U << bits) - 1; | ||
314 | |||
315 | /* update state and return */ | ||
316 | strm->next_in = in + OFF; | ||
317 | strm->next_out = out + OFF; | ||
318 | strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); | ||
319 | strm->avail_out = (unsigned)(out < end ? | ||
320 | 257 + (end - out) : 257 - (out - end)); | ||
321 | state->hold = hold; | ||
322 | state->bits = bits; | ||
323 | return; | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): | ||
328 | - Using bit fields for code structure | ||
329 | - Different op definition to avoid & for extra bits (do & for table bits) | ||
330 | - Three separate decoding do-loops for direct, window, and wnext == 0 | ||
331 | - Special case for distance > 1 copies to do overlapped load and store copy | ||
332 | - Explicit branch predictions (based on measured branch probabilities) | ||
333 | - Deferring match copy and interspersed it with decoding subsequent codes | ||
334 | - Swapping literal/length else | ||
335 | - Swapping window/direct else | ||
336 | - Larger unrolled copy loops (three is about right) | ||
337 | - Moving len -= 3 statement into middle of loop | ||
338 | */ | ||
339 | |||
340 | #endif /* !ASMINF */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.h deleted file mode 100644 index e5c1aa4..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffast.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* inffast.h -- header to use inffast.c | ||
2 | * Copyright (C) 1995-2003, 2010 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* WARNING: this file should *not* be used by applications. It is | ||
7 | part of the implementation of the compression library and is | ||
8 | subject to change. Applications should only use zlib.h. | ||
9 | */ | ||
10 | |||
11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffixed.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffixed.h deleted file mode 100644 index d628327..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inffixed.h +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* inffixed.h -- table for decoding fixed codes | ||
2 | * Generated automatically by makefixed(). | ||
3 | */ | ||
4 | |||
5 | /* WARNING: this file should *not* be used by applications. | ||
6 | It is part of the implementation of this library and is | ||
7 | subject to change. Applications should only use zlib.h. | ||
8 | */ | ||
9 | |||
10 | static const code lenfix[512] = { | ||
11 | {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, | ||
12 | {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, | ||
13 | {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, | ||
14 | {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, | ||
15 | {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, | ||
16 | {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, | ||
17 | {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, | ||
18 | {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, | ||
19 | {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, | ||
20 | {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, | ||
21 | {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, | ||
22 | {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, | ||
23 | {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, | ||
24 | {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, | ||
25 | {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, | ||
26 | {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, | ||
27 | {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, | ||
28 | {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, | ||
29 | {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, | ||
30 | {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, | ||
31 | {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, | ||
32 | {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, | ||
33 | {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, | ||
34 | {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, | ||
35 | {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, | ||
36 | {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, | ||
37 | {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, | ||
38 | {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, | ||
39 | {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, | ||
40 | {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, | ||
41 | {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, | ||
42 | {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, | ||
43 | {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, | ||
44 | {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, | ||
45 | {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, | ||
46 | {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, | ||
47 | {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, | ||
48 | {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, | ||
49 | {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, | ||
50 | {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, | ||
51 | {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, | ||
52 | {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, | ||
53 | {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, | ||
54 | {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, | ||
55 | {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, | ||
56 | {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, | ||
57 | {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, | ||
58 | {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, | ||
59 | {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, | ||
60 | {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, | ||
61 | {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, | ||
62 | {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, | ||
63 | {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, | ||
64 | {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, | ||
65 | {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, | ||
66 | {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, | ||
67 | {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, | ||
68 | {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, | ||
69 | {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, | ||
70 | {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, | ||
71 | {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, | ||
72 | {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, | ||
73 | {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, | ||
74 | {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, | ||
75 | {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, | ||
76 | {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, | ||
77 | {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, | ||
78 | {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, | ||
79 | {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, | ||
80 | {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, | ||
81 | {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, | ||
82 | {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, | ||
83 | {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, | ||
84 | {0,9,255} | ||
85 | }; | ||
86 | |||
87 | static const code distfix[32] = { | ||
88 | {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, | ||
89 | {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, | ||
90 | {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, | ||
91 | {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, | ||
92 | {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, | ||
93 | {22,5,193},{64,5,0} | ||
94 | }; | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.c deleted file mode 100644 index 47418a1..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.c +++ /dev/null | |||
@@ -1,1496 +0,0 @@ | |||
1 | /* inflate.c -- zlib decompression | ||
2 | * Copyright (C) 1995-2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * Change history: | ||
8 | * | ||
9 | * 1.2.beta0 24 Nov 2002 | ||
10 | * - First version -- complete rewrite of inflate to simplify code, avoid | ||
11 | * creation of window when not needed, minimize use of window when it is | ||
12 | * needed, make inffast.c even faster, implement gzip decoding, and to | ||
13 | * improve code readability and style over the previous zlib inflate code | ||
14 | * | ||
15 | * 1.2.beta1 25 Nov 2002 | ||
16 | * - Use pointers for available input and output checking in inffast.c | ||
17 | * - Remove input and output counters in inffast.c | ||
18 | * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 | ||
19 | * - Remove unnecessary second byte pull from length extra in inffast.c | ||
20 | * - Unroll direct copy to three copies per loop in inffast.c | ||
21 | * | ||
22 | * 1.2.beta2 4 Dec 2002 | ||
23 | * - Change external routine names to reduce potential conflicts | ||
24 | * - Correct filename to inffixed.h for fixed tables in inflate.c | ||
25 | * - Make hbuf[] unsigned char to match parameter type in inflate.c | ||
26 | * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) | ||
27 | * to avoid negation problem on Alphas (64 bit) in inflate.c | ||
28 | * | ||
29 | * 1.2.beta3 22 Dec 2002 | ||
30 | * - Add comments on state->bits assertion in inffast.c | ||
31 | * - Add comments on op field in inftrees.h | ||
32 | * - Fix bug in reuse of allocated window after inflateReset() | ||
33 | * - Remove bit fields--back to byte structure for speed | ||
34 | * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths | ||
35 | * - Change post-increments to pre-increments in inflate_fast(), PPC biased? | ||
36 | * - Add compile time option, POSTINC, to use post-increments instead (Intel?) | ||
37 | * - Make MATCH copy in inflate() much faster for when inflate_fast() not used | ||
38 | * - Use local copies of stream next and avail values, as well as local bit | ||
39 | * buffer and bit count in inflate()--for speed when inflate_fast() not used | ||
40 | * | ||
41 | * 1.2.beta4 1 Jan 2003 | ||
42 | * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings | ||
43 | * - Move a comment on output buffer sizes from inffast.c to inflate.c | ||
44 | * - Add comments in inffast.c to introduce the inflate_fast() routine | ||
45 | * - Rearrange window copies in inflate_fast() for speed and simplification | ||
46 | * - Unroll last copy for window match in inflate_fast() | ||
47 | * - Use local copies of window variables in inflate_fast() for speed | ||
48 | * - Pull out common wnext == 0 case for speed in inflate_fast() | ||
49 | * - Make op and len in inflate_fast() unsigned for consistency | ||
50 | * - Add FAR to lcode and dcode declarations in inflate_fast() | ||
51 | * - Simplified bad distance check in inflate_fast() | ||
52 | * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new | ||
53 | * source file infback.c to provide a call-back interface to inflate for | ||
54 | * programs like gzip and unzip -- uses window as output buffer to avoid | ||
55 | * window copying | ||
56 | * | ||
57 | * 1.2.beta5 1 Jan 2003 | ||
58 | * - Improved inflateBack() interface to allow the caller to provide initial | ||
59 | * input in strm. | ||
60 | * - Fixed stored blocks bug in inflateBack() | ||
61 | * | ||
62 | * 1.2.beta6 4 Jan 2003 | ||
63 | * - Added comments in inffast.c on effectiveness of POSTINC | ||
64 | * - Typecasting all around to reduce compiler warnings | ||
65 | * - Changed loops from while (1) or do {} while (1) to for (;;), again to | ||
66 | * make compilers happy | ||
67 | * - Changed type of window in inflateBackInit() to unsigned char * | ||
68 | * | ||
69 | * 1.2.beta7 27 Jan 2003 | ||
70 | * - Changed many types to unsigned or unsigned short to avoid warnings | ||
71 | * - Added inflateCopy() function | ||
72 | * | ||
73 | * 1.2.0 9 Mar 2003 | ||
74 | * - Changed inflateBack() interface to provide separate opaque descriptors | ||
75 | * for the in() and out() functions | ||
76 | * - Changed inflateBack() argument and in_func typedef to swap the length | ||
77 | * and buffer address return values for the input function | ||
78 | * - Check next_in and next_out for Z_NULL on entry to inflate() | ||
79 | * | ||
80 | * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. | ||
81 | */ | ||
82 | |||
83 | #include "zutil.h" | ||
84 | #include "inftrees.h" | ||
85 | #include "inflate.h" | ||
86 | #include "inffast.h" | ||
87 | |||
88 | #ifdef MAKEFIXED | ||
89 | # ifndef BUILDFIXED | ||
90 | # define BUILDFIXED | ||
91 | # endif | ||
92 | #endif | ||
93 | |||
94 | /* function prototypes */ | ||
95 | local void fixedtables OF((struct inflate_state FAR *state)); | ||
96 | local int updatewindow OF((z_streamp strm, unsigned out)); | ||
97 | #ifdef BUILDFIXED | ||
98 | void makefixed OF((void)); | ||
99 | #endif | ||
100 | local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, | ||
101 | unsigned len)); | ||
102 | |||
103 | int ZEXPORT inflateResetKeep(strm) | ||
104 | z_streamp strm; | ||
105 | { | ||
106 | struct inflate_state FAR *state; | ||
107 | |||
108 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
109 | state = (struct inflate_state FAR *)strm->state; | ||
110 | strm->total_in = strm->total_out = state->total = 0; | ||
111 | strm->msg = Z_NULL; | ||
112 | if (state->wrap) /* to support ill-conceived Java test suite */ | ||
113 | strm->adler = state->wrap & 1; | ||
114 | state->mode = HEAD; | ||
115 | state->last = 0; | ||
116 | state->havedict = 0; | ||
117 | state->dmax = 32768U; | ||
118 | state->head = Z_NULL; | ||
119 | state->hold = 0; | ||
120 | state->bits = 0; | ||
121 | state->lencode = state->distcode = state->next = state->codes; | ||
122 | state->sane = 1; | ||
123 | state->back = -1; | ||
124 | Tracev((stderr, "inflate: reset\n")); | ||
125 | return Z_OK; | ||
126 | } | ||
127 | |||
128 | int ZEXPORT inflateReset(strm) | ||
129 | z_streamp strm; | ||
130 | { | ||
131 | struct inflate_state FAR *state; | ||
132 | |||
133 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
134 | state = (struct inflate_state FAR *)strm->state; | ||
135 | state->wsize = 0; | ||
136 | state->whave = 0; | ||
137 | state->wnext = 0; | ||
138 | return inflateResetKeep(strm); | ||
139 | } | ||
140 | |||
141 | int ZEXPORT inflateReset2(strm, windowBits) | ||
142 | z_streamp strm; | ||
143 | int windowBits; | ||
144 | { | ||
145 | int wrap; | ||
146 | struct inflate_state FAR *state; | ||
147 | |||
148 | /* get the state */ | ||
149 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
150 | state = (struct inflate_state FAR *)strm->state; | ||
151 | |||
152 | /* extract wrap request from windowBits parameter */ | ||
153 | if (windowBits < 0) { | ||
154 | wrap = 0; | ||
155 | windowBits = -windowBits; | ||
156 | } | ||
157 | else { | ||
158 | wrap = (windowBits >> 4) + 1; | ||
159 | #ifdef GUNZIP | ||
160 | if (windowBits < 48) | ||
161 | windowBits &= 15; | ||
162 | #endif | ||
163 | } | ||
164 | |||
165 | /* set number of window bits, free window if different */ | ||
166 | if (windowBits && (windowBits < 8 || windowBits > 15)) | ||
167 | return Z_STREAM_ERROR; | ||
168 | if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { | ||
169 | ZFREE(strm, state->window); | ||
170 | state->window = Z_NULL; | ||
171 | } | ||
172 | |||
173 | /* update state and reset the rest of it */ | ||
174 | state->wrap = wrap; | ||
175 | state->wbits = (unsigned)windowBits; | ||
176 | return inflateReset(strm); | ||
177 | } | ||
178 | |||
179 | int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) | ||
180 | z_streamp strm; | ||
181 | int windowBits; | ||
182 | const char *version; | ||
183 | int stream_size; | ||
184 | { | ||
185 | int ret; | ||
186 | struct inflate_state FAR *state; | ||
187 | |||
188 | if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || | ||
189 | stream_size != (int)(sizeof(z_stream))) | ||
190 | return Z_VERSION_ERROR; | ||
191 | if (strm == Z_NULL) return Z_STREAM_ERROR; | ||
192 | strm->msg = Z_NULL; /* in case we return an error */ | ||
193 | if (strm->zalloc == (alloc_func)0) { | ||
194 | #ifdef Z_SOLO | ||
195 | return Z_STREAM_ERROR; | ||
196 | #else | ||
197 | strm->zalloc = zcalloc; | ||
198 | strm->opaque = (voidpf)0; | ||
199 | #endif | ||
200 | } | ||
201 | if (strm->zfree == (free_func)0) | ||
202 | #ifdef Z_SOLO | ||
203 | return Z_STREAM_ERROR; | ||
204 | #else | ||
205 | strm->zfree = zcfree; | ||
206 | #endif | ||
207 | state = (struct inflate_state FAR *) | ||
208 | ZALLOC(strm, 1, sizeof(struct inflate_state)); | ||
209 | if (state == Z_NULL) return Z_MEM_ERROR; | ||
210 | Tracev((stderr, "inflate: allocated\n")); | ||
211 | strm->state = (struct internal_state FAR *)state; | ||
212 | state->window = Z_NULL; | ||
213 | ret = inflateReset2(strm, windowBits); | ||
214 | if (ret != Z_OK) { | ||
215 | ZFREE(strm, state); | ||
216 | strm->state = Z_NULL; | ||
217 | } | ||
218 | return ret; | ||
219 | } | ||
220 | |||
221 | int ZEXPORT inflateInit_(strm, version, stream_size) | ||
222 | z_streamp strm; | ||
223 | const char *version; | ||
224 | int stream_size; | ||
225 | { | ||
226 | return inflateInit2_(strm, DEF_WBITS, version, stream_size); | ||
227 | } | ||
228 | |||
229 | int ZEXPORT inflatePrime(strm, bits, value) | ||
230 | z_streamp strm; | ||
231 | int bits; | ||
232 | int value; | ||
233 | { | ||
234 | struct inflate_state FAR *state; | ||
235 | |||
236 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
237 | state = (struct inflate_state FAR *)strm->state; | ||
238 | if (bits < 0) { | ||
239 | state->hold = 0; | ||
240 | state->bits = 0; | ||
241 | return Z_OK; | ||
242 | } | ||
243 | if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; | ||
244 | value &= (1L << bits) - 1; | ||
245 | state->hold += value << state->bits; | ||
246 | state->bits += bits; | ||
247 | return Z_OK; | ||
248 | } | ||
249 | |||
250 | /* | ||
251 | Return state with length and distance decoding tables and index sizes set to | ||
252 | fixed code decoding. Normally this returns fixed tables from inffixed.h. | ||
253 | If BUILDFIXED is defined, then instead this routine builds the tables the | ||
254 | first time it's called, and returns those tables the first time and | ||
255 | thereafter. This reduces the size of the code by about 2K bytes, in | ||
256 | exchange for a little execution time. However, BUILDFIXED should not be | ||
257 | used for threaded applications, since the rewriting of the tables and virgin | ||
258 | may not be thread-safe. | ||
259 | */ | ||
260 | local void fixedtables(state) | ||
261 | struct inflate_state FAR *state; | ||
262 | { | ||
263 | #ifdef BUILDFIXED | ||
264 | static int virgin = 1; | ||
265 | static code *lenfix, *distfix; | ||
266 | static code fixed[544]; | ||
267 | |||
268 | /* build fixed huffman tables if first call (may not be thread safe) */ | ||
269 | if (virgin) { | ||
270 | unsigned sym, bits; | ||
271 | static code *next; | ||
272 | |||
273 | /* literal/length table */ | ||
274 | sym = 0; | ||
275 | while (sym < 144) state->lens[sym++] = 8; | ||
276 | while (sym < 256) state->lens[sym++] = 9; | ||
277 | while (sym < 280) state->lens[sym++] = 7; | ||
278 | while (sym < 288) state->lens[sym++] = 8; | ||
279 | next = fixed; | ||
280 | lenfix = next; | ||
281 | bits = 9; | ||
282 | inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); | ||
283 | |||
284 | /* distance table */ | ||
285 | sym = 0; | ||
286 | while (sym < 32) state->lens[sym++] = 5; | ||
287 | distfix = next; | ||
288 | bits = 5; | ||
289 | inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); | ||
290 | |||
291 | /* do this just once */ | ||
292 | virgin = 0; | ||
293 | } | ||
294 | #else /* !BUILDFIXED */ | ||
295 | # include "inffixed.h" | ||
296 | #endif /* BUILDFIXED */ | ||
297 | state->lencode = lenfix; | ||
298 | state->lenbits = 9; | ||
299 | state->distcode = distfix; | ||
300 | state->distbits = 5; | ||
301 | } | ||
302 | |||
303 | #ifdef MAKEFIXED | ||
304 | #include <stdio.h> | ||
305 | |||
306 | /* | ||
307 | Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also | ||
308 | defines BUILDFIXED, so the tables are built on the fly. makefixed() writes | ||
309 | those tables to stdout, which would be piped to inffixed.h. A small program | ||
310 | can simply call makefixed to do this: | ||
311 | |||
312 | void makefixed(void); | ||
313 | |||
314 | int main(void) | ||
315 | { | ||
316 | makefixed(); | ||
317 | return 0; | ||
318 | } | ||
319 | |||
320 | Then that can be linked with zlib built with MAKEFIXED defined and run: | ||
321 | |||
322 | a.out > inffixed.h | ||
323 | */ | ||
324 | void makefixed() | ||
325 | { | ||
326 | unsigned low, size; | ||
327 | struct inflate_state state; | ||
328 | |||
329 | fixedtables(&state); | ||
330 | puts(" /* inffixed.h -- table for decoding fixed codes"); | ||
331 | puts(" * Generated automatically by makefixed()."); | ||
332 | puts(" */"); | ||
333 | puts(""); | ||
334 | puts(" /* WARNING: this file should *not* be used by applications."); | ||
335 | puts(" It is part of the implementation of this library and is"); | ||
336 | puts(" subject to change. Applications should only use zlib.h."); | ||
337 | puts(" */"); | ||
338 | puts(""); | ||
339 | size = 1U << 9; | ||
340 | printf(" static const code lenfix[%u] = {", size); | ||
341 | low = 0; | ||
342 | for (;;) { | ||
343 | if ((low % 7) == 0) printf("\n "); | ||
344 | printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, | ||
345 | state.lencode[low].bits, state.lencode[low].val); | ||
346 | if (++low == size) break; | ||
347 | putchar(','); | ||
348 | } | ||
349 | puts("\n };"); | ||
350 | size = 1U << 5; | ||
351 | printf("\n static const code distfix[%u] = {", size); | ||
352 | low = 0; | ||
353 | for (;;) { | ||
354 | if ((low % 6) == 0) printf("\n "); | ||
355 | printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, | ||
356 | state.distcode[low].val); | ||
357 | if (++low == size) break; | ||
358 | putchar(','); | ||
359 | } | ||
360 | puts("\n };"); | ||
361 | } | ||
362 | #endif /* MAKEFIXED */ | ||
363 | |||
364 | /* | ||
365 | Update the window with the last wsize (normally 32K) bytes written before | ||
366 | returning. If window does not exist yet, create it. This is only called | ||
367 | when a window is already in use, or when output has been written during this | ||
368 | inflate call, but the end of the deflate stream has not been reached yet. | ||
369 | It is also called to create a window for dictionary data when a dictionary | ||
370 | is loaded. | ||
371 | |||
372 | Providing output buffers larger than 32K to inflate() should provide a speed | ||
373 | advantage, since only the last 32K of output is copied to the sliding window | ||
374 | upon return from inflate(), and since all distances after the first 32K of | ||
375 | output will fall in the output data, making match copies simpler and faster. | ||
376 | The advantage may be dependent on the size of the processor's data caches. | ||
377 | */ | ||
378 | local int updatewindow(strm, out) | ||
379 | z_streamp strm; | ||
380 | unsigned out; | ||
381 | { | ||
382 | struct inflate_state FAR *state; | ||
383 | unsigned copy, dist; | ||
384 | |||
385 | state = (struct inflate_state FAR *)strm->state; | ||
386 | |||
387 | /* if it hasn't been done already, allocate space for the window */ | ||
388 | if (state->window == Z_NULL) { | ||
389 | state->window = (unsigned char FAR *) | ||
390 | ZALLOC(strm, 1U << state->wbits, | ||
391 | sizeof(unsigned char)); | ||
392 | if (state->window == Z_NULL) return 1; | ||
393 | } | ||
394 | |||
395 | /* if window not in use yet, initialize */ | ||
396 | if (state->wsize == 0) { | ||
397 | state->wsize = 1U << state->wbits; | ||
398 | state->wnext = 0; | ||
399 | state->whave = 0; | ||
400 | } | ||
401 | |||
402 | /* copy state->wsize or less output bytes into the circular window */ | ||
403 | copy = out - strm->avail_out; | ||
404 | if (copy >= state->wsize) { | ||
405 | zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); | ||
406 | state->wnext = 0; | ||
407 | state->whave = state->wsize; | ||
408 | } | ||
409 | else { | ||
410 | dist = state->wsize - state->wnext; | ||
411 | if (dist > copy) dist = copy; | ||
412 | zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); | ||
413 | copy -= dist; | ||
414 | if (copy) { | ||
415 | zmemcpy(state->window, strm->next_out - copy, copy); | ||
416 | state->wnext = copy; | ||
417 | state->whave = state->wsize; | ||
418 | } | ||
419 | else { | ||
420 | state->wnext += dist; | ||
421 | if (state->wnext == state->wsize) state->wnext = 0; | ||
422 | if (state->whave < state->wsize) state->whave += dist; | ||
423 | } | ||
424 | } | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | /* Macros for inflate(): */ | ||
429 | |||
430 | /* check function to use adler32() for zlib or crc32() for gzip */ | ||
431 | #ifdef GUNZIP | ||
432 | # define UPDATE(check, buf, len) \ | ||
433 | (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) | ||
434 | #else | ||
435 | # define UPDATE(check, buf, len) adler32(check, buf, len) | ||
436 | #endif | ||
437 | |||
438 | /* check macros for header crc */ | ||
439 | #ifdef GUNZIP | ||
440 | # define CRC2(check, word) \ | ||
441 | do { \ | ||
442 | hbuf[0] = (unsigned char)(word); \ | ||
443 | hbuf[1] = (unsigned char)((word) >> 8); \ | ||
444 | check = crc32(check, hbuf, 2); \ | ||
445 | } while (0) | ||
446 | |||
447 | # define CRC4(check, word) \ | ||
448 | do { \ | ||
449 | hbuf[0] = (unsigned char)(word); \ | ||
450 | hbuf[1] = (unsigned char)((word) >> 8); \ | ||
451 | hbuf[2] = (unsigned char)((word) >> 16); \ | ||
452 | hbuf[3] = (unsigned char)((word) >> 24); \ | ||
453 | check = crc32(check, hbuf, 4); \ | ||
454 | } while (0) | ||
455 | #endif | ||
456 | |||
457 | /* Load registers with state in inflate() for speed */ | ||
458 | #define LOAD() \ | ||
459 | do { \ | ||
460 | put = strm->next_out; \ | ||
461 | left = strm->avail_out; \ | ||
462 | next = strm->next_in; \ | ||
463 | have = strm->avail_in; \ | ||
464 | hold = state->hold; \ | ||
465 | bits = state->bits; \ | ||
466 | } while (0) | ||
467 | |||
468 | /* Restore state from registers in inflate() */ | ||
469 | #define RESTORE() \ | ||
470 | do { \ | ||
471 | strm->next_out = put; \ | ||
472 | strm->avail_out = left; \ | ||
473 | strm->next_in = next; \ | ||
474 | strm->avail_in = have; \ | ||
475 | state->hold = hold; \ | ||
476 | state->bits = bits; \ | ||
477 | } while (0) | ||
478 | |||
479 | /* Clear the input bit accumulator */ | ||
480 | #define INITBITS() \ | ||
481 | do { \ | ||
482 | hold = 0; \ | ||
483 | bits = 0; \ | ||
484 | } while (0) | ||
485 | |||
486 | /* Get a byte of input into the bit accumulator, or return from inflate() | ||
487 | if there is no input available. */ | ||
488 | #define PULLBYTE() \ | ||
489 | do { \ | ||
490 | if (have == 0) goto inf_leave; \ | ||
491 | have--; \ | ||
492 | hold += (unsigned long)(*next++) << bits; \ | ||
493 | bits += 8; \ | ||
494 | } while (0) | ||
495 | |||
496 | /* Assure that there are at least n bits in the bit accumulator. If there is | ||
497 | not enough available input to do that, then return from inflate(). */ | ||
498 | #define NEEDBITS(n) \ | ||
499 | do { \ | ||
500 | while (bits < (unsigned)(n)) \ | ||
501 | PULLBYTE(); \ | ||
502 | } while (0) | ||
503 | |||
504 | /* Return the low n bits of the bit accumulator (n < 16) */ | ||
505 | #define BITS(n) \ | ||
506 | ((unsigned)hold & ((1U << (n)) - 1)) | ||
507 | |||
508 | /* Remove n bits from the bit accumulator */ | ||
509 | #define DROPBITS(n) \ | ||
510 | do { \ | ||
511 | hold >>= (n); \ | ||
512 | bits -= (unsigned)(n); \ | ||
513 | } while (0) | ||
514 | |||
515 | /* Remove zero to seven bits as needed to go to a byte boundary */ | ||
516 | #define BYTEBITS() \ | ||
517 | do { \ | ||
518 | hold >>= bits & 7; \ | ||
519 | bits -= bits & 7; \ | ||
520 | } while (0) | ||
521 | |||
522 | /* | ||
523 | inflate() uses a state machine to process as much input data and generate as | ||
524 | much output data as possible before returning. The state machine is | ||
525 | structured roughly as follows: | ||
526 | |||
527 | for (;;) switch (state) { | ||
528 | ... | ||
529 | case STATEn: | ||
530 | if (not enough input data or output space to make progress) | ||
531 | return; | ||
532 | ... make progress ... | ||
533 | state = STATEm; | ||
534 | break; | ||
535 | ... | ||
536 | } | ||
537 | |||
538 | so when inflate() is called again, the same case is attempted again, and | ||
539 | if the appropriate resources are provided, the machine proceeds to the | ||
540 | next state. The NEEDBITS() macro is usually the way the state evaluates | ||
541 | whether it can proceed or should return. NEEDBITS() does the return if | ||
542 | the requested bits are not available. The typical use of the BITS macros | ||
543 | is: | ||
544 | |||
545 | NEEDBITS(n); | ||
546 | ... do something with BITS(n) ... | ||
547 | DROPBITS(n); | ||
548 | |||
549 | where NEEDBITS(n) either returns from inflate() if there isn't enough | ||
550 | input left to load n bits into the accumulator, or it continues. BITS(n) | ||
551 | gives the low n bits in the accumulator. When done, DROPBITS(n) drops | ||
552 | the low n bits off the accumulator. INITBITS() clears the accumulator | ||
553 | and sets the number of available bits to zero. BYTEBITS() discards just | ||
554 | enough bits to put the accumulator on a byte boundary. After BYTEBITS() | ||
555 | and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. | ||
556 | |||
557 | NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return | ||
558 | if there is no input available. The decoding of variable length codes uses | ||
559 | PULLBYTE() directly in order to pull just enough bytes to decode the next | ||
560 | code, and no more. | ||
561 | |||
562 | Some states loop until they get enough input, making sure that enough | ||
563 | state information is maintained to continue the loop where it left off | ||
564 | if NEEDBITS() returns in the loop. For example, want, need, and keep | ||
565 | would all have to actually be part of the saved state in case NEEDBITS() | ||
566 | returns: | ||
567 | |||
568 | case STATEw: | ||
569 | while (want < need) { | ||
570 | NEEDBITS(n); | ||
571 | keep[want++] = BITS(n); | ||
572 | DROPBITS(n); | ||
573 | } | ||
574 | state = STATEx; | ||
575 | case STATEx: | ||
576 | |||
577 | As shown above, if the next state is also the next case, then the break | ||
578 | is omitted. | ||
579 | |||
580 | A state may also return if there is not enough output space available to | ||
581 | complete that state. Those states are copying stored data, writing a | ||
582 | literal byte, and copying a matching string. | ||
583 | |||
584 | When returning, a "goto inf_leave" is used to update the total counters, | ||
585 | update the check value, and determine whether any progress has been made | ||
586 | during that inflate() call in order to return the proper return code. | ||
587 | Progress is defined as a change in either strm->avail_in or strm->avail_out. | ||
588 | When there is a window, goto inf_leave will update the window with the last | ||
589 | output written. If a goto inf_leave occurs in the middle of decompression | ||
590 | and there is no window currently, goto inf_leave will create one and copy | ||
591 | output to the window for the next call of inflate(). | ||
592 | |||
593 | In this implementation, the flush parameter of inflate() only affects the | ||
594 | return code (per zlib.h). inflate() always writes as much as possible to | ||
595 | strm->next_out, given the space available and the provided input--the effect | ||
596 | documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers | ||
597 | the allocation of and copying into a sliding window until necessary, which | ||
598 | provides the effect documented in zlib.h for Z_FINISH when the entire input | ||
599 | stream available. So the only thing the flush parameter actually does is: | ||
600 | when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it | ||
601 | will return Z_BUF_ERROR if it has not reached the end of the stream. | ||
602 | */ | ||
603 | |||
604 | int ZEXPORT inflate(strm, flush) | ||
605 | z_streamp strm; | ||
606 | int flush; | ||
607 | { | ||
608 | struct inflate_state FAR *state; | ||
609 | unsigned char FAR *next; /* next input */ | ||
610 | unsigned char FAR *put; /* next output */ | ||
611 | unsigned have, left; /* available input and output */ | ||
612 | unsigned long hold; /* bit buffer */ | ||
613 | unsigned bits; /* bits in bit buffer */ | ||
614 | unsigned in, out; /* save starting available input and output */ | ||
615 | unsigned copy; /* number of stored or match bytes to copy */ | ||
616 | unsigned char FAR *from; /* where to copy match bytes from */ | ||
617 | code here; /* current decoding table entry */ | ||
618 | code last; /* parent table entry */ | ||
619 | unsigned len; /* length to copy for repeats, bits to drop */ | ||
620 | int ret; /* return code */ | ||
621 | #ifdef GUNZIP | ||
622 | unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ | ||
623 | #endif | ||
624 | static const unsigned short order[19] = /* permutation of code lengths */ | ||
625 | {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; | ||
626 | |||
627 | if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || | ||
628 | (strm->next_in == Z_NULL && strm->avail_in != 0)) | ||
629 | return Z_STREAM_ERROR; | ||
630 | |||
631 | state = (struct inflate_state FAR *)strm->state; | ||
632 | if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ | ||
633 | LOAD(); | ||
634 | in = have; | ||
635 | out = left; | ||
636 | ret = Z_OK; | ||
637 | for (;;) | ||
638 | switch (state->mode) { | ||
639 | case HEAD: | ||
640 | if (state->wrap == 0) { | ||
641 | state->mode = TYPEDO; | ||
642 | break; | ||
643 | } | ||
644 | NEEDBITS(16); | ||
645 | #ifdef GUNZIP | ||
646 | if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ | ||
647 | state->check = crc32(0L, Z_NULL, 0); | ||
648 | CRC2(state->check, hold); | ||
649 | INITBITS(); | ||
650 | state->mode = FLAGS; | ||
651 | break; | ||
652 | } | ||
653 | state->flags = 0; /* expect zlib header */ | ||
654 | if (state->head != Z_NULL) | ||
655 | state->head->done = -1; | ||
656 | if (!(state->wrap & 1) || /* check if zlib header allowed */ | ||
657 | #else | ||
658 | if ( | ||
659 | #endif | ||
660 | ((BITS(8) << 8) + (hold >> 8)) % 31) { | ||
661 | strm->msg = (char *)"incorrect header check"; | ||
662 | state->mode = BAD; | ||
663 | break; | ||
664 | } | ||
665 | if (BITS(4) != Z_DEFLATED) { | ||
666 | strm->msg = (char *)"unknown compression method"; | ||
667 | state->mode = BAD; | ||
668 | break; | ||
669 | } | ||
670 | DROPBITS(4); | ||
671 | len = BITS(4) + 8; | ||
672 | if (state->wbits == 0) | ||
673 | state->wbits = len; | ||
674 | else if (len > state->wbits) { | ||
675 | strm->msg = (char *)"invalid window size"; | ||
676 | state->mode = BAD; | ||
677 | break; | ||
678 | } | ||
679 | state->dmax = 1U << len; | ||
680 | Tracev((stderr, "inflate: zlib header ok\n")); | ||
681 | strm->adler = state->check = adler32(0L, Z_NULL, 0); | ||
682 | state->mode = hold & 0x200 ? DICTID : TYPE; | ||
683 | INITBITS(); | ||
684 | break; | ||
685 | #ifdef GUNZIP | ||
686 | case FLAGS: | ||
687 | NEEDBITS(16); | ||
688 | state->flags = (int)(hold); | ||
689 | if ((state->flags & 0xff) != Z_DEFLATED) { | ||
690 | strm->msg = (char *)"unknown compression method"; | ||
691 | state->mode = BAD; | ||
692 | break; | ||
693 | } | ||
694 | if (state->flags & 0xe000) { | ||
695 | strm->msg = (char *)"unknown header flags set"; | ||
696 | state->mode = BAD; | ||
697 | break; | ||
698 | } | ||
699 | if (state->head != Z_NULL) | ||
700 | state->head->text = (int)((hold >> 8) & 1); | ||
701 | if (state->flags & 0x0200) CRC2(state->check, hold); | ||
702 | INITBITS(); | ||
703 | state->mode = TIME; | ||
704 | case TIME: | ||
705 | NEEDBITS(32); | ||
706 | if (state->head != Z_NULL) | ||
707 | state->head->time = hold; | ||
708 | if (state->flags & 0x0200) CRC4(state->check, hold); | ||
709 | INITBITS(); | ||
710 | state->mode = OS; | ||
711 | case OS: | ||
712 | NEEDBITS(16); | ||
713 | if (state->head != Z_NULL) { | ||
714 | state->head->xflags = (int)(hold & 0xff); | ||
715 | state->head->os = (int)(hold >> 8); | ||
716 | } | ||
717 | if (state->flags & 0x0200) CRC2(state->check, hold); | ||
718 | INITBITS(); | ||
719 | state->mode = EXLEN; | ||
720 | case EXLEN: | ||
721 | if (state->flags & 0x0400) { | ||
722 | NEEDBITS(16); | ||
723 | state->length = (unsigned)(hold); | ||
724 | if (state->head != Z_NULL) | ||
725 | state->head->extra_len = (unsigned)hold; | ||
726 | if (state->flags & 0x0200) CRC2(state->check, hold); | ||
727 | INITBITS(); | ||
728 | } | ||
729 | else if (state->head != Z_NULL) | ||
730 | state->head->extra = Z_NULL; | ||
731 | state->mode = EXTRA; | ||
732 | case EXTRA: | ||
733 | if (state->flags & 0x0400) { | ||
734 | copy = state->length; | ||
735 | if (copy > have) copy = have; | ||
736 | if (copy) { | ||
737 | if (state->head != Z_NULL && | ||
738 | state->head->extra != Z_NULL) { | ||
739 | len = state->head->extra_len - state->length; | ||
740 | zmemcpy(state->head->extra + len, next, | ||
741 | len + copy > state->head->extra_max ? | ||
742 | state->head->extra_max - len : copy); | ||
743 | } | ||
744 | if (state->flags & 0x0200) | ||
745 | state->check = crc32(state->check, next, copy); | ||
746 | have -= copy; | ||
747 | next += copy; | ||
748 | state->length -= copy; | ||
749 | } | ||
750 | if (state->length) goto inf_leave; | ||
751 | } | ||
752 | state->length = 0; | ||
753 | state->mode = NAME; | ||
754 | case NAME: | ||
755 | if (state->flags & 0x0800) { | ||
756 | if (have == 0) goto inf_leave; | ||
757 | copy = 0; | ||
758 | do { | ||
759 | len = (unsigned)(next[copy++]); | ||
760 | if (state->head != Z_NULL && | ||
761 | state->head->name != Z_NULL && | ||
762 | state->length < state->head->name_max) | ||
763 | state->head->name[state->length++] = len; | ||
764 | } while (len && copy < have); | ||
765 | if (state->flags & 0x0200) | ||
766 | state->check = crc32(state->check, next, copy); | ||
767 | have -= copy; | ||
768 | next += copy; | ||
769 | if (len) goto inf_leave; | ||
770 | } | ||
771 | else if (state->head != Z_NULL) | ||
772 | state->head->name = Z_NULL; | ||
773 | state->length = 0; | ||
774 | state->mode = COMMENT; | ||
775 | case COMMENT: | ||
776 | if (state->flags & 0x1000) { | ||
777 | if (have == 0) goto inf_leave; | ||
778 | copy = 0; | ||
779 | do { | ||
780 | len = (unsigned)(next[copy++]); | ||
781 | if (state->head != Z_NULL && | ||
782 | state->head->comment != Z_NULL && | ||
783 | state->length < state->head->comm_max) | ||
784 | state->head->comment[state->length++] = len; | ||
785 | } while (len && copy < have); | ||
786 | if (state->flags & 0x0200) | ||
787 | state->check = crc32(state->check, next, copy); | ||
788 | have -= copy; | ||
789 | next += copy; | ||
790 | if (len) goto inf_leave; | ||
791 | } | ||
792 | else if (state->head != Z_NULL) | ||
793 | state->head->comment = Z_NULL; | ||
794 | state->mode = HCRC; | ||
795 | case HCRC: | ||
796 | if (state->flags & 0x0200) { | ||
797 | NEEDBITS(16); | ||
798 | if (hold != (state->check & 0xffff)) { | ||
799 | strm->msg = (char *)"header crc mismatch"; | ||
800 | state->mode = BAD; | ||
801 | break; | ||
802 | } | ||
803 | INITBITS(); | ||
804 | } | ||
805 | if (state->head != Z_NULL) { | ||
806 | state->head->hcrc = (int)((state->flags >> 9) & 1); | ||
807 | state->head->done = 1; | ||
808 | } | ||
809 | strm->adler = state->check = crc32(0L, Z_NULL, 0); | ||
810 | state->mode = TYPE; | ||
811 | break; | ||
812 | #endif | ||
813 | case DICTID: | ||
814 | NEEDBITS(32); | ||
815 | strm->adler = state->check = ZSWAP32(hold); | ||
816 | INITBITS(); | ||
817 | state->mode = DICT; | ||
818 | case DICT: | ||
819 | if (state->havedict == 0) { | ||
820 | RESTORE(); | ||
821 | return Z_NEED_DICT; | ||
822 | } | ||
823 | strm->adler = state->check = adler32(0L, Z_NULL, 0); | ||
824 | state->mode = TYPE; | ||
825 | case TYPE: | ||
826 | if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; | ||
827 | case TYPEDO: | ||
828 | if (state->last) { | ||
829 | BYTEBITS(); | ||
830 | state->mode = CHECK; | ||
831 | break; | ||
832 | } | ||
833 | NEEDBITS(3); | ||
834 | state->last = BITS(1); | ||
835 | DROPBITS(1); | ||
836 | switch (BITS(2)) { | ||
837 | case 0: /* stored block */ | ||
838 | Tracev((stderr, "inflate: stored block%s\n", | ||
839 | state->last ? " (last)" : "")); | ||
840 | state->mode = STORED; | ||
841 | break; | ||
842 | case 1: /* fixed block */ | ||
843 | fixedtables(state); | ||
844 | Tracev((stderr, "inflate: fixed codes block%s\n", | ||
845 | state->last ? " (last)" : "")); | ||
846 | state->mode = LEN_; /* decode codes */ | ||
847 | if (flush == Z_TREES) { | ||
848 | DROPBITS(2); | ||
849 | goto inf_leave; | ||
850 | } | ||
851 | break; | ||
852 | case 2: /* dynamic block */ | ||
853 | Tracev((stderr, "inflate: dynamic codes block%s\n", | ||
854 | state->last ? " (last)" : "")); | ||
855 | state->mode = TABLE; | ||
856 | break; | ||
857 | case 3: | ||
858 | strm->msg = (char *)"invalid block type"; | ||
859 | state->mode = BAD; | ||
860 | } | ||
861 | DROPBITS(2); | ||
862 | break; | ||
863 | case STORED: | ||
864 | BYTEBITS(); /* go to byte boundary */ | ||
865 | NEEDBITS(32); | ||
866 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { | ||
867 | strm->msg = (char *)"invalid stored block lengths"; | ||
868 | state->mode = BAD; | ||
869 | break; | ||
870 | } | ||
871 | state->length = (unsigned)hold & 0xffff; | ||
872 | Tracev((stderr, "inflate: stored length %u\n", | ||
873 | state->length)); | ||
874 | INITBITS(); | ||
875 | state->mode = COPY_; | ||
876 | if (flush == Z_TREES) goto inf_leave; | ||
877 | case COPY_: | ||
878 | state->mode = COPY; | ||
879 | case COPY: | ||
880 | copy = state->length; | ||
881 | if (copy) { | ||
882 | if (copy > have) copy = have; | ||
883 | if (copy > left) copy = left; | ||
884 | if (copy == 0) goto inf_leave; | ||
885 | zmemcpy(put, next, copy); | ||
886 | have -= copy; | ||
887 | next += copy; | ||
888 | left -= copy; | ||
889 | put += copy; | ||
890 | state->length -= copy; | ||
891 | break; | ||
892 | } | ||
893 | Tracev((stderr, "inflate: stored end\n")); | ||
894 | state->mode = TYPE; | ||
895 | break; | ||
896 | case TABLE: | ||
897 | NEEDBITS(14); | ||
898 | state->nlen = BITS(5) + 257; | ||
899 | DROPBITS(5); | ||
900 | state->ndist = BITS(5) + 1; | ||
901 | DROPBITS(5); | ||
902 | state->ncode = BITS(4) + 4; | ||
903 | DROPBITS(4); | ||
904 | #ifndef PKZIP_BUG_WORKAROUND | ||
905 | if (state->nlen > 286 || state->ndist > 30) { | ||
906 | strm->msg = (char *)"too many length or distance symbols"; | ||
907 | state->mode = BAD; | ||
908 | break; | ||
909 | } | ||
910 | #endif | ||
911 | Tracev((stderr, "inflate: table sizes ok\n")); | ||
912 | state->have = 0; | ||
913 | state->mode = LENLENS; | ||
914 | case LENLENS: | ||
915 | while (state->have < state->ncode) { | ||
916 | NEEDBITS(3); | ||
917 | state->lens[order[state->have++]] = (unsigned short)BITS(3); | ||
918 | DROPBITS(3); | ||
919 | } | ||
920 | while (state->have < 19) | ||
921 | state->lens[order[state->have++]] = 0; | ||
922 | state->next = state->codes; | ||
923 | state->lencode = (code const FAR *)(state->next); | ||
924 | state->lenbits = 7; | ||
925 | ret = inflate_table(CODES, state->lens, 19, &(state->next), | ||
926 | &(state->lenbits), state->work); | ||
927 | if (ret) { | ||
928 | strm->msg = (char *)"invalid code lengths set"; | ||
929 | state->mode = BAD; | ||
930 | break; | ||
931 | } | ||
932 | Tracev((stderr, "inflate: code lengths ok\n")); | ||
933 | state->have = 0; | ||
934 | state->mode = CODELENS; | ||
935 | case CODELENS: | ||
936 | while (state->have < state->nlen + state->ndist) { | ||
937 | for (;;) { | ||
938 | here = state->lencode[BITS(state->lenbits)]; | ||
939 | if ((unsigned)(here.bits) <= bits) break; | ||
940 | PULLBYTE(); | ||
941 | } | ||
942 | if (here.val < 16) { | ||
943 | DROPBITS(here.bits); | ||
944 | state->lens[state->have++] = here.val; | ||
945 | } | ||
946 | else { | ||
947 | if (here.val == 16) { | ||
948 | NEEDBITS(here.bits + 2); | ||
949 | DROPBITS(here.bits); | ||
950 | if (state->have == 0) { | ||
951 | strm->msg = (char *)"invalid bit length repeat"; | ||
952 | state->mode = BAD; | ||
953 | break; | ||
954 | } | ||
955 | len = state->lens[state->have - 1]; | ||
956 | copy = 3 + BITS(2); | ||
957 | DROPBITS(2); | ||
958 | } | ||
959 | else if (here.val == 17) { | ||
960 | NEEDBITS(here.bits + 3); | ||
961 | DROPBITS(here.bits); | ||
962 | len = 0; | ||
963 | copy = 3 + BITS(3); | ||
964 | DROPBITS(3); | ||
965 | } | ||
966 | else { | ||
967 | NEEDBITS(here.bits + 7); | ||
968 | DROPBITS(here.bits); | ||
969 | len = 0; | ||
970 | copy = 11 + BITS(7); | ||
971 | DROPBITS(7); | ||
972 | } | ||
973 | if (state->have + copy > state->nlen + state->ndist) { | ||
974 | strm->msg = (char *)"invalid bit length repeat"; | ||
975 | state->mode = BAD; | ||
976 | break; | ||
977 | } | ||
978 | while (copy--) | ||
979 | state->lens[state->have++] = (unsigned short)len; | ||
980 | } | ||
981 | } | ||
982 | |||
983 | /* handle error breaks in while */ | ||
984 | if (state->mode == BAD) break; | ||
985 | |||
986 | /* check for end-of-block code (better have one) */ | ||
987 | if (state->lens[256] == 0) { | ||
988 | strm->msg = (char *)"invalid code -- missing end-of-block"; | ||
989 | state->mode = BAD; | ||
990 | break; | ||
991 | } | ||
992 | |||
993 | /* build code tables -- note: do not change the lenbits or distbits | ||
994 | values here (9 and 6) without reading the comments in inftrees.h | ||
995 | concerning the ENOUGH constants, which depend on those values */ | ||
996 | state->next = state->codes; | ||
997 | state->lencode = (code const FAR *)(state->next); | ||
998 | state->lenbits = 9; | ||
999 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), | ||
1000 | &(state->lenbits), state->work); | ||
1001 | if (ret) { | ||
1002 | strm->msg = (char *)"invalid literal/lengths set"; | ||
1003 | state->mode = BAD; | ||
1004 | break; | ||
1005 | } | ||
1006 | state->distcode = (code const FAR *)(state->next); | ||
1007 | state->distbits = 6; | ||
1008 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, | ||
1009 | &(state->next), &(state->distbits), state->work); | ||
1010 | if (ret) { | ||
1011 | strm->msg = (char *)"invalid distances set"; | ||
1012 | state->mode = BAD; | ||
1013 | break; | ||
1014 | } | ||
1015 | Tracev((stderr, "inflate: codes ok\n")); | ||
1016 | state->mode = LEN_; | ||
1017 | if (flush == Z_TREES) goto inf_leave; | ||
1018 | case LEN_: | ||
1019 | state->mode = LEN; | ||
1020 | case LEN: | ||
1021 | if (have >= 6 && left >= 258) { | ||
1022 | RESTORE(); | ||
1023 | inflate_fast(strm, out); | ||
1024 | LOAD(); | ||
1025 | if (state->mode == TYPE) | ||
1026 | state->back = -1; | ||
1027 | break; | ||
1028 | } | ||
1029 | state->back = 0; | ||
1030 | for (;;) { | ||
1031 | here = state->lencode[BITS(state->lenbits)]; | ||
1032 | if ((unsigned)(here.bits) <= bits) break; | ||
1033 | PULLBYTE(); | ||
1034 | } | ||
1035 | if (here.op && (here.op & 0xf0) == 0) { | ||
1036 | last = here; | ||
1037 | for (;;) { | ||
1038 | here = state->lencode[last.val + | ||
1039 | (BITS(last.bits + last.op) >> last.bits)]; | ||
1040 | if ((unsigned)(last.bits + here.bits) <= bits) break; | ||
1041 | PULLBYTE(); | ||
1042 | } | ||
1043 | DROPBITS(last.bits); | ||
1044 | state->back += last.bits; | ||
1045 | } | ||
1046 | DROPBITS(here.bits); | ||
1047 | state->back += here.bits; | ||
1048 | state->length = (unsigned)here.val; | ||
1049 | if ((int)(here.op) == 0) { | ||
1050 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? | ||
1051 | "inflate: literal '%c'\n" : | ||
1052 | "inflate: literal 0x%02x\n", here.val)); | ||
1053 | state->mode = LIT; | ||
1054 | break; | ||
1055 | } | ||
1056 | if (here.op & 32) { | ||
1057 | Tracevv((stderr, "inflate: end of block\n")); | ||
1058 | state->back = -1; | ||
1059 | state->mode = TYPE; | ||
1060 | break; | ||
1061 | } | ||
1062 | if (here.op & 64) { | ||
1063 | strm->msg = (char *)"invalid literal/length code"; | ||
1064 | state->mode = BAD; | ||
1065 | break; | ||
1066 | } | ||
1067 | state->extra = (unsigned)(here.op) & 15; | ||
1068 | state->mode = LENEXT; | ||
1069 | case LENEXT: | ||
1070 | if (state->extra) { | ||
1071 | NEEDBITS(state->extra); | ||
1072 | state->length += BITS(state->extra); | ||
1073 | DROPBITS(state->extra); | ||
1074 | state->back += state->extra; | ||
1075 | } | ||
1076 | Tracevv((stderr, "inflate: length %u\n", state->length)); | ||
1077 | state->was = state->length; | ||
1078 | state->mode = DIST; | ||
1079 | case DIST: | ||
1080 | for (;;) { | ||
1081 | here = state->distcode[BITS(state->distbits)]; | ||
1082 | if ((unsigned)(here.bits) <= bits) break; | ||
1083 | PULLBYTE(); | ||
1084 | } | ||
1085 | if ((here.op & 0xf0) == 0) { | ||
1086 | last = here; | ||
1087 | for (;;) { | ||
1088 | here = state->distcode[last.val + | ||
1089 | (BITS(last.bits + last.op) >> last.bits)]; | ||
1090 | if ((unsigned)(last.bits + here.bits) <= bits) break; | ||
1091 | PULLBYTE(); | ||
1092 | } | ||
1093 | DROPBITS(last.bits); | ||
1094 | state->back += last.bits; | ||
1095 | } | ||
1096 | DROPBITS(here.bits); | ||
1097 | state->back += here.bits; | ||
1098 | if (here.op & 64) { | ||
1099 | strm->msg = (char *)"invalid distance code"; | ||
1100 | state->mode = BAD; | ||
1101 | break; | ||
1102 | } | ||
1103 | state->offset = (unsigned)here.val; | ||
1104 | state->extra = (unsigned)(here.op) & 15; | ||
1105 | state->mode = DISTEXT; | ||
1106 | case DISTEXT: | ||
1107 | if (state->extra) { | ||
1108 | NEEDBITS(state->extra); | ||
1109 | state->offset += BITS(state->extra); | ||
1110 | DROPBITS(state->extra); | ||
1111 | state->back += state->extra; | ||
1112 | } | ||
1113 | #ifdef INFLATE_STRICT | ||
1114 | if (state->offset > state->dmax) { | ||
1115 | strm->msg = (char *)"invalid distance too far back"; | ||
1116 | state->mode = BAD; | ||
1117 | break; | ||
1118 | } | ||
1119 | #endif | ||
1120 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); | ||
1121 | state->mode = MATCH; | ||
1122 | case MATCH: | ||
1123 | if (left == 0) goto inf_leave; | ||
1124 | copy = out - left; | ||
1125 | if (state->offset > copy) { /* copy from window */ | ||
1126 | copy = state->offset - copy; | ||
1127 | if (copy > state->whave) { | ||
1128 | if (state->sane) { | ||
1129 | strm->msg = (char *)"invalid distance too far back"; | ||
1130 | state->mode = BAD; | ||
1131 | break; | ||
1132 | } | ||
1133 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
1134 | Trace((stderr, "inflate.c too far\n")); | ||
1135 | copy -= state->whave; | ||
1136 | if (copy > state->length) copy = state->length; | ||
1137 | if (copy > left) copy = left; | ||
1138 | left -= copy; | ||
1139 | state->length -= copy; | ||
1140 | do { | ||
1141 | *put++ = 0; | ||
1142 | } while (--copy); | ||
1143 | if (state->length == 0) state->mode = LEN; | ||
1144 | break; | ||
1145 | #endif | ||
1146 | } | ||
1147 | if (copy > state->wnext) { | ||
1148 | copy -= state->wnext; | ||
1149 | from = state->window + (state->wsize - copy); | ||
1150 | } | ||
1151 | else | ||
1152 | from = state->window + (state->wnext - copy); | ||
1153 | if (copy > state->length) copy = state->length; | ||
1154 | } | ||
1155 | else { /* copy from output */ | ||
1156 | from = put - state->offset; | ||
1157 | copy = state->length; | ||
1158 | } | ||
1159 | if (copy > left) copy = left; | ||
1160 | left -= copy; | ||
1161 | state->length -= copy; | ||
1162 | do { | ||
1163 | *put++ = *from++; | ||
1164 | } while (--copy); | ||
1165 | if (state->length == 0) state->mode = LEN; | ||
1166 | break; | ||
1167 | case LIT: | ||
1168 | if (left == 0) goto inf_leave; | ||
1169 | *put++ = (unsigned char)(state->length); | ||
1170 | left--; | ||
1171 | state->mode = LEN; | ||
1172 | break; | ||
1173 | case CHECK: | ||
1174 | if (state->wrap) { | ||
1175 | NEEDBITS(32); | ||
1176 | out -= left; | ||
1177 | strm->total_out += out; | ||
1178 | state->total += out; | ||
1179 | if (out) | ||
1180 | strm->adler = state->check = | ||
1181 | UPDATE(state->check, put - out, out); | ||
1182 | out = left; | ||
1183 | if (( | ||
1184 | #ifdef GUNZIP | ||
1185 | state->flags ? hold : | ||
1186 | #endif | ||
1187 | ZSWAP32(hold)) != state->check) { | ||
1188 | strm->msg = (char *)"incorrect data check"; | ||
1189 | state->mode = BAD; | ||
1190 | break; | ||
1191 | } | ||
1192 | INITBITS(); | ||
1193 | Tracev((stderr, "inflate: check matches trailer\n")); | ||
1194 | } | ||
1195 | #ifdef GUNZIP | ||
1196 | state->mode = LENGTH; | ||
1197 | case LENGTH: | ||
1198 | if (state->wrap && state->flags) { | ||
1199 | NEEDBITS(32); | ||
1200 | if (hold != (state->total & 0xffffffffUL)) { | ||
1201 | strm->msg = (char *)"incorrect length check"; | ||
1202 | state->mode = BAD; | ||
1203 | break; | ||
1204 | } | ||
1205 | INITBITS(); | ||
1206 | Tracev((stderr, "inflate: length matches trailer\n")); | ||
1207 | } | ||
1208 | #endif | ||
1209 | state->mode = DONE; | ||
1210 | case DONE: | ||
1211 | ret = Z_STREAM_END; | ||
1212 | goto inf_leave; | ||
1213 | case BAD: | ||
1214 | ret = Z_DATA_ERROR; | ||
1215 | goto inf_leave; | ||
1216 | case MEM: | ||
1217 | return Z_MEM_ERROR; | ||
1218 | case SYNC: | ||
1219 | default: | ||
1220 | return Z_STREAM_ERROR; | ||
1221 | } | ||
1222 | |||
1223 | /* | ||
1224 | Return from inflate(), updating the total counts and the check value. | ||
1225 | If there was no progress during the inflate() call, return a buffer | ||
1226 | error. Call updatewindow() to create and/or update the window state. | ||
1227 | Note: a memory error from inflate() is non-recoverable. | ||
1228 | */ | ||
1229 | inf_leave: | ||
1230 | RESTORE(); | ||
1231 | if (state->wsize || (out != strm->avail_out && state->mode < BAD && | ||
1232 | (state->mode < CHECK || flush != Z_FINISH))) | ||
1233 | if (updatewindow(strm, out)) { | ||
1234 | state->mode = MEM; | ||
1235 | return Z_MEM_ERROR; | ||
1236 | } | ||
1237 | in -= strm->avail_in; | ||
1238 | out -= strm->avail_out; | ||
1239 | strm->total_in += in; | ||
1240 | strm->total_out += out; | ||
1241 | state->total += out; | ||
1242 | if (state->wrap && out) | ||
1243 | strm->adler = state->check = | ||
1244 | UPDATE(state->check, strm->next_out - out, out); | ||
1245 | strm->data_type = state->bits + (state->last ? 64 : 0) + | ||
1246 | (state->mode == TYPE ? 128 : 0) + | ||
1247 | (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); | ||
1248 | if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) | ||
1249 | ret = Z_BUF_ERROR; | ||
1250 | return ret; | ||
1251 | } | ||
1252 | |||
1253 | int ZEXPORT inflateEnd(strm) | ||
1254 | z_streamp strm; | ||
1255 | { | ||
1256 | struct inflate_state FAR *state; | ||
1257 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) | ||
1258 | return Z_STREAM_ERROR; | ||
1259 | state = (struct inflate_state FAR *)strm->state; | ||
1260 | if (state->window != Z_NULL) ZFREE(strm, state->window); | ||
1261 | ZFREE(strm, strm->state); | ||
1262 | strm->state = Z_NULL; | ||
1263 | Tracev((stderr, "inflate: end\n")); | ||
1264 | return Z_OK; | ||
1265 | } | ||
1266 | |||
1267 | int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) | ||
1268 | z_streamp strm; | ||
1269 | const Bytef *dictionary; | ||
1270 | uInt dictLength; | ||
1271 | { | ||
1272 | struct inflate_state FAR *state; | ||
1273 | unsigned long dictid; | ||
1274 | unsigned char *next; | ||
1275 | unsigned avail; | ||
1276 | int ret; | ||
1277 | |||
1278 | /* check state */ | ||
1279 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1280 | state = (struct inflate_state FAR *)strm->state; | ||
1281 | if (state->wrap != 0 && state->mode != DICT) | ||
1282 | return Z_STREAM_ERROR; | ||
1283 | |||
1284 | /* check for correct dictionary identifier */ | ||
1285 | if (state->mode == DICT) { | ||
1286 | dictid = adler32(0L, Z_NULL, 0); | ||
1287 | dictid = adler32(dictid, dictionary, dictLength); | ||
1288 | if (dictid != state->check) | ||
1289 | return Z_DATA_ERROR; | ||
1290 | } | ||
1291 | |||
1292 | /* copy dictionary to window using updatewindow(), which will amend the | ||
1293 | existing dictionary if appropriate */ | ||
1294 | next = strm->next_out; | ||
1295 | avail = strm->avail_out; | ||
1296 | strm->next_out = (Bytef *)dictionary + dictLength; | ||
1297 | strm->avail_out = 0; | ||
1298 | ret = updatewindow(strm, dictLength); | ||
1299 | strm->avail_out = avail; | ||
1300 | strm->next_out = next; | ||
1301 | if (ret) { | ||
1302 | state->mode = MEM; | ||
1303 | return Z_MEM_ERROR; | ||
1304 | } | ||
1305 | state->havedict = 1; | ||
1306 | Tracev((stderr, "inflate: dictionary set\n")); | ||
1307 | return Z_OK; | ||
1308 | } | ||
1309 | |||
1310 | int ZEXPORT inflateGetHeader(strm, head) | ||
1311 | z_streamp strm; | ||
1312 | gz_headerp head; | ||
1313 | { | ||
1314 | struct inflate_state FAR *state; | ||
1315 | |||
1316 | /* check state */ | ||
1317 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1318 | state = (struct inflate_state FAR *)strm->state; | ||
1319 | if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; | ||
1320 | |||
1321 | /* save header structure */ | ||
1322 | state->head = head; | ||
1323 | head->done = 0; | ||
1324 | return Z_OK; | ||
1325 | } | ||
1326 | |||
1327 | /* | ||
1328 | Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found | ||
1329 | or when out of input. When called, *have is the number of pattern bytes | ||
1330 | found in order so far, in 0..3. On return *have is updated to the new | ||
1331 | state. If on return *have equals four, then the pattern was found and the | ||
1332 | return value is how many bytes were read including the last byte of the | ||
1333 | pattern. If *have is less than four, then the pattern has not been found | ||
1334 | yet and the return value is len. In the latter case, syncsearch() can be | ||
1335 | called again with more data and the *have state. *have is initialized to | ||
1336 | zero for the first call. | ||
1337 | */ | ||
1338 | local unsigned syncsearch(have, buf, len) | ||
1339 | unsigned FAR *have; | ||
1340 | unsigned char FAR *buf; | ||
1341 | unsigned len; | ||
1342 | { | ||
1343 | unsigned got; | ||
1344 | unsigned next; | ||
1345 | |||
1346 | got = *have; | ||
1347 | next = 0; | ||
1348 | while (next < len && got < 4) { | ||
1349 | if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) | ||
1350 | got++; | ||
1351 | else if (buf[next]) | ||
1352 | got = 0; | ||
1353 | else | ||
1354 | got = 4 - got; | ||
1355 | next++; | ||
1356 | } | ||
1357 | *have = got; | ||
1358 | return next; | ||
1359 | } | ||
1360 | |||
1361 | int ZEXPORT inflateSync(strm) | ||
1362 | z_streamp strm; | ||
1363 | { | ||
1364 | unsigned len; /* number of bytes to look at or looked at */ | ||
1365 | unsigned long in, out; /* temporary to save total_in and total_out */ | ||
1366 | unsigned char buf[4]; /* to restore bit buffer to byte string */ | ||
1367 | struct inflate_state FAR *state; | ||
1368 | |||
1369 | /* check parameters */ | ||
1370 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1371 | state = (struct inflate_state FAR *)strm->state; | ||
1372 | if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; | ||
1373 | |||
1374 | /* if first time, start search in bit buffer */ | ||
1375 | if (state->mode != SYNC) { | ||
1376 | state->mode = SYNC; | ||
1377 | state->hold <<= state->bits & 7; | ||
1378 | state->bits -= state->bits & 7; | ||
1379 | len = 0; | ||
1380 | while (state->bits >= 8) { | ||
1381 | buf[len++] = (unsigned char)(state->hold); | ||
1382 | state->hold >>= 8; | ||
1383 | state->bits -= 8; | ||
1384 | } | ||
1385 | state->have = 0; | ||
1386 | syncsearch(&(state->have), buf, len); | ||
1387 | } | ||
1388 | |||
1389 | /* search available input */ | ||
1390 | len = syncsearch(&(state->have), strm->next_in, strm->avail_in); | ||
1391 | strm->avail_in -= len; | ||
1392 | strm->next_in += len; | ||
1393 | strm->total_in += len; | ||
1394 | |||
1395 | /* return no joy or set up to restart inflate() on a new block */ | ||
1396 | if (state->have != 4) return Z_DATA_ERROR; | ||
1397 | in = strm->total_in; out = strm->total_out; | ||
1398 | inflateReset(strm); | ||
1399 | strm->total_in = in; strm->total_out = out; | ||
1400 | state->mode = TYPE; | ||
1401 | return Z_OK; | ||
1402 | } | ||
1403 | |||
1404 | /* | ||
1405 | Returns true if inflate is currently at the end of a block generated by | ||
1406 | Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP | ||
1407 | implementation to provide an additional safety check. PPP uses | ||
1408 | Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored | ||
1409 | block. When decompressing, PPP checks that at the end of input packet, | ||
1410 | inflate is waiting for these length bytes. | ||
1411 | */ | ||
1412 | int ZEXPORT inflateSyncPoint(strm) | ||
1413 | z_streamp strm; | ||
1414 | { | ||
1415 | struct inflate_state FAR *state; | ||
1416 | |||
1417 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1418 | state = (struct inflate_state FAR *)strm->state; | ||
1419 | return state->mode == STORED && state->bits == 0; | ||
1420 | } | ||
1421 | |||
1422 | int ZEXPORT inflateCopy(dest, source) | ||
1423 | z_streamp dest; | ||
1424 | z_streamp source; | ||
1425 | { | ||
1426 | struct inflate_state FAR *state; | ||
1427 | struct inflate_state FAR *copy; | ||
1428 | unsigned char FAR *window; | ||
1429 | unsigned wsize; | ||
1430 | |||
1431 | /* check input */ | ||
1432 | if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || | ||
1433 | source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) | ||
1434 | return Z_STREAM_ERROR; | ||
1435 | state = (struct inflate_state FAR *)source->state; | ||
1436 | |||
1437 | /* allocate space */ | ||
1438 | copy = (struct inflate_state FAR *) | ||
1439 | ZALLOC(source, 1, sizeof(struct inflate_state)); | ||
1440 | if (copy == Z_NULL) return Z_MEM_ERROR; | ||
1441 | window = Z_NULL; | ||
1442 | if (state->window != Z_NULL) { | ||
1443 | window = (unsigned char FAR *) | ||
1444 | ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); | ||
1445 | if (window == Z_NULL) { | ||
1446 | ZFREE(source, copy); | ||
1447 | return Z_MEM_ERROR; | ||
1448 | } | ||
1449 | } | ||
1450 | |||
1451 | /* copy state */ | ||
1452 | zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); | ||
1453 | zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); | ||
1454 | if (state->lencode >= state->codes && | ||
1455 | state->lencode <= state->codes + ENOUGH - 1) { | ||
1456 | copy->lencode = copy->codes + (state->lencode - state->codes); | ||
1457 | copy->distcode = copy->codes + (state->distcode - state->codes); | ||
1458 | } | ||
1459 | copy->next = copy->codes + (state->next - state->codes); | ||
1460 | if (window != Z_NULL) { | ||
1461 | wsize = 1U << state->wbits; | ||
1462 | zmemcpy(window, state->window, wsize); | ||
1463 | } | ||
1464 | copy->window = window; | ||
1465 | dest->state = (struct internal_state FAR *)copy; | ||
1466 | return Z_OK; | ||
1467 | } | ||
1468 | |||
1469 | int ZEXPORT inflateUndermine(strm, subvert) | ||
1470 | z_streamp strm; | ||
1471 | int subvert; | ||
1472 | { | ||
1473 | struct inflate_state FAR *state; | ||
1474 | |||
1475 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1476 | state = (struct inflate_state FAR *)strm->state; | ||
1477 | state->sane = !subvert; | ||
1478 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
1479 | return Z_OK; | ||
1480 | #else | ||
1481 | state->sane = 1; | ||
1482 | return Z_DATA_ERROR; | ||
1483 | #endif | ||
1484 | } | ||
1485 | |||
1486 | long ZEXPORT inflateMark(strm) | ||
1487 | z_streamp strm; | ||
1488 | { | ||
1489 | struct inflate_state FAR *state; | ||
1490 | |||
1491 | if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; | ||
1492 | state = (struct inflate_state FAR *)strm->state; | ||
1493 | return ((long)(state->back) << 16) + | ||
1494 | (state->mode == COPY ? state->length : | ||
1495 | (state->mode == MATCH ? state->was - state->length : 0)); | ||
1496 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.h deleted file mode 100644 index 95f4986..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inflate.h +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* inflate.h -- internal inflate state definition | ||
2 | * Copyright (C) 1995-2009 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* WARNING: this file should *not* be used by applications. It is | ||
7 | part of the implementation of the compression library and is | ||
8 | subject to change. Applications should only use zlib.h. | ||
9 | */ | ||
10 | |||
11 | /* define NO_GZIP when compiling if you want to disable gzip header and | ||
12 | trailer decoding by inflate(). NO_GZIP would be used to avoid linking in | ||
13 | the crc code when it is not needed. For shared libraries, gzip decoding | ||
14 | should be left enabled. */ | ||
15 | #ifndef NO_GZIP | ||
16 | # define GUNZIP | ||
17 | #endif | ||
18 | |||
19 | /* Possible inflate modes between inflate() calls */ | ||
20 | typedef enum { | ||
21 | HEAD, /* i: waiting for magic header */ | ||
22 | FLAGS, /* i: waiting for method and flags (gzip) */ | ||
23 | TIME, /* i: waiting for modification time (gzip) */ | ||
24 | OS, /* i: waiting for extra flags and operating system (gzip) */ | ||
25 | EXLEN, /* i: waiting for extra length (gzip) */ | ||
26 | EXTRA, /* i: waiting for extra bytes (gzip) */ | ||
27 | NAME, /* i: waiting for end of file name (gzip) */ | ||
28 | COMMENT, /* i: waiting for end of comment (gzip) */ | ||
29 | HCRC, /* i: waiting for header crc (gzip) */ | ||
30 | DICTID, /* i: waiting for dictionary check value */ | ||
31 | DICT, /* waiting for inflateSetDictionary() call */ | ||
32 | TYPE, /* i: waiting for type bits, including last-flag bit */ | ||
33 | TYPEDO, /* i: same, but skip check to exit inflate on new block */ | ||
34 | STORED, /* i: waiting for stored size (length and complement) */ | ||
35 | COPY_, /* i/o: same as COPY below, but only first time in */ | ||
36 | COPY, /* i/o: waiting for input or output to copy stored block */ | ||
37 | TABLE, /* i: waiting for dynamic block table lengths */ | ||
38 | LENLENS, /* i: waiting for code length code lengths */ | ||
39 | CODELENS, /* i: waiting for length/lit and distance code lengths */ | ||
40 | LEN_, /* i: same as LEN below, but only first time in */ | ||
41 | LEN, /* i: waiting for length/lit/eob code */ | ||
42 | LENEXT, /* i: waiting for length extra bits */ | ||
43 | DIST, /* i: waiting for distance code */ | ||
44 | DISTEXT, /* i: waiting for distance extra bits */ | ||
45 | MATCH, /* o: waiting for output space to copy string */ | ||
46 | LIT, /* o: waiting for output space to write literal */ | ||
47 | CHECK, /* i: waiting for 32-bit check value */ | ||
48 | LENGTH, /* i: waiting for 32-bit length (gzip) */ | ||
49 | DONE, /* finished check, done -- remain here until reset */ | ||
50 | BAD, /* got a data error -- remain here until reset */ | ||
51 | MEM, /* got an inflate() memory error -- remain here until reset */ | ||
52 | SYNC /* looking for synchronization bytes to restart inflate() */ | ||
53 | } inflate_mode; | ||
54 | |||
55 | /* | ||
56 | State transitions between above modes - | ||
57 | |||
58 | (most modes can go to BAD or MEM on error -- not shown for clarity) | ||
59 | |||
60 | Process header: | ||
61 | HEAD -> (gzip) or (zlib) or (raw) | ||
62 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> | ||
63 | HCRC -> TYPE | ||
64 | (zlib) -> DICTID or TYPE | ||
65 | DICTID -> DICT -> TYPE | ||
66 | (raw) -> TYPEDO | ||
67 | Read deflate blocks: | ||
68 | TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK | ||
69 | STORED -> COPY_ -> COPY -> TYPE | ||
70 | TABLE -> LENLENS -> CODELENS -> LEN_ | ||
71 | LEN_ -> LEN | ||
72 | Read deflate codes in fixed or dynamic block: | ||
73 | LEN -> LENEXT or LIT or TYPE | ||
74 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN | ||
75 | LIT -> LEN | ||
76 | Process trailer: | ||
77 | CHECK -> LENGTH -> DONE | ||
78 | */ | ||
79 | |||
80 | /* state maintained between inflate() calls. Approximately 10K bytes. */ | ||
81 | struct inflate_state { | ||
82 | inflate_mode mode; /* current inflate mode */ | ||
83 | int last; /* true if processing last block */ | ||
84 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ | ||
85 | int havedict; /* true if dictionary provided */ | ||
86 | int flags; /* gzip header method and flags (0 if zlib) */ | ||
87 | unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ | ||
88 | unsigned long check; /* protected copy of check value */ | ||
89 | unsigned long total; /* protected copy of output count */ | ||
90 | gz_headerp head; /* where to save gzip header information */ | ||
91 | /* sliding window */ | ||
92 | unsigned wbits; /* log base 2 of requested window size */ | ||
93 | unsigned wsize; /* window size or zero if not using window */ | ||
94 | unsigned whave; /* valid bytes in the window */ | ||
95 | unsigned wnext; /* window write index */ | ||
96 | unsigned char FAR *window; /* allocated sliding window, if needed */ | ||
97 | /* bit accumulator */ | ||
98 | unsigned long hold; /* input bit accumulator */ | ||
99 | unsigned bits; /* number of bits in "in" */ | ||
100 | /* for string and stored block copying */ | ||
101 | unsigned length; /* literal or length of data to copy */ | ||
102 | unsigned offset; /* distance back to copy string from */ | ||
103 | /* for table and code decoding */ | ||
104 | unsigned extra; /* extra bits needed */ | ||
105 | /* fixed and dynamic code tables */ | ||
106 | code const FAR *lencode; /* starting table for length/literal codes */ | ||
107 | code const FAR *distcode; /* starting table for distance codes */ | ||
108 | unsigned lenbits; /* index bits for lencode */ | ||
109 | unsigned distbits; /* index bits for distcode */ | ||
110 | /* dynamic table building */ | ||
111 | unsigned ncode; /* number of code length code lengths */ | ||
112 | unsigned nlen; /* number of length code lengths */ | ||
113 | unsigned ndist; /* number of distance code lengths */ | ||
114 | unsigned have; /* number of code lengths in lens[] */ | ||
115 | code FAR *next; /* next available space in codes[] */ | ||
116 | unsigned short lens[320]; /* temporary storage for code lengths */ | ||
117 | unsigned short work[288]; /* work area for code table building */ | ||
118 | code codes[ENOUGH]; /* space for code tables */ | ||
119 | int sane; /* if false, allow invalid distance too far */ | ||
120 | int back; /* bits back of last unprocessed length/lit */ | ||
121 | unsigned was; /* initial length of match */ | ||
122 | }; | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.c deleted file mode 100644 index 7803d01..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.c +++ /dev/null | |||
@@ -1,306 +0,0 @@ | |||
1 | /* inftrees.c -- generate Huffman trees for efficient decoding | ||
2 | * Copyright (C) 1995-2012 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | #include "zutil.h" | ||
7 | #include "inftrees.h" | ||
8 | |||
9 | #define MAXBITS 15 | ||
10 | |||
11 | const char inflate_copyright[] = | ||
12 | " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; | ||
13 | /* | ||
14 | If you use the zlib library in a product, an acknowledgment is welcome | ||
15 | in the documentation of your product. If for some reason you cannot | ||
16 | include such an acknowledgment, I would appreciate that you keep this | ||
17 | copyright string in the executable of your product. | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | Build a set of tables to decode the provided canonical Huffman code. | ||
22 | The code lengths are lens[0..codes-1]. The result starts at *table, | ||
23 | whose indices are 0..2^bits-1. work is a writable array of at least | ||
24 | lens shorts, which is used as a work area. type is the type of code | ||
25 | to be generated, CODES, LENS, or DISTS. On return, zero is success, | ||
26 | -1 is an invalid code, and +1 means that ENOUGH isn't enough. table | ||
27 | on return points to the next available entry's address. bits is the | ||
28 | requested root table index bits, and on return it is the actual root | ||
29 | table index bits. It will differ if the request is greater than the | ||
30 | longest code or if it is less than the shortest code. | ||
31 | */ | ||
32 | int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) | ||
33 | codetype type; | ||
34 | unsigned short FAR *lens; | ||
35 | unsigned codes; | ||
36 | code FAR * FAR *table; | ||
37 | unsigned FAR *bits; | ||
38 | unsigned short FAR *work; | ||
39 | { | ||
40 | unsigned len; /* a code's length in bits */ | ||
41 | unsigned sym; /* index of code symbols */ | ||
42 | unsigned min, max; /* minimum and maximum code lengths */ | ||
43 | unsigned root; /* number of index bits for root table */ | ||
44 | unsigned curr; /* number of index bits for current table */ | ||
45 | unsigned drop; /* code bits to drop for sub-table */ | ||
46 | int left; /* number of prefix codes available */ | ||
47 | unsigned used; /* code entries in table used */ | ||
48 | unsigned huff; /* Huffman code */ | ||
49 | unsigned incr; /* for incrementing code, index */ | ||
50 | unsigned fill; /* index for replicating entries */ | ||
51 | unsigned low; /* low bits for current root entry */ | ||
52 | unsigned mask; /* mask for low root bits */ | ||
53 | code here; /* table entry for duplication */ | ||
54 | code FAR *next; /* next available space in table */ | ||
55 | const unsigned short FAR *base; /* base value table to use */ | ||
56 | const unsigned short FAR *extra; /* extra bits table to use */ | ||
57 | int end; /* use base and extra for symbol > end */ | ||
58 | unsigned short count[MAXBITS+1]; /* number of codes of each length */ | ||
59 | unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ | ||
60 | static const unsigned short lbase[31] = { /* Length codes 257..285 base */ | ||
61 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, | ||
62 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; | ||
63 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ | ||
64 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, | ||
65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; | ||
66 | static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ | ||
67 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | ||
68 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | ||
69 | 8193, 12289, 16385, 24577, 0, 0}; | ||
70 | static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ | ||
71 | 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, | ||
72 | 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, | ||
73 | 28, 28, 29, 29, 64, 64}; | ||
74 | |||
75 | /* | ||
76 | Process a set of code lengths to create a canonical Huffman code. The | ||
77 | code lengths are lens[0..codes-1]. Each length corresponds to the | ||
78 | symbols 0..codes-1. The Huffman code is generated by first sorting the | ||
79 | symbols by length from short to long, and retaining the symbol order | ||
80 | for codes with equal lengths. Then the code starts with all zero bits | ||
81 | for the first code of the shortest length, and the codes are integer | ||
82 | increments for the same length, and zeros are appended as the length | ||
83 | increases. For the deflate format, these bits are stored backwards | ||
84 | from their more natural integer increment ordering, and so when the | ||
85 | decoding tables are built in the large loop below, the integer codes | ||
86 | are incremented backwards. | ||
87 | |||
88 | This routine assumes, but does not check, that all of the entries in | ||
89 | lens[] are in the range 0..MAXBITS. The caller must assure this. | ||
90 | 1..MAXBITS is interpreted as that code length. zero means that that | ||
91 | symbol does not occur in this code. | ||
92 | |||
93 | The codes are sorted by computing a count of codes for each length, | ||
94 | creating from that a table of starting indices for each length in the | ||
95 | sorted table, and then entering the symbols in order in the sorted | ||
96 | table. The sorted table is work[], with that space being provided by | ||
97 | the caller. | ||
98 | |||
99 | The length counts are used for other purposes as well, i.e. finding | ||
100 | the minimum and maximum length codes, determining if there are any | ||
101 | codes at all, checking for a valid set of lengths, and looking ahead | ||
102 | at length counts to determine sub-table sizes when building the | ||
103 | decoding tables. | ||
104 | */ | ||
105 | |||
106 | /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ | ||
107 | for (len = 0; len <= MAXBITS; len++) | ||
108 | count[len] = 0; | ||
109 | for (sym = 0; sym < codes; sym++) | ||
110 | count[lens[sym]]++; | ||
111 | |||
112 | /* bound code lengths, force root to be within code lengths */ | ||
113 | root = *bits; | ||
114 | for (max = MAXBITS; max >= 1; max--) | ||
115 | if (count[max] != 0) break; | ||
116 | if (root > max) root = max; | ||
117 | if (max == 0) { /* no symbols to code at all */ | ||
118 | here.op = (unsigned char)64; /* invalid code marker */ | ||
119 | here.bits = (unsigned char)1; | ||
120 | here.val = (unsigned short)0; | ||
121 | *(*table)++ = here; /* make a table to force an error */ | ||
122 | *(*table)++ = here; | ||
123 | *bits = 1; | ||
124 | return 0; /* no symbols, but wait for decoding to report error */ | ||
125 | } | ||
126 | for (min = 1; min < max; min++) | ||
127 | if (count[min] != 0) break; | ||
128 | if (root < min) root = min; | ||
129 | |||
130 | /* check for an over-subscribed or incomplete set of lengths */ | ||
131 | left = 1; | ||
132 | for (len = 1; len <= MAXBITS; len++) { | ||
133 | left <<= 1; | ||
134 | left -= count[len]; | ||
135 | if (left < 0) return -1; /* over-subscribed */ | ||
136 | } | ||
137 | if (left > 0 && (type == CODES || max != 1)) | ||
138 | return -1; /* incomplete set */ | ||
139 | |||
140 | /* generate offsets into symbol table for each length for sorting */ | ||
141 | offs[1] = 0; | ||
142 | for (len = 1; len < MAXBITS; len++) | ||
143 | offs[len + 1] = offs[len] + count[len]; | ||
144 | |||
145 | /* sort symbols by length, by symbol order within each length */ | ||
146 | for (sym = 0; sym < codes; sym++) | ||
147 | if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; | ||
148 | |||
149 | /* | ||
150 | Create and fill in decoding tables. In this loop, the table being | ||
151 | filled is at next and has curr index bits. The code being used is huff | ||
152 | with length len. That code is converted to an index by dropping drop | ||
153 | bits off of the bottom. For codes where len is less than drop + curr, | ||
154 | those top drop + curr - len bits are incremented through all values to | ||
155 | fill the table with replicated entries. | ||
156 | |||
157 | root is the number of index bits for the root table. When len exceeds | ||
158 | root, sub-tables are created pointed to by the root entry with an index | ||
159 | of the low root bits of huff. This is saved in low to check for when a | ||
160 | new sub-table should be started. drop is zero when the root table is | ||
161 | being filled, and drop is root when sub-tables are being filled. | ||
162 | |||
163 | When a new sub-table is needed, it is necessary to look ahead in the | ||
164 | code lengths to determine what size sub-table is needed. The length | ||
165 | counts are used for this, and so count[] is decremented as codes are | ||
166 | entered in the tables. | ||
167 | |||
168 | used keeps track of how many table entries have been allocated from the | ||
169 | provided *table space. It is checked for LENS and DIST tables against | ||
170 | the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in | ||
171 | the initial root table size constants. See the comments in inftrees.h | ||
172 | for more information. | ||
173 | |||
174 | sym increments through all symbols, and the loop terminates when | ||
175 | all codes of length max, i.e. all codes, have been processed. This | ||
176 | routine permits incomplete codes, so another loop after this one fills | ||
177 | in the rest of the decoding tables with invalid code markers. | ||
178 | */ | ||
179 | |||
180 | /* set up for code type */ | ||
181 | switch (type) { | ||
182 | case CODES: | ||
183 | base = extra = work; /* dummy value--not used */ | ||
184 | end = 19; | ||
185 | break; | ||
186 | case LENS: | ||
187 | base = lbase; | ||
188 | base -= 257; | ||
189 | extra = lext; | ||
190 | extra -= 257; | ||
191 | end = 256; | ||
192 | break; | ||
193 | default: /* DISTS */ | ||
194 | base = dbase; | ||
195 | extra = dext; | ||
196 | end = -1; | ||
197 | } | ||
198 | |||
199 | /* initialize state for loop */ | ||
200 | huff = 0; /* starting code */ | ||
201 | sym = 0; /* starting code symbol */ | ||
202 | len = min; /* starting code length */ | ||
203 | next = *table; /* current table to fill in */ | ||
204 | curr = root; /* current table index bits */ | ||
205 | drop = 0; /* current bits to drop from code for index */ | ||
206 | low = (unsigned)(-1); /* trigger new sub-table when len > root */ | ||
207 | used = 1U << root; /* use root table entries */ | ||
208 | mask = used - 1; /* mask for comparing low */ | ||
209 | |||
210 | /* check available table space */ | ||
211 | if ((type == LENS && used >= ENOUGH_LENS) || | ||
212 | (type == DISTS && used >= ENOUGH_DISTS)) | ||
213 | return 1; | ||
214 | |||
215 | /* process all codes and make table entries */ | ||
216 | for (;;) { | ||
217 | /* create table entry */ | ||
218 | here.bits = (unsigned char)(len - drop); | ||
219 | if ((int)(work[sym]) < end) { | ||
220 | here.op = (unsigned char)0; | ||
221 | here.val = work[sym]; | ||
222 | } | ||
223 | else if ((int)(work[sym]) > end) { | ||
224 | here.op = (unsigned char)(extra[work[sym]]); | ||
225 | here.val = base[work[sym]]; | ||
226 | } | ||
227 | else { | ||
228 | here.op = (unsigned char)(32 + 64); /* end of block */ | ||
229 | here.val = 0; | ||
230 | } | ||
231 | |||
232 | /* replicate for those indices with low len bits equal to huff */ | ||
233 | incr = 1U << (len - drop); | ||
234 | fill = 1U << curr; | ||
235 | min = fill; /* save offset to next table */ | ||
236 | do { | ||
237 | fill -= incr; | ||
238 | next[(huff >> drop) + fill] = here; | ||
239 | } while (fill != 0); | ||
240 | |||
241 | /* backwards increment the len-bit code huff */ | ||
242 | incr = 1U << (len - 1); | ||
243 | while (huff & incr) | ||
244 | incr >>= 1; | ||
245 | if (incr != 0) { | ||
246 | huff &= incr - 1; | ||
247 | huff += incr; | ||
248 | } | ||
249 | else | ||
250 | huff = 0; | ||
251 | |||
252 | /* go to next symbol, update count, len */ | ||
253 | sym++; | ||
254 | if (--(count[len]) == 0) { | ||
255 | if (len == max) break; | ||
256 | len = lens[work[sym]]; | ||
257 | } | ||
258 | |||
259 | /* create new sub-table if needed */ | ||
260 | if (len > root && (huff & mask) != low) { | ||
261 | /* if first time, transition to sub-tables */ | ||
262 | if (drop == 0) | ||
263 | drop = root; | ||
264 | |||
265 | /* increment past last table */ | ||
266 | next += min; /* here min is 1 << curr */ | ||
267 | |||
268 | /* determine length of next table */ | ||
269 | curr = len - drop; | ||
270 | left = (int)(1 << curr); | ||
271 | while (curr + drop < max) { | ||
272 | left -= count[curr + drop]; | ||
273 | if (left <= 0) break; | ||
274 | curr++; | ||
275 | left <<= 1; | ||
276 | } | ||
277 | |||
278 | /* check for enough space */ | ||
279 | used += 1U << curr; | ||
280 | if ((type == LENS && used >= ENOUGH_LENS) || | ||
281 | (type == DISTS && used >= ENOUGH_DISTS)) | ||
282 | return 1; | ||
283 | |||
284 | /* point entry in root table to sub-table */ | ||
285 | low = huff & mask; | ||
286 | (*table)[low].op = (unsigned char)curr; | ||
287 | (*table)[low].bits = (unsigned char)root; | ||
288 | (*table)[low].val = (unsigned short)(next - *table); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | /* fill in remaining table entry if code is incomplete (guaranteed to have | ||
293 | at most one remaining entry, since if the code is incomplete, the | ||
294 | maximum code length that was allowed to get this far is one bit) */ | ||
295 | if (huff != 0) { | ||
296 | here.op = (unsigned char)64; /* invalid code marker */ | ||
297 | here.bits = (unsigned char)(len - drop); | ||
298 | here.val = (unsigned short)0; | ||
299 | next[huff] = here; | ||
300 | } | ||
301 | |||
302 | /* set return parameters */ | ||
303 | *table += used; | ||
304 | *bits = root; | ||
305 | return 0; | ||
306 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.h deleted file mode 100644 index baa53a0..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/inftrees.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* inftrees.h -- header to use inftrees.c | ||
2 | * Copyright (C) 1995-2005, 2010 Mark Adler | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* WARNING: this file should *not* be used by applications. It is | ||
7 | part of the implementation of the compression library and is | ||
8 | subject to change. Applications should only use zlib.h. | ||
9 | */ | ||
10 | |||
11 | /* Structure for decoding tables. Each entry provides either the | ||
12 | information needed to do the operation requested by the code that | ||
13 | indexed that table entry, or it provides a pointer to another | ||
14 | table that indexes more bits of the code. op indicates whether | ||
15 | the entry is a pointer to another table, a literal, a length or | ||
16 | distance, an end-of-block, or an invalid code. For a table | ||
17 | pointer, the low four bits of op is the number of index bits of | ||
18 | that table. For a length or distance, the low four bits of op | ||
19 | is the number of extra bits to get after the code. bits is | ||
20 | the number of bits in this code or part of the code to drop off | ||
21 | of the bit buffer. val is the actual byte to output in the case | ||
22 | of a literal, the base length or distance, or the offset from | ||
23 | the current table to the next table. Each entry is four bytes. */ | ||
24 | typedef struct { | ||
25 | unsigned char op; /* operation, extra bits, table bits */ | ||
26 | unsigned char bits; /* bits in this part of the code */ | ||
27 | unsigned short val; /* offset in table or code value */ | ||
28 | } code; | ||
29 | |||
30 | /* op values as set by inflate_table(): | ||
31 | 00000000 - literal | ||
32 | 0000tttt - table link, tttt != 0 is the number of table index bits | ||
33 | 0001eeee - length or distance, eeee is the number of extra bits | ||
34 | 01100000 - end of block | ||
35 | 01000000 - invalid code | ||
36 | */ | ||
37 | |||
38 | /* Maximum size of the dynamic table. The maximum number of code structures is | ||
39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance | ||
40 | codes. These values were found by exhaustive searches using the program | ||
41 | examples/enough.c found in the zlib distribtution. The arguments to that | ||
42 | program are the number of symbols, the initial root table size, and the | ||
43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes | ||
44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. | ||
45 | The initial root table size (9 or 6) is found in the fifth argument of the | ||
46 | inflate_table() calls in inflate.c and infback.c. If the root table size is | ||
47 | changed, then these maximum sizes would be need to be recalculated and | ||
48 | updated. */ | ||
49 | #define ENOUGH_LENS 852 | ||
50 | #define ENOUGH_DISTS 592 | ||
51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) | ||
52 | |||
53 | /* Type of code to build for inflate_table() */ | ||
54 | typedef enum { | ||
55 | CODES, | ||
56 | LENS, | ||
57 | DISTS | ||
58 | } codetype; | ||
59 | |||
60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, | ||
61 | unsigned codes, code FAR * FAR *table, | ||
62 | unsigned FAR *bits, unsigned short FAR *work)); | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/treebuild.xml b/libraries/irrlicht-1.8/source/Irrlicht/zlib/treebuild.xml deleted file mode 100644 index 1f4d15f..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/treebuild.xml +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <package name="zlib" version="1.2.7"> | ||
3 | <library name="zlib" dlversion="1.2.7" dlname="z"> | ||
4 | <property name="description"> zip compression library </property> | ||
5 | <property name="include-target-dir" value="$(@PACKAGE/install-includedir)" /> | ||
6 | |||
7 | <!-- fixme: not implemented yet --> | ||
8 | <property name="compiler/c/inline" value="yes" /> | ||
9 | |||
10 | <include-file name="zlib.h" scope="public" mode="644" /> | ||
11 | <include-file name="zconf.h" scope="public" mode="644" /> | ||
12 | |||
13 | <source name="adler32.c"> | ||
14 | <depend name="zlib.h" /> | ||
15 | <depend name="zconf.h" /> | ||
16 | </source> | ||
17 | <source name="compress.c"> | ||
18 | <depend name="zlib.h" /> | ||
19 | <depend name="zconf.h" /> | ||
20 | </source> | ||
21 | <source name="crc32.c"> | ||
22 | <depend name="zlib.h" /> | ||
23 | <depend name="zconf.h" /> | ||
24 | <depend name="crc32.h" /> | ||
25 | </source> | ||
26 | <source name="gzclose.c"> | ||
27 | <depend name="zlib.h" /> | ||
28 | <depend name="zconf.h" /> | ||
29 | <depend name="gzguts.h" /> | ||
30 | </source> | ||
31 | <source name="gzlib.c"> | ||
32 | <depend name="zlib.h" /> | ||
33 | <depend name="zconf.h" /> | ||
34 | <depend name="gzguts.h" /> | ||
35 | </source> | ||
36 | <source name="gzread.c"> | ||
37 | <depend name="zlib.h" /> | ||
38 | <depend name="zconf.h" /> | ||
39 | <depend name="gzguts.h" /> | ||
40 | </source> | ||
41 | <source name="gzwrite.c"> | ||
42 | <depend name="zlib.h" /> | ||
43 | <depend name="zconf.h" /> | ||
44 | <depend name="gzguts.h" /> | ||
45 | </source> | ||
46 | <source name="uncompr.c"> | ||
47 | <depend name="zlib.h" /> | ||
48 | <depend name="zconf.h" /> | ||
49 | </source> | ||
50 | <source name="deflate.c"> | ||
51 | <depend name="zlib.h" /> | ||
52 | <depend name="zconf.h" /> | ||
53 | <depend name="zutil.h" /> | ||
54 | <depend name="deflate.h" /> | ||
55 | </source> | ||
56 | <source name="trees.c"> | ||
57 | <depend name="zlib.h" /> | ||
58 | <depend name="zconf.h" /> | ||
59 | <depend name="zutil.h" /> | ||
60 | <depend name="deflate.h" /> | ||
61 | <depend name="trees.h" /> | ||
62 | </source> | ||
63 | <source name="zutil.c"> | ||
64 | <depend name="zlib.h" /> | ||
65 | <depend name="zconf.h" /> | ||
66 | <depend name="zutil.h" /> | ||
67 | </source> | ||
68 | <source name="inflate.c"> | ||
69 | <depend name="zlib.h" /> | ||
70 | <depend name="zconf.h" /> | ||
71 | <depend name="zutil.h" /> | ||
72 | <depend name="inftrees.h" /> | ||
73 | <depend name="inflate.h" /> | ||
74 | <depend name="inffast.h" /> | ||
75 | </source> | ||
76 | <source name="infback.c"> | ||
77 | <depend name="zlib.h" /> | ||
78 | <depend name="zconf.h" /> | ||
79 | <depend name="zutil.h" /> | ||
80 | <depend name="inftrees.h" /> | ||
81 | <depend name="inflate.h" /> | ||
82 | <depend name="inffast.h" /> | ||
83 | </source> | ||
84 | <source name="inftrees.c"> | ||
85 | <depend name="zlib.h" /> | ||
86 | <depend name="zconf.h" /> | ||
87 | <depend name="zutil.h" /> | ||
88 | <depend name="inftrees.h" /> | ||
89 | </source> | ||
90 | <source name="inffast.c"> | ||
91 | <depend name="zlib.h" /> | ||
92 | <depend name="zconf.h" /> | ||
93 | <depend name="zutil.h" /> | ||
94 | <depend name="inftrees.h" /> | ||
95 | <depend name="inflate.h" /> | ||
96 | <depend name="inffast.h" /> | ||
97 | </source> | ||
98 | </library> | ||
99 | </package> | ||
100 | |||
101 | <!-- | ||
102 | CFLAGS=-O | ||
103 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
104 | #CFLAGS=-g -DDEBUG | ||
105 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
106 | # -Wstrict-prototypes -Wmissing-prototypes | ||
107 | |||
108 | # OBJA = | ||
109 | # to use the asm code: make OBJA=match.o | ||
110 | # | ||
111 | match.o: match.S | ||
112 | $(CPP) match.S > _match.s | ||
113 | $(CC) -c _match.s | ||
114 | mv _match.o match.o | ||
115 | rm -f _match.s | ||
116 | --> | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.c deleted file mode 100644 index 8c32b21..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.c +++ /dev/null | |||
@@ -1,1224 +0,0 @@ | |||
1 | /* trees.c -- output deflated data using Huffman coding | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly | ||
3 | * detect_data_type() function provided freely by Cosmin Truta, 2006 | ||
4 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * ALGORITHM | ||
9 | * | ||
10 | * The "deflation" process uses several Huffman trees. The more | ||
11 | * common source values are represented by shorter bit sequences. | ||
12 | * | ||
13 | * Each code tree is stored in a compressed form which is itself | ||
14 | * a Huffman encoding of the lengths of all the code strings (in | ||
15 | * ascending order by source values). The actual code strings are | ||
16 | * reconstructed from the lengths in the inflate process, as described | ||
17 | * in the deflate specification. | ||
18 | * | ||
19 | * REFERENCES | ||
20 | * | ||
21 | * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". | ||
22 | * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc | ||
23 | * | ||
24 | * Storer, James A. | ||
25 | * Data Compression: Methods and Theory, pp. 49-50. | ||
26 | * Computer Science Press, 1988. ISBN 0-7167-8156-5. | ||
27 | * | ||
28 | * Sedgewick, R. | ||
29 | * Algorithms, p290. | ||
30 | * Addison-Wesley, 1983. ISBN 0-201-06672-6. | ||
31 | */ | ||
32 | |||
33 | /* @(#) $Id$ */ | ||
34 | |||
35 | /* #define GEN_TREES_H */ | ||
36 | |||
37 | #include "deflate.h" | ||
38 | |||
39 | #ifdef DEBUG | ||
40 | # include <ctype.h> | ||
41 | #endif | ||
42 | |||
43 | /* =========================================================================== | ||
44 | * Constants | ||
45 | */ | ||
46 | |||
47 | #define MAX_BL_BITS 7 | ||
48 | /* Bit length codes must not exceed MAX_BL_BITS bits */ | ||
49 | |||
50 | #define END_BLOCK 256 | ||
51 | /* end of block literal code */ | ||
52 | |||
53 | #define REP_3_6 16 | ||
54 | /* repeat previous bit length 3-6 times (2 bits of repeat count) */ | ||
55 | |||
56 | #define REPZ_3_10 17 | ||
57 | /* repeat a zero length 3-10 times (3 bits of repeat count) */ | ||
58 | |||
59 | #define REPZ_11_138 18 | ||
60 | /* repeat a zero length 11-138 times (7 bits of repeat count) */ | ||
61 | |||
62 | local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ | ||
63 | = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; | ||
64 | |||
65 | local const int extra_dbits[D_CODES] /* extra bits for each distance code */ | ||
66 | = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; | ||
67 | |||
68 | local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ | ||
69 | = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; | ||
70 | |||
71 | local const uch bl_order[BL_CODES] | ||
72 | = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; | ||
73 | /* The lengths of the bit length codes are sent in order of decreasing | ||
74 | * probability, to avoid transmitting the lengths for unused bit length codes. | ||
75 | */ | ||
76 | |||
77 | /* =========================================================================== | ||
78 | * Local data. These are initialized only once. | ||
79 | */ | ||
80 | |||
81 | #define DIST_CODE_LEN 512 /* see definition of array dist_code below */ | ||
82 | |||
83 | #if defined(GEN_TREES_H) || !defined(STDC) | ||
84 | /* non ANSI compilers may not accept trees.h */ | ||
85 | |||
86 | local ct_data static_ltree[L_CODES+2]; | ||
87 | /* The static literal tree. Since the bit lengths are imposed, there is no | ||
88 | * need for the L_CODES extra codes used during heap construction. However | ||
89 | * The codes 286 and 287 are needed to build a canonical tree (see _tr_init | ||
90 | * below). | ||
91 | */ | ||
92 | |||
93 | local ct_data static_dtree[D_CODES]; | ||
94 | /* The static distance tree. (Actually a trivial tree since all codes use | ||
95 | * 5 bits.) | ||
96 | */ | ||
97 | |||
98 | uch _dist_code[DIST_CODE_LEN]; | ||
99 | /* Distance codes. The first 256 values correspond to the distances | ||
100 | * 3 .. 258, the last 256 values correspond to the top 8 bits of | ||
101 | * the 15 bit distances. | ||
102 | */ | ||
103 | |||
104 | uch _length_code[MAX_MATCH-MIN_MATCH+1]; | ||
105 | /* length code for each normalized match length (0 == MIN_MATCH) */ | ||
106 | |||
107 | local int base_length[LENGTH_CODES]; | ||
108 | /* First normalized length for each code (0 = MIN_MATCH) */ | ||
109 | |||
110 | local int base_dist[D_CODES]; | ||
111 | /* First normalized distance for each code (0 = distance of 1) */ | ||
112 | |||
113 | #else | ||
114 | # include "trees.h" | ||
115 | #endif /* GEN_TREES_H */ | ||
116 | |||
117 | struct static_tree_desc_s { | ||
118 | const ct_data *static_tree; /* static tree or NULL */ | ||
119 | const intf *extra_bits; /* extra bits for each code or NULL */ | ||
120 | int extra_base; /* base index for extra_bits */ | ||
121 | int elems; /* max number of elements in the tree */ | ||
122 | int max_length; /* max bit length for the codes */ | ||
123 | }; | ||
124 | |||
125 | local static_tree_desc static_l_desc = | ||
126 | {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; | ||
127 | |||
128 | local static_tree_desc static_d_desc = | ||
129 | {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; | ||
130 | |||
131 | local static_tree_desc static_bl_desc = | ||
132 | {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; | ||
133 | |||
134 | /* =========================================================================== | ||
135 | * Local (static) routines in this file. | ||
136 | */ | ||
137 | |||
138 | local void tr_static_init OF((void)); | ||
139 | local void init_block OF((deflate_state *s)); | ||
140 | local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); | ||
141 | local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); | ||
142 | local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); | ||
143 | local void build_tree OF((deflate_state *s, tree_desc *desc)); | ||
144 | local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); | ||
145 | local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); | ||
146 | local int build_bl_tree OF((deflate_state *s)); | ||
147 | local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, | ||
148 | int blcodes)); | ||
149 | local void compress_block OF((deflate_state *s, ct_data *ltree, | ||
150 | ct_data *dtree)); | ||
151 | local int detect_data_type OF((deflate_state *s)); | ||
152 | local unsigned bi_reverse OF((unsigned value, int length)); | ||
153 | local void bi_windup OF((deflate_state *s)); | ||
154 | local void bi_flush OF((deflate_state *s)); | ||
155 | local void copy_block OF((deflate_state *s, charf *buf, unsigned len, | ||
156 | int header)); | ||
157 | |||
158 | #ifdef GEN_TREES_H | ||
159 | local void gen_trees_header OF((void)); | ||
160 | #endif | ||
161 | |||
162 | #ifndef DEBUG | ||
163 | # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) | ||
164 | /* Send a code of the given tree. c and tree must not have side effects */ | ||
165 | |||
166 | #else /* DEBUG */ | ||
167 | # define send_code(s, c, tree) \ | ||
168 | { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ | ||
169 | send_bits(s, tree[c].Code, tree[c].Len); } | ||
170 | #endif | ||
171 | |||
172 | /* =========================================================================== | ||
173 | * Output a short LSB first on the stream. | ||
174 | * IN assertion: there is enough room in pendingBuf. | ||
175 | */ | ||
176 | #define put_short(s, w) { \ | ||
177 | put_byte(s, (uch)((w) & 0xff)); \ | ||
178 | put_byte(s, (uch)((ush)(w) >> 8)); \ | ||
179 | } | ||
180 | |||
181 | /* =========================================================================== | ||
182 | * Send a value on a given number of bits. | ||
183 | * IN assertion: length <= 16 and value fits in length bits. | ||
184 | */ | ||
185 | #ifdef DEBUG | ||
186 | local void send_bits OF((deflate_state *s, int value, int length)); | ||
187 | |||
188 | local void send_bits(s, value, length) | ||
189 | deflate_state *s; | ||
190 | int value; /* value to send */ | ||
191 | int length; /* number of bits */ | ||
192 | { | ||
193 | Tracevv((stderr," l %2d v %4x ", length, value)); | ||
194 | Assert(length > 0 && length <= 15, "invalid length"); | ||
195 | s->bits_sent += (ulg)length; | ||
196 | |||
197 | /* If not enough room in bi_buf, use (valid) bits from bi_buf and | ||
198 | * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) | ||
199 | * unused bits in value. | ||
200 | */ | ||
201 | if (s->bi_valid > (int)Buf_size - length) { | ||
202 | s->bi_buf |= (ush)value << s->bi_valid; | ||
203 | put_short(s, s->bi_buf); | ||
204 | s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); | ||
205 | s->bi_valid += length - Buf_size; | ||
206 | } else { | ||
207 | s->bi_buf |= (ush)value << s->bi_valid; | ||
208 | s->bi_valid += length; | ||
209 | } | ||
210 | } | ||
211 | #else /* !DEBUG */ | ||
212 | |||
213 | #define send_bits(s, value, length) \ | ||
214 | { int len = length;\ | ||
215 | if (s->bi_valid > (int)Buf_size - len) {\ | ||
216 | int val = value;\ | ||
217 | s->bi_buf |= (ush)val << s->bi_valid;\ | ||
218 | put_short(s, s->bi_buf);\ | ||
219 | s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ | ||
220 | s->bi_valid += len - Buf_size;\ | ||
221 | } else {\ | ||
222 | s->bi_buf |= (ush)(value) << s->bi_valid;\ | ||
223 | s->bi_valid += len;\ | ||
224 | }\ | ||
225 | } | ||
226 | #endif /* DEBUG */ | ||
227 | |||
228 | |||
229 | /* the arguments must not have side effects */ | ||
230 | |||
231 | /* =========================================================================== | ||
232 | * Initialize the various 'constant' tables. | ||
233 | */ | ||
234 | local void tr_static_init() | ||
235 | { | ||
236 | #if defined(GEN_TREES_H) || !defined(STDC) | ||
237 | static int static_init_done = 0; | ||
238 | int n; /* iterates over tree elements */ | ||
239 | int bits; /* bit counter */ | ||
240 | int length; /* length value */ | ||
241 | int code; /* code value */ | ||
242 | int dist; /* distance index */ | ||
243 | ush bl_count[MAX_BITS+1]; | ||
244 | /* number of codes at each bit length for an optimal tree */ | ||
245 | |||
246 | if (static_init_done) return; | ||
247 | |||
248 | /* For some embedded targets, global variables are not initialized: */ | ||
249 | #ifdef NO_INIT_GLOBAL_POINTERS | ||
250 | static_l_desc.static_tree = static_ltree; | ||
251 | static_l_desc.extra_bits = extra_lbits; | ||
252 | static_d_desc.static_tree = static_dtree; | ||
253 | static_d_desc.extra_bits = extra_dbits; | ||
254 | static_bl_desc.extra_bits = extra_blbits; | ||
255 | #endif | ||
256 | |||
257 | /* Initialize the mapping length (0..255) -> length code (0..28) */ | ||
258 | length = 0; | ||
259 | for (code = 0; code < LENGTH_CODES-1; code++) { | ||
260 | base_length[code] = length; | ||
261 | for (n = 0; n < (1<<extra_lbits[code]); n++) { | ||
262 | _length_code[length++] = (uch)code; | ||
263 | } | ||
264 | } | ||
265 | Assert (length == 256, "tr_static_init: length != 256"); | ||
266 | /* Note that the length 255 (match length 258) can be represented | ||
267 | * in two different ways: code 284 + 5 bits or code 285, so we | ||
268 | * overwrite length_code[255] to use the best encoding: | ||
269 | */ | ||
270 | _length_code[length-1] = (uch)code; | ||
271 | |||
272 | /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ | ||
273 | dist = 0; | ||
274 | for (code = 0 ; code < 16; code++) { | ||
275 | base_dist[code] = dist; | ||
276 | for (n = 0; n < (1<<extra_dbits[code]); n++) { | ||
277 | _dist_code[dist++] = (uch)code; | ||
278 | } | ||
279 | } | ||
280 | Assert (dist == 256, "tr_static_init: dist != 256"); | ||
281 | dist >>= 7; /* from now on, all distances are divided by 128 */ | ||
282 | for ( ; code < D_CODES; code++) { | ||
283 | base_dist[code] = dist << 7; | ||
284 | for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { | ||
285 | _dist_code[256 + dist++] = (uch)code; | ||
286 | } | ||
287 | } | ||
288 | Assert (dist == 256, "tr_static_init: 256+dist != 512"); | ||
289 | |||
290 | /* Construct the codes of the static literal tree */ | ||
291 | for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; | ||
292 | n = 0; | ||
293 | while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; | ||
294 | while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; | ||
295 | while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; | ||
296 | while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; | ||
297 | /* Codes 286 and 287 do not exist, but we must include them in the | ||
298 | * tree construction to get a canonical Huffman tree (longest code | ||
299 | * all ones) | ||
300 | */ | ||
301 | gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); | ||
302 | |||
303 | /* The static distance tree is trivial: */ | ||
304 | for (n = 0; n < D_CODES; n++) { | ||
305 | static_dtree[n].Len = 5; | ||
306 | static_dtree[n].Code = bi_reverse((unsigned)n, 5); | ||
307 | } | ||
308 | static_init_done = 1; | ||
309 | |||
310 | # ifdef GEN_TREES_H | ||
311 | gen_trees_header(); | ||
312 | # endif | ||
313 | #endif /* defined(GEN_TREES_H) || !defined(STDC) */ | ||
314 | } | ||
315 | |||
316 | /* =========================================================================== | ||
317 | * Genererate the file trees.h describing the static trees. | ||
318 | */ | ||
319 | #ifdef GEN_TREES_H | ||
320 | # ifndef DEBUG | ||
321 | # include <stdio.h> | ||
322 | # endif | ||
323 | |||
324 | # define SEPARATOR(i, last, width) \ | ||
325 | ((i) == (last)? "\n};\n\n" : \ | ||
326 | ((i) % (width) == (width)-1 ? ",\n" : ", ")) | ||
327 | |||
328 | void gen_trees_header() | ||
329 | { | ||
330 | FILE *header = fopen("trees.h", "w"); | ||
331 | int i; | ||
332 | |||
333 | Assert (header != NULL, "Can't open trees.h"); | ||
334 | fprintf(header, | ||
335 | "/* header created automatically with -DGEN_TREES_H */\n\n"); | ||
336 | |||
337 | fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); | ||
338 | for (i = 0; i < L_CODES+2; i++) { | ||
339 | fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, | ||
340 | static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); | ||
341 | } | ||
342 | |||
343 | fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); | ||
344 | for (i = 0; i < D_CODES; i++) { | ||
345 | fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, | ||
346 | static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); | ||
347 | } | ||
348 | |||
349 | fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); | ||
350 | for (i = 0; i < DIST_CODE_LEN; i++) { | ||
351 | fprintf(header, "%2u%s", _dist_code[i], | ||
352 | SEPARATOR(i, DIST_CODE_LEN-1, 20)); | ||
353 | } | ||
354 | |||
355 | fprintf(header, | ||
356 | "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); | ||
357 | for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { | ||
358 | fprintf(header, "%2u%s", _length_code[i], | ||
359 | SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); | ||
360 | } | ||
361 | |||
362 | fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); | ||
363 | for (i = 0; i < LENGTH_CODES; i++) { | ||
364 | fprintf(header, "%1u%s", base_length[i], | ||
365 | SEPARATOR(i, LENGTH_CODES-1, 20)); | ||
366 | } | ||
367 | |||
368 | fprintf(header, "local const int base_dist[D_CODES] = {\n"); | ||
369 | for (i = 0; i < D_CODES; i++) { | ||
370 | fprintf(header, "%5u%s", base_dist[i], | ||
371 | SEPARATOR(i, D_CODES-1, 10)); | ||
372 | } | ||
373 | |||
374 | fclose(header); | ||
375 | } | ||
376 | #endif /* GEN_TREES_H */ | ||
377 | |||
378 | /* =========================================================================== | ||
379 | * Initialize the tree data structures for a new zlib stream. | ||
380 | */ | ||
381 | void ZLIB_INTERNAL _tr_init(s) | ||
382 | deflate_state *s; | ||
383 | { | ||
384 | tr_static_init(); | ||
385 | |||
386 | s->l_desc.dyn_tree = s->dyn_ltree; | ||
387 | s->l_desc.stat_desc = &static_l_desc; | ||
388 | |||
389 | s->d_desc.dyn_tree = s->dyn_dtree; | ||
390 | s->d_desc.stat_desc = &static_d_desc; | ||
391 | |||
392 | s->bl_desc.dyn_tree = s->bl_tree; | ||
393 | s->bl_desc.stat_desc = &static_bl_desc; | ||
394 | |||
395 | s->bi_buf = 0; | ||
396 | s->bi_valid = 0; | ||
397 | #ifdef DEBUG | ||
398 | s->compressed_len = 0L; | ||
399 | s->bits_sent = 0L; | ||
400 | #endif | ||
401 | |||
402 | /* Initialize the first block of the first file: */ | ||
403 | init_block(s); | ||
404 | } | ||
405 | |||
406 | /* =========================================================================== | ||
407 | * Initialize a new block. | ||
408 | */ | ||
409 | local void init_block(s) | ||
410 | deflate_state *s; | ||
411 | { | ||
412 | int n; /* iterates over tree elements */ | ||
413 | |||
414 | /* Initialize the trees. */ | ||
415 | for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; | ||
416 | for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; | ||
417 | for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; | ||
418 | |||
419 | s->dyn_ltree[END_BLOCK].Freq = 1; | ||
420 | s->opt_len = s->static_len = 0L; | ||
421 | s->last_lit = s->matches = 0; | ||
422 | } | ||
423 | |||
424 | #define SMALLEST 1 | ||
425 | /* Index within the heap array of least frequent node in the Huffman tree */ | ||
426 | |||
427 | |||
428 | /* =========================================================================== | ||
429 | * Remove the smallest element from the heap and recreate the heap with | ||
430 | * one less element. Updates heap and heap_len. | ||
431 | */ | ||
432 | #define pqremove(s, tree, top) \ | ||
433 | {\ | ||
434 | top = s->heap[SMALLEST]; \ | ||
435 | s->heap[SMALLEST] = s->heap[s->heap_len--]; \ | ||
436 | pqdownheap(s, tree, SMALLEST); \ | ||
437 | } | ||
438 | |||
439 | /* =========================================================================== | ||
440 | * Compares to subtrees, using the tree depth as tie breaker when | ||
441 | * the subtrees have equal frequency. This minimizes the worst case length. | ||
442 | */ | ||
443 | #define smaller(tree, n, m, depth) \ | ||
444 | (tree[n].Freq < tree[m].Freq || \ | ||
445 | (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) | ||
446 | |||
447 | /* =========================================================================== | ||
448 | * Restore the heap property by moving down the tree starting at node k, | ||
449 | * exchanging a node with the smallest of its two sons if necessary, stopping | ||
450 | * when the heap property is re-established (each father smaller than its | ||
451 | * two sons). | ||
452 | */ | ||
453 | local void pqdownheap(s, tree, k) | ||
454 | deflate_state *s; | ||
455 | ct_data *tree; /* the tree to restore */ | ||
456 | int k; /* node to move down */ | ||
457 | { | ||
458 | int v = s->heap[k]; | ||
459 | int j = k << 1; /* left son of k */ | ||
460 | while (j <= s->heap_len) { | ||
461 | /* Set j to the smallest of the two sons: */ | ||
462 | if (j < s->heap_len && | ||
463 | smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { | ||
464 | j++; | ||
465 | } | ||
466 | /* Exit if v is smaller than both sons */ | ||
467 | if (smaller(tree, v, s->heap[j], s->depth)) break; | ||
468 | |||
469 | /* Exchange v with the smallest son */ | ||
470 | s->heap[k] = s->heap[j]; k = j; | ||
471 | |||
472 | /* And continue down the tree, setting j to the left son of k */ | ||
473 | j <<= 1; | ||
474 | } | ||
475 | s->heap[k] = v; | ||
476 | } | ||
477 | |||
478 | /* =========================================================================== | ||
479 | * Compute the optimal bit lengths for a tree and update the total bit length | ||
480 | * for the current block. | ||
481 | * IN assertion: the fields freq and dad are set, heap[heap_max] and | ||
482 | * above are the tree nodes sorted by increasing frequency. | ||
483 | * OUT assertions: the field len is set to the optimal bit length, the | ||
484 | * array bl_count contains the frequencies for each bit length. | ||
485 | * The length opt_len is updated; static_len is also updated if stree is | ||
486 | * not null. | ||
487 | */ | ||
488 | local void gen_bitlen(s, desc) | ||
489 | deflate_state *s; | ||
490 | tree_desc *desc; /* the tree descriptor */ | ||
491 | { | ||
492 | ct_data *tree = desc->dyn_tree; | ||
493 | int max_code = desc->max_code; | ||
494 | const ct_data *stree = desc->stat_desc->static_tree; | ||
495 | const intf *extra = desc->stat_desc->extra_bits; | ||
496 | int base = desc->stat_desc->extra_base; | ||
497 | int max_length = desc->stat_desc->max_length; | ||
498 | int h; /* heap index */ | ||
499 | int n, m; /* iterate over the tree elements */ | ||
500 | int bits; /* bit length */ | ||
501 | int xbits; /* extra bits */ | ||
502 | ush f; /* frequency */ | ||
503 | int overflow = 0; /* number of elements with bit length too large */ | ||
504 | |||
505 | for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; | ||
506 | |||
507 | /* In a first pass, compute the optimal bit lengths (which may | ||
508 | * overflow in the case of the bit length tree). | ||
509 | */ | ||
510 | tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ | ||
511 | |||
512 | for (h = s->heap_max+1; h < HEAP_SIZE; h++) { | ||
513 | n = s->heap[h]; | ||
514 | bits = tree[tree[n].Dad].Len + 1; | ||
515 | if (bits > max_length) bits = max_length, overflow++; | ||
516 | tree[n].Len = (ush)bits; | ||
517 | /* We overwrite tree[n].Dad which is no longer needed */ | ||
518 | |||
519 | if (n > max_code) continue; /* not a leaf node */ | ||
520 | |||
521 | s->bl_count[bits]++; | ||
522 | xbits = 0; | ||
523 | if (n >= base) xbits = extra[n-base]; | ||
524 | f = tree[n].Freq; | ||
525 | s->opt_len += (ulg)f * (bits + xbits); | ||
526 | if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); | ||
527 | } | ||
528 | if (overflow == 0) return; | ||
529 | |||
530 | Trace((stderr,"\nbit length overflow\n")); | ||
531 | /* This happens for example on obj2 and pic of the Calgary corpus */ | ||
532 | |||
533 | /* Find the first bit length which could increase: */ | ||
534 | do { | ||
535 | bits = max_length-1; | ||
536 | while (s->bl_count[bits] == 0) bits--; | ||
537 | s->bl_count[bits]--; /* move one leaf down the tree */ | ||
538 | s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ | ||
539 | s->bl_count[max_length]--; | ||
540 | /* The brother of the overflow item also moves one step up, | ||
541 | * but this does not affect bl_count[max_length] | ||
542 | */ | ||
543 | overflow -= 2; | ||
544 | } while (overflow > 0); | ||
545 | |||
546 | /* Now recompute all bit lengths, scanning in increasing frequency. | ||
547 | * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all | ||
548 | * lengths instead of fixing only the wrong ones. This idea is taken | ||
549 | * from 'ar' written by Haruhiko Okumura.) | ||
550 | */ | ||
551 | for (bits = max_length; bits != 0; bits--) { | ||
552 | n = s->bl_count[bits]; | ||
553 | while (n != 0) { | ||
554 | m = s->heap[--h]; | ||
555 | if (m > max_code) continue; | ||
556 | if ((unsigned) tree[m].Len != (unsigned) bits) { | ||
557 | Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); | ||
558 | s->opt_len += ((long)bits - (long)tree[m].Len) | ||
559 | *(long)tree[m].Freq; | ||
560 | tree[m].Len = (ush)bits; | ||
561 | } | ||
562 | n--; | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | |||
567 | /* =========================================================================== | ||
568 | * Generate the codes for a given tree and bit counts (which need not be | ||
569 | * optimal). | ||
570 | * IN assertion: the array bl_count contains the bit length statistics for | ||
571 | * the given tree and the field len is set for all tree elements. | ||
572 | * OUT assertion: the field code is set for all tree elements of non | ||
573 | * zero code length. | ||
574 | */ | ||
575 | local void gen_codes (tree, max_code, bl_count) | ||
576 | ct_data *tree; /* the tree to decorate */ | ||
577 | int max_code; /* largest code with non zero frequency */ | ||
578 | ushf *bl_count; /* number of codes at each bit length */ | ||
579 | { | ||
580 | ush next_code[MAX_BITS+1]; /* next code value for each bit length */ | ||
581 | ush code = 0; /* running code value */ | ||
582 | int bits; /* bit index */ | ||
583 | int n; /* code index */ | ||
584 | |||
585 | /* The distribution counts are first used to generate the code values | ||
586 | * without bit reversal. | ||
587 | */ | ||
588 | for (bits = 1; bits <= MAX_BITS; bits++) { | ||
589 | next_code[bits] = code = (code + bl_count[bits-1]) << 1; | ||
590 | } | ||
591 | /* Check that the bit counts in bl_count are consistent. The last code | ||
592 | * must be all ones. | ||
593 | */ | ||
594 | Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, | ||
595 | "inconsistent bit counts"); | ||
596 | Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); | ||
597 | |||
598 | for (n = 0; n <= max_code; n++) { | ||
599 | int len = tree[n].Len; | ||
600 | if (len == 0) continue; | ||
601 | /* Now reverse the bits */ | ||
602 | tree[n].Code = bi_reverse(next_code[len]++, len); | ||
603 | |||
604 | Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", | ||
605 | n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); | ||
606 | } | ||
607 | } | ||
608 | |||
609 | /* =========================================================================== | ||
610 | * Construct one Huffman tree and assigns the code bit strings and lengths. | ||
611 | * Update the total bit length for the current block. | ||
612 | * IN assertion: the field freq is set for all tree elements. | ||
613 | * OUT assertions: the fields len and code are set to the optimal bit length | ||
614 | * and corresponding code. The length opt_len is updated; static_len is | ||
615 | * also updated if stree is not null. The field max_code is set. | ||
616 | */ | ||
617 | local void build_tree(s, desc) | ||
618 | deflate_state *s; | ||
619 | tree_desc *desc; /* the tree descriptor */ | ||
620 | { | ||
621 | ct_data *tree = desc->dyn_tree; | ||
622 | const ct_data *stree = desc->stat_desc->static_tree; | ||
623 | int elems = desc->stat_desc->elems; | ||
624 | int n, m; /* iterate over heap elements */ | ||
625 | int max_code = -1; /* largest code with non zero frequency */ | ||
626 | int node; /* new node being created */ | ||
627 | |||
628 | /* Construct the initial heap, with least frequent element in | ||
629 | * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. | ||
630 | * heap[0] is not used. | ||
631 | */ | ||
632 | s->heap_len = 0, s->heap_max = HEAP_SIZE; | ||
633 | |||
634 | for (n = 0; n < elems; n++) { | ||
635 | if (tree[n].Freq != 0) { | ||
636 | s->heap[++(s->heap_len)] = max_code = n; | ||
637 | s->depth[n] = 0; | ||
638 | } else { | ||
639 | tree[n].Len = 0; | ||
640 | } | ||
641 | } | ||
642 | |||
643 | /* The pkzip format requires that at least one distance code exists, | ||
644 | * and that at least one bit should be sent even if there is only one | ||
645 | * possible code. So to avoid special checks later on we force at least | ||
646 | * two codes of non zero frequency. | ||
647 | */ | ||
648 | while (s->heap_len < 2) { | ||
649 | node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); | ||
650 | tree[node].Freq = 1; | ||
651 | s->depth[node] = 0; | ||
652 | s->opt_len--; if (stree) s->static_len -= stree[node].Len; | ||
653 | /* node is 0 or 1 so it does not have extra bits */ | ||
654 | } | ||
655 | desc->max_code = max_code; | ||
656 | |||
657 | /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, | ||
658 | * establish sub-heaps of increasing lengths: | ||
659 | */ | ||
660 | for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); | ||
661 | |||
662 | /* Construct the Huffman tree by repeatedly combining the least two | ||
663 | * frequent nodes. | ||
664 | */ | ||
665 | node = elems; /* next internal node of the tree */ | ||
666 | do { | ||
667 | pqremove(s, tree, n); /* n = node of least frequency */ | ||
668 | m = s->heap[SMALLEST]; /* m = node of next least frequency */ | ||
669 | |||
670 | s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ | ||
671 | s->heap[--(s->heap_max)] = m; | ||
672 | |||
673 | /* Create a new node father of n and m */ | ||
674 | tree[node].Freq = tree[n].Freq + tree[m].Freq; | ||
675 | s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? | ||
676 | s->depth[n] : s->depth[m]) + 1); | ||
677 | tree[n].Dad = tree[m].Dad = (ush)node; | ||
678 | #ifdef DUMP_BL_TREE | ||
679 | if (tree == s->bl_tree) { | ||
680 | fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", | ||
681 | node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); | ||
682 | } | ||
683 | #endif | ||
684 | /* and insert the new node in the heap */ | ||
685 | s->heap[SMALLEST] = node++; | ||
686 | pqdownheap(s, tree, SMALLEST); | ||
687 | |||
688 | } while (s->heap_len >= 2); | ||
689 | |||
690 | s->heap[--(s->heap_max)] = s->heap[SMALLEST]; | ||
691 | |||
692 | /* At this point, the fields freq and dad are set. We can now | ||
693 | * generate the bit lengths. | ||
694 | */ | ||
695 | gen_bitlen(s, (tree_desc *)desc); | ||
696 | |||
697 | /* The field len is now set, we can generate the bit codes */ | ||
698 | gen_codes ((ct_data *)tree, max_code, s->bl_count); | ||
699 | } | ||
700 | |||
701 | /* =========================================================================== | ||
702 | * Scan a literal or distance tree to determine the frequencies of the codes | ||
703 | * in the bit length tree. | ||
704 | */ | ||
705 | local void scan_tree (s, tree, max_code) | ||
706 | deflate_state *s; | ||
707 | ct_data *tree; /* the tree to be scanned */ | ||
708 | int max_code; /* and its largest code of non zero frequency */ | ||
709 | { | ||
710 | int n; /* iterates over all tree elements */ | ||
711 | int prevlen = -1; /* last emitted length */ | ||
712 | int curlen; /* length of current code */ | ||
713 | int nextlen = tree[0].Len; /* length of next code */ | ||
714 | int count = 0; /* repeat count of the current code */ | ||
715 | int max_count = 7; /* max repeat count */ | ||
716 | int min_count = 4; /* min repeat count */ | ||
717 | |||
718 | if (nextlen == 0) max_count = 138, min_count = 3; | ||
719 | tree[max_code+1].Len = (ush)0xffff; /* guard */ | ||
720 | |||
721 | for (n = 0; n <= max_code; n++) { | ||
722 | curlen = nextlen; nextlen = tree[n+1].Len; | ||
723 | if (++count < max_count && curlen == nextlen) { | ||
724 | continue; | ||
725 | } else if (count < min_count) { | ||
726 | s->bl_tree[curlen].Freq += count; | ||
727 | } else if (curlen != 0) { | ||
728 | if (curlen != prevlen) s->bl_tree[curlen].Freq++; | ||
729 | s->bl_tree[REP_3_6].Freq++; | ||
730 | } else if (count <= 10) { | ||
731 | s->bl_tree[REPZ_3_10].Freq++; | ||
732 | } else { | ||
733 | s->bl_tree[REPZ_11_138].Freq++; | ||
734 | } | ||
735 | count = 0; prevlen = curlen; | ||
736 | if (nextlen == 0) { | ||
737 | max_count = 138, min_count = 3; | ||
738 | } else if (curlen == nextlen) { | ||
739 | max_count = 6, min_count = 3; | ||
740 | } else { | ||
741 | max_count = 7, min_count = 4; | ||
742 | } | ||
743 | } | ||
744 | } | ||
745 | |||
746 | /* =========================================================================== | ||
747 | * Send a literal or distance tree in compressed form, using the codes in | ||
748 | * bl_tree. | ||
749 | */ | ||
750 | local void send_tree (s, tree, max_code) | ||
751 | deflate_state *s; | ||
752 | ct_data *tree; /* the tree to be scanned */ | ||
753 | int max_code; /* and its largest code of non zero frequency */ | ||
754 | { | ||
755 | int n; /* iterates over all tree elements */ | ||
756 | int prevlen = -1; /* last emitted length */ | ||
757 | int curlen; /* length of current code */ | ||
758 | int nextlen = tree[0].Len; /* length of next code */ | ||
759 | int count = 0; /* repeat count of the current code */ | ||
760 | int max_count = 7; /* max repeat count */ | ||
761 | int min_count = 4; /* min repeat count */ | ||
762 | |||
763 | /* tree[max_code+1].Len = -1; */ /* guard already set */ | ||
764 | if (nextlen == 0) max_count = 138, min_count = 3; | ||
765 | |||
766 | for (n = 0; n <= max_code; n++) { | ||
767 | curlen = nextlen; nextlen = tree[n+1].Len; | ||
768 | if (++count < max_count && curlen == nextlen) { | ||
769 | continue; | ||
770 | } else if (count < min_count) { | ||
771 | do { send_code(s, curlen, s->bl_tree); } while (--count != 0); | ||
772 | |||
773 | } else if (curlen != 0) { | ||
774 | if (curlen != prevlen) { | ||
775 | send_code(s, curlen, s->bl_tree); count--; | ||
776 | } | ||
777 | Assert(count >= 3 && count <= 6, " 3_6?"); | ||
778 | send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); | ||
779 | |||
780 | } else if (count <= 10) { | ||
781 | send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); | ||
782 | |||
783 | } else { | ||
784 | send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); | ||
785 | } | ||
786 | count = 0; prevlen = curlen; | ||
787 | if (nextlen == 0) { | ||
788 | max_count = 138, min_count = 3; | ||
789 | } else if (curlen == nextlen) { | ||
790 | max_count = 6, min_count = 3; | ||
791 | } else { | ||
792 | max_count = 7, min_count = 4; | ||
793 | } | ||
794 | } | ||
795 | } | ||
796 | |||
797 | /* =========================================================================== | ||
798 | * Construct the Huffman tree for the bit lengths and return the index in | ||
799 | * bl_order of the last bit length code to send. | ||
800 | */ | ||
801 | local int build_bl_tree(s) | ||
802 | deflate_state *s; | ||
803 | { | ||
804 | int max_blindex; /* index of last bit length code of non zero freq */ | ||
805 | |||
806 | /* Determine the bit length frequencies for literal and distance trees */ | ||
807 | scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); | ||
808 | scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); | ||
809 | |||
810 | /* Build the bit length tree: */ | ||
811 | build_tree(s, (tree_desc *)(&(s->bl_desc))); | ||
812 | /* opt_len now includes the length of the tree representations, except | ||
813 | * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. | ||
814 | */ | ||
815 | |||
816 | /* Determine the number of bit length codes to send. The pkzip format | ||
817 | * requires that at least 4 bit length codes be sent. (appnote.txt says | ||
818 | * 3 but the actual value used is 4.) | ||
819 | */ | ||
820 | for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { | ||
821 | if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; | ||
822 | } | ||
823 | /* Update opt_len to include the bit length tree and counts */ | ||
824 | s->opt_len += 3*(max_blindex+1) + 5+5+4; | ||
825 | Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", | ||
826 | s->opt_len, s->static_len)); | ||
827 | |||
828 | return max_blindex; | ||
829 | } | ||
830 | |||
831 | /* =========================================================================== | ||
832 | * Send the header for a block using dynamic Huffman trees: the counts, the | ||
833 | * lengths of the bit length codes, the literal tree and the distance tree. | ||
834 | * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. | ||
835 | */ | ||
836 | local void send_all_trees(s, lcodes, dcodes, blcodes) | ||
837 | deflate_state *s; | ||
838 | int lcodes, dcodes, blcodes; /* number of codes for each tree */ | ||
839 | { | ||
840 | int rank; /* index in bl_order */ | ||
841 | |||
842 | Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); | ||
843 | Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, | ||
844 | "too many codes"); | ||
845 | Tracev((stderr, "\nbl counts: ")); | ||
846 | send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ | ||
847 | send_bits(s, dcodes-1, 5); | ||
848 | send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ | ||
849 | for (rank = 0; rank < blcodes; rank++) { | ||
850 | Tracev((stderr, "\nbl code %2d ", bl_order[rank])); | ||
851 | send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); | ||
852 | } | ||
853 | Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); | ||
854 | |||
855 | send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ | ||
856 | Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); | ||
857 | |||
858 | send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ | ||
859 | Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); | ||
860 | } | ||
861 | |||
862 | /* =========================================================================== | ||
863 | * Send a stored block | ||
864 | */ | ||
865 | void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) | ||
866 | deflate_state *s; | ||
867 | charf *buf; /* input block */ | ||
868 | ulg stored_len; /* length of input block */ | ||
869 | int last; /* one if this is the last block for a file */ | ||
870 | { | ||
871 | send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ | ||
872 | #ifdef DEBUG | ||
873 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; | ||
874 | s->compressed_len += (stored_len + 4) << 3; | ||
875 | #endif | ||
876 | copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ | ||
877 | } | ||
878 | |||
879 | /* =========================================================================== | ||
880 | * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) | ||
881 | */ | ||
882 | void ZLIB_INTERNAL _tr_flush_bits(s) | ||
883 | deflate_state *s; | ||
884 | { | ||
885 | bi_flush(s); | ||
886 | } | ||
887 | |||
888 | /* =========================================================================== | ||
889 | * Send one empty static block to give enough lookahead for inflate. | ||
890 | * This takes 10 bits, of which 7 may remain in the bit buffer. | ||
891 | */ | ||
892 | void ZLIB_INTERNAL _tr_align(s) | ||
893 | deflate_state *s; | ||
894 | { | ||
895 | send_bits(s, STATIC_TREES<<1, 3); | ||
896 | send_code(s, END_BLOCK, static_ltree); | ||
897 | #ifdef DEBUG | ||
898 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ | ||
899 | #endif | ||
900 | bi_flush(s); | ||
901 | } | ||
902 | |||
903 | /* =========================================================================== | ||
904 | * Determine the best encoding for the current block: dynamic trees, static | ||
905 | * trees or store, and output the encoded block to the zip file. | ||
906 | */ | ||
907 | void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) | ||
908 | deflate_state *s; | ||
909 | charf *buf; /* input block, or NULL if too old */ | ||
910 | ulg stored_len; /* length of input block */ | ||
911 | int last; /* one if this is the last block for a file */ | ||
912 | { | ||
913 | ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ | ||
914 | int max_blindex = 0; /* index of last bit length code of non zero freq */ | ||
915 | |||
916 | /* Build the Huffman trees unless a stored block is forced */ | ||
917 | if (s->level > 0) { | ||
918 | |||
919 | /* Check if the file is binary or text */ | ||
920 | if (s->strm->data_type == Z_UNKNOWN) | ||
921 | s->strm->data_type = detect_data_type(s); | ||
922 | |||
923 | /* Construct the literal and distance trees */ | ||
924 | build_tree(s, (tree_desc *)(&(s->l_desc))); | ||
925 | Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, | ||
926 | s->static_len)); | ||
927 | |||
928 | build_tree(s, (tree_desc *)(&(s->d_desc))); | ||
929 | Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, | ||
930 | s->static_len)); | ||
931 | /* At this point, opt_len and static_len are the total bit lengths of | ||
932 | * the compressed block data, excluding the tree representations. | ||
933 | */ | ||
934 | |||
935 | /* Build the bit length tree for the above two trees, and get the index | ||
936 | * in bl_order of the last bit length code to send. | ||
937 | */ | ||
938 | max_blindex = build_bl_tree(s); | ||
939 | |||
940 | /* Determine the best encoding. Compute the block lengths in bytes. */ | ||
941 | opt_lenb = (s->opt_len+3+7)>>3; | ||
942 | static_lenb = (s->static_len+3+7)>>3; | ||
943 | |||
944 | Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", | ||
945 | opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, | ||
946 | s->last_lit)); | ||
947 | |||
948 | if (static_lenb <= opt_lenb) opt_lenb = static_lenb; | ||
949 | |||
950 | } else { | ||
951 | Assert(buf != (char*)0, "lost buf"); | ||
952 | opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ | ||
953 | } | ||
954 | |||
955 | #ifdef FORCE_STORED | ||
956 | if (buf != (char*)0) { /* force stored block */ | ||
957 | #else | ||
958 | if (stored_len+4 <= opt_lenb && buf != (char*)0) { | ||
959 | /* 4: two words for the lengths */ | ||
960 | #endif | ||
961 | /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. | ||
962 | * Otherwise we can't have processed more than WSIZE input bytes since | ||
963 | * the last block flush, because compression would have been | ||
964 | * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to | ||
965 | * transform a block into a stored block. | ||
966 | */ | ||
967 | _tr_stored_block(s, buf, stored_len, last); | ||
968 | |||
969 | #ifdef FORCE_STATIC | ||
970 | } else if (static_lenb >= 0) { /* force static trees */ | ||
971 | #else | ||
972 | } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { | ||
973 | #endif | ||
974 | send_bits(s, (STATIC_TREES<<1)+last, 3); | ||
975 | compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); | ||
976 | #ifdef DEBUG | ||
977 | s->compressed_len += 3 + s->static_len; | ||
978 | #endif | ||
979 | } else { | ||
980 | send_bits(s, (DYN_TREES<<1)+last, 3); | ||
981 | send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, | ||
982 | max_blindex+1); | ||
983 | compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); | ||
984 | #ifdef DEBUG | ||
985 | s->compressed_len += 3 + s->opt_len; | ||
986 | #endif | ||
987 | } | ||
988 | Assert (s->compressed_len == s->bits_sent, "bad compressed size"); | ||
989 | /* The above check is made mod 2^32, for files larger than 512 MB | ||
990 | * and uLong implemented on 32 bits. | ||
991 | */ | ||
992 | init_block(s); | ||
993 | |||
994 | if (last) { | ||
995 | bi_windup(s); | ||
996 | #ifdef DEBUG | ||
997 | s->compressed_len += 7; /* align on byte boundary */ | ||
998 | #endif | ||
999 | } | ||
1000 | Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, | ||
1001 | s->compressed_len-7*last)); | ||
1002 | } | ||
1003 | |||
1004 | /* =========================================================================== | ||
1005 | * Save the match info and tally the frequency counts. Return true if | ||
1006 | * the current block must be flushed. | ||
1007 | */ | ||
1008 | int ZLIB_INTERNAL _tr_tally (s, dist, lc) | ||
1009 | deflate_state *s; | ||
1010 | unsigned dist; /* distance of matched string */ | ||
1011 | unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ | ||
1012 | { | ||
1013 | s->d_buf[s->last_lit] = (ush)dist; | ||
1014 | s->l_buf[s->last_lit++] = (uch)lc; | ||
1015 | if (dist == 0) { | ||
1016 | /* lc is the unmatched char */ | ||
1017 | s->dyn_ltree[lc].Freq++; | ||
1018 | } else { | ||
1019 | s->matches++; | ||
1020 | /* Here, lc is the match length - MIN_MATCH */ | ||
1021 | dist--; /* dist = match distance - 1 */ | ||
1022 | Assert((ush)dist < (ush)MAX_DIST(s) && | ||
1023 | (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && | ||
1024 | (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); | ||
1025 | |||
1026 | s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; | ||
1027 | s->dyn_dtree[d_code(dist)].Freq++; | ||
1028 | } | ||
1029 | |||
1030 | #ifdef TRUNCATE_BLOCK | ||
1031 | /* Try to guess if it is profitable to stop the current block here */ | ||
1032 | if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { | ||
1033 | /* Compute an upper bound for the compressed length */ | ||
1034 | ulg out_length = (ulg)s->last_lit*8L; | ||
1035 | ulg in_length = (ulg)((long)s->strstart - s->block_start); | ||
1036 | int dcode; | ||
1037 | for (dcode = 0; dcode < D_CODES; dcode++) { | ||
1038 | out_length += (ulg)s->dyn_dtree[dcode].Freq * | ||
1039 | (5L+extra_dbits[dcode]); | ||
1040 | } | ||
1041 | out_length >>= 3; | ||
1042 | Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", | ||
1043 | s->last_lit, in_length, out_length, | ||
1044 | 100L - out_length*100L/in_length)); | ||
1045 | if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; | ||
1046 | } | ||
1047 | #endif | ||
1048 | return (s->last_lit == s->lit_bufsize-1); | ||
1049 | /* We avoid equality with lit_bufsize because of wraparound at 64K | ||
1050 | * on 16 bit machines and because stored blocks are restricted to | ||
1051 | * 64K-1 bytes. | ||
1052 | */ | ||
1053 | } | ||
1054 | |||
1055 | /* =========================================================================== | ||
1056 | * Send the block data compressed using the given Huffman trees | ||
1057 | */ | ||
1058 | local void compress_block(s, ltree, dtree) | ||
1059 | deflate_state *s; | ||
1060 | ct_data *ltree; /* literal tree */ | ||
1061 | ct_data *dtree; /* distance tree */ | ||
1062 | { | ||
1063 | unsigned dist; /* distance of matched string */ | ||
1064 | int lc; /* match length or unmatched char (if dist == 0) */ | ||
1065 | unsigned lx = 0; /* running index in l_buf */ | ||
1066 | unsigned code; /* the code to send */ | ||
1067 | int extra; /* number of extra bits to send */ | ||
1068 | |||
1069 | if (s->last_lit != 0) do { | ||
1070 | dist = s->d_buf[lx]; | ||
1071 | lc = s->l_buf[lx++]; | ||
1072 | if (dist == 0) { | ||
1073 | send_code(s, lc, ltree); /* send a literal byte */ | ||
1074 | Tracecv(isgraph(lc), (stderr," '%c' ", lc)); | ||
1075 | } else { | ||
1076 | /* Here, lc is the match length - MIN_MATCH */ | ||
1077 | code = _length_code[lc]; | ||
1078 | send_code(s, code+LITERALS+1, ltree); /* send the length code */ | ||
1079 | extra = extra_lbits[code]; | ||
1080 | if (extra != 0) { | ||
1081 | lc -= base_length[code]; | ||
1082 | send_bits(s, lc, extra); /* send the extra length bits */ | ||
1083 | } | ||
1084 | dist--; /* dist is now the match distance - 1 */ | ||
1085 | code = d_code(dist); | ||
1086 | Assert (code < D_CODES, "bad d_code"); | ||
1087 | |||
1088 | send_code(s, code, dtree); /* send the distance code */ | ||
1089 | extra = extra_dbits[code]; | ||
1090 | if (extra != 0) { | ||
1091 | dist -= base_dist[code]; | ||
1092 | send_bits(s, dist, extra); /* send the extra distance bits */ | ||
1093 | } | ||
1094 | } /* literal or match pair ? */ | ||
1095 | |||
1096 | /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ | ||
1097 | Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, | ||
1098 | "pendingBuf overflow"); | ||
1099 | |||
1100 | } while (lx < s->last_lit); | ||
1101 | |||
1102 | send_code(s, END_BLOCK, ltree); | ||
1103 | } | ||
1104 | |||
1105 | /* =========================================================================== | ||
1106 | * Check if the data type is TEXT or BINARY, using the following algorithm: | ||
1107 | * - TEXT if the two conditions below are satisfied: | ||
1108 | * a) There are no non-portable control characters belonging to the | ||
1109 | * "black list" (0..6, 14..25, 28..31). | ||
1110 | * b) There is at least one printable character belonging to the | ||
1111 | * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). | ||
1112 | * - BINARY otherwise. | ||
1113 | * - The following partially-portable control characters form a | ||
1114 | * "gray list" that is ignored in this detection algorithm: | ||
1115 | * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). | ||
1116 | * IN assertion: the fields Freq of dyn_ltree are set. | ||
1117 | */ | ||
1118 | local int detect_data_type(s) | ||
1119 | deflate_state *s; | ||
1120 | { | ||
1121 | /* black_mask is the bit mask of black-listed bytes | ||
1122 | * set bits 0..6, 14..25, and 28..31 | ||
1123 | * 0xf3ffc07f = binary 11110011111111111100000001111111 | ||
1124 | */ | ||
1125 | unsigned long black_mask = 0xf3ffc07fUL; | ||
1126 | int n; | ||
1127 | |||
1128 | /* Check for non-textual ("black-listed") bytes. */ | ||
1129 | for (n = 0; n <= 31; n++, black_mask >>= 1) | ||
1130 | if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) | ||
1131 | return Z_BINARY; | ||
1132 | |||
1133 | /* Check for textual ("white-listed") bytes. */ | ||
1134 | if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 | ||
1135 | || s->dyn_ltree[13].Freq != 0) | ||
1136 | return Z_TEXT; | ||
1137 | for (n = 32; n < LITERALS; n++) | ||
1138 | if (s->dyn_ltree[n].Freq != 0) | ||
1139 | return Z_TEXT; | ||
1140 | |||
1141 | /* There are no "black-listed" or "white-listed" bytes: | ||
1142 | * this stream either is empty or has tolerated ("gray-listed") bytes only. | ||
1143 | */ | ||
1144 | return Z_BINARY; | ||
1145 | } | ||
1146 | |||
1147 | /* =========================================================================== | ||
1148 | * Reverse the first len bits of a code, using straightforward code (a faster | ||
1149 | * method would use a table) | ||
1150 | * IN assertion: 1 <= len <= 15 | ||
1151 | */ | ||
1152 | local unsigned bi_reverse(code, len) | ||
1153 | unsigned code; /* the value to invert */ | ||
1154 | int len; /* its bit length */ | ||
1155 | { | ||
1156 | register unsigned res = 0; | ||
1157 | do { | ||
1158 | res |= code & 1; | ||
1159 | code >>= 1, res <<= 1; | ||
1160 | } while (--len > 0); | ||
1161 | return res >> 1; | ||
1162 | } | ||
1163 | |||
1164 | /* =========================================================================== | ||
1165 | * Flush the bit buffer, keeping at most 7 bits in it. | ||
1166 | */ | ||
1167 | local void bi_flush(s) | ||
1168 | deflate_state *s; | ||
1169 | { | ||
1170 | if (s->bi_valid == 16) { | ||
1171 | put_short(s, s->bi_buf); | ||
1172 | s->bi_buf = 0; | ||
1173 | s->bi_valid = 0; | ||
1174 | } else if (s->bi_valid >= 8) { | ||
1175 | put_byte(s, (Byte)s->bi_buf); | ||
1176 | s->bi_buf >>= 8; | ||
1177 | s->bi_valid -= 8; | ||
1178 | } | ||
1179 | } | ||
1180 | |||
1181 | /* =========================================================================== | ||
1182 | * Flush the bit buffer and align the output on a byte boundary | ||
1183 | */ | ||
1184 | local void bi_windup(s) | ||
1185 | deflate_state *s; | ||
1186 | { | ||
1187 | if (s->bi_valid > 8) { | ||
1188 | put_short(s, s->bi_buf); | ||
1189 | } else if (s->bi_valid > 0) { | ||
1190 | put_byte(s, (Byte)s->bi_buf); | ||
1191 | } | ||
1192 | s->bi_buf = 0; | ||
1193 | s->bi_valid = 0; | ||
1194 | #ifdef DEBUG | ||
1195 | s->bits_sent = (s->bits_sent+7) & ~7; | ||
1196 | #endif | ||
1197 | } | ||
1198 | |||
1199 | /* =========================================================================== | ||
1200 | * Copy a stored block, storing first the length and its | ||
1201 | * one's complement if requested. | ||
1202 | */ | ||
1203 | local void copy_block(s, buf, len, header) | ||
1204 | deflate_state *s; | ||
1205 | charf *buf; /* the input data */ | ||
1206 | unsigned len; /* its length */ | ||
1207 | int header; /* true if block header must be written */ | ||
1208 | { | ||
1209 | bi_windup(s); /* align on byte boundary */ | ||
1210 | |||
1211 | if (header) { | ||
1212 | put_short(s, (ush)len); | ||
1213 | put_short(s, (ush)~len); | ||
1214 | #ifdef DEBUG | ||
1215 | s->bits_sent += 2*16; | ||
1216 | #endif | ||
1217 | } | ||
1218 | #ifdef DEBUG | ||
1219 | s->bits_sent += (ulg)len<<3; | ||
1220 | #endif | ||
1221 | while (len--) { | ||
1222 | put_byte(s, *buf++); | ||
1223 | } | ||
1224 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.h deleted file mode 100644 index d35639d..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/trees.h +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* header created automatically with -DGEN_TREES_H */ | ||
2 | |||
3 | local const ct_data static_ltree[L_CODES+2] = { | ||
4 | {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, | ||
5 | {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, | ||
6 | {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, | ||
7 | {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, | ||
8 | {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, | ||
9 | {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, | ||
10 | {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, | ||
11 | {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, | ||
12 | {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, | ||
13 | {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, | ||
14 | {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, | ||
15 | {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, | ||
16 | {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, | ||
17 | {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, | ||
18 | {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, | ||
19 | {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, | ||
20 | {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, | ||
21 | {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, | ||
22 | {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, | ||
23 | {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, | ||
24 | {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, | ||
25 | {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, | ||
26 | {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, | ||
27 | {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, | ||
28 | {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, | ||
29 | {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, | ||
30 | {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, | ||
31 | {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, | ||
32 | {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, | ||
33 | {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, | ||
34 | {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, | ||
35 | {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, | ||
36 | {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, | ||
37 | {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, | ||
38 | {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, | ||
39 | {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, | ||
40 | {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, | ||
41 | {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, | ||
42 | {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, | ||
43 | {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, | ||
44 | {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, | ||
45 | {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, | ||
46 | {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, | ||
47 | {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, | ||
48 | {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, | ||
49 | {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, | ||
50 | {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, | ||
51 | {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, | ||
52 | {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, | ||
53 | {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, | ||
54 | {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, | ||
55 | {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, | ||
56 | {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, | ||
57 | {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, | ||
58 | {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, | ||
59 | {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, | ||
60 | {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, | ||
61 | {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} | ||
62 | }; | ||
63 | |||
64 | local const ct_data static_dtree[D_CODES] = { | ||
65 | {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, | ||
66 | {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, | ||
67 | {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, | ||
68 | {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, | ||
69 | {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, | ||
70 | {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} | ||
71 | }; | ||
72 | |||
73 | const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { | ||
74 | 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, | ||
75 | 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, | ||
76 | 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, | ||
77 | 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
78 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, | ||
79 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
80 | 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, | ||
81 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, | ||
82 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, | ||
83 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, | ||
84 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, | ||
85 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, | ||
86 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, | ||
87 | 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, | ||
88 | 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, | ||
89 | 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, | ||
90 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, | ||
91 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, | ||
92 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, | ||
93 | 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||
94 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||
95 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||
96 | 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, | ||
97 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, | ||
98 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, | ||
99 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 | ||
100 | }; | ||
101 | |||
102 | const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { | ||
103 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, | ||
104 | 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, | ||
105 | 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, | ||
106 | 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, | ||
107 | 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, | ||
108 | 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, | ||
109 | 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, | ||
110 | 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, | ||
111 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, | ||
112 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, | ||
113 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, | ||
114 | 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, | ||
115 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 | ||
116 | }; | ||
117 | |||
118 | local const int base_length[LENGTH_CODES] = { | ||
119 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, | ||
120 | 64, 80, 96, 112, 128, 160, 192, 224, 0 | ||
121 | }; | ||
122 | |||
123 | local const int base_dist[D_CODES] = { | ||
124 | 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, | ||
125 | 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, | ||
126 | 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 | ||
127 | }; | ||
128 | |||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/uncompr.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/uncompr.c deleted file mode 100644 index ad98be3..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/uncompr.c +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* uncompr.c -- decompress a memory buffer | ||
2 | * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #define ZLIB_INTERNAL | ||
9 | #include "zlib.h" | ||
10 | |||
11 | /* =========================================================================== | ||
12 | Decompresses the source buffer into the destination buffer. sourceLen is | ||
13 | the byte length of the source buffer. Upon entry, destLen is the total | ||
14 | size of the destination buffer, which must be large enough to hold the | ||
15 | entire uncompressed data. (The size of the uncompressed data must have | ||
16 | been saved previously by the compressor and transmitted to the decompressor | ||
17 | by some mechanism outside the scope of this compression library.) | ||
18 | Upon exit, destLen is the actual size of the compressed buffer. | ||
19 | |||
20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | ||
21 | enough memory, Z_BUF_ERROR if there was not enough room in the output | ||
22 | buffer, or Z_DATA_ERROR if the input data was corrupted. | ||
23 | */ | ||
24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) | ||
25 | Bytef *dest; | ||
26 | uLongf *destLen; | ||
27 | const Bytef *source; | ||
28 | uLong sourceLen; | ||
29 | { | ||
30 | z_stream stream; | ||
31 | int err; | ||
32 | |||
33 | stream.next_in = (Bytef*)source; | ||
34 | stream.avail_in = (uInt)sourceLen; | ||
35 | /* Check for source > 64K on 16-bit machine: */ | ||
36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; | ||
37 | |||
38 | stream.next_out = dest; | ||
39 | stream.avail_out = (uInt)*destLen; | ||
40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; | ||
41 | |||
42 | stream.zalloc = (alloc_func)0; | ||
43 | stream.zfree = (free_func)0; | ||
44 | |||
45 | err = inflateInit(&stream); | ||
46 | if (err != Z_OK) return err; | ||
47 | |||
48 | err = inflate(&stream, Z_FINISH); | ||
49 | if (err != Z_STREAM_END) { | ||
50 | inflateEnd(&stream); | ||
51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) | ||
52 | return Z_DATA_ERROR; | ||
53 | return err; | ||
54 | } | ||
55 | *destLen = stream.total_out; | ||
56 | |||
57 | err = inflateEnd(&stream); | ||
58 | return err; | ||
59 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h deleted file mode 100644 index 1477c89..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h +++ /dev/null | |||
@@ -1,506 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #ifndef ZCONF_H | ||
9 | #define ZCONF_H | ||
10 | |||
11 | /* | ||
12 | * If you *really* need a unique prefix for all types and library functions, | ||
13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
14 | * Even better than compiling with -DZ_PREFIX would be to use configure to set | ||
15 | * this permanently in zconf.h using "./configure --zprefix". | ||
16 | */ | ||
17 | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | ||
18 | # define Z_PREFIX_SET | ||
19 | |||
20 | /* all linked symbols */ | ||
21 | # define _dist_code z__dist_code | ||
22 | # define _length_code z__length_code | ||
23 | # define _tr_align z__tr_align | ||
24 | # define _tr_flush_block z__tr_flush_block | ||
25 | # define _tr_init z__tr_init | ||
26 | # define _tr_stored_block z__tr_stored_block | ||
27 | # define _tr_tally z__tr_tally | ||
28 | # define adler32 z_adler32 | ||
29 | # define adler32_combine z_adler32_combine | ||
30 | # define adler32_combine64 z_adler32_combine64 | ||
31 | # ifndef Z_SOLO | ||
32 | # define compress z_compress | ||
33 | # define compress2 z_compress2 | ||
34 | # define compressBound z_compressBound | ||
35 | # endif | ||
36 | # define crc32 z_crc32 | ||
37 | # define crc32_combine z_crc32_combine | ||
38 | # define crc32_combine64 z_crc32_combine64 | ||
39 | # define deflate z_deflate | ||
40 | # define deflateBound z_deflateBound | ||
41 | # define deflateCopy z_deflateCopy | ||
42 | # define deflateEnd z_deflateEnd | ||
43 | # define deflateInit2_ z_deflateInit2_ | ||
44 | # define deflateInit_ z_deflateInit_ | ||
45 | # define deflateParams z_deflateParams | ||
46 | # define deflatePending z_deflatePending | ||
47 | # define deflatePrime z_deflatePrime | ||
48 | # define deflateReset z_deflateReset | ||
49 | # define deflateResetKeep z_deflateResetKeep | ||
50 | # define deflateSetDictionary z_deflateSetDictionary | ||
51 | # define deflateSetHeader z_deflateSetHeader | ||
52 | # define deflateTune z_deflateTune | ||
53 | # define deflate_copyright z_deflate_copyright | ||
54 | # define get_crc_table z_get_crc_table | ||
55 | # ifndef Z_SOLO | ||
56 | # define gz_error z_gz_error | ||
57 | # define gz_intmax z_gz_intmax | ||
58 | # define gz_strwinerror z_gz_strwinerror | ||
59 | # define gzbuffer z_gzbuffer | ||
60 | # define gzclearerr z_gzclearerr | ||
61 | # define gzclose z_gzclose | ||
62 | # define gzclose_r z_gzclose_r | ||
63 | # define gzclose_w z_gzclose_w | ||
64 | # define gzdirect z_gzdirect | ||
65 | # define gzdopen z_gzdopen | ||
66 | # define gzeof z_gzeof | ||
67 | # define gzerror z_gzerror | ||
68 | # define gzflush z_gzflush | ||
69 | # define gzgetc z_gzgetc | ||
70 | # define gzgetc_ z_gzgetc_ | ||
71 | # define gzgets z_gzgets | ||
72 | # define gzoffset z_gzoffset | ||
73 | # define gzoffset64 z_gzoffset64 | ||
74 | # define gzopen z_gzopen | ||
75 | # define gzopen64 z_gzopen64 | ||
76 | # ifdef _WIN32 | ||
77 | # define gzopen_w z_gzopen_w | ||
78 | # endif | ||
79 | # define gzprintf z_gzprintf | ||
80 | # define gzputc z_gzputc | ||
81 | # define gzputs z_gzputs | ||
82 | # define gzread z_gzread | ||
83 | # define gzrewind z_gzrewind | ||
84 | # define gzseek z_gzseek | ||
85 | # define gzseek64 z_gzseek64 | ||
86 | # define gzsetparams z_gzsetparams | ||
87 | # define gztell z_gztell | ||
88 | # define gztell64 z_gztell64 | ||
89 | # define gzungetc z_gzungetc | ||
90 | # define gzwrite z_gzwrite | ||
91 | # endif | ||
92 | # define inflate z_inflate | ||
93 | # define inflateBack z_inflateBack | ||
94 | # define inflateBackEnd z_inflateBackEnd | ||
95 | # define inflateBackInit_ z_inflateBackInit_ | ||
96 | # define inflateCopy z_inflateCopy | ||
97 | # define inflateEnd z_inflateEnd | ||
98 | # define inflateGetHeader z_inflateGetHeader | ||
99 | # define inflateInit2_ z_inflateInit2_ | ||
100 | # define inflateInit_ z_inflateInit_ | ||
101 | # define inflateMark z_inflateMark | ||
102 | # define inflatePrime z_inflatePrime | ||
103 | # define inflateReset z_inflateReset | ||
104 | # define inflateReset2 z_inflateReset2 | ||
105 | # define inflateSetDictionary z_inflateSetDictionary | ||
106 | # define inflateSync z_inflateSync | ||
107 | # define inflateSyncPoint z_inflateSyncPoint | ||
108 | # define inflateUndermine z_inflateUndermine | ||
109 | # define inflateResetKeep z_inflateResetKeep | ||
110 | # define inflate_copyright z_inflate_copyright | ||
111 | # define inflate_fast z_inflate_fast | ||
112 | # define inflate_table z_inflate_table | ||
113 | # ifndef Z_SOLO | ||
114 | # define uncompress z_uncompress | ||
115 | # endif | ||
116 | # define zError z_zError | ||
117 | # ifndef Z_SOLO | ||
118 | # define zcalloc z_zcalloc | ||
119 | # define zcfree z_zcfree | ||
120 | # endif | ||
121 | # define zlibCompileFlags z_zlibCompileFlags | ||
122 | # define zlibVersion z_zlibVersion | ||
123 | |||
124 | /* all zlib typedefs in zlib.h and zconf.h */ | ||
125 | # define Byte z_Byte | ||
126 | # define Bytef z_Bytef | ||
127 | # define alloc_func z_alloc_func | ||
128 | # define charf z_charf | ||
129 | # define free_func z_free_func | ||
130 | # ifndef Z_SOLO | ||
131 | # define gzFile z_gzFile | ||
132 | # endif | ||
133 | # define gz_header z_gz_header | ||
134 | # define gz_headerp z_gz_headerp | ||
135 | # define in_func z_in_func | ||
136 | # define intf z_intf | ||
137 | # define out_func z_out_func | ||
138 | # define uInt z_uInt | ||
139 | # define uIntf z_uIntf | ||
140 | # define uLong z_uLong | ||
141 | # define uLongf z_uLongf | ||
142 | # define voidp z_voidp | ||
143 | # define voidpc z_voidpc | ||
144 | # define voidpf z_voidpf | ||
145 | |||
146 | /* all zlib structs in zlib.h and zconf.h */ | ||
147 | # define gz_header_s z_gz_header_s | ||
148 | # define internal_state z_internal_state | ||
149 | |||
150 | #endif | ||
151 | |||
152 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
153 | # define MSDOS | ||
154 | #endif | ||
155 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | ||
156 | # define OS2 | ||
157 | #endif | ||
158 | #if defined(_WINDOWS) && !defined(WINDOWS) | ||
159 | # define WINDOWS | ||
160 | #endif | ||
161 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) | ||
162 | # ifndef WIN32 | ||
163 | # define WIN32 | ||
164 | # endif | ||
165 | #endif | ||
166 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) | ||
167 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) | ||
168 | # ifndef SYS16BIT | ||
169 | # define SYS16BIT | ||
170 | # endif | ||
171 | # endif | ||
172 | #endif | ||
173 | |||
174 | /* | ||
175 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
176 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
177 | */ | ||
178 | #ifdef SYS16BIT | ||
179 | # define MAXSEG_64K | ||
180 | #endif | ||
181 | #ifdef MSDOS | ||
182 | # define UNALIGNED_OK | ||
183 | #endif | ||
184 | |||
185 | #ifdef __STDC_VERSION__ | ||
186 | # ifndef STDC | ||
187 | # define STDC | ||
188 | # endif | ||
189 | # if __STDC_VERSION__ >= 199901L | ||
190 | # ifndef STDC99 | ||
191 | # define STDC99 | ||
192 | # endif | ||
193 | # endif | ||
194 | #endif | ||
195 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) | ||
196 | # define STDC | ||
197 | #endif | ||
198 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) | ||
199 | # define STDC | ||
200 | #endif | ||
201 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) | ||
202 | # define STDC | ||
203 | #endif | ||
204 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) | ||
205 | # define STDC | ||
206 | #endif | ||
207 | |||
208 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
209 | # define STDC | ||
210 | #endif | ||
211 | |||
212 | #ifndef STDC | ||
213 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
214 | # define const /* note: need a more gentle solution here */ | ||
215 | # endif | ||
216 | #endif | ||
217 | |||
218 | #if defined(ZLIB_CONST) && !defined(z_const) | ||
219 | # define z_const const | ||
220 | #else | ||
221 | # define z_const | ||
222 | #endif | ||
223 | |||
224 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
225 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | ||
226 | # define NO_DUMMY_DECL | ||
227 | #endif | ||
228 | |||
229 | /* Maximum value for memLevel in deflateInit2 */ | ||
230 | #ifndef MAX_MEM_LEVEL | ||
231 | # ifdef MAXSEG_64K | ||
232 | # define MAX_MEM_LEVEL 8 | ||
233 | # else | ||
234 | # define MAX_MEM_LEVEL 9 | ||
235 | # endif | ||
236 | #endif | ||
237 | |||
238 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
239 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
240 | * created by gzip. (Files created by minigzip can still be extracted by | ||
241 | * gzip.) | ||
242 | */ | ||
243 | #ifndef MAX_WBITS | ||
244 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
245 | #endif | ||
246 | |||
247 | /* The memory requirements for deflate are (in bytes): | ||
248 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
249 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
250 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
251 | the default memory requirements from 256K to 128K, compile with | ||
252 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
253 | Of course this will generally degrade compression (there's no free lunch). | ||
254 | |||
255 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
256 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
257 | for small objects. | ||
258 | */ | ||
259 | |||
260 | /* Type declarations */ | ||
261 | |||
262 | #ifndef OF /* function prototypes */ | ||
263 | # ifdef STDC | ||
264 | # define OF(args) args | ||
265 | # else | ||
266 | # define OF(args) () | ||
267 | # endif | ||
268 | #endif | ||
269 | |||
270 | #ifndef Z_ARG /* function prototypes for stdarg */ | ||
271 | # if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
272 | # define Z_ARG(args) args | ||
273 | # else | ||
274 | # define Z_ARG(args) () | ||
275 | # endif | ||
276 | #endif | ||
277 | |||
278 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
279 | * model programming (small or medium model with some far allocations). | ||
280 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
281 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
282 | * just define FAR to be empty. | ||
283 | */ | ||
284 | #ifdef SYS16BIT | ||
285 | # if defined(M_I86SM) || defined(M_I86MM) | ||
286 | /* MSC small or medium model */ | ||
287 | # define SMALL_MEDIUM | ||
288 | # ifdef _MSC_VER | ||
289 | # define FAR _far | ||
290 | # else | ||
291 | # define FAR far | ||
292 | # endif | ||
293 | # endif | ||
294 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
295 | /* Turbo C small or medium model */ | ||
296 | # define SMALL_MEDIUM | ||
297 | # ifdef __BORLANDC__ | ||
298 | # define FAR _far | ||
299 | # else | ||
300 | # define FAR far | ||
301 | # endif | ||
302 | # endif | ||
303 | #endif | ||
304 | |||
305 | #if defined(WINDOWS) || defined(WIN32) | ||
306 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
307 | * This is not mandatory, but it offers a little performance increase. | ||
308 | */ | ||
309 | # ifdef ZLIB_DLL | ||
310 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
311 | # ifdef ZLIB_INTERNAL | ||
312 | # define ZEXTERN extern __declspec(dllexport) | ||
313 | # else | ||
314 | # define ZEXTERN extern __declspec(dllimport) | ||
315 | # endif | ||
316 | # endif | ||
317 | # endif /* ZLIB_DLL */ | ||
318 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
319 | * define ZLIB_WINAPI. | ||
320 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
321 | */ | ||
322 | # ifdef ZLIB_WINAPI | ||
323 | # ifdef FAR | ||
324 | # undef FAR | ||
325 | # endif | ||
326 | # include <windows.h> | ||
327 | /* No need for _export, use ZLIB.DEF instead. */ | ||
328 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
329 | # define ZEXPORT WINAPI | ||
330 | # ifdef WIN32 | ||
331 | # define ZEXPORTVA WINAPIV | ||
332 | # else | ||
333 | # define ZEXPORTVA FAR CDECL | ||
334 | # endif | ||
335 | # endif | ||
336 | #endif | ||
337 | |||
338 | #if defined (__BEOS__) | ||
339 | # ifdef ZLIB_DLL | ||
340 | # ifdef ZLIB_INTERNAL | ||
341 | # define ZEXPORT __declspec(dllexport) | ||
342 | # define ZEXPORTVA __declspec(dllexport) | ||
343 | # else | ||
344 | # define ZEXPORT __declspec(dllimport) | ||
345 | # define ZEXPORTVA __declspec(dllimport) | ||
346 | # endif | ||
347 | # endif | ||
348 | #endif | ||
349 | |||
350 | #ifndef ZEXTERN | ||
351 | # define ZEXTERN extern | ||
352 | #endif | ||
353 | #ifndef ZEXPORT | ||
354 | # define ZEXPORT | ||
355 | #endif | ||
356 | #ifndef ZEXPORTVA | ||
357 | # define ZEXPORTVA | ||
358 | #endif | ||
359 | |||
360 | #ifndef FAR | ||
361 | # define FAR | ||
362 | #endif | ||
363 | |||
364 | #if !defined(__MACTYPES__) | ||
365 | typedef unsigned char Byte; /* 8 bits */ | ||
366 | #endif | ||
367 | typedef unsigned int uInt; /* 16 bits or more */ | ||
368 | typedef unsigned long uLong; /* 32 bits or more */ | ||
369 | |||
370 | #ifdef SMALL_MEDIUM | ||
371 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
372 | # define Bytef Byte FAR | ||
373 | #else | ||
374 | typedef Byte FAR Bytef; | ||
375 | #endif | ||
376 | typedef char FAR charf; | ||
377 | typedef int FAR intf; | ||
378 | typedef uInt FAR uIntf; | ||
379 | typedef uLong FAR uLongf; | ||
380 | |||
381 | #ifdef STDC | ||
382 | typedef void const *voidpc; | ||
383 | typedef void FAR *voidpf; | ||
384 | typedef void *voidp; | ||
385 | #else | ||
386 | typedef Byte const *voidpc; | ||
387 | typedef Byte FAR *voidpf; | ||
388 | typedef Byte *voidp; | ||
389 | #endif | ||
390 | |||
391 | /* ./configure may #define Z_U4 here */ | ||
392 | |||
393 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | ||
394 | # include <limits.h> | ||
395 | # if (UINT_MAX == 0xffffffffUL) | ||
396 | # define Z_U4 unsigned | ||
397 | # else | ||
398 | # if (ULONG_MAX == 0xffffffffUL) | ||
399 | # define Z_U4 unsigned long | ||
400 | # else | ||
401 | # if (USHRT_MAX == 0xffffffffUL) | ||
402 | # define Z_U4 unsigned short | ||
403 | # endif | ||
404 | # endif | ||
405 | # endif | ||
406 | #endif | ||
407 | |||
408 | #ifdef Z_U4 | ||
409 | typedef Z_U4 z_crc_t; | ||
410 | #else | ||
411 | typedef unsigned long z_crc_t; | ||
412 | #endif | ||
413 | |||
414 | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | ||
415 | # define Z_HAVE_UNISTD_H | ||
416 | #endif | ||
417 | |||
418 | #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | ||
419 | # define Z_HAVE_STDARG_H | ||
420 | #endif | ||
421 | |||
422 | #ifdef STDC | ||
423 | # ifndef Z_SOLO | ||
424 | # include <sys/types.h> /* for off_t */ | ||
425 | # endif | ||
426 | #endif | ||
427 | |||
428 | #ifdef _WIN32 | ||
429 | # include <stddef.h> /* for wchar_t */ | ||
430 | #endif | ||
431 | |||
432 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | ||
433 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | ||
434 | * though the former does not conform to the LFS document), but considering | ||
435 | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | ||
436 | * equivalently requesting no 64-bit operations | ||
437 | */ | ||
438 | #if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | ||
439 | # undef _LARGEFILE64_SOURCE | ||
440 | #endif | ||
441 | |||
442 | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | ||
443 | # define Z_HAVE_UNISTD_H | ||
444 | #endif | ||
445 | #ifndef Z_SOLO | ||
446 | # if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) | ||
447 | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | ||
448 | # ifdef VMS | ||
449 | # include <unixio.h> /* for off_t */ | ||
450 | # endif | ||
451 | # ifndef z_off_t | ||
452 | # define z_off_t off_t | ||
453 | # endif | ||
454 | # endif | ||
455 | #endif | ||
456 | |||
457 | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 | ||
458 | # define Z_LFS64 | ||
459 | #endif | ||
460 | |||
461 | #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) | ||
462 | # define Z_LARGE64 | ||
463 | #endif | ||
464 | |||
465 | #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) | ||
466 | # define Z_WANT64 | ||
467 | #endif | ||
468 | |||
469 | #if !defined(SEEK_SET) && !defined(Z_SOLO) | ||
470 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
471 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
472 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
473 | #endif | ||
474 | |||
475 | #ifndef z_off_t | ||
476 | # define z_off_t long | ||
477 | #endif | ||
478 | |||
479 | #if !defined(_WIN32) && defined(Z_LARGE64) | ||
480 | # define z_off64_t off64_t | ||
481 | #else | ||
482 | # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) | ||
483 | # define z_off64_t __int64 | ||
484 | # else | ||
485 | # define z_off64_t z_off_t | ||
486 | # endif | ||
487 | #endif | ||
488 | |||
489 | /* MVS linker does not support external names larger than 8 bytes */ | ||
490 | #if defined(__MVS__) | ||
491 | #pragma map(deflateInit_,"DEIN") | ||
492 | #pragma map(deflateInit2_,"DEIN2") | ||
493 | #pragma map(deflateEnd,"DEEND") | ||
494 | #pragma map(deflateBound,"DEBND") | ||
495 | #pragma map(inflateInit_,"ININ") | ||
496 | #pragma map(inflateInit2_,"ININ2") | ||
497 | #pragma map(inflateEnd,"INEND") | ||
498 | #pragma map(inflateSync,"INSY") | ||
499 | #pragma map(inflateSetDictionary,"INSEDI") | ||
500 | #pragma map(compressBound,"CMBND") | ||
501 | #pragma map(inflate_table,"INTABL") | ||
502 | #pragma map(inflate_fast,"INFA") | ||
503 | #pragma map(inflate_copyright,"INCOPY") | ||
504 | #endif | ||
505 | |||
506 | #endif /* ZCONF_H */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.cmakein b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.cmakein deleted file mode 100644 index b6ca59a..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.cmakein +++ /dev/null | |||
@@ -1,508 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #ifndef ZCONF_H | ||
9 | #define ZCONF_H | ||
10 | #cmakedefine Z_PREFIX | ||
11 | #cmakedefine Z_HAVE_UNISTD_H | ||
12 | |||
13 | /* | ||
14 | * If you *really* need a unique prefix for all types and library functions, | ||
15 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
16 | * Even better than compiling with -DZ_PREFIX would be to use configure to set | ||
17 | * this permanently in zconf.h using "./configure --zprefix". | ||
18 | */ | ||
19 | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | ||
20 | # define Z_PREFIX_SET | ||
21 | |||
22 | /* all linked symbols */ | ||
23 | # define _dist_code z__dist_code | ||
24 | # define _length_code z__length_code | ||
25 | # define _tr_align z__tr_align | ||
26 | # define _tr_flush_block z__tr_flush_block | ||
27 | # define _tr_init z__tr_init | ||
28 | # define _tr_stored_block z__tr_stored_block | ||
29 | # define _tr_tally z__tr_tally | ||
30 | # define adler32 z_adler32 | ||
31 | # define adler32_combine z_adler32_combine | ||
32 | # define adler32_combine64 z_adler32_combine64 | ||
33 | # ifndef Z_SOLO | ||
34 | # define compress z_compress | ||
35 | # define compress2 z_compress2 | ||
36 | # define compressBound z_compressBound | ||
37 | # endif | ||
38 | # define crc32 z_crc32 | ||
39 | # define crc32_combine z_crc32_combine | ||
40 | # define crc32_combine64 z_crc32_combine64 | ||
41 | # define deflate z_deflate | ||
42 | # define deflateBound z_deflateBound | ||
43 | # define deflateCopy z_deflateCopy | ||
44 | # define deflateEnd z_deflateEnd | ||
45 | # define deflateInit2_ z_deflateInit2_ | ||
46 | # define deflateInit_ z_deflateInit_ | ||
47 | # define deflateParams z_deflateParams | ||
48 | # define deflatePending z_deflatePending | ||
49 | # define deflatePrime z_deflatePrime | ||
50 | # define deflateReset z_deflateReset | ||
51 | # define deflateResetKeep z_deflateResetKeep | ||
52 | # define deflateSetDictionary z_deflateSetDictionary | ||
53 | # define deflateSetHeader z_deflateSetHeader | ||
54 | # define deflateTune z_deflateTune | ||
55 | # define deflate_copyright z_deflate_copyright | ||
56 | # define get_crc_table z_get_crc_table | ||
57 | # ifndef Z_SOLO | ||
58 | # define gz_error z_gz_error | ||
59 | # define gz_intmax z_gz_intmax | ||
60 | # define gz_strwinerror z_gz_strwinerror | ||
61 | # define gzbuffer z_gzbuffer | ||
62 | # define gzclearerr z_gzclearerr | ||
63 | # define gzclose z_gzclose | ||
64 | # define gzclose_r z_gzclose_r | ||
65 | # define gzclose_w z_gzclose_w | ||
66 | # define gzdirect z_gzdirect | ||
67 | # define gzdopen z_gzdopen | ||
68 | # define gzeof z_gzeof | ||
69 | # define gzerror z_gzerror | ||
70 | # define gzflush z_gzflush | ||
71 | # define gzgetc z_gzgetc | ||
72 | # define gzgetc_ z_gzgetc_ | ||
73 | # define gzgets z_gzgets | ||
74 | # define gzoffset z_gzoffset | ||
75 | # define gzoffset64 z_gzoffset64 | ||
76 | # define gzopen z_gzopen | ||
77 | # define gzopen64 z_gzopen64 | ||
78 | # ifdef _WIN32 | ||
79 | # define gzopen_w z_gzopen_w | ||
80 | # endif | ||
81 | # define gzprintf z_gzprintf | ||
82 | # define gzputc z_gzputc | ||
83 | # define gzputs z_gzputs | ||
84 | # define gzread z_gzread | ||
85 | # define gzrewind z_gzrewind | ||
86 | # define gzseek z_gzseek | ||
87 | # define gzseek64 z_gzseek64 | ||
88 | # define gzsetparams z_gzsetparams | ||
89 | # define gztell z_gztell | ||
90 | # define gztell64 z_gztell64 | ||
91 | # define gzungetc z_gzungetc | ||
92 | # define gzwrite z_gzwrite | ||
93 | # endif | ||
94 | # define inflate z_inflate | ||
95 | # define inflateBack z_inflateBack | ||
96 | # define inflateBackEnd z_inflateBackEnd | ||
97 | # define inflateBackInit_ z_inflateBackInit_ | ||
98 | # define inflateCopy z_inflateCopy | ||
99 | # define inflateEnd z_inflateEnd | ||
100 | # define inflateGetHeader z_inflateGetHeader | ||
101 | # define inflateInit2_ z_inflateInit2_ | ||
102 | # define inflateInit_ z_inflateInit_ | ||
103 | # define inflateMark z_inflateMark | ||
104 | # define inflatePrime z_inflatePrime | ||
105 | # define inflateReset z_inflateReset | ||
106 | # define inflateReset2 z_inflateReset2 | ||
107 | # define inflateSetDictionary z_inflateSetDictionary | ||
108 | # define inflateSync z_inflateSync | ||
109 | # define inflateSyncPoint z_inflateSyncPoint | ||
110 | # define inflateUndermine z_inflateUndermine | ||
111 | # define inflateResetKeep z_inflateResetKeep | ||
112 | # define inflate_copyright z_inflate_copyright | ||
113 | # define inflate_fast z_inflate_fast | ||
114 | # define inflate_table z_inflate_table | ||
115 | # ifndef Z_SOLO | ||
116 | # define uncompress z_uncompress | ||
117 | # endif | ||
118 | # define zError z_zError | ||
119 | # ifndef Z_SOLO | ||
120 | # define zcalloc z_zcalloc | ||
121 | # define zcfree z_zcfree | ||
122 | # endif | ||
123 | # define zlibCompileFlags z_zlibCompileFlags | ||
124 | # define zlibVersion z_zlibVersion | ||
125 | |||
126 | /* all zlib typedefs in zlib.h and zconf.h */ | ||
127 | # define Byte z_Byte | ||
128 | # define Bytef z_Bytef | ||
129 | # define alloc_func z_alloc_func | ||
130 | # define charf z_charf | ||
131 | # define free_func z_free_func | ||
132 | # ifndef Z_SOLO | ||
133 | # define gzFile z_gzFile | ||
134 | # endif | ||
135 | # define gz_header z_gz_header | ||
136 | # define gz_headerp z_gz_headerp | ||
137 | # define in_func z_in_func | ||
138 | # define intf z_intf | ||
139 | # define out_func z_out_func | ||
140 | # define uInt z_uInt | ||
141 | # define uIntf z_uIntf | ||
142 | # define uLong z_uLong | ||
143 | # define uLongf z_uLongf | ||
144 | # define voidp z_voidp | ||
145 | # define voidpc z_voidpc | ||
146 | # define voidpf z_voidpf | ||
147 | |||
148 | /* all zlib structs in zlib.h and zconf.h */ | ||
149 | # define gz_header_s z_gz_header_s | ||
150 | # define internal_state z_internal_state | ||
151 | |||
152 | #endif | ||
153 | |||
154 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
155 | # define MSDOS | ||
156 | #endif | ||
157 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | ||
158 | # define OS2 | ||
159 | #endif | ||
160 | #if defined(_WINDOWS) && !defined(WINDOWS) | ||
161 | # define WINDOWS | ||
162 | #endif | ||
163 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) | ||
164 | # ifndef WIN32 | ||
165 | # define WIN32 | ||
166 | # endif | ||
167 | #endif | ||
168 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) | ||
169 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) | ||
170 | # ifndef SYS16BIT | ||
171 | # define SYS16BIT | ||
172 | # endif | ||
173 | # endif | ||
174 | #endif | ||
175 | |||
176 | /* | ||
177 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
178 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
179 | */ | ||
180 | #ifdef SYS16BIT | ||
181 | # define MAXSEG_64K | ||
182 | #endif | ||
183 | #ifdef MSDOS | ||
184 | # define UNALIGNED_OK | ||
185 | #endif | ||
186 | |||
187 | #ifdef __STDC_VERSION__ | ||
188 | # ifndef STDC | ||
189 | # define STDC | ||
190 | # endif | ||
191 | # if __STDC_VERSION__ >= 199901L | ||
192 | # ifndef STDC99 | ||
193 | # define STDC99 | ||
194 | # endif | ||
195 | # endif | ||
196 | #endif | ||
197 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) | ||
198 | # define STDC | ||
199 | #endif | ||
200 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) | ||
201 | # define STDC | ||
202 | #endif | ||
203 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) | ||
204 | # define STDC | ||
205 | #endif | ||
206 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) | ||
207 | # define STDC | ||
208 | #endif | ||
209 | |||
210 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
211 | # define STDC | ||
212 | #endif | ||
213 | |||
214 | #ifndef STDC | ||
215 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
216 | # define const /* note: need a more gentle solution here */ | ||
217 | # endif | ||
218 | #endif | ||
219 | |||
220 | #if defined(ZLIB_CONST) && !defined(z_const) | ||
221 | # define z_const const | ||
222 | #else | ||
223 | # define z_const | ||
224 | #endif | ||
225 | |||
226 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
227 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | ||
228 | # define NO_DUMMY_DECL | ||
229 | #endif | ||
230 | |||
231 | /* Maximum value for memLevel in deflateInit2 */ | ||
232 | #ifndef MAX_MEM_LEVEL | ||
233 | # ifdef MAXSEG_64K | ||
234 | # define MAX_MEM_LEVEL 8 | ||
235 | # else | ||
236 | # define MAX_MEM_LEVEL 9 | ||
237 | # endif | ||
238 | #endif | ||
239 | |||
240 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
241 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
242 | * created by gzip. (Files created by minigzip can still be extracted by | ||
243 | * gzip.) | ||
244 | */ | ||
245 | #ifndef MAX_WBITS | ||
246 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
247 | #endif | ||
248 | |||
249 | /* The memory requirements for deflate are (in bytes): | ||
250 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
251 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
252 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
253 | the default memory requirements from 256K to 128K, compile with | ||
254 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
255 | Of course this will generally degrade compression (there's no free lunch). | ||
256 | |||
257 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
258 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
259 | for small objects. | ||
260 | */ | ||
261 | |||
262 | /* Type declarations */ | ||
263 | |||
264 | #ifndef OF /* function prototypes */ | ||
265 | # ifdef STDC | ||
266 | # define OF(args) args | ||
267 | # else | ||
268 | # define OF(args) () | ||
269 | # endif | ||
270 | #endif | ||
271 | |||
272 | #ifndef Z_ARG /* function prototypes for stdarg */ | ||
273 | # if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
274 | # define Z_ARG(args) args | ||
275 | # else | ||
276 | # define Z_ARG(args) () | ||
277 | # endif | ||
278 | #endif | ||
279 | |||
280 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
281 | * model programming (small or medium model with some far allocations). | ||
282 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
283 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
284 | * just define FAR to be empty. | ||
285 | */ | ||
286 | #ifdef SYS16BIT | ||
287 | # if defined(M_I86SM) || defined(M_I86MM) | ||
288 | /* MSC small or medium model */ | ||
289 | # define SMALL_MEDIUM | ||
290 | # ifdef _MSC_VER | ||
291 | # define FAR _far | ||
292 | # else | ||
293 | # define FAR far | ||
294 | # endif | ||
295 | # endif | ||
296 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
297 | /* Turbo C small or medium model */ | ||
298 | # define SMALL_MEDIUM | ||
299 | # ifdef __BORLANDC__ | ||
300 | # define FAR _far | ||
301 | # else | ||
302 | # define FAR far | ||
303 | # endif | ||
304 | # endif | ||
305 | #endif | ||
306 | |||
307 | #if defined(WINDOWS) || defined(WIN32) | ||
308 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
309 | * This is not mandatory, but it offers a little performance increase. | ||
310 | */ | ||
311 | # ifdef ZLIB_DLL | ||
312 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
313 | # ifdef ZLIB_INTERNAL | ||
314 | # define ZEXTERN extern __declspec(dllexport) | ||
315 | # else | ||
316 | # define ZEXTERN extern __declspec(dllimport) | ||
317 | # endif | ||
318 | # endif | ||
319 | # endif /* ZLIB_DLL */ | ||
320 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
321 | * define ZLIB_WINAPI. | ||
322 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
323 | */ | ||
324 | # ifdef ZLIB_WINAPI | ||
325 | # ifdef FAR | ||
326 | # undef FAR | ||
327 | # endif | ||
328 | # include <windows.h> | ||
329 | /* No need for _export, use ZLIB.DEF instead. */ | ||
330 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
331 | # define ZEXPORT WINAPI | ||
332 | # ifdef WIN32 | ||
333 | # define ZEXPORTVA WINAPIV | ||
334 | # else | ||
335 | # define ZEXPORTVA FAR CDECL | ||
336 | # endif | ||
337 | # endif | ||
338 | #endif | ||
339 | |||
340 | #if defined (__BEOS__) | ||
341 | # ifdef ZLIB_DLL | ||
342 | # ifdef ZLIB_INTERNAL | ||
343 | # define ZEXPORT __declspec(dllexport) | ||
344 | # define ZEXPORTVA __declspec(dllexport) | ||
345 | # else | ||
346 | # define ZEXPORT __declspec(dllimport) | ||
347 | # define ZEXPORTVA __declspec(dllimport) | ||
348 | # endif | ||
349 | # endif | ||
350 | #endif | ||
351 | |||
352 | #ifndef ZEXTERN | ||
353 | # define ZEXTERN extern | ||
354 | #endif | ||
355 | #ifndef ZEXPORT | ||
356 | # define ZEXPORT | ||
357 | #endif | ||
358 | #ifndef ZEXPORTVA | ||
359 | # define ZEXPORTVA | ||
360 | #endif | ||
361 | |||
362 | #ifndef FAR | ||
363 | # define FAR | ||
364 | #endif | ||
365 | |||
366 | #if !defined(__MACTYPES__) | ||
367 | typedef unsigned char Byte; /* 8 bits */ | ||
368 | #endif | ||
369 | typedef unsigned int uInt; /* 16 bits or more */ | ||
370 | typedef unsigned long uLong; /* 32 bits or more */ | ||
371 | |||
372 | #ifdef SMALL_MEDIUM | ||
373 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
374 | # define Bytef Byte FAR | ||
375 | #else | ||
376 | typedef Byte FAR Bytef; | ||
377 | #endif | ||
378 | typedef char FAR charf; | ||
379 | typedef int FAR intf; | ||
380 | typedef uInt FAR uIntf; | ||
381 | typedef uLong FAR uLongf; | ||
382 | |||
383 | #ifdef STDC | ||
384 | typedef void const *voidpc; | ||
385 | typedef void FAR *voidpf; | ||
386 | typedef void *voidp; | ||
387 | #else | ||
388 | typedef Byte const *voidpc; | ||
389 | typedef Byte FAR *voidpf; | ||
390 | typedef Byte *voidp; | ||
391 | #endif | ||
392 | |||
393 | /* ./configure may #define Z_U4 here */ | ||
394 | |||
395 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | ||
396 | # include <limits.h> | ||
397 | # if (UINT_MAX == 0xffffffffUL) | ||
398 | # define Z_U4 unsigned | ||
399 | # else | ||
400 | # if (ULONG_MAX == 0xffffffffUL) | ||
401 | # define Z_U4 unsigned long | ||
402 | # else | ||
403 | # if (USHRT_MAX == 0xffffffffUL) | ||
404 | # define Z_U4 unsigned short | ||
405 | # endif | ||
406 | # endif | ||
407 | # endif | ||
408 | #endif | ||
409 | |||
410 | #ifdef Z_U4 | ||
411 | typedef Z_U4 z_crc_t; | ||
412 | #else | ||
413 | typedef unsigned long z_crc_t; | ||
414 | #endif | ||
415 | |||
416 | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | ||
417 | # define Z_HAVE_UNISTD_H | ||
418 | #endif | ||
419 | |||
420 | #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | ||
421 | # define Z_HAVE_STDARG_H | ||
422 | #endif | ||
423 | |||
424 | #ifdef STDC | ||
425 | # ifndef Z_SOLO | ||
426 | # include <sys/types.h> /* for off_t */ | ||
427 | # endif | ||
428 | #endif | ||
429 | |||
430 | #ifdef _WIN32 | ||
431 | # include <stddef.h> /* for wchar_t */ | ||
432 | #endif | ||
433 | |||
434 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | ||
435 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | ||
436 | * though the former does not conform to the LFS document), but considering | ||
437 | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | ||
438 | * equivalently requesting no 64-bit operations | ||
439 | */ | ||
440 | #if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | ||
441 | # undef _LARGEFILE64_SOURCE | ||
442 | #endif | ||
443 | |||
444 | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | ||
445 | # define Z_HAVE_UNISTD_H | ||
446 | #endif | ||
447 | #ifndef Z_SOLO | ||
448 | # if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) | ||
449 | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | ||
450 | # ifdef VMS | ||
451 | # include <unixio.h> /* for off_t */ | ||
452 | # endif | ||
453 | # ifndef z_off_t | ||
454 | # define z_off_t off_t | ||
455 | # endif | ||
456 | # endif | ||
457 | #endif | ||
458 | |||
459 | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 | ||
460 | # define Z_LFS64 | ||
461 | #endif | ||
462 | |||
463 | #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) | ||
464 | # define Z_LARGE64 | ||
465 | #endif | ||
466 | |||
467 | #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) | ||
468 | # define Z_WANT64 | ||
469 | #endif | ||
470 | |||
471 | #if !defined(SEEK_SET) && !defined(Z_SOLO) | ||
472 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
473 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
474 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
475 | #endif | ||
476 | |||
477 | #ifndef z_off_t | ||
478 | # define z_off_t long | ||
479 | #endif | ||
480 | |||
481 | #if !defined(_WIN32) && defined(Z_LARGE64) | ||
482 | # define z_off64_t off64_t | ||
483 | #else | ||
484 | # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) | ||
485 | # define z_off64_t __int64 | ||
486 | # else | ||
487 | # define z_off64_t z_off_t | ||
488 | # endif | ||
489 | #endif | ||
490 | |||
491 | /* MVS linker does not support external names larger than 8 bytes */ | ||
492 | #if defined(__MVS__) | ||
493 | #pragma map(deflateInit_,"DEIN") | ||
494 | #pragma map(deflateInit2_,"DEIN2") | ||
495 | #pragma map(deflateEnd,"DEEND") | ||
496 | #pragma map(deflateBound,"DEBND") | ||
497 | #pragma map(inflateInit_,"ININ") | ||
498 | #pragma map(inflateInit2_,"ININ2") | ||
499 | #pragma map(inflateEnd,"INEND") | ||
500 | #pragma map(inflateSync,"INSY") | ||
501 | #pragma map(inflateSetDictionary,"INSEDI") | ||
502 | #pragma map(compressBound,"CMBND") | ||
503 | #pragma map(inflate_table,"INTABL") | ||
504 | #pragma map(inflate_fast,"INFA") | ||
505 | #pragma map(inflate_copyright,"INCOPY") | ||
506 | #endif | ||
507 | |||
508 | #endif /* ZCONF_H */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.in b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.in deleted file mode 100644 index 8a46a58..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zconf.h.in +++ /dev/null | |||
@@ -1,506 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #ifndef ZCONF_H | ||
9 | #define ZCONF_H | ||
10 | |||
11 | /* | ||
12 | * If you *really* need a unique prefix for all types and library functions, | ||
13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
14 | * Even better than compiling with -DZ_PREFIX would be to use configure to set | ||
15 | * this permanently in zconf.h using "./configure --zprefix". | ||
16 | */ | ||
17 | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | ||
18 | # define Z_PREFIX_SET | ||
19 | |||
20 | /* all linked symbols */ | ||
21 | # define _dist_code z__dist_code | ||
22 | # define _length_code z__length_code | ||
23 | # define _tr_align z__tr_align | ||
24 | # define _tr_flush_block z__tr_flush_block | ||
25 | # define _tr_init z__tr_init | ||
26 | # define _tr_stored_block z__tr_stored_block | ||
27 | # define _tr_tally z__tr_tally | ||
28 | # define adler32 z_adler32 | ||
29 | # define adler32_combine z_adler32_combine | ||
30 | # define adler32_combine64 z_adler32_combine64 | ||
31 | # ifndef Z_SOLO | ||
32 | # define compress z_compress | ||
33 | # define compress2 z_compress2 | ||
34 | # define compressBound z_compressBound | ||
35 | # endif | ||
36 | # define crc32 z_crc32 | ||
37 | # define crc32_combine z_crc32_combine | ||
38 | # define crc32_combine64 z_crc32_combine64 | ||
39 | # define deflate z_deflate | ||
40 | # define deflateBound z_deflateBound | ||
41 | # define deflateCopy z_deflateCopy | ||
42 | # define deflateEnd z_deflateEnd | ||
43 | # define deflateInit2_ z_deflateInit2_ | ||
44 | # define deflateInit_ z_deflateInit_ | ||
45 | # define deflateParams z_deflateParams | ||
46 | # define deflatePending z_deflatePending | ||
47 | # define deflatePrime z_deflatePrime | ||
48 | # define deflateReset z_deflateReset | ||
49 | # define deflateResetKeep z_deflateResetKeep | ||
50 | # define deflateSetDictionary z_deflateSetDictionary | ||
51 | # define deflateSetHeader z_deflateSetHeader | ||
52 | # define deflateTune z_deflateTune | ||
53 | # define deflate_copyright z_deflate_copyright | ||
54 | # define get_crc_table z_get_crc_table | ||
55 | # ifndef Z_SOLO | ||
56 | # define gz_error z_gz_error | ||
57 | # define gz_intmax z_gz_intmax | ||
58 | # define gz_strwinerror z_gz_strwinerror | ||
59 | # define gzbuffer z_gzbuffer | ||
60 | # define gzclearerr z_gzclearerr | ||
61 | # define gzclose z_gzclose | ||
62 | # define gzclose_r z_gzclose_r | ||
63 | # define gzclose_w z_gzclose_w | ||
64 | # define gzdirect z_gzdirect | ||
65 | # define gzdopen z_gzdopen | ||
66 | # define gzeof z_gzeof | ||
67 | # define gzerror z_gzerror | ||
68 | # define gzflush z_gzflush | ||
69 | # define gzgetc z_gzgetc | ||
70 | # define gzgetc_ z_gzgetc_ | ||
71 | # define gzgets z_gzgets | ||
72 | # define gzoffset z_gzoffset | ||
73 | # define gzoffset64 z_gzoffset64 | ||
74 | # define gzopen z_gzopen | ||
75 | # define gzopen64 z_gzopen64 | ||
76 | # ifdef _WIN32 | ||
77 | # define gzopen_w z_gzopen_w | ||
78 | # endif | ||
79 | # define gzprintf z_gzprintf | ||
80 | # define gzputc z_gzputc | ||
81 | # define gzputs z_gzputs | ||
82 | # define gzread z_gzread | ||
83 | # define gzrewind z_gzrewind | ||
84 | # define gzseek z_gzseek | ||
85 | # define gzseek64 z_gzseek64 | ||
86 | # define gzsetparams z_gzsetparams | ||
87 | # define gztell z_gztell | ||
88 | # define gztell64 z_gztell64 | ||
89 | # define gzungetc z_gzungetc | ||
90 | # define gzwrite z_gzwrite | ||
91 | # endif | ||
92 | # define inflate z_inflate | ||
93 | # define inflateBack z_inflateBack | ||
94 | # define inflateBackEnd z_inflateBackEnd | ||
95 | # define inflateBackInit_ z_inflateBackInit_ | ||
96 | # define inflateCopy z_inflateCopy | ||
97 | # define inflateEnd z_inflateEnd | ||
98 | # define inflateGetHeader z_inflateGetHeader | ||
99 | # define inflateInit2_ z_inflateInit2_ | ||
100 | # define inflateInit_ z_inflateInit_ | ||
101 | # define inflateMark z_inflateMark | ||
102 | # define inflatePrime z_inflatePrime | ||
103 | # define inflateReset z_inflateReset | ||
104 | # define inflateReset2 z_inflateReset2 | ||
105 | # define inflateSetDictionary z_inflateSetDictionary | ||
106 | # define inflateSync z_inflateSync | ||
107 | # define inflateSyncPoint z_inflateSyncPoint | ||
108 | # define inflateUndermine z_inflateUndermine | ||
109 | # define inflateResetKeep z_inflateResetKeep | ||
110 | # define inflate_copyright z_inflate_copyright | ||
111 | # define inflate_fast z_inflate_fast | ||
112 | # define inflate_table z_inflate_table | ||
113 | # ifndef Z_SOLO | ||
114 | # define uncompress z_uncompress | ||
115 | # endif | ||
116 | # define zError z_zError | ||
117 | # ifndef Z_SOLO | ||
118 | # define zcalloc z_zcalloc | ||
119 | # define zcfree z_zcfree | ||
120 | # endif | ||
121 | # define zlibCompileFlags z_zlibCompileFlags | ||
122 | # define zlibVersion z_zlibVersion | ||
123 | |||
124 | /* all zlib typedefs in zlib.h and zconf.h */ | ||
125 | # define Byte z_Byte | ||
126 | # define Bytef z_Bytef | ||
127 | # define alloc_func z_alloc_func | ||
128 | # define charf z_charf | ||
129 | # define free_func z_free_func | ||
130 | # ifndef Z_SOLO | ||
131 | # define gzFile z_gzFile | ||
132 | # endif | ||
133 | # define gz_header z_gz_header | ||
134 | # define gz_headerp z_gz_headerp | ||
135 | # define in_func z_in_func | ||
136 | # define intf z_intf | ||
137 | # define out_func z_out_func | ||
138 | # define uInt z_uInt | ||
139 | # define uIntf z_uIntf | ||
140 | # define uLong z_uLong | ||
141 | # define uLongf z_uLongf | ||
142 | # define voidp z_voidp | ||
143 | # define voidpc z_voidpc | ||
144 | # define voidpf z_voidpf | ||
145 | |||
146 | /* all zlib structs in zlib.h and zconf.h */ | ||
147 | # define gz_header_s z_gz_header_s | ||
148 | # define internal_state z_internal_state | ||
149 | |||
150 | #endif | ||
151 | |||
152 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
153 | # define MSDOS | ||
154 | #endif | ||
155 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | ||
156 | # define OS2 | ||
157 | #endif | ||
158 | #if defined(_WINDOWS) && !defined(WINDOWS) | ||
159 | # define WINDOWS | ||
160 | #endif | ||
161 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) | ||
162 | # ifndef WIN32 | ||
163 | # define WIN32 | ||
164 | # endif | ||
165 | #endif | ||
166 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) | ||
167 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) | ||
168 | # ifndef SYS16BIT | ||
169 | # define SYS16BIT | ||
170 | # endif | ||
171 | # endif | ||
172 | #endif | ||
173 | |||
174 | /* | ||
175 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
176 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
177 | */ | ||
178 | #ifdef SYS16BIT | ||
179 | # define MAXSEG_64K | ||
180 | #endif | ||
181 | #ifdef MSDOS | ||
182 | # define UNALIGNED_OK | ||
183 | #endif | ||
184 | |||
185 | #ifdef __STDC_VERSION__ | ||
186 | # ifndef STDC | ||
187 | # define STDC | ||
188 | # endif | ||
189 | # if __STDC_VERSION__ >= 199901L | ||
190 | # ifndef STDC99 | ||
191 | # define STDC99 | ||
192 | # endif | ||
193 | # endif | ||
194 | #endif | ||
195 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) | ||
196 | # define STDC | ||
197 | #endif | ||
198 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) | ||
199 | # define STDC | ||
200 | #endif | ||
201 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) | ||
202 | # define STDC | ||
203 | #endif | ||
204 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) | ||
205 | # define STDC | ||
206 | #endif | ||
207 | |||
208 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
209 | # define STDC | ||
210 | #endif | ||
211 | |||
212 | #ifndef STDC | ||
213 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
214 | # define const /* note: need a more gentle solution here */ | ||
215 | # endif | ||
216 | #endif | ||
217 | |||
218 | #if defined(ZLIB_CONST) && !defined(z_const) | ||
219 | # define z_const const | ||
220 | #else | ||
221 | # define z_const | ||
222 | #endif | ||
223 | |||
224 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
225 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | ||
226 | # define NO_DUMMY_DECL | ||
227 | #endif | ||
228 | |||
229 | /* Maximum value for memLevel in deflateInit2 */ | ||
230 | #ifndef MAX_MEM_LEVEL | ||
231 | # ifdef MAXSEG_64K | ||
232 | # define MAX_MEM_LEVEL 8 | ||
233 | # else | ||
234 | # define MAX_MEM_LEVEL 9 | ||
235 | # endif | ||
236 | #endif | ||
237 | |||
238 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
239 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
240 | * created by gzip. (Files created by minigzip can still be extracted by | ||
241 | * gzip.) | ||
242 | */ | ||
243 | #ifndef MAX_WBITS | ||
244 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
245 | #endif | ||
246 | |||
247 | /* The memory requirements for deflate are (in bytes): | ||
248 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
249 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
250 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
251 | the default memory requirements from 256K to 128K, compile with | ||
252 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
253 | Of course this will generally degrade compression (there's no free lunch). | ||
254 | |||
255 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
256 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
257 | for small objects. | ||
258 | */ | ||
259 | |||
260 | /* Type declarations */ | ||
261 | |||
262 | #ifndef OF /* function prototypes */ | ||
263 | # ifdef STDC | ||
264 | # define OF(args) args | ||
265 | # else | ||
266 | # define OF(args) () | ||
267 | # endif | ||
268 | #endif | ||
269 | |||
270 | #ifndef Z_ARG /* function prototypes for stdarg */ | ||
271 | # if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
272 | # define Z_ARG(args) args | ||
273 | # else | ||
274 | # define Z_ARG(args) () | ||
275 | # endif | ||
276 | #endif | ||
277 | |||
278 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
279 | * model programming (small or medium model with some far allocations). | ||
280 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
281 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
282 | * just define FAR to be empty. | ||
283 | */ | ||
284 | #ifdef SYS16BIT | ||
285 | # if defined(M_I86SM) || defined(M_I86MM) | ||
286 | /* MSC small or medium model */ | ||
287 | # define SMALL_MEDIUM | ||
288 | # ifdef _MSC_VER | ||
289 | # define FAR _far | ||
290 | # else | ||
291 | # define FAR far | ||
292 | # endif | ||
293 | # endif | ||
294 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
295 | /* Turbo C small or medium model */ | ||
296 | # define SMALL_MEDIUM | ||
297 | # ifdef __BORLANDC__ | ||
298 | # define FAR _far | ||
299 | # else | ||
300 | # define FAR far | ||
301 | # endif | ||
302 | # endif | ||
303 | #endif | ||
304 | |||
305 | #if defined(WINDOWS) || defined(WIN32) | ||
306 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
307 | * This is not mandatory, but it offers a little performance increase. | ||
308 | */ | ||
309 | # ifdef ZLIB_DLL | ||
310 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
311 | # ifdef ZLIB_INTERNAL | ||
312 | # define ZEXTERN extern __declspec(dllexport) | ||
313 | # else | ||
314 | # define ZEXTERN extern __declspec(dllimport) | ||
315 | # endif | ||
316 | # endif | ||
317 | # endif /* ZLIB_DLL */ | ||
318 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
319 | * define ZLIB_WINAPI. | ||
320 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
321 | */ | ||
322 | # ifdef ZLIB_WINAPI | ||
323 | # ifdef FAR | ||
324 | # undef FAR | ||
325 | # endif | ||
326 | # include <windows.h> | ||
327 | /* No need for _export, use ZLIB.DEF instead. */ | ||
328 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
329 | # define ZEXPORT WINAPI | ||
330 | # ifdef WIN32 | ||
331 | # define ZEXPORTVA WINAPIV | ||
332 | # else | ||
333 | # define ZEXPORTVA FAR CDECL | ||
334 | # endif | ||
335 | # endif | ||
336 | #endif | ||
337 | |||
338 | #if defined (__BEOS__) | ||
339 | # ifdef ZLIB_DLL | ||
340 | # ifdef ZLIB_INTERNAL | ||
341 | # define ZEXPORT __declspec(dllexport) | ||
342 | # define ZEXPORTVA __declspec(dllexport) | ||
343 | # else | ||
344 | # define ZEXPORT __declspec(dllimport) | ||
345 | # define ZEXPORTVA __declspec(dllimport) | ||
346 | # endif | ||
347 | # endif | ||
348 | #endif | ||
349 | |||
350 | #ifndef ZEXTERN | ||
351 | # define ZEXTERN extern | ||
352 | #endif | ||
353 | #ifndef ZEXPORT | ||
354 | # define ZEXPORT | ||
355 | #endif | ||
356 | #ifndef ZEXPORTVA | ||
357 | # define ZEXPORTVA | ||
358 | #endif | ||
359 | |||
360 | #ifndef FAR | ||
361 | # define FAR | ||
362 | #endif | ||
363 | |||
364 | #if !defined(__MACTYPES__) | ||
365 | typedef unsigned char Byte; /* 8 bits */ | ||
366 | #endif | ||
367 | typedef unsigned int uInt; /* 16 bits or more */ | ||
368 | typedef unsigned long uLong; /* 32 bits or more */ | ||
369 | |||
370 | #ifdef SMALL_MEDIUM | ||
371 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
372 | # define Bytef Byte FAR | ||
373 | #else | ||
374 | typedef Byte FAR Bytef; | ||
375 | #endif | ||
376 | typedef char FAR charf; | ||
377 | typedef int FAR intf; | ||
378 | typedef uInt FAR uIntf; | ||
379 | typedef uLong FAR uLongf; | ||
380 | |||
381 | #ifdef STDC | ||
382 | typedef void const *voidpc; | ||
383 | typedef void FAR *voidpf; | ||
384 | typedef void *voidp; | ||
385 | #else | ||
386 | typedef Byte const *voidpc; | ||
387 | typedef Byte FAR *voidpf; | ||
388 | typedef Byte *voidp; | ||
389 | #endif | ||
390 | |||
391 | /* ./configure may #define Z_U4 here */ | ||
392 | |||
393 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | ||
394 | # include <limits.h> | ||
395 | # if (UINT_MAX == 0xffffffffUL) | ||
396 | # define Z_U4 unsigned | ||
397 | # else | ||
398 | # if (ULONG_MAX == 0xffffffffUL) | ||
399 | # define Z_U4 unsigned long | ||
400 | # else | ||
401 | # if (USHRT_MAX == 0xffffffffUL) | ||
402 | # define Z_U4 unsigned short | ||
403 | # endif | ||
404 | # endif | ||
405 | # endif | ||
406 | #endif | ||
407 | |||
408 | #ifdef Z_U4 | ||
409 | typedef Z_U4 z_crc_t; | ||
410 | #else | ||
411 | typedef unsigned long z_crc_t; | ||
412 | #endif | ||
413 | |||
414 | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | ||
415 | # define Z_HAVE_UNISTD_H | ||
416 | #endif | ||
417 | |||
418 | #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | ||
419 | # define Z_HAVE_STDARG_H | ||
420 | #endif | ||
421 | |||
422 | #ifdef STDC | ||
423 | # ifndef Z_SOLO | ||
424 | # include <sys/types.h> /* for off_t */ | ||
425 | # endif | ||
426 | #endif | ||
427 | |||
428 | #ifdef _WIN32 | ||
429 | # include <stddef.h> /* for wchar_t */ | ||
430 | #endif | ||
431 | |||
432 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | ||
433 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | ||
434 | * though the former does not conform to the LFS document), but considering | ||
435 | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | ||
436 | * equivalently requesting no 64-bit operations | ||
437 | */ | ||
438 | #if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | ||
439 | # undef _LARGEFILE64_SOURCE | ||
440 | #endif | ||
441 | |||
442 | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | ||
443 | # define Z_HAVE_UNISTD_H | ||
444 | #endif | ||
445 | #ifndef Z_SOLO | ||
446 | # if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) | ||
447 | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | ||
448 | # ifdef VMS | ||
449 | # include <unixio.h> /* for off_t */ | ||
450 | # endif | ||
451 | # ifndef z_off_t | ||
452 | # define z_off_t off_t | ||
453 | # endif | ||
454 | # endif | ||
455 | #endif | ||
456 | |||
457 | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 | ||
458 | # define Z_LFS64 | ||
459 | #endif | ||
460 | |||
461 | #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) | ||
462 | # define Z_LARGE64 | ||
463 | #endif | ||
464 | |||
465 | #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) | ||
466 | # define Z_WANT64 | ||
467 | #endif | ||
468 | |||
469 | #if !defined(SEEK_SET) && !defined(Z_SOLO) | ||
470 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
471 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
472 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
473 | #endif | ||
474 | |||
475 | #ifndef z_off_t | ||
476 | # define z_off_t long | ||
477 | #endif | ||
478 | |||
479 | #if !defined(_WIN32) && defined(Z_LARGE64) | ||
480 | # define z_off64_t off64_t | ||
481 | #else | ||
482 | # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) | ||
483 | # define z_off64_t __int64 | ||
484 | # else | ||
485 | # define z_off64_t z_off_t | ||
486 | # endif | ||
487 | #endif | ||
488 | |||
489 | /* MVS linker does not support external names larger than 8 bytes */ | ||
490 | #if defined(__MVS__) | ||
491 | #pragma map(deflateInit_,"DEIN") | ||
492 | #pragma map(deflateInit2_,"DEIN2") | ||
493 | #pragma map(deflateEnd,"DEEND") | ||
494 | #pragma map(deflateBound,"DEBND") | ||
495 | #pragma map(inflateInit_,"ININ") | ||
496 | #pragma map(inflateInit2_,"ININ2") | ||
497 | #pragma map(inflateEnd,"INEND") | ||
498 | #pragma map(inflateSync,"INSY") | ||
499 | #pragma map(inflateSetDictionary,"INSEDI") | ||
500 | #pragma map(compressBound,"CMBND") | ||
501 | #pragma map(inflate_table,"INTABL") | ||
502 | #pragma map(inflate_fast,"INFA") | ||
503 | #pragma map(inflate_copyright,"INCOPY") | ||
504 | #endif | ||
505 | |||
506 | #endif /* ZCONF_H */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3 b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3 deleted file mode 100644 index 79d3402..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3 +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | .TH ZLIB 3 "2 May 2012" | ||
2 | .SH NAME | ||
3 | zlib \- compression/decompression library | ||
4 | .SH SYNOPSIS | ||
5 | [see | ||
6 | .I zlib.h | ||
7 | for full description] | ||
8 | .SH DESCRIPTION | ||
9 | The | ||
10 | .I zlib | ||
11 | library is a general purpose data compression library. | ||
12 | The code is thread safe, assuming that the standard library functions | ||
13 | used are thread safe, such as memory allocation routines. | ||
14 | It provides in-memory compression and decompression functions, | ||
15 | including integrity checks of the uncompressed data. | ||
16 | This version of the library supports only one compression method (deflation) | ||
17 | but other algorithms may be added later | ||
18 | with the same stream interface. | ||
19 | .LP | ||
20 | Compression can be done in a single step if the buffers are large enough | ||
21 | or can be done by repeated calls of the compression function. | ||
22 | In the latter case, | ||
23 | the application must provide more input and/or consume the output | ||
24 | (providing more output space) before each call. | ||
25 | .LP | ||
26 | The library also supports reading and writing files in | ||
27 | .IR gzip (1) | ||
28 | (.gz) format | ||
29 | with an interface similar to that of stdio. | ||
30 | .LP | ||
31 | The library does not install any signal handler. | ||
32 | The decoder checks the consistency of the compressed data, | ||
33 | so the library should never crash even in the case of corrupted input. | ||
34 | .LP | ||
35 | All functions of the compression library are documented in the file | ||
36 | .IR zlib.h . | ||
37 | The distribution source includes examples of use of the library | ||
38 | in the files | ||
39 | .I test/example.c | ||
40 | and | ||
41 | .IR test/minigzip.c, | ||
42 | as well as other examples in the | ||
43 | .IR examples/ | ||
44 | directory. | ||
45 | .LP | ||
46 | Changes to this version are documented in the file | ||
47 | .I ChangeLog | ||
48 | that accompanies the source. | ||
49 | .LP | ||
50 | .I zlib | ||
51 | is available in Java using the java.util.zip package: | ||
52 | .IP | ||
53 | http://java.sun.com/developer/technicalArticles/Programming/compression/ | ||
54 | .LP | ||
55 | A Perl interface to | ||
56 | .IR zlib , | ||
57 | written by Paul Marquess (pmqs@cpan.org), | ||
58 | is available at CPAN (Comprehensive Perl Archive Network) sites, | ||
59 | including: | ||
60 | .IP | ||
61 | http://search.cpan.org/~pmqs/IO-Compress-Zlib/ | ||
62 | .LP | ||
63 | A Python interface to | ||
64 | .IR zlib , | ||
65 | written by A.M. Kuchling (amk@magnet.com), | ||
66 | is available in Python 1.5 and later versions: | ||
67 | .IP | ||
68 | http://docs.python.org/library/zlib.html | ||
69 | .LP | ||
70 | .I zlib | ||
71 | is built into | ||
72 | .IR tcl: | ||
73 | .IP | ||
74 | http://wiki.tcl.tk/4610 | ||
75 | .LP | ||
76 | An experimental package to read and write files in .zip format, | ||
77 | written on top of | ||
78 | .I zlib | ||
79 | by Gilles Vollant (info@winimage.com), | ||
80 | is available at: | ||
81 | .IP | ||
82 | http://www.winimage.com/zLibDll/minizip.html | ||
83 | and also in the | ||
84 | .I contrib/minizip | ||
85 | directory of the main | ||
86 | .I zlib | ||
87 | source distribution. | ||
88 | .SH "SEE ALSO" | ||
89 | The | ||
90 | .I zlib | ||
91 | web site can be found at: | ||
92 | .IP | ||
93 | http://zlib.net/ | ||
94 | .LP | ||
95 | The data format used by the zlib library is described by RFC | ||
96 | (Request for Comments) 1950 to 1952 in the files: | ||
97 | .IP | ||
98 | http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format) | ||
99 | .br | ||
100 | http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format) | ||
101 | .br | ||
102 | http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format) | ||
103 | .LP | ||
104 | Mark Nelson wrote an article about | ||
105 | .I zlib | ||
106 | for the Jan. 1997 issue of Dr. Dobb's Journal; | ||
107 | a copy of the article is available at: | ||
108 | .IP | ||
109 | http://marknelson.us/1997/01/01/zlib-engine/ | ||
110 | .SH "REPORTING PROBLEMS" | ||
111 | Before reporting a problem, | ||
112 | please check the | ||
113 | .I zlib | ||
114 | web site to verify that you have the latest version of | ||
115 | .IR zlib ; | ||
116 | otherwise, | ||
117 | obtain the latest version and see if the problem still exists. | ||
118 | Please read the | ||
119 | .I zlib | ||
120 | FAQ at: | ||
121 | .IP | ||
122 | http://zlib.net/zlib_faq.html | ||
123 | .LP | ||
124 | before asking for help. | ||
125 | Send questions and/or comments to zlib@gzip.org, | ||
126 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). | ||
127 | .SH AUTHORS | ||
128 | Version 1.2.7 | ||
129 | Copyright (C) 1995-2012 Jean-loup Gailly (jloup@gzip.org) | ||
130 | and Mark Adler (madler@alumni.caltech.edu). | ||
131 | .LP | ||
132 | This software is provided "as-is," | ||
133 | without any express or implied warranty. | ||
134 | In no event will the authors be held liable for any damages | ||
135 | arising from the use of this software. | ||
136 | See the distribution directory with respect to requirements | ||
137 | governing redistribution. | ||
138 | The deflate format used by | ||
139 | .I zlib | ||
140 | was defined by Phil Katz. | ||
141 | The deflate and | ||
142 | .I zlib | ||
143 | specifications were written by L. Peter Deutsch. | ||
144 | Thanks to all the people who reported problems and suggested various | ||
145 | improvements in | ||
146 | .IR zlib ; | ||
147 | who are too numerous to cite here. | ||
148 | .LP | ||
149 | UNIX manual page by R. P. C. Rodgers, | ||
150 | U.S. National Library of Medicine (rodgers@nlm.nih.gov). | ||
151 | .\" end of man page | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3.pdf b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3.pdf deleted file mode 100644 index 485306c..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.3.pdf +++ /dev/null | |||
Binary files differ | |||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.h deleted file mode 100644 index be12096..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.h +++ /dev/null | |||
@@ -1,1744 +0,0 @@ | |||
1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | ||
2 | version 1.2.7, May 2nd, 2012 | ||
3 | |||
4 | Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler | ||
5 | |||
6 | This software is provided 'as-is', without any express or implied | ||
7 | warranty. In no event will the authors 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. | ||
21 | |||
22 | Jean-loup Gailly Mark Adler | ||
23 | jloup@gzip.org madler@alumni.caltech.edu | ||
24 | |||
25 | |||
26 | The data format used by the zlib library is described by RFCs (Request for | ||
27 | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 | ||
28 | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). | ||
29 | */ | ||
30 | |||
31 | #ifndef ZLIB_H | ||
32 | #define ZLIB_H | ||
33 | |||
34 | #include "zconf.h" | ||
35 | |||
36 | #ifdef __cplusplus | ||
37 | extern "C" { | ||
38 | #endif | ||
39 | |||
40 | #define ZLIB_VERSION "1.2.7" | ||
41 | #define ZLIB_VERNUM 0x1270 | ||
42 | #define ZLIB_VER_MAJOR 1 | ||
43 | #define ZLIB_VER_MINOR 2 | ||
44 | #define ZLIB_VER_REVISION 7 | ||
45 | #define ZLIB_VER_SUBREVISION 0 | ||
46 | |||
47 | /* | ||
48 | The 'zlib' compression library provides in-memory compression and | ||
49 | decompression functions, including integrity checks of the uncompressed data. | ||
50 | This version of the library supports only one compression method (deflation) | ||
51 | but other algorithms will be added later and will have the same stream | ||
52 | interface. | ||
53 | |||
54 | Compression can be done in a single step if the buffers are large enough, | ||
55 | or can be done by repeated calls of the compression function. In the latter | ||
56 | case, the application must provide more input and/or consume the output | ||
57 | (providing more output space) before each call. | ||
58 | |||
59 | The compressed data format used by default by the in-memory functions is | ||
60 | the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped | ||
61 | around a deflate stream, which is itself documented in RFC 1951. | ||
62 | |||
63 | The library also supports reading and writing files in gzip (.gz) format | ||
64 | with an interface similar to that of stdio using the functions that start | ||
65 | with "gz". The gzip format is different from the zlib format. gzip is a | ||
66 | gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. | ||
67 | |||
68 | This library can optionally read and write gzip streams in memory as well. | ||
69 | |||
70 | The zlib format was designed to be compact and fast for use in memory | ||
71 | and on communications channels. The gzip format was designed for single- | ||
72 | file compression on file systems, has a larger header than zlib to maintain | ||
73 | directory information, and uses a different, slower check method than zlib. | ||
74 | |||
75 | The library does not install any signal handler. The decoder checks | ||
76 | the consistency of the compressed data, so the library should never crash | ||
77 | even in case of corrupted input. | ||
78 | */ | ||
79 | |||
80 | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | ||
81 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); | ||
82 | |||
83 | struct internal_state; | ||
84 | |||
85 | typedef struct z_stream_s { | ||
86 | z_const Bytef *next_in; /* next input byte */ | ||
87 | uInt avail_in; /* number of bytes available at next_in */ | ||
88 | uLong total_in; /* total number of input bytes read so far */ | ||
89 | |||
90 | Bytef *next_out; /* next output byte should be put there */ | ||
91 | uInt avail_out; /* remaining free space at next_out */ | ||
92 | uLong total_out; /* total number of bytes output so far */ | ||
93 | |||
94 | z_const char *msg; /* last error message, NULL if no error */ | ||
95 | struct internal_state FAR *state; /* not visible by applications */ | ||
96 | |||
97 | alloc_func zalloc; /* used to allocate the internal state */ | ||
98 | free_func zfree; /* used to free the internal state */ | ||
99 | voidpf opaque; /* private data object passed to zalloc and zfree */ | ||
100 | |||
101 | int data_type; /* best guess about the data type: binary or text */ | ||
102 | uLong adler; /* adler32 value of the uncompressed data */ | ||
103 | uLong reserved; /* reserved for future use */ | ||
104 | } z_stream; | ||
105 | |||
106 | typedef z_stream FAR *z_streamp; | ||
107 | |||
108 | /* | ||
109 | gzip header information passed to and from zlib routines. See RFC 1952 | ||
110 | for more details on the meanings of these fields. | ||
111 | */ | ||
112 | typedef struct gz_header_s { | ||
113 | int text; /* true if compressed data believed to be text */ | ||
114 | uLong time; /* modification time */ | ||
115 | int xflags; /* extra flags (not used when writing a gzip file) */ | ||
116 | int os; /* operating system */ | ||
117 | Bytef *extra; /* pointer to extra field or Z_NULL if none */ | ||
118 | uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ | ||
119 | uInt extra_max; /* space at extra (only when reading header) */ | ||
120 | Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ | ||
121 | uInt name_max; /* space at name (only when reading header) */ | ||
122 | Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ | ||
123 | uInt comm_max; /* space at comment (only when reading header) */ | ||
124 | int hcrc; /* true if there was or will be a header crc */ | ||
125 | int done; /* true when done reading gzip header (not used | ||
126 | when writing a gzip file) */ | ||
127 | } gz_header; | ||
128 | |||
129 | typedef gz_header FAR *gz_headerp; | ||
130 | |||
131 | /* | ||
132 | The application must update next_in and avail_in when avail_in has dropped | ||
133 | to zero. It must update next_out and avail_out when avail_out has dropped | ||
134 | to zero. The application must initialize zalloc, zfree and opaque before | ||
135 | calling the init function. All other fields are set by the compression | ||
136 | library and must not be updated by the application. | ||
137 | |||
138 | The opaque value provided by the application will be passed as the first | ||
139 | parameter for calls of zalloc and zfree. This can be useful for custom | ||
140 | memory management. The compression library attaches no meaning to the | ||
141 | opaque value. | ||
142 | |||
143 | zalloc must return Z_NULL if there is not enough memory for the object. | ||
144 | If zlib is used in a multi-threaded application, zalloc and zfree must be | ||
145 | thread safe. | ||
146 | |||
147 | On 16-bit systems, the functions zalloc and zfree must be able to allocate | ||
148 | exactly 65536 bytes, but will not be required to allocate more than this if | ||
149 | the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers | ||
150 | returned by zalloc for objects of exactly 65536 bytes *must* have their | ||
151 | offset normalized to zero. The default allocation function provided by this | ||
152 | library ensures this (see zutil.c). To reduce memory requirements and avoid | ||
153 | any allocation of 64K objects, at the expense of compression ratio, compile | ||
154 | the library with -DMAX_WBITS=14 (see zconf.h). | ||
155 | |||
156 | The fields total_in and total_out can be used for statistics or progress | ||
157 | reports. After compression, total_in holds the total size of the | ||
158 | uncompressed data and may be saved for use in the decompressor (particularly | ||
159 | if the decompressor wants to decompress everything in a single step). | ||
160 | */ | ||
161 | |||
162 | /* constants */ | ||
163 | |||
164 | #define Z_NO_FLUSH 0 | ||
165 | #define Z_PARTIAL_FLUSH 1 | ||
166 | #define Z_SYNC_FLUSH 2 | ||
167 | #define Z_FULL_FLUSH 3 | ||
168 | #define Z_FINISH 4 | ||
169 | #define Z_BLOCK 5 | ||
170 | #define Z_TREES 6 | ||
171 | /* Allowed flush values; see deflate() and inflate() below for details */ | ||
172 | |||
173 | #define Z_OK 0 | ||
174 | #define Z_STREAM_END 1 | ||
175 | #define Z_NEED_DICT 2 | ||
176 | #define Z_ERRNO (-1) | ||
177 | #define Z_STREAM_ERROR (-2) | ||
178 | #define Z_DATA_ERROR (-3) | ||
179 | #define Z_MEM_ERROR (-4) | ||
180 | #define Z_BUF_ERROR (-5) | ||
181 | #define Z_VERSION_ERROR (-6) | ||
182 | /* Return codes for the compression/decompression functions. Negative values | ||
183 | * are errors, positive values are used for special but normal events. | ||
184 | */ | ||
185 | |||
186 | #define Z_NO_COMPRESSION 0 | ||
187 | #define Z_BEST_SPEED 1 | ||
188 | #define Z_BEST_COMPRESSION 9 | ||
189 | #define Z_DEFAULT_COMPRESSION (-1) | ||
190 | /* compression levels */ | ||
191 | |||
192 | #define Z_FILTERED 1 | ||
193 | #define Z_HUFFMAN_ONLY 2 | ||
194 | #define Z_RLE 3 | ||
195 | #define Z_FIXED 4 | ||
196 | #define Z_DEFAULT_STRATEGY 0 | ||
197 | /* compression strategy; see deflateInit2() below for details */ | ||
198 | |||
199 | #define Z_BINARY 0 | ||
200 | #define Z_TEXT 1 | ||
201 | #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ | ||
202 | #define Z_UNKNOWN 2 | ||
203 | /* Possible values of the data_type field (though see inflate()) */ | ||
204 | |||
205 | #define Z_DEFLATED 8 | ||
206 | /* The deflate compression method (the only one supported in this version) */ | ||
207 | |||
208 | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | ||
209 | |||
210 | #define zlib_version zlibVersion() | ||
211 | /* for compatibility with versions < 1.0.2 */ | ||
212 | |||
213 | |||
214 | /* basic functions */ | ||
215 | |||
216 | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); | ||
217 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | ||
218 | If the first character differs, the library code actually used is not | ||
219 | compatible with the zlib.h header file used by the application. This check | ||
220 | is automatically made by deflateInit and inflateInit. | ||
221 | */ | ||
222 | |||
223 | /* | ||
224 | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); | ||
225 | |||
226 | Initializes the internal stream state for compression. The fields | ||
227 | zalloc, zfree and opaque must be initialized before by the caller. If | ||
228 | zalloc and zfree are set to Z_NULL, deflateInit updates them to use default | ||
229 | allocation functions. | ||
230 | |||
231 | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | ||
232 | 1 gives best speed, 9 gives best compression, 0 gives no compression at all | ||
233 | (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION | ||
234 | requests a default compromise between speed and compression (currently | ||
235 | equivalent to level 6). | ||
236 | |||
237 | deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
238 | memory, Z_STREAM_ERROR if level is not a valid compression level, or | ||
239 | Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible | ||
240 | with the version assumed by the caller (ZLIB_VERSION). msg is set to null | ||
241 | if there is no error message. deflateInit does not perform any compression: | ||
242 | this will be done by deflate(). | ||
243 | */ | ||
244 | |||
245 | |||
246 | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | ||
247 | /* | ||
248 | deflate compresses as much data as possible, and stops when the input | ||
249 | buffer becomes empty or the output buffer becomes full. It may introduce | ||
250 | some output latency (reading input without producing any output) except when | ||
251 | forced to flush. | ||
252 | |||
253 | The detailed semantics are as follows. deflate performs one or both of the | ||
254 | following actions: | ||
255 | |||
256 | - Compress more input starting at next_in and update next_in and avail_in | ||
257 | accordingly. If not all input can be processed (because there is not | ||
258 | enough room in the output buffer), next_in and avail_in are updated and | ||
259 | processing will resume at this point for the next call of deflate(). | ||
260 | |||
261 | - Provide more output starting at next_out and update next_out and avail_out | ||
262 | accordingly. This action is forced if the parameter flush is non zero. | ||
263 | Forcing flush frequently degrades the compression ratio, so this parameter | ||
264 | should be set only when necessary (in interactive applications). Some | ||
265 | output may be provided even if flush is not set. | ||
266 | |||
267 | Before the call of deflate(), the application should ensure that at least | ||
268 | one of the actions is possible, by providing more input and/or consuming more | ||
269 | output, and updating avail_in or avail_out accordingly; avail_out should | ||
270 | never be zero before the call. The application can consume the compressed | ||
271 | output when it wants, for example when the output buffer is full (avail_out | ||
272 | == 0), or after each call of deflate(). If deflate returns Z_OK and with | ||
273 | zero avail_out, it must be called again after making room in the output | ||
274 | buffer because there might be more output pending. | ||
275 | |||
276 | Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to | ||
277 | decide how much data to accumulate before producing output, in order to | ||
278 | maximize compression. | ||
279 | |||
280 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | ||
281 | flushed to the output buffer and the output is aligned on a byte boundary, so | ||
282 | that the decompressor can get all input data available so far. (In | ||
283 | particular avail_in is zero after the call if enough output space has been | ||
284 | provided before the call.) Flushing may degrade compression for some | ||
285 | compression algorithms and so it should be used only when necessary. This | ||
286 | completes the current deflate block and follows it with an empty stored block | ||
287 | that is three bits plus filler bits to the next byte, followed by four bytes | ||
288 | (00 00 ff ff). | ||
289 | |||
290 | If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the | ||
291 | output buffer, but the output is not aligned to a byte boundary. All of the | ||
292 | input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. | ||
293 | This completes the current deflate block and follows it with an empty fixed | ||
294 | codes block that is 10 bits long. This assures that enough bytes are output | ||
295 | in order for the decompressor to finish the block before the empty fixed code | ||
296 | block. | ||
297 | |||
298 | If flush is set to Z_BLOCK, a deflate block is completed and emitted, as | ||
299 | for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to | ||
300 | seven bits of the current block are held to be written as the next byte after | ||
301 | the next deflate block is completed. In this case, the decompressor may not | ||
302 | be provided enough bits at this point in order to complete decompression of | ||
303 | the data provided so far to the compressor. It may need to wait for the next | ||
304 | block to be emitted. This is for advanced applications that need to control | ||
305 | the emission of deflate blocks. | ||
306 | |||
307 | If flush is set to Z_FULL_FLUSH, all output is flushed as with | ||
308 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can | ||
309 | restart from this point if previous compressed data has been damaged or if | ||
310 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade | ||
311 | compression. | ||
312 | |||
313 | If deflate returns with avail_out == 0, this function must be called again | ||
314 | with the same value of the flush parameter and more output space (updated | ||
315 | avail_out), until the flush is complete (deflate returns with non-zero | ||
316 | avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that | ||
317 | avail_out is greater than six to avoid repeated flush markers due to | ||
318 | avail_out == 0 on return. | ||
319 | |||
320 | If the parameter flush is set to Z_FINISH, pending input is processed, | ||
321 | pending output is flushed and deflate returns with Z_STREAM_END if there was | ||
322 | enough output space; if deflate returns with Z_OK, this function must be | ||
323 | called again with Z_FINISH and more output space (updated avail_out) but no | ||
324 | more input data, until it returns with Z_STREAM_END or an error. After | ||
325 | deflate has returned Z_STREAM_END, the only possible operations on the stream | ||
326 | are deflateReset or deflateEnd. | ||
327 | |||
328 | Z_FINISH can be used immediately after deflateInit if all the compression | ||
329 | is to be done in a single step. In this case, avail_out must be at least the | ||
330 | value returned by deflateBound (see below). Then deflate is guaranteed to | ||
331 | return Z_STREAM_END. If not enough output space is provided, deflate will | ||
332 | not return Z_STREAM_END, and it must be called again as described above. | ||
333 | |||
334 | deflate() sets strm->adler to the adler32 checksum of all input read | ||
335 | so far (that is, total_in bytes). | ||
336 | |||
337 | deflate() may update strm->data_type if it can make a good guess about | ||
338 | the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered | ||
339 | binary. This field is only for information purposes and does not affect the | ||
340 | compression algorithm in any manner. | ||
341 | |||
342 | deflate() returns Z_OK if some progress has been made (more input | ||
343 | processed or more output produced), Z_STREAM_END if all input has been | ||
344 | consumed and all output has been produced (only when flush is set to | ||
345 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example | ||
346 | if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible | ||
347 | (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not | ||
348 | fatal, and deflate() can be called again with more input and more output | ||
349 | space to continue compressing. | ||
350 | */ | ||
351 | |||
352 | |||
353 | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); | ||
354 | /* | ||
355 | All dynamically allocated data structures for this stream are freed. | ||
356 | This function discards any unprocessed input and does not flush any pending | ||
357 | output. | ||
358 | |||
359 | deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the | ||
360 | stream state was inconsistent, Z_DATA_ERROR if the stream was freed | ||
361 | prematurely (some input or output was discarded). In the error case, msg | ||
362 | may be set but then points to a static string (which must not be | ||
363 | deallocated). | ||
364 | */ | ||
365 | |||
366 | |||
367 | /* | ||
368 | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | ||
369 | |||
370 | Initializes the internal stream state for decompression. The fields | ||
371 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by | ||
372 | the caller. If next_in is not Z_NULL and avail_in is large enough (the | ||
373 | exact value depends on the compression method), inflateInit determines the | ||
374 | compression method from the zlib header and allocates all data structures | ||
375 | accordingly; otherwise the allocation will be deferred to the first call of | ||
376 | inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to | ||
377 | use default allocation functions. | ||
378 | |||
379 | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
380 | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | ||
381 | version assumed by the caller, or Z_STREAM_ERROR if the parameters are | ||
382 | invalid, such as a null pointer to the structure. msg is set to null if | ||
383 | there is no error message. inflateInit does not perform any decompression | ||
384 | apart from possibly reading the zlib header if present: actual decompression | ||
385 | will be done by inflate(). (So next_in and avail_in may be modified, but | ||
386 | next_out and avail_out are unused and unchanged.) The current implementation | ||
387 | of inflateInit() does not process any header information -- that is deferred | ||
388 | until inflate() is called. | ||
389 | */ | ||
390 | |||
391 | |||
392 | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | ||
393 | /* | ||
394 | inflate decompresses as much data as possible, and stops when the input | ||
395 | buffer becomes empty or the output buffer becomes full. It may introduce | ||
396 | some output latency (reading input without producing any output) except when | ||
397 | forced to flush. | ||
398 | |||
399 | The detailed semantics are as follows. inflate performs one or both of the | ||
400 | following actions: | ||
401 | |||
402 | - Decompress more input starting at next_in and update next_in and avail_in | ||
403 | accordingly. If not all input can be processed (because there is not | ||
404 | enough room in the output buffer), next_in is updated and processing will | ||
405 | resume at this point for the next call of inflate(). | ||
406 | |||
407 | - Provide more output starting at next_out and update next_out and avail_out | ||
408 | accordingly. inflate() provides as much output as possible, until there is | ||
409 | no more input data or no more space in the output buffer (see below about | ||
410 | the flush parameter). | ||
411 | |||
412 | Before the call of inflate(), the application should ensure that at least | ||
413 | one of the actions is possible, by providing more input and/or consuming more | ||
414 | output, and updating the next_* and avail_* values accordingly. The | ||
415 | application can consume the uncompressed output when it wants, for example | ||
416 | when the output buffer is full (avail_out == 0), or after each call of | ||
417 | inflate(). If inflate returns Z_OK and with zero avail_out, it must be | ||
418 | called again after making room in the output buffer because there might be | ||
419 | more output pending. | ||
420 | |||
421 | The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, | ||
422 | Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much | ||
423 | output as possible to the output buffer. Z_BLOCK requests that inflate() | ||
424 | stop if and when it gets to the next deflate block boundary. When decoding | ||
425 | the zlib or gzip format, this will cause inflate() to return immediately | ||
426 | after the header and before the first block. When doing a raw inflate, | ||
427 | inflate() will go ahead and process the first block, and will return when it | ||
428 | gets to the end of that block, or when it runs out of data. | ||
429 | |||
430 | The Z_BLOCK option assists in appending to or combining deflate streams. | ||
431 | Also to assist in this, on return inflate() will set strm->data_type to the | ||
432 | number of unused bits in the last byte taken from strm->next_in, plus 64 if | ||
433 | inflate() is currently decoding the last block in the deflate stream, plus | ||
434 | 128 if inflate() returned immediately after decoding an end-of-block code or | ||
435 | decoding the complete header up to just before the first byte of the deflate | ||
436 | stream. The end-of-block will not be indicated until all of the uncompressed | ||
437 | data from that block has been written to strm->next_out. The number of | ||
438 | unused bits may in general be greater than seven, except when bit 7 of | ||
439 | data_type is set, in which case the number of unused bits will be less than | ||
440 | eight. data_type is set as noted here every time inflate() returns for all | ||
441 | flush options, and so can be used to determine the amount of currently | ||
442 | consumed input in bits. | ||
443 | |||
444 | The Z_TREES option behaves as Z_BLOCK does, but it also returns when the | ||
445 | end of each deflate block header is reached, before any actual data in that | ||
446 | block is decoded. This allows the caller to determine the length of the | ||
447 | deflate block header for later use in random access within a deflate block. | ||
448 | 256 is added to the value of strm->data_type when inflate() returns | ||
449 | immediately after reaching the end of the deflate block header. | ||
450 | |||
451 | inflate() should normally be called until it returns Z_STREAM_END or an | ||
452 | error. However if all decompression is to be performed in a single step (a | ||
453 | single call of inflate), the parameter flush should be set to Z_FINISH. In | ||
454 | this case all pending input is processed and all pending output is flushed; | ||
455 | avail_out must be large enough to hold all of the uncompressed data for the | ||
456 | operation to complete. (The size of the uncompressed data may have been | ||
457 | saved by the compressor for this purpose.) The use of Z_FINISH is not | ||
458 | required to perform an inflation in one step. However it may be used to | ||
459 | inform inflate that a faster approach can be used for the single inflate() | ||
460 | call. Z_FINISH also informs inflate to not maintain a sliding window if the | ||
461 | stream completes, which reduces inflate's memory footprint. If the stream | ||
462 | does not complete, either because not all of the stream is provided or not | ||
463 | enough output space is provided, then a sliding window will be allocated and | ||
464 | inflate() can be called again to continue the operation as if Z_NO_FLUSH had | ||
465 | been used. | ||
466 | |||
467 | In this implementation, inflate() always flushes as much output as | ||
468 | possible to the output buffer, and always uses the faster approach on the | ||
469 | first call. So the effects of the flush parameter in this implementation are | ||
470 | on the return value of inflate() as noted below, when inflate() returns early | ||
471 | when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of | ||
472 | memory for a sliding window when Z_FINISH is used. | ||
473 | |||
474 | If a preset dictionary is needed after this call (see inflateSetDictionary | ||
475 | below), inflate sets strm->adler to the Adler-32 checksum of the dictionary | ||
476 | chosen by the compressor and returns Z_NEED_DICT; otherwise it sets | ||
477 | strm->adler to the Adler-32 checksum of all output produced so far (that is, | ||
478 | total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described | ||
479 | below. At the end of the stream, inflate() checks that its computed adler32 | ||
480 | checksum is equal to that saved by the compressor and returns Z_STREAM_END | ||
481 | only if the checksum is correct. | ||
482 | |||
483 | inflate() can decompress and check either zlib-wrapped or gzip-wrapped | ||
484 | deflate data. The header type is detected automatically, if requested when | ||
485 | initializing with inflateInit2(). Any information contained in the gzip | ||
486 | header is not retained, so applications that need that information should | ||
487 | instead use raw inflate, see inflateInit2() below, or inflateBack() and | ||
488 | perform their own processing of the gzip header and trailer. When processing | ||
489 | gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output | ||
490 | producted so far. The CRC-32 is checked against the gzip trailer. | ||
491 | |||
492 | inflate() returns Z_OK if some progress has been made (more input processed | ||
493 | or more output produced), Z_STREAM_END if the end of the compressed data has | ||
494 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a | ||
495 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | ||
496 | corrupted (input stream not conforming to the zlib format or incorrect check | ||
497 | value), Z_STREAM_ERROR if the stream structure was inconsistent (for example | ||
498 | next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, | ||
499 | Z_BUF_ERROR if no progress is possible or if there was not enough room in the | ||
500 | output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | ||
501 | inflate() can be called again with more input and more output space to | ||
502 | continue decompressing. If Z_DATA_ERROR is returned, the application may | ||
503 | then call inflateSync() to look for a good compression block if a partial | ||
504 | recovery of the data is desired. | ||
505 | */ | ||
506 | |||
507 | |||
508 | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); | ||
509 | /* | ||
510 | All dynamically allocated data structures for this stream are freed. | ||
511 | This function discards any unprocessed input and does not flush any pending | ||
512 | output. | ||
513 | |||
514 | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | ||
515 | was inconsistent. In the error case, msg may be set but then points to a | ||
516 | static string (which must not be deallocated). | ||
517 | */ | ||
518 | |||
519 | |||
520 | /* Advanced functions */ | ||
521 | |||
522 | /* | ||
523 | The following functions are needed only in some special applications. | ||
524 | */ | ||
525 | |||
526 | /* | ||
527 | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | ||
528 | int level, | ||
529 | int method, | ||
530 | int windowBits, | ||
531 | int memLevel, | ||
532 | int strategy)); | ||
533 | |||
534 | This is another version of deflateInit with more compression options. The | ||
535 | fields next_in, zalloc, zfree and opaque must be initialized before by the | ||
536 | caller. | ||
537 | |||
538 | The method parameter is the compression method. It must be Z_DEFLATED in | ||
539 | this version of the library. | ||
540 | |||
541 | The windowBits parameter is the base two logarithm of the window size | ||
542 | (the size of the history buffer). It should be in the range 8..15 for this | ||
543 | version of the library. Larger values of this parameter result in better | ||
544 | compression at the expense of memory usage. The default value is 15 if | ||
545 | deflateInit is used instead. | ||
546 | |||
547 | windowBits can also be -8..-15 for raw deflate. In this case, -windowBits | ||
548 | determines the window size. deflate() will then generate raw deflate data | ||
549 | with no zlib header or trailer, and will not compute an adler32 check value. | ||
550 | |||
551 | windowBits can also be greater than 15 for optional gzip encoding. Add | ||
552 | 16 to windowBits to write a simple gzip header and trailer around the | ||
553 | compressed data instead of a zlib wrapper. The gzip header will have no | ||
554 | file name, no extra data, no comment, no modification time (set to zero), no | ||
555 | header crc, and the operating system will be set to 255 (unknown). If a | ||
556 | gzip stream is being written, strm->adler is a crc32 instead of an adler32. | ||
557 | |||
558 | The memLevel parameter specifies how much memory should be allocated | ||
559 | for the internal compression state. memLevel=1 uses minimum memory but is | ||
560 | slow and reduces compression ratio; memLevel=9 uses maximum memory for | ||
561 | optimal speed. The default value is 8. See zconf.h for total memory usage | ||
562 | as a function of windowBits and memLevel. | ||
563 | |||
564 | The strategy parameter is used to tune the compression algorithm. Use the | ||
565 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a | ||
566 | filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no | ||
567 | string match), or Z_RLE to limit match distances to one (run-length | ||
568 | encoding). Filtered data consists mostly of small values with a somewhat | ||
569 | random distribution. In this case, the compression algorithm is tuned to | ||
570 | compress them better. The effect of Z_FILTERED is to force more Huffman | ||
571 | coding and less string matching; it is somewhat intermediate between | ||
572 | Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as | ||
573 | fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The | ||
574 | strategy parameter only affects the compression ratio but not the | ||
575 | correctness of the compressed output even if it is not set appropriately. | ||
576 | Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler | ||
577 | decoder for special applications. | ||
578 | |||
579 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
580 | memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid | ||
581 | method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is | ||
582 | incompatible with the version assumed by the caller (ZLIB_VERSION). msg is | ||
583 | set to null if there is no error message. deflateInit2 does not perform any | ||
584 | compression: this will be done by deflate(). | ||
585 | */ | ||
586 | |||
587 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | ||
588 | const Bytef *dictionary, | ||
589 | uInt dictLength)); | ||
590 | /* | ||
591 | Initializes the compression dictionary from the given byte sequence | ||
592 | without producing any compressed output. When using the zlib format, this | ||
593 | function must be called immediately after deflateInit, deflateInit2 or | ||
594 | deflateReset, and before any call of deflate. When doing raw deflate, this | ||
595 | function must be called either before any call of deflate, or immediately | ||
596 | after the completion of a deflate block, i.e. after all input has been | ||
597 | consumed and all output has been delivered when using any of the flush | ||
598 | options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The | ||
599 | compressor and decompressor must use exactly the same dictionary (see | ||
600 | inflateSetDictionary). | ||
601 | |||
602 | The dictionary should consist of strings (byte sequences) that are likely | ||
603 | to be encountered later in the data to be compressed, with the most commonly | ||
604 | used strings preferably put towards the end of the dictionary. Using a | ||
605 | dictionary is most useful when the data to be compressed is short and can be | ||
606 | predicted with good accuracy; the data can then be compressed better than | ||
607 | with the default empty dictionary. | ||
608 | |||
609 | Depending on the size of the compression data structures selected by | ||
610 | deflateInit or deflateInit2, a part of the dictionary may in effect be | ||
611 | discarded, for example if the dictionary is larger than the window size | ||
612 | provided in deflateInit or deflateInit2. Thus the strings most likely to be | ||
613 | useful should be put at the end of the dictionary, not at the front. In | ||
614 | addition, the current implementation of deflate will use at most the window | ||
615 | size minus 262 bytes of the provided dictionary. | ||
616 | |||
617 | Upon return of this function, strm->adler is set to the adler32 value | ||
618 | of the dictionary; the decompressor may later use this value to determine | ||
619 | which dictionary has been used by the compressor. (The adler32 value | ||
620 | applies to the whole dictionary even if only a subset of the dictionary is | ||
621 | actually used by the compressor.) If a raw deflate was requested, then the | ||
622 | adler32 value is not computed and strm->adler is not set. | ||
623 | |||
624 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | ||
625 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | ||
626 | inconsistent (for example if deflate has already been called for this stream | ||
627 | or if not at a block boundary for raw deflate). deflateSetDictionary does | ||
628 | not perform any compression: this will be done by deflate(). | ||
629 | */ | ||
630 | |||
631 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | ||
632 | z_streamp source)); | ||
633 | /* | ||
634 | Sets the destination stream as a complete copy of the source stream. | ||
635 | |||
636 | This function can be useful when several compression strategies will be | ||
637 | tried, for example when there are several ways of pre-processing the input | ||
638 | data with a filter. The streams that will be discarded should then be freed | ||
639 | by calling deflateEnd. Note that deflateCopy duplicates the internal | ||
640 | compression state which can be quite large, so this strategy is slow and can | ||
641 | consume lots of memory. | ||
642 | |||
643 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | ||
644 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | ||
645 | (such as zalloc being Z_NULL). msg is left unchanged in both source and | ||
646 | destination. | ||
647 | */ | ||
648 | |||
649 | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | ||
650 | /* | ||
651 | This function is equivalent to deflateEnd followed by deflateInit, | ||
652 | but does not free and reallocate all the internal compression state. The | ||
653 | stream will keep the same compression level and any other attributes that | ||
654 | may have been set by deflateInit2. | ||
655 | |||
656 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
657 | stream state was inconsistent (such as zalloc or state being Z_NULL). | ||
658 | */ | ||
659 | |||
660 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | ||
661 | int level, | ||
662 | int strategy)); | ||
663 | /* | ||
664 | Dynamically update the compression level and compression strategy. The | ||
665 | interpretation of level and strategy is as in deflateInit2. This can be | ||
666 | used to switch between compression and straight copy of the input data, or | ||
667 | to switch to a different kind of input data requiring a different strategy. | ||
668 | If the compression level is changed, the input available so far is | ||
669 | compressed with the old level (and may be flushed); the new level will take | ||
670 | effect only at the next call of deflate(). | ||
671 | |||
672 | Before the call of deflateParams, the stream state must be set as for | ||
673 | a call of deflate(), since the currently available input may have to be | ||
674 | compressed and flushed. In particular, strm->avail_out must be non-zero. | ||
675 | |||
676 | deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source | ||
677 | stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if | ||
678 | strm->avail_out was zero. | ||
679 | */ | ||
680 | |||
681 | ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, | ||
682 | int good_length, | ||
683 | int max_lazy, | ||
684 | int nice_length, | ||
685 | int max_chain)); | ||
686 | /* | ||
687 | Fine tune deflate's internal compression parameters. This should only be | ||
688 | used by someone who understands the algorithm used by zlib's deflate for | ||
689 | searching for the best matching string, and even then only by the most | ||
690 | fanatic optimizer trying to squeeze out the last compressed bit for their | ||
691 | specific input data. Read the deflate.c source code for the meaning of the | ||
692 | max_lazy, good_length, nice_length, and max_chain parameters. | ||
693 | |||
694 | deflateTune() can be called after deflateInit() or deflateInit2(), and | ||
695 | returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. | ||
696 | */ | ||
697 | |||
698 | ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | ||
699 | uLong sourceLen)); | ||
700 | /* | ||
701 | deflateBound() returns an upper bound on the compressed size after | ||
702 | deflation of sourceLen bytes. It must be called after deflateInit() or | ||
703 | deflateInit2(), and after deflateSetHeader(), if used. This would be used | ||
704 | to allocate an output buffer for deflation in a single pass, and so would be | ||
705 | called before deflate(). If that first deflate() call is provided the | ||
706 | sourceLen input bytes, an output buffer allocated to the size returned by | ||
707 | deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed | ||
708 | to return Z_STREAM_END. Note that it is possible for the compressed size to | ||
709 | be larger than the value returned by deflateBound() if flush options other | ||
710 | than Z_FINISH or Z_NO_FLUSH are used. | ||
711 | */ | ||
712 | |||
713 | ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | ||
714 | unsigned *pending, | ||
715 | int *bits)); | ||
716 | /* | ||
717 | deflatePending() returns the number of bytes and bits of output that have | ||
718 | been generated, but not yet provided in the available output. The bytes not | ||
719 | provided would be due to the available output space having being consumed. | ||
720 | The number of bits of output not provided are between 0 and 7, where they | ||
721 | await more bits to join them in order to fill out a full byte. If pending | ||
722 | or bits are Z_NULL, then those values are not set. | ||
723 | |||
724 | deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
725 | stream state was inconsistent. | ||
726 | */ | ||
727 | |||
728 | ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | ||
729 | int bits, | ||
730 | int value)); | ||
731 | /* | ||
732 | deflatePrime() inserts bits in the deflate output stream. The intent | ||
733 | is that this function is used to start off the deflate output with the bits | ||
734 | leftover from a previous deflate stream when appending to it. As such, this | ||
735 | function can only be used for raw deflate, and must be used before the first | ||
736 | deflate() call after a deflateInit2() or deflateReset(). bits must be less | ||
737 | than or equal to 16, and that many of the least significant bits of value | ||
738 | will be inserted in the output. | ||
739 | |||
740 | deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough | ||
741 | room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the | ||
742 | source stream state was inconsistent. | ||
743 | */ | ||
744 | |||
745 | ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | ||
746 | gz_headerp head)); | ||
747 | /* | ||
748 | deflateSetHeader() provides gzip header information for when a gzip | ||
749 | stream is requested by deflateInit2(). deflateSetHeader() may be called | ||
750 | after deflateInit2() or deflateReset() and before the first call of | ||
751 | deflate(). The text, time, os, extra field, name, and comment information | ||
752 | in the provided gz_header structure are written to the gzip header (xflag is | ||
753 | ignored -- the extra flags are set according to the compression level). The | ||
754 | caller must assure that, if not Z_NULL, name and comment are terminated with | ||
755 | a zero byte, and that if extra is not Z_NULL, that extra_len bytes are | ||
756 | available there. If hcrc is true, a gzip header crc is included. Note that | ||
757 | the current versions of the command-line version of gzip (up through version | ||
758 | 1.3.x) do not support header crc's, and will report that it is a "multi-part | ||
759 | gzip file" and give up. | ||
760 | |||
761 | If deflateSetHeader is not used, the default gzip header has text false, | ||
762 | the time set to zero, and os set to 255, with no extra, name, or comment | ||
763 | fields. The gzip header is returned to the default state by deflateReset(). | ||
764 | |||
765 | deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
766 | stream state was inconsistent. | ||
767 | */ | ||
768 | |||
769 | /* | ||
770 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | ||
771 | int windowBits)); | ||
772 | |||
773 | This is another version of inflateInit with an extra parameter. The | ||
774 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized | ||
775 | before by the caller. | ||
776 | |||
777 | The windowBits parameter is the base two logarithm of the maximum window | ||
778 | size (the size of the history buffer). It should be in the range 8..15 for | ||
779 | this version of the library. The default value is 15 if inflateInit is used | ||
780 | instead. windowBits must be greater than or equal to the windowBits value | ||
781 | provided to deflateInit2() while compressing, or it must be equal to 15 if | ||
782 | deflateInit2() was not used. If a compressed stream with a larger window | ||
783 | size is given as input, inflate() will return with the error code | ||
784 | Z_DATA_ERROR instead of trying to allocate a larger window. | ||
785 | |||
786 | windowBits can also be zero to request that inflate use the window size in | ||
787 | the zlib header of the compressed stream. | ||
788 | |||
789 | windowBits can also be -8..-15 for raw inflate. In this case, -windowBits | ||
790 | determines the window size. inflate() will then process raw deflate data, | ||
791 | not looking for a zlib or gzip header, not generating a check value, and not | ||
792 | looking for any check values for comparison at the end of the stream. This | ||
793 | is for use with other formats that use the deflate compressed data format | ||
794 | such as zip. Those formats provide their own check values. If a custom | ||
795 | format is developed using the raw deflate format for compressed data, it is | ||
796 | recommended that a check value such as an adler32 or a crc32 be applied to | ||
797 | the uncompressed data as is done in the zlib, gzip, and zip formats. For | ||
798 | most applications, the zlib format should be used as is. Note that comments | ||
799 | above on the use in deflateInit2() applies to the magnitude of windowBits. | ||
800 | |||
801 | windowBits can also be greater than 15 for optional gzip decoding. Add | ||
802 | 32 to windowBits to enable zlib and gzip decoding with automatic header | ||
803 | detection, or add 16 to decode only the gzip format (the zlib format will | ||
804 | return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a | ||
805 | crc32 instead of an adler32. | ||
806 | |||
807 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
808 | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | ||
809 | version assumed by the caller, or Z_STREAM_ERROR if the parameters are | ||
810 | invalid, such as a null pointer to the structure. msg is set to null if | ||
811 | there is no error message. inflateInit2 does not perform any decompression | ||
812 | apart from possibly reading the zlib header if present: actual decompression | ||
813 | will be done by inflate(). (So next_in and avail_in may be modified, but | ||
814 | next_out and avail_out are unused and unchanged.) The current implementation | ||
815 | of inflateInit2() does not process any header information -- that is | ||
816 | deferred until inflate() is called. | ||
817 | */ | ||
818 | |||
819 | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | ||
820 | const Bytef *dictionary, | ||
821 | uInt dictLength)); | ||
822 | /* | ||
823 | Initializes the decompression dictionary from the given uncompressed byte | ||
824 | sequence. This function must be called immediately after a call of inflate, | ||
825 | if that call returned Z_NEED_DICT. The dictionary chosen by the compressor | ||
826 | can be determined from the adler32 value returned by that call of inflate. | ||
827 | The compressor and decompressor must use exactly the same dictionary (see | ||
828 | deflateSetDictionary). For raw inflate, this function can be called at any | ||
829 | time to set the dictionary. If the provided dictionary is smaller than the | ||
830 | window and there is already data in the window, then the provided dictionary | ||
831 | will amend what's there. The application must insure that the dictionary | ||
832 | that was used for compression is provided. | ||
833 | |||
834 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | ||
835 | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | ||
836 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | ||
837 | expected one (incorrect adler32 value). inflateSetDictionary does not | ||
838 | perform any decompression: this will be done by subsequent calls of | ||
839 | inflate(). | ||
840 | */ | ||
841 | |||
842 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | ||
843 | /* | ||
844 | Skips invalid compressed data until a possible full flush point (see above | ||
845 | for the description of deflate with Z_FULL_FLUSH) can be found, or until all | ||
846 | available input is skipped. No output is provided. | ||
847 | |||
848 | inflateSync searches for a 00 00 FF FF pattern in the compressed data. | ||
849 | All full flush points have this pattern, but not all occurences of this | ||
850 | pattern are full flush points. | ||
851 | |||
852 | inflateSync returns Z_OK if a possible full flush point has been found, | ||
853 | Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point | ||
854 | has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. | ||
855 | In the success case, the application may save the current current value of | ||
856 | total_in which indicates where valid compressed data was found. In the | ||
857 | error case, the application may repeatedly call inflateSync, providing more | ||
858 | input each time, until success or end of the input data. | ||
859 | */ | ||
860 | |||
861 | ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | ||
862 | z_streamp source)); | ||
863 | /* | ||
864 | Sets the destination stream as a complete copy of the source stream. | ||
865 | |||
866 | This function can be useful when randomly accessing a large stream. The | ||
867 | first pass through the stream can periodically record the inflate state, | ||
868 | allowing restarting inflate at those points when randomly accessing the | ||
869 | stream. | ||
870 | |||
871 | inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | ||
872 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | ||
873 | (such as zalloc being Z_NULL). msg is left unchanged in both source and | ||
874 | destination. | ||
875 | */ | ||
876 | |||
877 | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | ||
878 | /* | ||
879 | This function is equivalent to inflateEnd followed by inflateInit, | ||
880 | but does not free and reallocate all the internal decompression state. The | ||
881 | stream will keep attributes that may have been set by inflateInit2. | ||
882 | |||
883 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
884 | stream state was inconsistent (such as zalloc or state being Z_NULL). | ||
885 | */ | ||
886 | |||
887 | ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, | ||
888 | int windowBits)); | ||
889 | /* | ||
890 | This function is the same as inflateReset, but it also permits changing | ||
891 | the wrap and window size requests. The windowBits parameter is interpreted | ||
892 | the same as it is for inflateInit2. | ||
893 | |||
894 | inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
895 | stream state was inconsistent (such as zalloc or state being Z_NULL), or if | ||
896 | the windowBits parameter is invalid. | ||
897 | */ | ||
898 | |||
899 | ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | ||
900 | int bits, | ||
901 | int value)); | ||
902 | /* | ||
903 | This function inserts bits in the inflate input stream. The intent is | ||
904 | that this function is used to start inflating at a bit position in the | ||
905 | middle of a byte. The provided bits will be used before any bytes are used | ||
906 | from next_in. This function should only be used with raw inflate, and | ||
907 | should be used before the first inflate() call after inflateInit2() or | ||
908 | inflateReset(). bits must be less than or equal to 16, and that many of the | ||
909 | least significant bits of value will be inserted in the input. | ||
910 | |||
911 | If bits is negative, then the input stream bit buffer is emptied. Then | ||
912 | inflatePrime() can be called again to put bits in the buffer. This is used | ||
913 | to clear out bits leftover after feeding inflate a block description prior | ||
914 | to feeding inflate codes. | ||
915 | |||
916 | inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
917 | stream state was inconsistent. | ||
918 | */ | ||
919 | |||
920 | ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); | ||
921 | /* | ||
922 | This function returns two values, one in the lower 16 bits of the return | ||
923 | value, and the other in the remaining upper bits, obtained by shifting the | ||
924 | return value down 16 bits. If the upper value is -1 and the lower value is | ||
925 | zero, then inflate() is currently decoding information outside of a block. | ||
926 | If the upper value is -1 and the lower value is non-zero, then inflate is in | ||
927 | the middle of a stored block, with the lower value equaling the number of | ||
928 | bytes from the input remaining to copy. If the upper value is not -1, then | ||
929 | it is the number of bits back from the current bit position in the input of | ||
930 | the code (literal or length/distance pair) currently being processed. In | ||
931 | that case the lower value is the number of bytes already emitted for that | ||
932 | code. | ||
933 | |||
934 | A code is being processed if inflate is waiting for more input to complete | ||
935 | decoding of the code, or if it has completed decoding but is waiting for | ||
936 | more output space to write the literal or match data. | ||
937 | |||
938 | inflateMark() is used to mark locations in the input data for random | ||
939 | access, which may be at bit positions, and to note those cases where the | ||
940 | output of a code may span boundaries of random access blocks. The current | ||
941 | location in the input stream can be determined from avail_in and data_type | ||
942 | as noted in the description for the Z_BLOCK flush parameter for inflate. | ||
943 | |||
944 | inflateMark returns the value noted above or -1 << 16 if the provided | ||
945 | source stream state was inconsistent. | ||
946 | */ | ||
947 | |||
948 | ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | ||
949 | gz_headerp head)); | ||
950 | /* | ||
951 | inflateGetHeader() requests that gzip header information be stored in the | ||
952 | provided gz_header structure. inflateGetHeader() may be called after | ||
953 | inflateInit2() or inflateReset(), and before the first call of inflate(). | ||
954 | As inflate() processes the gzip stream, head->done is zero until the header | ||
955 | is completed, at which time head->done is set to one. If a zlib stream is | ||
956 | being decoded, then head->done is set to -1 to indicate that there will be | ||
957 | no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be | ||
958 | used to force inflate() to return immediately after header processing is | ||
959 | complete and before any actual data is decompressed. | ||
960 | |||
961 | The text, time, xflags, and os fields are filled in with the gzip header | ||
962 | contents. hcrc is set to true if there is a header CRC. (The header CRC | ||
963 | was valid if done is set to one.) If extra is not Z_NULL, then extra_max | ||
964 | contains the maximum number of bytes to write to extra. Once done is true, | ||
965 | extra_len contains the actual extra field length, and extra contains the | ||
966 | extra field, or that field truncated if extra_max is less than extra_len. | ||
967 | If name is not Z_NULL, then up to name_max characters are written there, | ||
968 | terminated with a zero unless the length is greater than name_max. If | ||
969 | comment is not Z_NULL, then up to comm_max characters are written there, | ||
970 | terminated with a zero unless the length is greater than comm_max. When any | ||
971 | of extra, name, or comment are not Z_NULL and the respective field is not | ||
972 | present in the header, then that field is set to Z_NULL to signal its | ||
973 | absence. This allows the use of deflateSetHeader() with the returned | ||
974 | structure to duplicate the header. However if those fields are set to | ||
975 | allocated memory, then the application will need to save those pointers | ||
976 | elsewhere so that they can be eventually freed. | ||
977 | |||
978 | If inflateGetHeader is not used, then the header information is simply | ||
979 | discarded. The header is always checked for validity, including the header | ||
980 | CRC if present. inflateReset() will reset the process to discard the header | ||
981 | information. The application would need to call inflateGetHeader() again to | ||
982 | retrieve the header from the next gzip stream. | ||
983 | |||
984 | inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
985 | stream state was inconsistent. | ||
986 | */ | ||
987 | |||
988 | /* | ||
989 | ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, | ||
990 | unsigned char FAR *window)); | ||
991 | |||
992 | Initialize the internal stream state for decompression using inflateBack() | ||
993 | calls. The fields zalloc, zfree and opaque in strm must be initialized | ||
994 | before the call. If zalloc and zfree are Z_NULL, then the default library- | ||
995 | derived memory allocation routines are used. windowBits is the base two | ||
996 | logarithm of the window size, in the range 8..15. window is a caller | ||
997 | supplied buffer of that size. Except for special applications where it is | ||
998 | assured that deflate was used with small window sizes, windowBits must be 15 | ||
999 | and a 32K byte window must be supplied to be able to decompress general | ||
1000 | deflate streams. | ||
1001 | |||
1002 | See inflateBack() for the usage of these routines. | ||
1003 | |||
1004 | inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | ||
1005 | the parameters are invalid, Z_MEM_ERROR if the internal state could not be | ||
1006 | allocated, or Z_VERSION_ERROR if the version of the library does not match | ||
1007 | the version of the header file. | ||
1008 | */ | ||
1009 | |||
1010 | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | ||
1011 | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | ||
1012 | |||
1013 | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | ||
1014 | in_func in, void FAR *in_desc, | ||
1015 | out_func out, void FAR *out_desc)); | ||
1016 | /* | ||
1017 | inflateBack() does a raw inflate with a single call using a call-back | ||
1018 | interface for input and output. This is more efficient than inflate() for | ||
1019 | file i/o applications in that it avoids copying between the output and the | ||
1020 | sliding window by simply making the window itself the output buffer. This | ||
1021 | function trusts the application to not change the output buffer passed by | ||
1022 | the output function, at least until inflateBack() returns. | ||
1023 | |||
1024 | inflateBackInit() must be called first to allocate the internal state | ||
1025 | and to initialize the state with the user-provided window buffer. | ||
1026 | inflateBack() may then be used multiple times to inflate a complete, raw | ||
1027 | deflate stream with each call. inflateBackEnd() is then called to free the | ||
1028 | allocated state. | ||
1029 | |||
1030 | A raw deflate stream is one with no zlib or gzip header or trailer. | ||
1031 | This routine would normally be used in a utility that reads zip or gzip | ||
1032 | files and writes out uncompressed files. The utility would decode the | ||
1033 | header and process the trailer on its own, hence this routine expects only | ||
1034 | the raw deflate stream to decompress. This is different from the normal | ||
1035 | behavior of inflate(), which expects either a zlib or gzip header and | ||
1036 | trailer around the deflate stream. | ||
1037 | |||
1038 | inflateBack() uses two subroutines supplied by the caller that are then | ||
1039 | called by inflateBack() for input and output. inflateBack() calls those | ||
1040 | routines until it reads a complete deflate stream and writes out all of the | ||
1041 | uncompressed data, or until it encounters an error. The function's | ||
1042 | parameters and return types are defined above in the in_func and out_func | ||
1043 | typedefs. inflateBack() will call in(in_desc, &buf) which should return the | ||
1044 | number of bytes of provided input, and a pointer to that input in buf. If | ||
1045 | there is no input available, in() must return zero--buf is ignored in that | ||
1046 | case--and inflateBack() will return a buffer error. inflateBack() will call | ||
1047 | out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() | ||
1048 | should return zero on success, or non-zero on failure. If out() returns | ||
1049 | non-zero, inflateBack() will return with an error. Neither in() nor out() | ||
1050 | are permitted to change the contents of the window provided to | ||
1051 | inflateBackInit(), which is also the buffer that out() uses to write from. | ||
1052 | The length written by out() will be at most the window size. Any non-zero | ||
1053 | amount of input may be provided by in(). | ||
1054 | |||
1055 | For convenience, inflateBack() can be provided input on the first call by | ||
1056 | setting strm->next_in and strm->avail_in. If that input is exhausted, then | ||
1057 | in() will be called. Therefore strm->next_in must be initialized before | ||
1058 | calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called | ||
1059 | immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in | ||
1060 | must also be initialized, and then if strm->avail_in is not zero, input will | ||
1061 | initially be taken from strm->next_in[0 .. strm->avail_in - 1]. | ||
1062 | |||
1063 | The in_desc and out_desc parameters of inflateBack() is passed as the | ||
1064 | first parameter of in() and out() respectively when they are called. These | ||
1065 | descriptors can be optionally used to pass any information that the caller- | ||
1066 | supplied in() and out() functions need to do their job. | ||
1067 | |||
1068 | On return, inflateBack() will set strm->next_in and strm->avail_in to | ||
1069 | pass back any unused input that was provided by the last in() call. The | ||
1070 | return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR | ||
1071 | if in() or out() returned an error, Z_DATA_ERROR if there was a format error | ||
1072 | in the deflate stream (in which case strm->msg is set to indicate the nature | ||
1073 | of the error), or Z_STREAM_ERROR if the stream was not properly initialized. | ||
1074 | In the case of Z_BUF_ERROR, an input or output error can be distinguished | ||
1075 | using strm->next_in which will be Z_NULL only if in() returned an error. If | ||
1076 | strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning | ||
1077 | non-zero. (in() will always be called before out(), so strm->next_in is | ||
1078 | assured to be defined if out() returns non-zero.) Note that inflateBack() | ||
1079 | cannot return Z_OK. | ||
1080 | */ | ||
1081 | |||
1082 | ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); | ||
1083 | /* | ||
1084 | All memory allocated by inflateBackInit() is freed. | ||
1085 | |||
1086 | inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream | ||
1087 | state was inconsistent. | ||
1088 | */ | ||
1089 | |||
1090 | ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); | ||
1091 | /* Return flags indicating compile-time options. | ||
1092 | |||
1093 | Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: | ||
1094 | 1.0: size of uInt | ||
1095 | 3.2: size of uLong | ||
1096 | 5.4: size of voidpf (pointer) | ||
1097 | 7.6: size of z_off_t | ||
1098 | |||
1099 | Compiler, assembler, and debug options: | ||
1100 | 8: DEBUG | ||
1101 | 9: ASMV or ASMINF -- use ASM code | ||
1102 | 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention | ||
1103 | 11: 0 (reserved) | ||
1104 | |||
1105 | One-time table building (smaller code, but not thread-safe if true): | ||
1106 | 12: BUILDFIXED -- build static block decoding tables when needed | ||
1107 | 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed | ||
1108 | 14,15: 0 (reserved) | ||
1109 | |||
1110 | Library content (indicates missing functionality): | ||
1111 | 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking | ||
1112 | deflate code when not needed) | ||
1113 | 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect | ||
1114 | and decode gzip streams (to avoid linking crc code) | ||
1115 | 18-19: 0 (reserved) | ||
1116 | |||
1117 | Operation variations (changes in library functionality): | ||
1118 | 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate | ||
1119 | 21: FASTEST -- deflate algorithm with only one, lowest compression level | ||
1120 | 22,23: 0 (reserved) | ||
1121 | |||
1122 | The sprintf variant used by gzprintf (zero is best): | ||
1123 | 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format | ||
1124 | 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | ||
1125 | 26: 0 = returns value, 1 = void -- 1 means inferred string length returned | ||
1126 | |||
1127 | Remainder: | ||
1128 | 27-31: 0 (reserved) | ||
1129 | */ | ||
1130 | |||
1131 | #ifndef Z_SOLO | ||
1132 | |||
1133 | /* utility functions */ | ||
1134 | |||
1135 | /* | ||
1136 | The following utility functions are implemented on top of the basic | ||
1137 | stream-oriented functions. To simplify the interface, some default options | ||
1138 | are assumed (compression level and memory usage, standard memory allocation | ||
1139 | functions). The source code of these utility functions can be modified if | ||
1140 | you need special options. | ||
1141 | */ | ||
1142 | |||
1143 | ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | ||
1144 | const Bytef *source, uLong sourceLen)); | ||
1145 | /* | ||
1146 | Compresses the source buffer into the destination buffer. sourceLen is | ||
1147 | the byte length of the source buffer. Upon entry, destLen is the total size | ||
1148 | of the destination buffer, which must be at least the value returned by | ||
1149 | compressBound(sourceLen). Upon exit, destLen is the actual size of the | ||
1150 | compressed buffer. | ||
1151 | |||
1152 | compress returns Z_OK if success, Z_MEM_ERROR if there was not | ||
1153 | enough memory, Z_BUF_ERROR if there was not enough room in the output | ||
1154 | buffer. | ||
1155 | */ | ||
1156 | |||
1157 | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | ||
1158 | const Bytef *source, uLong sourceLen, | ||
1159 | int level)); | ||
1160 | /* | ||
1161 | Compresses the source buffer into the destination buffer. The level | ||
1162 | parameter has the same meaning as in deflateInit. sourceLen is the byte | ||
1163 | length of the source buffer. Upon entry, destLen is the total size of the | ||
1164 | destination buffer, which must be at least the value returned by | ||
1165 | compressBound(sourceLen). Upon exit, destLen is the actual size of the | ||
1166 | compressed buffer. | ||
1167 | |||
1168 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
1169 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, | ||
1170 | Z_STREAM_ERROR if the level parameter is invalid. | ||
1171 | */ | ||
1172 | |||
1173 | ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); | ||
1174 | /* | ||
1175 | compressBound() returns an upper bound on the compressed size after | ||
1176 | compress() or compress2() on sourceLen bytes. It would be used before a | ||
1177 | compress() or compress2() call to allocate the destination buffer. | ||
1178 | */ | ||
1179 | |||
1180 | ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | ||
1181 | const Bytef *source, uLong sourceLen)); | ||
1182 | /* | ||
1183 | Decompresses the source buffer into the destination buffer. sourceLen is | ||
1184 | the byte length of the source buffer. Upon entry, destLen is the total size | ||
1185 | of the destination buffer, which must be large enough to hold the entire | ||
1186 | uncompressed data. (The size of the uncompressed data must have been saved | ||
1187 | previously by the compressor and transmitted to the decompressor by some | ||
1188 | mechanism outside the scope of this compression library.) Upon exit, destLen | ||
1189 | is the actual size of the uncompressed buffer. | ||
1190 | |||
1191 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | ||
1192 | enough memory, Z_BUF_ERROR if there was not enough room in the output | ||
1193 | buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In | ||
1194 | the case where there is not enough room, uncompress() will fill the output | ||
1195 | buffer with the uncompressed data up to that point. | ||
1196 | */ | ||
1197 | |||
1198 | /* gzip file access functions */ | ||
1199 | |||
1200 | /* | ||
1201 | This library supports reading and writing files in gzip (.gz) format with | ||
1202 | an interface similar to that of stdio, using the functions that start with | ||
1203 | "gz". The gzip format is different from the zlib format. gzip is a gzip | ||
1204 | wrapper, documented in RFC 1952, wrapped around a deflate stream. | ||
1205 | */ | ||
1206 | |||
1207 | typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ | ||
1208 | |||
1209 | /* | ||
1210 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||
1211 | |||
1212 | Opens a gzip (.gz) file for reading or writing. The mode parameter is as | ||
1213 | in fopen ("rb" or "wb") but can also include a compression level ("wb9") or | ||
1214 | a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only | ||
1215 | compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' | ||
1216 | for fixed code compression as in "wb9F". (See the description of | ||
1217 | deflateInit2 for more information about the strategy parameter.) 'T' will | ||
1218 | request transparent writing or appending with no compression and not using | ||
1219 | the gzip format. | ||
1220 | |||
1221 | "a" can be used instead of "w" to request that the gzip stream that will | ||
1222 | be written be appended to the file. "+" will result in an error, since | ||
1223 | reading and writing to the same gzip file is not supported. The addition of | ||
1224 | "x" when writing will create the file exclusively, which fails if the file | ||
1225 | already exists. On systems that support it, the addition of "e" when | ||
1226 | reading or writing will set the flag to close the file on an execve() call. | ||
1227 | |||
1228 | These functions, as well as gzip, will read and decode a sequence of gzip | ||
1229 | streams in a file. The append function of gzopen() can be used to create | ||
1230 | such a file. (Also see gzflush() for another way to do this.) When | ||
1231 | appending, gzopen does not test whether the file begins with a gzip stream, | ||
1232 | nor does it look for the end of the gzip streams to begin appending. gzopen | ||
1233 | will simply append a gzip stream to the existing file. | ||
1234 | |||
1235 | gzopen can be used to read a file which is not in gzip format; in this | ||
1236 | case gzread will directly read from the file without decompression. When | ||
1237 | reading, this will be detected automatically by looking for the magic two- | ||
1238 | byte gzip header. | ||
1239 | |||
1240 | gzopen returns NULL if the file could not be opened, if there was | ||
1241 | insufficient memory to allocate the gzFile state, or if an invalid mode was | ||
1242 | specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). | ||
1243 | errno can be checked to determine if the reason gzopen failed was that the | ||
1244 | file could not be opened. | ||
1245 | */ | ||
1246 | |||
1247 | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | ||
1248 | /* | ||
1249 | gzdopen associates a gzFile with the file descriptor fd. File descriptors | ||
1250 | are obtained from calls like open, dup, creat, pipe or fileno (if the file | ||
1251 | has been previously opened with fopen). The mode parameter is as in gzopen. | ||
1252 | |||
1253 | The next call of gzclose on the returned gzFile will also close the file | ||
1254 | descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor | ||
1255 | fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, | ||
1256 | mode);. The duplicated descriptor should be saved to avoid a leak, since | ||
1257 | gzdopen does not close fd if it fails. If you are using fileno() to get the | ||
1258 | file descriptor from a FILE *, then you will have to use dup() to avoid | ||
1259 | double-close()ing the file descriptor. Both gzclose() and fclose() will | ||
1260 | close the associated file descriptor, so they need to have different file | ||
1261 | descriptors. | ||
1262 | |||
1263 | gzdopen returns NULL if there was insufficient memory to allocate the | ||
1264 | gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not | ||
1265 | provided, or '+' was provided), or if fd is -1. The file descriptor is not | ||
1266 | used until the next gz* read, write, seek, or close operation, so gzdopen | ||
1267 | will not detect if fd is invalid (unless fd is -1). | ||
1268 | */ | ||
1269 | |||
1270 | ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); | ||
1271 | /* | ||
1272 | Set the internal buffer size used by this library's functions. The | ||
1273 | default buffer size is 8192 bytes. This function must be called after | ||
1274 | gzopen() or gzdopen(), and before any other calls that read or write the | ||
1275 | file. The buffer memory allocation is always deferred to the first read or | ||
1276 | write. Two buffers are allocated, either both of the specified size when | ||
1277 | writing, or one of the specified size and the other twice that size when | ||
1278 | reading. A larger buffer size of, for example, 64K or 128K bytes will | ||
1279 | noticeably increase the speed of decompression (reading). | ||
1280 | |||
1281 | The new buffer size also affects the maximum length for gzprintf(). | ||
1282 | |||
1283 | gzbuffer() returns 0 on success, or -1 on failure, such as being called | ||
1284 | too late. | ||
1285 | */ | ||
1286 | |||
1287 | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | ||
1288 | /* | ||
1289 | Dynamically update the compression level or strategy. See the description | ||
1290 | of deflateInit2 for the meaning of these parameters. | ||
1291 | |||
1292 | gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not | ||
1293 | opened for writing. | ||
1294 | */ | ||
1295 | |||
1296 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | ||
1297 | /* | ||
1298 | Reads the given number of uncompressed bytes from the compressed file. If | ||
1299 | the input file is not in gzip format, gzread copies the given number of | ||
1300 | bytes into the buffer directly from the file. | ||
1301 | |||
1302 | After reaching the end of a gzip stream in the input, gzread will continue | ||
1303 | to read, looking for another gzip stream. Any number of gzip streams may be | ||
1304 | concatenated in the input file, and will all be decompressed by gzread(). | ||
1305 | If something other than a gzip stream is encountered after a gzip stream, | ||
1306 | that remaining trailing garbage is ignored (and no error is returned). | ||
1307 | |||
1308 | gzread can be used to read a gzip file that is being concurrently written. | ||
1309 | Upon reaching the end of the input, gzread will return with the available | ||
1310 | data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then | ||
1311 | gzclearerr can be used to clear the end of file indicator in order to permit | ||
1312 | gzread to be tried again. Z_OK indicates that a gzip stream was completed | ||
1313 | on the last gzread. Z_BUF_ERROR indicates that the input file ended in the | ||
1314 | middle of a gzip stream. Note that gzread does not return -1 in the event | ||
1315 | of an incomplete gzip stream. This error is deferred until gzclose(), which | ||
1316 | will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip | ||
1317 | stream. Alternatively, gzerror can be used before gzclose to detect this | ||
1318 | case. | ||
1319 | |||
1320 | gzread returns the number of uncompressed bytes actually read, less than | ||
1321 | len for end of file, or -1 for error. | ||
1322 | */ | ||
1323 | |||
1324 | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | ||
1325 | voidpc buf, unsigned len)); | ||
1326 | /* | ||
1327 | Writes the given number of uncompressed bytes into the compressed file. | ||
1328 | gzwrite returns the number of uncompressed bytes written or 0 in case of | ||
1329 | error. | ||
1330 | */ | ||
1331 | |||
1332 | ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); | ||
1333 | /* | ||
1334 | Converts, formats, and writes the arguments to the compressed file under | ||
1335 | control of the format string, as in fprintf. gzprintf returns the number of | ||
1336 | uncompressed bytes actually written, or 0 in case of error. The number of | ||
1337 | uncompressed bytes written is limited to 8191, or one less than the buffer | ||
1338 | size given to gzbuffer(). The caller should assure that this limit is not | ||
1339 | exceeded. If it is exceeded, then gzprintf() will return an error (0) with | ||
1340 | nothing written. In this case, there may also be a buffer overflow with | ||
1341 | unpredictable consequences, which is possible only if zlib was compiled with | ||
1342 | the insecure functions sprintf() or vsprintf() because the secure snprintf() | ||
1343 | or vsnprintf() functions were not available. This can be determined using | ||
1344 | zlibCompileFlags(). | ||
1345 | */ | ||
1346 | |||
1347 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | ||
1348 | /* | ||
1349 | Writes the given null-terminated string to the compressed file, excluding | ||
1350 | the terminating null character. | ||
1351 | |||
1352 | gzputs returns the number of characters written, or -1 in case of error. | ||
1353 | */ | ||
1354 | |||
1355 | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | ||
1356 | /* | ||
1357 | Reads bytes from the compressed file until len-1 characters are read, or a | ||
1358 | newline character is read and transferred to buf, or an end-of-file | ||
1359 | condition is encountered. If any characters are read or if len == 1, the | ||
1360 | string is terminated with a null character. If no characters are read due | ||
1361 | to an end-of-file or len < 1, then the buffer is left untouched. | ||
1362 | |||
1363 | gzgets returns buf which is a null-terminated string, or it returns NULL | ||
1364 | for end-of-file or in case of error. If there was an error, the contents at | ||
1365 | buf are indeterminate. | ||
1366 | */ | ||
1367 | |||
1368 | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); | ||
1369 | /* | ||
1370 | Writes c, converted to an unsigned char, into the compressed file. gzputc | ||
1371 | returns the value that was written, or -1 in case of error. | ||
1372 | */ | ||
1373 | |||
1374 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); | ||
1375 | /* | ||
1376 | Reads one byte from the compressed file. gzgetc returns this byte or -1 | ||
1377 | in case of end of file or error. This is implemented as a macro for speed. | ||
1378 | As such, it does not do all of the checking the other functions do. I.e. | ||
1379 | it does not check to see if file is NULL, nor whether the structure file | ||
1380 | points to has been clobbered or not. | ||
1381 | */ | ||
1382 | |||
1383 | ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); | ||
1384 | /* | ||
1385 | Push one character back onto the stream to be read as the first character | ||
1386 | on the next read. At least one character of push-back is allowed. | ||
1387 | gzungetc() returns the character pushed, or -1 on failure. gzungetc() will | ||
1388 | fail if c is -1, and may fail if a character has been pushed but not read | ||
1389 | yet. If gzungetc is used immediately after gzopen or gzdopen, at least the | ||
1390 | output buffer size of pushed characters is allowed. (See gzbuffer above.) | ||
1391 | The pushed character will be discarded if the stream is repositioned with | ||
1392 | gzseek() or gzrewind(). | ||
1393 | */ | ||
1394 | |||
1395 | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); | ||
1396 | /* | ||
1397 | Flushes all pending output into the compressed file. The parameter flush | ||
1398 | is as in the deflate() function. The return value is the zlib error number | ||
1399 | (see function gzerror below). gzflush is only permitted when writing. | ||
1400 | |||
1401 | If the flush parameter is Z_FINISH, the remaining data is written and the | ||
1402 | gzip stream is completed in the output. If gzwrite() is called again, a new | ||
1403 | gzip stream will be started in the output. gzread() is able to read such | ||
1404 | concatented gzip streams. | ||
1405 | |||
1406 | gzflush should be called only when strictly necessary because it will | ||
1407 | degrade compression if called too often. | ||
1408 | */ | ||
1409 | |||
1410 | /* | ||
1411 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, | ||
1412 | z_off_t offset, int whence)); | ||
1413 | |||
1414 | Sets the starting position for the next gzread or gzwrite on the given | ||
1415 | compressed file. The offset represents a number of bytes in the | ||
1416 | uncompressed data stream. The whence parameter is defined as in lseek(2); | ||
1417 | the value SEEK_END is not supported. | ||
1418 | |||
1419 | If the file is opened for reading, this function is emulated but can be | ||
1420 | extremely slow. If the file is opened for writing, only forward seeks are | ||
1421 | supported; gzseek then compresses a sequence of zeroes up to the new | ||
1422 | starting position. | ||
1423 | |||
1424 | gzseek returns the resulting offset location as measured in bytes from | ||
1425 | the beginning of the uncompressed stream, or -1 in case of error, in | ||
1426 | particular if the file is opened for writing and the new starting position | ||
1427 | would be before the current position. | ||
1428 | */ | ||
1429 | |||
1430 | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | ||
1431 | /* | ||
1432 | Rewinds the given file. This function is supported only for reading. | ||
1433 | |||
1434 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | ||
1435 | */ | ||
1436 | |||
1437 | /* | ||
1438 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | ||
1439 | |||
1440 | Returns the starting position for the next gzread or gzwrite on the given | ||
1441 | compressed file. This position represents a number of bytes in the | ||
1442 | uncompressed data stream, and is zero when starting, even if appending or | ||
1443 | reading a gzip stream from the middle of a file using gzdopen(). | ||
1444 | |||
1445 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) | ||
1446 | */ | ||
1447 | |||
1448 | /* | ||
1449 | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); | ||
1450 | |||
1451 | Returns the current offset in the file being read or written. This offset | ||
1452 | includes the count of bytes that precede the gzip stream, for example when | ||
1453 | appending or when using gzdopen() for reading. When reading, the offset | ||
1454 | does not include as yet unused buffered input. This information can be used | ||
1455 | for a progress indicator. On error, gzoffset() returns -1. | ||
1456 | */ | ||
1457 | |||
1458 | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); | ||
1459 | /* | ||
1460 | Returns true (1) if the end-of-file indicator has been set while reading, | ||
1461 | false (0) otherwise. Note that the end-of-file indicator is set only if the | ||
1462 | read tried to go past the end of the input, but came up short. Therefore, | ||
1463 | just like feof(), gzeof() may return false even if there is no more data to | ||
1464 | read, in the event that the last read request was for the exact number of | ||
1465 | bytes remaining in the input file. This will happen if the input file size | ||
1466 | is an exact multiple of the buffer size. | ||
1467 | |||
1468 | If gzeof() returns true, then the read functions will return no more data, | ||
1469 | unless the end-of-file indicator is reset by gzclearerr() and the input file | ||
1470 | has grown since the previous end of file was detected. | ||
1471 | */ | ||
1472 | |||
1473 | ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); | ||
1474 | /* | ||
1475 | Returns true (1) if file is being copied directly while reading, or false | ||
1476 | (0) if file is a gzip stream being decompressed. | ||
1477 | |||
1478 | If the input file is empty, gzdirect() will return true, since the input | ||
1479 | does not contain a gzip stream. | ||
1480 | |||
1481 | If gzdirect() is used immediately after gzopen() or gzdopen() it will | ||
1482 | cause buffers to be allocated to allow reading the file to determine if it | ||
1483 | is a gzip file. Therefore if gzbuffer() is used, it should be called before | ||
1484 | gzdirect(). | ||
1485 | |||
1486 | When writing, gzdirect() returns true (1) if transparent writing was | ||
1487 | requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: | ||
1488 | gzdirect() is not needed when writing. Transparent writing must be | ||
1489 | explicitly requested, so the application already knows the answer. When | ||
1490 | linking statically, using gzdirect() will include all of the zlib code for | ||
1491 | gzip file reading and decompression, which may not be desired.) | ||
1492 | */ | ||
1493 | |||
1494 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | ||
1495 | /* | ||
1496 | Flushes all pending output if necessary, closes the compressed file and | ||
1497 | deallocates the (de)compression state. Note that once file is closed, you | ||
1498 | cannot call gzerror with file, since its structures have been deallocated. | ||
1499 | gzclose must not be called more than once on the same file, just as free | ||
1500 | must not be called more than once on the same allocation. | ||
1501 | |||
1502 | gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a | ||
1503 | file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the | ||
1504 | last read ended in the middle of a gzip stream, or Z_OK on success. | ||
1505 | */ | ||
1506 | |||
1507 | ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | ||
1508 | ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | ||
1509 | /* | ||
1510 | Same as gzclose(), but gzclose_r() is only for use when reading, and | ||
1511 | gzclose_w() is only for use when writing or appending. The advantage to | ||
1512 | using these instead of gzclose() is that they avoid linking in zlib | ||
1513 | compression or decompression code that is not used when only reading or only | ||
1514 | writing respectively. If gzclose() is used, then both compression and | ||
1515 | decompression code will be included the application when linking to a static | ||
1516 | zlib library. | ||
1517 | */ | ||
1518 | |||
1519 | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | ||
1520 | /* | ||
1521 | Returns the error message for the last error which occurred on the given | ||
1522 | compressed file. errnum is set to zlib error number. If an error occurred | ||
1523 | in the file system and not in the compression library, errnum is set to | ||
1524 | Z_ERRNO and the application may consult errno to get the exact error code. | ||
1525 | |||
1526 | The application must not modify the returned string. Future calls to | ||
1527 | this function may invalidate the previously returned string. If file is | ||
1528 | closed, then the string previously returned by gzerror will no longer be | ||
1529 | available. | ||
1530 | |||
1531 | gzerror() should be used to distinguish errors from end-of-file for those | ||
1532 | functions above that do not distinguish those cases in their return values. | ||
1533 | */ | ||
1534 | |||
1535 | ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | ||
1536 | /* | ||
1537 | Clears the error and end-of-file flags for file. This is analogous to the | ||
1538 | clearerr() function in stdio. This is useful for continuing to read a gzip | ||
1539 | file that is being written concurrently. | ||
1540 | */ | ||
1541 | |||
1542 | #endif /* !Z_SOLO */ | ||
1543 | |||
1544 | /* checksum functions */ | ||
1545 | |||
1546 | /* | ||
1547 | These functions are not related to compression but are exported | ||
1548 | anyway because they might be useful in applications using the compression | ||
1549 | library. | ||
1550 | */ | ||
1551 | |||
1552 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | ||
1553 | /* | ||
1554 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | ||
1555 | return the updated checksum. If buf is Z_NULL, this function returns the | ||
1556 | required initial value for the checksum. | ||
1557 | |||
1558 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed | ||
1559 | much faster. | ||
1560 | |||
1561 | Usage example: | ||
1562 | |||
1563 | uLong adler = adler32(0L, Z_NULL, 0); | ||
1564 | |||
1565 | while (read_buffer(buffer, length) != EOF) { | ||
1566 | adler = adler32(adler, buffer, length); | ||
1567 | } | ||
1568 | if (adler != original_adler) error(); | ||
1569 | */ | ||
1570 | |||
1571 | /* | ||
1572 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | ||
1573 | z_off_t len2)); | ||
1574 | |||
1575 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | ||
1576 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | ||
1577 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of | ||
1578 | seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note | ||
1579 | that the z_off_t type (like off_t) is a signed integer. If len2 is | ||
1580 | negative, the result has no meaning or utility. | ||
1581 | */ | ||
1582 | |||
1583 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | ||
1584 | /* | ||
1585 | Update a running CRC-32 with the bytes buf[0..len-1] and return the | ||
1586 | updated CRC-32. If buf is Z_NULL, this function returns the required | ||
1587 | initial value for the crc. Pre- and post-conditioning (one's complement) is | ||
1588 | performed within this function so it shouldn't be done by the application. | ||
1589 | |||
1590 | Usage example: | ||
1591 | |||
1592 | uLong crc = crc32(0L, Z_NULL, 0); | ||
1593 | |||
1594 | while (read_buffer(buffer, length) != EOF) { | ||
1595 | crc = crc32(crc, buffer, length); | ||
1596 | } | ||
1597 | if (crc != original_crc) error(); | ||
1598 | */ | ||
1599 | |||
1600 | /* | ||
1601 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); | ||
1602 | |||
1603 | Combine two CRC-32 check values into one. For two sequences of bytes, | ||
1604 | seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | ||
1605 | calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | ||
1606 | check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and | ||
1607 | len2. | ||
1608 | */ | ||
1609 | |||
1610 | |||
1611 | /* various hacks, don't look :) */ | ||
1612 | |||
1613 | /* deflateInit and inflateInit are macros to allow checking the zlib version | ||
1614 | * and the compiler's view of z_stream: | ||
1615 | */ | ||
1616 | ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, | ||
1617 | const char *version, int stream_size)); | ||
1618 | ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, | ||
1619 | const char *version, int stream_size)); | ||
1620 | ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | ||
1621 | int windowBits, int memLevel, | ||
1622 | int strategy, const char *version, | ||
1623 | int stream_size)); | ||
1624 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | ||
1625 | const char *version, int stream_size)); | ||
1626 | ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, | ||
1627 | unsigned char FAR *window, | ||
1628 | const char *version, | ||
1629 | int stream_size)); | ||
1630 | #define deflateInit(strm, level) \ | ||
1631 | deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) | ||
1632 | #define inflateInit(strm) \ | ||
1633 | inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) | ||
1634 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | ||
1635 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | ||
1636 | (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) | ||
1637 | #define inflateInit2(strm, windowBits) \ | ||
1638 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ | ||
1639 | (int)sizeof(z_stream)) | ||
1640 | #define inflateBackInit(strm, windowBits, window) \ | ||
1641 | inflateBackInit_((strm), (windowBits), (window), \ | ||
1642 | ZLIB_VERSION, (int)sizeof(z_stream)) | ||
1643 | |||
1644 | #ifndef Z_SOLO | ||
1645 | |||
1646 | /* gzgetc() macro and its supporting function and exposed data structure. Note | ||
1647 | * that the real internal state is much larger than the exposed structure. | ||
1648 | * This abbreviated structure exposes just enough for the gzgetc() macro. The | ||
1649 | * user should not mess with these exposed elements, since their names or | ||
1650 | * behavior could change in the future, perhaps even capriciously. They can | ||
1651 | * only be used by the gzgetc() macro. You have been warned. | ||
1652 | */ | ||
1653 | struct gzFile_s { | ||
1654 | unsigned have; | ||
1655 | unsigned char *next; | ||
1656 | z_off64_t pos; | ||
1657 | }; | ||
1658 | ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ | ||
1659 | #ifdef Z_PREFIX_SET | ||
1660 | # undef z_gzgetc | ||
1661 | # define z_gzgetc(g) \ | ||
1662 | ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | ||
1663 | #else | ||
1664 | # define gzgetc(g) \ | ||
1665 | ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | ||
1666 | #endif | ||
1667 | |||
1668 | /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or | ||
1669 | * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if | ||
1670 | * both are true, the application gets the *64 functions, and the regular | ||
1671 | * functions are changed to 64 bits) -- in case these are set on systems | ||
1672 | * without large file support, _LFS64_LARGEFILE must also be true | ||
1673 | */ | ||
1674 | #ifdef Z_LARGE64 | ||
1675 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||
1676 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); | ||
1677 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | ||
1678 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | ||
1679 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | ||
1680 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | ||
1681 | #endif | ||
1682 | |||
1683 | #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) | ||
1684 | # ifdef Z_PREFIX_SET | ||
1685 | # define z_gzopen z_gzopen64 | ||
1686 | # define z_gzseek z_gzseek64 | ||
1687 | # define z_gztell z_gztell64 | ||
1688 | # define z_gzoffset z_gzoffset64 | ||
1689 | # define z_adler32_combine z_adler32_combine64 | ||
1690 | # define z_crc32_combine z_crc32_combine64 | ||
1691 | # else | ||
1692 | # define gzopen gzopen64 | ||
1693 | # define gzseek gzseek64 | ||
1694 | # define gztell gztell64 | ||
1695 | # define gzoffset gzoffset64 | ||
1696 | # define adler32_combine adler32_combine64 | ||
1697 | # define crc32_combine crc32_combine64 | ||
1698 | # endif | ||
1699 | # ifndef Z_LARGE64 | ||
1700 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||
1701 | ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); | ||
1702 | ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); | ||
1703 | ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); | ||
1704 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | ||
1705 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | ||
1706 | # endif | ||
1707 | #else | ||
1708 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | ||
1709 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | ||
1710 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | ||
1711 | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | ||
1712 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ||
1713 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ||
1714 | #endif | ||
1715 | |||
1716 | #else /* Z_SOLO */ | ||
1717 | |||
1718 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ||
1719 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ||
1720 | |||
1721 | #endif /* !Z_SOLO */ | ||
1722 | |||
1723 | /* hack for buggy compilers */ | ||
1724 | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | ||
1725 | struct internal_state {int dummy;}; | ||
1726 | #endif | ||
1727 | |||
1728 | /* undocumented functions */ | ||
1729 | ZEXTERN const char * ZEXPORT zError OF((int)); | ||
1730 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | ||
1731 | ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | ||
1732 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | ||
1733 | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | ||
1734 | ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | ||
1735 | #if defined(_WIN32) && !defined(Z_SOLO) | ||
1736 | ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | ||
1737 | const char *mode)); | ||
1738 | #endif | ||
1739 | |||
1740 | #ifdef __cplusplus | ||
1741 | } | ||
1742 | #endif | ||
1743 | |||
1744 | #endif /* ZLIB_H */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.map b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.map deleted file mode 100644 index 771f420..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.map +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | ZLIB_1.2.0 { | ||
2 | global: | ||
3 | compressBound; | ||
4 | deflateBound; | ||
5 | inflateBack; | ||
6 | inflateBackEnd; | ||
7 | inflateBackInit_; | ||
8 | inflateCopy; | ||
9 | local: | ||
10 | deflate_copyright; | ||
11 | inflate_copyright; | ||
12 | inflate_fast; | ||
13 | inflate_table; | ||
14 | zcalloc; | ||
15 | zcfree; | ||
16 | z_errmsg; | ||
17 | gz_error; | ||
18 | gz_intmax; | ||
19 | _*; | ||
20 | }; | ||
21 | |||
22 | ZLIB_1.2.0.2 { | ||
23 | gzclearerr; | ||
24 | gzungetc; | ||
25 | zlibCompileFlags; | ||
26 | } ZLIB_1.2.0; | ||
27 | |||
28 | ZLIB_1.2.0.8 { | ||
29 | deflatePrime; | ||
30 | } ZLIB_1.2.0.2; | ||
31 | |||
32 | ZLIB_1.2.2 { | ||
33 | adler32_combine; | ||
34 | crc32_combine; | ||
35 | deflateSetHeader; | ||
36 | inflateGetHeader; | ||
37 | } ZLIB_1.2.0.8; | ||
38 | |||
39 | ZLIB_1.2.2.3 { | ||
40 | deflateTune; | ||
41 | gzdirect; | ||
42 | } ZLIB_1.2.2; | ||
43 | |||
44 | ZLIB_1.2.2.4 { | ||
45 | inflatePrime; | ||
46 | } ZLIB_1.2.2.3; | ||
47 | |||
48 | ZLIB_1.2.3.3 { | ||
49 | adler32_combine64; | ||
50 | crc32_combine64; | ||
51 | gzopen64; | ||
52 | gzseek64; | ||
53 | gztell64; | ||
54 | inflateUndermine; | ||
55 | } ZLIB_1.2.2.4; | ||
56 | |||
57 | ZLIB_1.2.3.4 { | ||
58 | inflateReset2; | ||
59 | inflateMark; | ||
60 | } ZLIB_1.2.3.3; | ||
61 | |||
62 | ZLIB_1.2.3.5 { | ||
63 | gzbuffer; | ||
64 | gzoffset; | ||
65 | gzoffset64; | ||
66 | gzclose_r; | ||
67 | gzclose_w; | ||
68 | } ZLIB_1.2.3.4; | ||
69 | |||
70 | ZLIB_1.2.5.1 { | ||
71 | deflatePending; | ||
72 | } ZLIB_1.2.3.5; | ||
73 | |||
74 | ZLIB_1.2.5.2 { | ||
75 | deflateResetKeep; | ||
76 | gzgetc_; | ||
77 | inflateResetKeep; | ||
78 | } ZLIB_1.2.5.1; | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.cmakein b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.cmakein deleted file mode 100644 index a5e6429..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.cmakein +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | prefix=@CMAKE_INSTALL_PREFIX@ | ||
2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ | ||
3 | libdir=@INSTALL_LIB_DIR@ | ||
4 | sharedlibdir=@INSTALL_LIB_DIR@ | ||
5 | includedir=@INSTALL_INC_DIR@ | ||
6 | |||
7 | Name: zlib | ||
8 | Description: zlib compression library | ||
9 | Version: @VERSION@ | ||
10 | |||
11 | Requires: | ||
12 | Libs: -L${libdir} -L${sharedlibdir} -lz | ||
13 | Cflags: -I${includedir} | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.in b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.in deleted file mode 100644 index 7e5acf9..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib.pc.in +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | prefix=@prefix@ | ||
2 | exec_prefix=@exec_prefix@ | ||
3 | libdir=@libdir@ | ||
4 | sharedlibdir=@sharedlibdir@ | ||
5 | includedir=@includedir@ | ||
6 | |||
7 | Name: zlib | ||
8 | Description: zlib compression library | ||
9 | Version: @VERSION@ | ||
10 | |||
11 | Requires: | ||
12 | Libs: -L${libdir} -L${sharedlibdir} -lz | ||
13 | Cflags: -I${includedir} | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib2ansi b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib2ansi deleted file mode 100644 index 15e3e16..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zlib2ansi +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Transform K&R C function definitions into ANSI equivalent. | ||
4 | # | ||
5 | # Author: Paul Marquess | ||
6 | # Version: 1.0 | ||
7 | # Date: 3 October 2006 | ||
8 | |||
9 | # TODO | ||
10 | # | ||
11 | # Asumes no function pointer parameters. unless they are typedefed. | ||
12 | # Assumes no literal strings that look like function definitions | ||
13 | # Assumes functions start at the beginning of a line | ||
14 | |||
15 | use strict; | ||
16 | use warnings; | ||
17 | |||
18 | local $/; | ||
19 | $_ = <>; | ||
20 | |||
21 | my $sp = qr{ \s* (?: /\* .*? \*/ )? \s* }x; # assume no nested comments | ||
22 | |||
23 | my $d1 = qr{ $sp (?: [\w\*\s]+ $sp)* $sp \w+ $sp [\[\]\s]* $sp }x ; | ||
24 | my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ; | ||
25 | my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ; | ||
26 | |||
27 | |||
28 | while (s/^ | ||
29 | ( # Start $1 | ||
30 | ( # Start $2 | ||
31 | .*? # Minimal eat content | ||
32 | ( ^ \w [\w\s\*]+ ) # $3 -- function name | ||
33 | \s* # optional whitespace | ||
34 | ) # $2 - Matched up to before parameter list | ||
35 | |||
36 | \( \s* # Literal "(" + optional whitespace | ||
37 | ( [^\)]+ ) # $4 - one or more anythings except ")" | ||
38 | \s* \) # optional whitespace surrounding a Literal ")" | ||
39 | |||
40 | ( (?: $dList )+ ) # $5 | ||
41 | |||
42 | $sp ^ { # literal "{" at start of line | ||
43 | ) # Remember to $1 | ||
44 | //xsom | ||
45 | ) | ||
46 | { | ||
47 | my $all = $1 ; | ||
48 | my $prefix = $2; | ||
49 | my $param_list = $4 ; | ||
50 | my $params = $5; | ||
51 | |||
52 | StripComments($params); | ||
53 | StripComments($param_list); | ||
54 | $param_list =~ s/^\s+//; | ||
55 | $param_list =~ s/\s+$//; | ||
56 | |||
57 | my $i = 0 ; | ||
58 | my %pList = map { $_ => $i++ } | ||
59 | split /\s*,\s*/, $param_list; | ||
60 | my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ; | ||
61 | |||
62 | my @params = split /\s*;\s*/, $params; | ||
63 | my @outParams = (); | ||
64 | foreach my $p (@params) | ||
65 | { | ||
66 | if ($p =~ /,/) | ||
67 | { | ||
68 | my @bits = split /\s*,\s*/, $p; | ||
69 | my $first = shift @bits; | ||
70 | $first =~ s/^\s*//; | ||
71 | push @outParams, $first; | ||
72 | $first =~ /^(\w+\s*)/; | ||
73 | my $type = $1 ; | ||
74 | push @outParams, map { $type . $_ } @bits; | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | $p =~ s/^\s+//; | ||
79 | push @outParams, $p; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | |||
84 | my %tmp = map { /$pMatch/; $_ => $pList{$1} } | ||
85 | @outParams ; | ||
86 | |||
87 | @outParams = map { " $_" } | ||
88 | sort { $tmp{$a} <=> $tmp{$b} } | ||
89 | @outParams ; | ||
90 | |||
91 | print $prefix ; | ||
92 | print "(\n" . join(",\n", @outParams) . ")\n"; | ||
93 | print "{" ; | ||
94 | |||
95 | } | ||
96 | |||
97 | # Output any trailing code. | ||
98 | print ; | ||
99 | exit 0; | ||
100 | |||
101 | |||
102 | sub StripComments | ||
103 | { | ||
104 | |||
105 | no warnings; | ||
106 | |||
107 | # Strip C & C++ coments | ||
108 | # From the perlfaq | ||
109 | $_[0] =~ | ||
110 | |||
111 | s{ | ||
112 | /\* ## Start of /* ... */ comment | ||
113 | [^*]*\*+ ## Non-* followed by 1-or-more *'s | ||
114 | ( | ||
115 | [^/*][^*]*\*+ | ||
116 | )* ## 0-or-more things which don't start with / | ||
117 | ## but do end with '*' | ||
118 | / ## End of /* ... */ comment | ||
119 | |||
120 | | ## OR C++ Comment | ||
121 | // ## Start of C++ comment // | ||
122 | [^\n]* ## followed by 0-or-more non end of line characters | ||
123 | |||
124 | | ## OR various things which aren't comments: | ||
125 | |||
126 | ( | ||
127 | " ## Start of " ... " string | ||
128 | ( | ||
129 | \\. ## Escaped char | ||
130 | | ## OR | ||
131 | [^"\\] ## Non "\ | ||
132 | )* | ||
133 | " ## End of " ... " string | ||
134 | |||
135 | | ## OR | ||
136 | |||
137 | ' ## Start of ' ... ' string | ||
138 | ( | ||
139 | \\. ## Escaped char | ||
140 | | ## OR | ||
141 | [^'\\] ## Non '\ | ||
142 | )* | ||
143 | ' ## End of ' ... ' string | ||
144 | |||
145 | | ## OR | ||
146 | |||
147 | . ## Anything other char | ||
148 | [^/"'\\]* ## Chars which doesn't start a comment, string or escape | ||
149 | ) | ||
150 | }{$2}gxs; | ||
151 | |||
152 | } | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.c b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.c deleted file mode 100644 index fba73b7..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.c +++ /dev/null | |||
@@ -1,324 +0,0 @@ | |||
1 | /* zutil.c -- target dependent utility functions for the compression library | ||
2 | * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #include "zutil.h" | ||
9 | #ifndef Z_SOLO | ||
10 | # include "gzguts.h" | ||
11 | #endif | ||
12 | |||
13 | #ifndef NO_DUMMY_DECL | ||
14 | struct internal_state {int dummy;}; /* for buggy compilers */ | ||
15 | #endif | ||
16 | |||
17 | const char * const z_errmsg[10] = { | ||
18 | "need dictionary", /* Z_NEED_DICT 2 */ | ||
19 | "stream end", /* Z_STREAM_END 1 */ | ||
20 | "", /* Z_OK 0 */ | ||
21 | "file error", /* Z_ERRNO (-1) */ | ||
22 | "stream error", /* Z_STREAM_ERROR (-2) */ | ||
23 | "data error", /* Z_DATA_ERROR (-3) */ | ||
24 | "insufficient memory", /* Z_MEM_ERROR (-4) */ | ||
25 | "buffer error", /* Z_BUF_ERROR (-5) */ | ||
26 | "incompatible version",/* Z_VERSION_ERROR (-6) */ | ||
27 | ""}; | ||
28 | |||
29 | |||
30 | const char * ZEXPORT zlibVersion() | ||
31 | { | ||
32 | return ZLIB_VERSION; | ||
33 | } | ||
34 | |||
35 | uLong ZEXPORT zlibCompileFlags() | ||
36 | { | ||
37 | uLong flags; | ||
38 | |||
39 | flags = 0; | ||
40 | switch ((int)(sizeof(uInt))) { | ||
41 | case 2: break; | ||
42 | case 4: flags += 1; break; | ||
43 | case 8: flags += 2; break; | ||
44 | default: flags += 3; | ||
45 | } | ||
46 | switch ((int)(sizeof(uLong))) { | ||
47 | case 2: break; | ||
48 | case 4: flags += 1 << 2; break; | ||
49 | case 8: flags += 2 << 2; break; | ||
50 | default: flags += 3 << 2; | ||
51 | } | ||
52 | switch ((int)(sizeof(voidpf))) { | ||
53 | case 2: break; | ||
54 | case 4: flags += 1 << 4; break; | ||
55 | case 8: flags += 2 << 4; break; | ||
56 | default: flags += 3 << 4; | ||
57 | } | ||
58 | switch ((int)(sizeof(z_off_t))) { | ||
59 | case 2: break; | ||
60 | case 4: flags += 1 << 6; break; | ||
61 | case 8: flags += 2 << 6; break; | ||
62 | default: flags += 3 << 6; | ||
63 | } | ||
64 | #ifdef DEBUG | ||
65 | flags += 1 << 8; | ||
66 | #endif | ||
67 | #if defined(ASMV) || defined(ASMINF) | ||
68 | flags += 1 << 9; | ||
69 | #endif | ||
70 | #ifdef ZLIB_WINAPI | ||
71 | flags += 1 << 10; | ||
72 | #endif | ||
73 | #ifdef BUILDFIXED | ||
74 | flags += 1 << 12; | ||
75 | #endif | ||
76 | #ifdef DYNAMIC_CRC_TABLE | ||
77 | flags += 1 << 13; | ||
78 | #endif | ||
79 | #ifdef NO_GZCOMPRESS | ||
80 | flags += 1L << 16; | ||
81 | #endif | ||
82 | #ifdef NO_GZIP | ||
83 | flags += 1L << 17; | ||
84 | #endif | ||
85 | #ifdef PKZIP_BUG_WORKAROUND | ||
86 | flags += 1L << 20; | ||
87 | #endif | ||
88 | #ifdef FASTEST | ||
89 | flags += 1L << 21; | ||
90 | #endif | ||
91 | #if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
92 | # ifdef NO_vsnprintf | ||
93 | flags += 1L << 25; | ||
94 | # ifdef HAS_vsprintf_void | ||
95 | flags += 1L << 26; | ||
96 | # endif | ||
97 | # else | ||
98 | # ifdef HAS_vsnprintf_void | ||
99 | flags += 1L << 26; | ||
100 | # endif | ||
101 | # endif | ||
102 | #else | ||
103 | flags += 1L << 24; | ||
104 | # ifdef NO_snprintf | ||
105 | flags += 1L << 25; | ||
106 | # ifdef HAS_sprintf_void | ||
107 | flags += 1L << 26; | ||
108 | # endif | ||
109 | # else | ||
110 | # ifdef HAS_snprintf_void | ||
111 | flags += 1L << 26; | ||
112 | # endif | ||
113 | # endif | ||
114 | #endif | ||
115 | return flags; | ||
116 | } | ||
117 | |||
118 | #ifdef DEBUG | ||
119 | |||
120 | # ifndef verbose | ||
121 | # define verbose 0 | ||
122 | # endif | ||
123 | int ZLIB_INTERNAL z_verbose = verbose; | ||
124 | |||
125 | void ZLIB_INTERNAL z_error (m) | ||
126 | char *m; | ||
127 | { | ||
128 | fprintf(stderr, "%s\n", m); | ||
129 | exit(1); | ||
130 | } | ||
131 | #endif | ||
132 | |||
133 | /* exported to allow conversion of error code to string for compress() and | ||
134 | * uncompress() | ||
135 | */ | ||
136 | const char * ZEXPORT zError(err) | ||
137 | int err; | ||
138 | { | ||
139 | return ERR_MSG(err); | ||
140 | } | ||
141 | |||
142 | #if defined(_WIN32_WCE) | ||
143 | /* The Microsoft C Run-Time Library for Windows CE doesn't have | ||
144 | * errno. We define it as a global variable to simplify porting. | ||
145 | * Its value is always 0 and should not be used. | ||
146 | */ | ||
147 | int errno = 0; | ||
148 | #endif | ||
149 | |||
150 | #ifndef HAVE_MEMCPY | ||
151 | |||
152 | void ZLIB_INTERNAL zmemcpy(dest, source, len) | ||
153 | Bytef* dest; | ||
154 | const Bytef* source; | ||
155 | uInt len; | ||
156 | { | ||
157 | if (len == 0) return; | ||
158 | do { | ||
159 | *dest++ = *source++; /* ??? to be unrolled */ | ||
160 | } while (--len != 0); | ||
161 | } | ||
162 | |||
163 | int ZLIB_INTERNAL zmemcmp(s1, s2, len) | ||
164 | const Bytef* s1; | ||
165 | const Bytef* s2; | ||
166 | uInt len; | ||
167 | { | ||
168 | uInt j; | ||
169 | |||
170 | for (j = 0; j < len; j++) { | ||
171 | if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; | ||
172 | } | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | void ZLIB_INTERNAL zmemzero(dest, len) | ||
177 | Bytef* dest; | ||
178 | uInt len; | ||
179 | { | ||
180 | if (len == 0) return; | ||
181 | do { | ||
182 | *dest++ = 0; /* ??? to be unrolled */ | ||
183 | } while (--len != 0); | ||
184 | } | ||
185 | #endif | ||
186 | |||
187 | #ifndef Z_SOLO | ||
188 | |||
189 | #ifdef SYS16BIT | ||
190 | |||
191 | #ifdef __TURBOC__ | ||
192 | /* Turbo C in 16-bit mode */ | ||
193 | |||
194 | # define MY_ZCALLOC | ||
195 | |||
196 | /* Turbo C malloc() does not allow dynamic allocation of 64K bytes | ||
197 | * and farmalloc(64K) returns a pointer with an offset of 8, so we | ||
198 | * must fix the pointer. Warning: the pointer must be put back to its | ||
199 | * original form in order to free it, use zcfree(). | ||
200 | */ | ||
201 | |||
202 | #define MAX_PTR 10 | ||
203 | /* 10*64K = 640K */ | ||
204 | |||
205 | local int next_ptr = 0; | ||
206 | |||
207 | typedef struct ptr_table_s { | ||
208 | voidpf org_ptr; | ||
209 | voidpf new_ptr; | ||
210 | } ptr_table; | ||
211 | |||
212 | local ptr_table table[MAX_PTR]; | ||
213 | /* This table is used to remember the original form of pointers | ||
214 | * to large buffers (64K). Such pointers are normalized with a zero offset. | ||
215 | * Since MSDOS is not a preemptive multitasking OS, this table is not | ||
216 | * protected from concurrent access. This hack doesn't work anyway on | ||
217 | * a protected system like OS/2. Use Microsoft C instead. | ||
218 | */ | ||
219 | |||
220 | voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) | ||
221 | { | ||
222 | voidpf buf = opaque; /* just to make some compilers happy */ | ||
223 | ulg bsize = (ulg)items*size; | ||
224 | |||
225 | /* If we allocate less than 65520 bytes, we assume that farmalloc | ||
226 | * will return a usable pointer which doesn't have to be normalized. | ||
227 | */ | ||
228 | if (bsize < 65520L) { | ||
229 | buf = farmalloc(bsize); | ||
230 | if (*(ush*)&buf != 0) return buf; | ||
231 | } else { | ||
232 | buf = farmalloc(bsize + 16L); | ||
233 | } | ||
234 | if (buf == NULL || next_ptr >= MAX_PTR) return NULL; | ||
235 | table[next_ptr].org_ptr = buf; | ||
236 | |||
237 | /* Normalize the pointer to seg:0 */ | ||
238 | *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; | ||
239 | *(ush*)&buf = 0; | ||
240 | table[next_ptr++].new_ptr = buf; | ||
241 | return buf; | ||
242 | } | ||
243 | |||
244 | void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) | ||
245 | { | ||
246 | int n; | ||
247 | if (*(ush*)&ptr != 0) { /* object < 64K */ | ||
248 | farfree(ptr); | ||
249 | return; | ||
250 | } | ||
251 | /* Find the original pointer */ | ||
252 | for (n = 0; n < next_ptr; n++) { | ||
253 | if (ptr != table[n].new_ptr) continue; | ||
254 | |||
255 | farfree(table[n].org_ptr); | ||
256 | while (++n < next_ptr) { | ||
257 | table[n-1] = table[n]; | ||
258 | } | ||
259 | next_ptr--; | ||
260 | return; | ||
261 | } | ||
262 | ptr = opaque; /* just to make some compilers happy */ | ||
263 | Assert(0, "zcfree: ptr not found"); | ||
264 | } | ||
265 | |||
266 | #endif /* __TURBOC__ */ | ||
267 | |||
268 | |||
269 | #ifdef M_I86 | ||
270 | /* Microsoft C in 16-bit mode */ | ||
271 | |||
272 | # define MY_ZCALLOC | ||
273 | |||
274 | #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) | ||
275 | # define _halloc halloc | ||
276 | # define _hfree hfree | ||
277 | #endif | ||
278 | |||
279 | voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) | ||
280 | { | ||
281 | if (opaque) opaque = 0; /* to make compiler happy */ | ||
282 | return _halloc((long)items, size); | ||
283 | } | ||
284 | |||
285 | void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) | ||
286 | { | ||
287 | if (opaque) opaque = 0; /* to make compiler happy */ | ||
288 | _hfree(ptr); | ||
289 | } | ||
290 | |||
291 | #endif /* M_I86 */ | ||
292 | |||
293 | #endif /* SYS16BIT */ | ||
294 | |||
295 | |||
296 | #ifndef MY_ZCALLOC /* Any system without a special alloc function */ | ||
297 | |||
298 | #ifndef STDC | ||
299 | extern voidp malloc OF((uInt size)); | ||
300 | extern voidp calloc OF((uInt items, uInt size)); | ||
301 | extern void free OF((voidpf ptr)); | ||
302 | #endif | ||
303 | |||
304 | voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) | ||
305 | voidpf opaque; | ||
306 | unsigned items; | ||
307 | unsigned size; | ||
308 | { | ||
309 | if (opaque) items += size - size; /* make compiler happy */ | ||
310 | return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : | ||
311 | (voidpf)calloc(items, size); | ||
312 | } | ||
313 | |||
314 | void ZLIB_INTERNAL zcfree (opaque, ptr) | ||
315 | voidpf opaque; | ||
316 | voidpf ptr; | ||
317 | { | ||
318 | free(ptr); | ||
319 | if (opaque) return; /* make compiler happy */ | ||
320 | } | ||
321 | |||
322 | #endif /* MY_ZCALLOC */ | ||
323 | |||
324 | #endif /* !Z_SOLO */ | ||
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.h b/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.h deleted file mode 100644 index a133a91..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/zlib/zutil.h +++ /dev/null | |||
@@ -1,252 +0,0 @@ | |||
1 | /* zutil.h -- internal interface and configuration of the compression library | ||
2 | * Copyright (C) 1995-2012 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* WARNING: this file should *not* be used by applications. It is | ||
7 | part of the implementation of the compression library and is | ||
8 | subject to change. Applications should only use zlib.h. | ||
9 | */ | ||
10 | |||
11 | /* @(#) $Id$ */ | ||
12 | |||
13 | #ifndef ZUTIL_H | ||
14 | #define ZUTIL_H | ||
15 | |||
16 | #ifdef HAVE_HIDDEN | ||
17 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) | ||
18 | #else | ||
19 | # define ZLIB_INTERNAL | ||
20 | #endif | ||
21 | |||
22 | #include "zlib.h" | ||
23 | |||
24 | #if defined(STDC) && !defined(Z_SOLO) | ||
25 | # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) | ||
26 | # include <stddef.h> | ||
27 | # endif | ||
28 | # include <string.h> | ||
29 | # include <stdlib.h> | ||
30 | #endif | ||
31 | |||
32 | #ifdef Z_SOLO | ||
33 | typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ | ||
34 | #endif | ||
35 | |||
36 | #ifndef local | ||
37 | # define local static | ||
38 | #endif | ||
39 | /* compile with -Dlocal if your debugger can't find static symbols */ | ||
40 | |||
41 | typedef unsigned char uch; | ||
42 | typedef uch FAR uchf; | ||
43 | typedef unsigned short ush; | ||
44 | typedef ush FAR ushf; | ||
45 | typedef unsigned long ulg; | ||
46 | |||
47 | extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | ||
48 | /* (size given to avoid silly warnings with Visual C++) */ | ||
49 | |||
50 | #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] | ||
51 | |||
52 | #define ERR_RETURN(strm,err) \ | ||
53 | return (strm->msg = (char*)ERR_MSG(err), (err)) | ||
54 | /* To be used only when the state is known to be valid */ | ||
55 | |||
56 | /* common constants */ | ||
57 | |||
58 | #ifndef DEF_WBITS | ||
59 | # define DEF_WBITS MAX_WBITS | ||
60 | #endif | ||
61 | /* default windowBits for decompression. MAX_WBITS is for compression only */ | ||
62 | |||
63 | #if MAX_MEM_LEVEL >= 8 | ||
64 | # define DEF_MEM_LEVEL 8 | ||
65 | #else | ||
66 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
67 | #endif | ||
68 | /* default memLevel */ | ||
69 | |||
70 | #define STORED_BLOCK 0 | ||
71 | #define STATIC_TREES 1 | ||
72 | #define DYN_TREES 2 | ||
73 | /* The three kinds of block type */ | ||
74 | |||
75 | #define MIN_MATCH 3 | ||
76 | #define MAX_MATCH 258 | ||
77 | /* The minimum and maximum match lengths */ | ||
78 | |||
79 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ | ||
80 | |||
81 | /* target dependencies */ | ||
82 | |||
83 | #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) | ||
84 | # define OS_CODE 0x00 | ||
85 | # ifndef Z_SOLO | ||
86 | # if defined(__TURBOC__) || defined(__BORLANDC__) | ||
87 | # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) | ||
88 | /* Allow compilation with ANSI keywords only enabled */ | ||
89 | void _Cdecl farfree( void *block ); | ||
90 | void *_Cdecl farmalloc( unsigned long nbytes ); | ||
91 | # else | ||
92 | # include <alloc.h> | ||
93 | # endif | ||
94 | # else /* MSC or DJGPP */ | ||
95 | # include <malloc.h> | ||
96 | # endif | ||
97 | # endif | ||
98 | #endif | ||
99 | |||
100 | #ifdef AMIGA | ||
101 | # define OS_CODE 0x01 | ||
102 | #endif | ||
103 | |||
104 | #if defined(VAXC) || defined(VMS) | ||
105 | # define OS_CODE 0x02 | ||
106 | # define F_OPEN(name, mode) \ | ||
107 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") | ||
108 | #endif | ||
109 | |||
110 | #if defined(ATARI) || defined(atarist) | ||
111 | # define OS_CODE 0x05 | ||
112 | #endif | ||
113 | |||
114 | #ifdef OS2 | ||
115 | # define OS_CODE 0x06 | ||
116 | # if defined(M_I86) && !defined(Z_SOLO) | ||
117 | # include <malloc.h> | ||
118 | # endif | ||
119 | #endif | ||
120 | |||
121 | #if defined(MACOS) || defined(TARGET_OS_MAC) | ||
122 | # define OS_CODE 0x07 | ||
123 | # ifndef Z_SOLO | ||
124 | # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os | ||
125 | # include <unix.h> /* for fdopen */ | ||
126 | # else | ||
127 | # ifndef fdopen | ||
128 | # define fdopen(fd,mode) NULL /* No fdopen() */ | ||
129 | # endif | ||
130 | # endif | ||
131 | # endif | ||
132 | #endif | ||
133 | |||
134 | #ifdef TOPS20 | ||
135 | # define OS_CODE 0x0a | ||
136 | #endif | ||
137 | |||
138 | #ifdef WIN32 | ||
139 | # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ | ||
140 | # define OS_CODE 0x0b | ||
141 | # endif | ||
142 | #endif | ||
143 | |||
144 | #ifdef __50SERIES /* Prime/PRIMOS */ | ||
145 | # define OS_CODE 0x0f | ||
146 | #endif | ||
147 | |||
148 | #if defined(_BEOS_) || defined(RISCOS) | ||
149 | # define fdopen(fd,mode) NULL /* No fdopen() */ | ||
150 | #endif | ||
151 | |||
152 | #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX | ||
153 | # if defined(_WIN32_WCE) | ||
154 | # define fdopen(fd,mode) NULL /* No fdopen() */ | ||
155 | # ifndef _PTRDIFF_T_DEFINED | ||
156 | typedef int ptrdiff_t; | ||
157 | # define _PTRDIFF_T_DEFINED | ||
158 | # endif | ||
159 | # else | ||
160 | # define fdopen(fd,type) _fdopen(fd,type) | ||
161 | # endif | ||
162 | #endif | ||
163 | |||
164 | #if defined(__BORLANDC__) && !defined(MSDOS) | ||
165 | #pragma warn -8004 | ||
166 | #pragma warn -8008 | ||
167 | #pragma warn -8066 | ||
168 | #endif | ||
169 | |||
170 | /* provide prototypes for these when building zlib without LFS */ | ||
171 | #if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) | ||
172 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | ||
173 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | ||
174 | #endif | ||
175 | |||
176 | /* common defaults */ | ||
177 | |||
178 | #ifndef OS_CODE | ||
179 | # define OS_CODE 0x03 /* assume Unix */ | ||
180 | #endif | ||
181 | |||
182 | #ifndef F_OPEN | ||
183 | # define F_OPEN(name, mode) fopen((name), (mode)) | ||
184 | #endif | ||
185 | |||
186 | /* functions */ | ||
187 | |||
188 | #if defined(pyr) || defined(Z_SOLO) | ||
189 | # define NO_MEMCPY | ||
190 | #endif | ||
191 | #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) | ||
192 | /* Use our own functions for small and medium model with MSC <= 5.0. | ||
193 | * You may have to use the same strategy for Borland C (untested). | ||
194 | * The __SC__ check is for Symantec. | ||
195 | */ | ||
196 | # define NO_MEMCPY | ||
197 | #endif | ||
198 | #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) | ||
199 | # define HAVE_MEMCPY | ||
200 | #endif | ||
201 | #ifdef HAVE_MEMCPY | ||
202 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ | ||
203 | # define zmemcpy _fmemcpy | ||
204 | # define zmemcmp _fmemcmp | ||
205 | # define zmemzero(dest, len) _fmemset(dest, 0, len) | ||
206 | # else | ||
207 | # define zmemcpy memcpy | ||
208 | # define zmemcmp memcmp | ||
209 | # define zmemzero(dest, len) memset(dest, 0, len) | ||
210 | # endif | ||
211 | #else | ||
212 | void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); | ||
213 | int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); | ||
214 | void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); | ||
215 | #endif | ||
216 | |||
217 | /* Diagnostic functions */ | ||
218 | #ifdef DEBUG | ||
219 | # include <stdio.h> | ||
220 | extern int ZLIB_INTERNAL z_verbose; | ||
221 | extern void ZLIB_INTERNAL z_error OF((char *m)); | ||
222 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);} | ||
223 | # define Trace(x) {if (z_verbose>=0) fprintf x ;} | ||
224 | # define Tracev(x) {if (z_verbose>0) fprintf x ;} | ||
225 | # define Tracevv(x) {if (z_verbose>1) fprintf x ;} | ||
226 | # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} | ||
227 | # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} | ||
228 | #else | ||
229 | # define Assert(cond,msg) | ||
230 | # define Trace(x) | ||
231 | # define Tracev(x) | ||
232 | # define Tracevv(x) | ||
233 | # define Tracec(c,x) | ||
234 | # define Tracecv(c,x) | ||
235 | #endif | ||
236 | |||
237 | #ifndef Z_SOLO | ||
238 | voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, | ||
239 | unsigned size)); | ||
240 | void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); | ||
241 | #endif | ||
242 | |||
243 | #define ZALLOC(strm, items, size) \ | ||
244 | (*((strm)->zalloc))((strm)->opaque, (items), (size)) | ||
245 | #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) | ||
246 | #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} | ||
247 | |||
248 | /* Reverse the bytes in a 32-bit value */ | ||
249 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ | ||
250 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) | ||
251 | |||
252 | #endif /* ZUTIL_H */ | ||