├── Android.mk ├── CleanSpec.mk ├── MODULE_LICENSE_BSD_LIKE ├── NOTICE ├── src ├── CMakeLists.txt ├── ChangeLog ├── FAQ ├── INDEX ├── Makefile.in ├── README ├── adler32.c ├── amiga │ ├── Makefile.pup │ └── Makefile.sas ├── as400 │ ├── bndsrc │ ├── compile.clp │ ├── readme.txt │ └── zlib.inc ├── compress.c ├── configure ├── contrib │ ├── README.contrib │ ├── ada │ │ ├── buffer_demo.adb │ │ ├── mtest.adb │ │ ├── read.adb │ │ ├── readme.txt │ │ ├── test.adb │ │ ├── zlib-streams.adb │ │ ├── zlib-streams.ads │ │ ├── zlib-thin.adb │ │ ├── zlib-thin.ads │ │ ├── zlib.adb │ │ ├── zlib.ads │ │ └── zlib.gpr │ ├── amd64 │ │ └── amd64-match.S │ ├── asm686 │ │ ├── README.686 │ │ └── match.S │ ├── blast │ │ ├── Makefile │ │ ├── README │ │ ├── blast.c │ │ ├── blast.h │ │ ├── test.pk │ │ └── test.txt │ ├── delphi │ │ ├── ZLib.pas │ │ ├── ZLibConst.pas │ │ ├── readme.txt │ │ └── zlibd32.mak │ ├── dotzlib │ │ ├── DotZLib.build │ │ ├── DotZLib.chm │ │ ├── DotZLib.sln │ │ ├── DotZLib │ │ │ ├── AssemblyInfo.cs │ │ │ ├── ChecksumImpl.cs │ │ │ ├── CircularBuffer.cs │ │ │ ├── CodecBase.cs │ │ │ ├── Deflater.cs │ │ │ ├── DotZLib.cs │ │ │ ├── DotZLib.csproj │ │ │ ├── GZipStream.cs │ │ │ ├── Inflater.cs │ │ │ └── UnitTests.cs │ │ ├── LICENSE_1_0.txt │ │ └── readme.txt │ ├── gcc_gvmat64 │ │ └── gvmat64.S │ ├── infback9 │ │ ├── README │ │ ├── infback9.c │ │ ├── infback9.h │ │ ├── inffix9.h │ │ ├── inflate9.h │ │ ├── inftree9.c │ │ └── inftree9.h │ ├── inflate86 │ │ ├── inffas86.c │ │ └── inffast.S │ ├── iostream │ │ ├── test.cpp │ │ ├── zfstream.cpp │ │ └── zfstream.h │ ├── iostream2 │ │ ├── zstream.h │ │ └── zstream_test.cpp │ ├── iostream3 │ │ ├── README │ │ ├── TODO │ │ ├── test.cc │ │ ├── zfstream.cc │ │ └── zfstream.h │ ├── masmx64 │ │ ├── bld_ml64.bat │ │ ├── gvmat64.asm │ │ ├── inffas8664.c │ │ ├── inffasx64.asm │ │ └── readme.txt │ ├── masmx86 │ │ ├── bld_ml32.bat │ │ ├── inffas32.asm │ │ ├── match686.asm │ │ └── readme.txt │ ├── minizip │ │ ├── Makefile │ │ ├── Makefile.am │ │ ├── MiniZip64_Changes.txt │ │ ├── MiniZip64_info.txt │ │ ├── configure.ac │ │ ├── crypt.h │ │ ├── ioapi.c │ │ ├── ioapi.h │ │ ├── iowin32.c │ │ ├── iowin32.h │ │ ├── make_vms.com │ │ ├── miniunz.c │ │ ├── miniunzip.1 │ │ ├── minizip.1 │ │ ├── minizip.c │ │ ├── minizip.pc.in │ │ ├── mztools.c │ │ ├── mztools.h │ │ ├── unzip.c │ │ ├── unzip.h │ │ ├── zip.c │ │ └── zip.h │ ├── pascal │ │ ├── example.pas │ │ ├── readme.txt │ │ ├── zlibd32.mak │ │ └── zlibpas.pas │ ├── puff │ │ ├── Makefile │ │ ├── README │ │ ├── puff.c │ │ ├── puff.h │ │ ├── pufftest.c │ │ └── zeros.raw │ ├── testzlib │ │ ├── testzlib.c │ │ └── testzlib.txt │ ├── untgz │ │ ├── Makefile │ │ ├── Makefile.msc │ │ └── untgz.c │ └── vstudio │ │ ├── readme.txt │ │ ├── vc10 │ │ ├── miniunz.vcxproj │ │ ├── miniunz.vcxproj.filters │ │ ├── minizip.vcxproj │ │ ├── minizip.vcxproj.filters │ │ ├── testzlib.vcxproj │ │ ├── testzlib.vcxproj.filters │ │ ├── testzlibdll.vcxproj │ │ ├── testzlibdll.vcxproj.filters │ │ ├── zlib.rc │ │ ├── zlibstat.vcxproj │ │ ├── zlibstat.vcxproj.filters │ │ ├── zlibvc.def │ │ ├── zlibvc.sln │ │ ├── zlibvc.vcxproj │ │ └── zlibvc.vcxproj.filters │ │ ├── vc11 │ │ ├── miniunz.vcxproj │ │ ├── minizip.vcxproj │ │ ├── testzlib.vcxproj │ │ ├── testzlibdll.vcxproj │ │ ├── zlib.rc │ │ ├── zlibstat.vcxproj │ │ ├── zlibvc.def │ │ ├── zlibvc.sln │ │ └── zlibvc.vcxproj │ │ └── vc9 │ │ ├── miniunz.vcproj │ │ ├── minizip.vcproj │ │ ├── testzlib.vcproj │ │ ├── testzlibdll.vcproj │ │ ├── zlib.rc │ │ ├── zlibstat.vcproj │ │ ├── zlibvc.def │ │ ├── zlibvc.sln │ │ └── zlibvc.vcproj ├── crc32.c ├── crc32.h ├── deflate.c ├── deflate.h ├── doc │ ├── algorithm.txt │ ├── rfc1950.txt │ ├── rfc1951.txt │ ├── rfc1952.txt │ └── txtvsbin.txt ├── examples │ ├── README.examples │ ├── enough.c │ ├── fitblk.c │ ├── gun.c │ ├── gzappend.c │ ├── gzjoin.c │ ├── gzlog.c │ ├── gzlog.h │ ├── zlib_how.html │ ├── zpipe.c │ └── zran.c ├── gzclose.c ├── gzguts.h ├── gzlib.c ├── gzread.c ├── gzwrite.c ├── infback.c ├── inffast.c ├── inffast.h ├── inffixed.h ├── inflate.c ├── inflate.h ├── inftrees.c ├── inftrees.h ├── make_vms.com ├── msdos │ ├── Makefile.bor │ ├── Makefile.dj2 │ ├── Makefile.emx │ ├── Makefile.msc │ └── Makefile.tc ├── nintendods │ ├── Makefile │ └── README ├── old │ ├── Makefile.emx │ ├── Makefile.riscos │ ├── README │ ├── descrip.mms │ ├── os2 │ │ ├── Makefile.os2 │ │ └── zlib.def │ └── visual-basic.txt ├── qnx │ └── package.qpg ├── test │ ├── example.c │ ├── infcover.c │ └── minigzip.c ├── treebuild.xml ├── trees.c ├── trees.h ├── uncompr.c ├── watcom │ ├── watcom_f.mak │ └── watcom_l.mak ├── win32 │ ├── DLL_FAQ.txt │ ├── Makefile.bor │ ├── Makefile.gcc │ ├── Makefile.msc │ ├── README-WIN32.txt │ ├── VisualC.txt │ ├── zlib.def │ └── zlib1.rc ├── zconf.h ├── zconf.h.cmakein ├── zconf.h.in ├── zlib.3 ├── zlib.3.pdf ├── zlib.h ├── zlib.map ├── zlib.pc ├── zlib.pc.cmakein ├── zlib.pc.in ├── zlib2ansi ├── zutil.c └── zutil.h ├── update_zlib.sh ├── zconf.h ├── zlib.h └── zutil.h /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # measurements show that the ARM version of ZLib is about x1.17 faster 5 | # than the thumb one... 6 | LOCAL_ARM_MODE := arm 7 | 8 | zlib_files := \ 9 | src/adler32.c \ 10 | src/compress.c \ 11 | src/crc32.c \ 12 | src/deflate.c \ 13 | src/gzclose.c \ 14 | src/gzlib.c \ 15 | src/gzread.c \ 16 | src/gzwrite.c \ 17 | src/infback.c \ 18 | src/inflate.c \ 19 | src/inftrees.c \ 20 | src/inffast.c \ 21 | src/trees.c \ 22 | src/uncompr.c \ 23 | src/zutil.c 24 | 25 | LOCAL_MODULE := libz 26 | LOCAL_MODULE_TAGS := optional 27 | LOCAL_CFLAGS += -O3 -DUSE_MMAP 28 | LOCAL_CFLAGS_arm64 += -mcpu=generic+crc 29 | 30 | # TODO: This is to work around b/24465209. Remove after root cause is fixed 31 | LOCAL_LDFLAGS_arm := -Wl,--hash-style=both 32 | 33 | LOCAL_SRC_FILES := $(zlib_files) 34 | ifneq ($(TARGET_BUILD_APPS),) 35 | LOCAL_SDK_VERSION := 9 36 | else 37 | LOCAL_CXX_STL := none 38 | endif 39 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) 40 | include $(BUILD_SHARED_LIBRARY) 41 | 42 | include $(CLEAR_VARS) 43 | 44 | LOCAL_ARM_MODE := arm 45 | LOCAL_MODULE := libz 46 | LOCAL_MODULE_TAGS := optional 47 | LOCAL_CFLAGS += -O3 -DUSE_MMAP 48 | LOCAL_CFLAGS_arm64 += -mcpu=generic+crc 49 | LOCAL_SRC_FILES := $(zlib_files) 50 | ifneq ($(TARGET_BUILD_APPS),) 51 | LOCAL_SDK_VERSION := 9 52 | else 53 | LOCAL_CXX_STL := none 54 | endif 55 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) 56 | include $(BUILD_STATIC_LIBRARY) 57 | 58 | include $(CLEAR_VARS) 59 | 60 | LOCAL_MODULE := libz 61 | LOCAL_MODULE_TAGS := optional 62 | LOCAL_CFLAGS += -O3 -DUSE_MMAP 63 | LOCAL_SRC_FILES := $(zlib_files) 64 | LOCAL_MULTILIB := both 65 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) 66 | LOCAL_MODULE_HOST_OS := darwin linux windows 67 | LOCAL_CXX_STL := none 68 | include $(BUILD_HOST_STATIC_LIBRARY) 69 | 70 | include $(CLEAR_VARS) 71 | 72 | LOCAL_MODULE := libz-host 73 | LOCAL_MODULE_TAGS := optional 74 | LOCAL_CFLAGS += -O3 -DUSE_MMAP 75 | LOCAL_SRC_FILES := $(zlib_files) 76 | LOCAL_MULTILIB := both 77 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) 78 | LOCAL_CXX_STL := none 79 | include $(BUILD_HOST_SHARED_LIBRARY) 80 | 81 | include $(CLEAR_VARS) 82 | 83 | LOCAL_SRC_FILES:= \ 84 | src/test/minigzip.c 85 | 86 | LOCAL_MODULE:= gzip 87 | 88 | LOCAL_SHARED_LIBRARIES := libz 89 | 90 | LOCAL_CXX_STL := none 91 | 92 | include $(BUILD_EXECUTABLE) 93 | 94 | include $(CLEAR_VARS) 95 | 96 | LOCAL_SRC_FILES:= \ 97 | src/test/minigzip.c 98 | 99 | LOCAL_MODULE:= minigzip 100 | 101 | LOCAL_STATIC_LIBRARIES := libz 102 | 103 | LOCAL_CXX_STL := none 104 | 105 | include $(BUILD_HOST_EXECUTABLE) 106 | -------------------------------------------------------------------------------- /CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | -------------------------------------------------------------------------------- /MODULE_LICENSE_BSD_LIKE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/MODULE_LICENSE_BSD_LIKE -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | Jean-loup Gailly Mark Adler 20 | jloup@gzip.org madler@alumni.caltech.edu 21 | -------------------------------------------------------------------------------- /src/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/ChangeLog -------------------------------------------------------------------------------- /src/INDEX: -------------------------------------------------------------------------------- 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 69 | -------------------------------------------------------------------------------- /src/amiga/Makefile.pup: -------------------------------------------------------------------------------- 1 | # Amiga powerUP (TM) Makefile 2 | # makefile for libpng and SAS C V6.58/7.00 PPC compiler 3 | # Copyright (C) 1998 by Andreas R. Kleinert 4 | 5 | LIBNAME = libzip.a 6 | 7 | CC = scppc 8 | CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \ 9 | OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER 10 | AR = ppc-amigaos-ar cr 11 | RANLIB = ppc-amigaos-ranlib 12 | LD = ppc-amigaos-ld -r 13 | LDFLAGS = -o 14 | LDLIBS = LIB:scppc.a LIB:end.o 15 | RM = delete quiet 16 | 17 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ 18 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o 19 | 20 | TEST_OBJS = example.o minigzip.o 21 | 22 | all: example minigzip 23 | 24 | check: test 25 | test: all 26 | example 27 | echo hello world | minigzip | minigzip -d 28 | 29 | $(LIBNAME): $(OBJS) 30 | $(AR) $@ $(OBJS) 31 | -$(RANLIB) $@ 32 | 33 | example: example.o $(LIBNAME) 34 | $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) 35 | 36 | minigzip: minigzip.o $(LIBNAME) 37 | $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) 38 | 39 | mostlyclean: clean 40 | clean: 41 | $(RM) *.o example minigzip $(LIBNAME) foo.gz 42 | 43 | zip: 44 | zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \ 45 | descrip.mms *.[ch] 46 | 47 | tgz: 48 | cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \ 49 | zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch] 50 | 51 | # DO NOT DELETE THIS LINE -- make depend depends on it. 52 | 53 | adler32.o: zlib.h zconf.h 54 | compress.o: zlib.h zconf.h 55 | crc32.o: crc32.h zlib.h zconf.h 56 | deflate.o: deflate.h zutil.h zlib.h zconf.h 57 | example.o: zlib.h zconf.h 58 | gzclose.o: zlib.h zconf.h gzguts.h 59 | gzlib.o: zlib.h zconf.h gzguts.h 60 | gzread.o: zlib.h zconf.h gzguts.h 61 | gzwrite.o: zlib.h zconf.h gzguts.h 62 | inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 63 | inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 64 | infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 65 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h 66 | minigzip.o: zlib.h zconf.h 67 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h 68 | uncompr.o: zlib.h zconf.h 69 | zutil.o: zutil.h zlib.h zconf.h 70 | -------------------------------------------------------------------------------- /src/amiga/Makefile.sas: -------------------------------------------------------------------------------- 1 | # SMakefile for zlib 2 | # Modified from the standard UNIX Makefile Copyright Jean-loup Gailly 3 | # Osma Ahvenlampi 4 | # Amiga, SAS/C 6.56 & Smake 5 | 6 | CC=sc 7 | CFLAGS=OPT 8 | #CFLAGS=OPT CPU=68030 9 | #CFLAGS=DEBUG=LINE 10 | LDFLAGS=LIB z.lib 11 | 12 | SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \ 13 | NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \ 14 | DEF=POSTINC 15 | 16 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ 17 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o 18 | 19 | TEST_OBJS = example.o minigzip.o 20 | 21 | all: SCOPTIONS example minigzip 22 | 23 | check: test 24 | test: all 25 | example 26 | echo hello world | minigzip | minigzip -d 27 | 28 | install: z.lib 29 | copy clone zlib.h zconf.h INCLUDE: 30 | copy clone z.lib LIB: 31 | 32 | z.lib: $(OBJS) 33 | oml z.lib r $(OBJS) 34 | 35 | example: example.o z.lib 36 | $(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS) 37 | 38 | minigzip: minigzip.o z.lib 39 | $(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS) 40 | 41 | mostlyclean: clean 42 | clean: 43 | -delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS 44 | 45 | SCOPTIONS: Makefile.sas 46 | copy to $@ 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 | } 81 | -------------------------------------------------------------------------------- /src/contrib/README.contrib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/README.contrib -------------------------------------------------------------------------------- /src/contrib/ada/buffer_demo.adb: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | -- ZLib for Ada thick binding. -- 3 | -- -- 4 | -- Copyright (C) 2002-2004 Dmitriy Anisimkov -- 5 | -- -- 6 | -- Open source license information is in the zlib.ads file. -- 7 | ---------------------------------------------------------------- 8 | -- 9 | -- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $ 10 | 11 | -- This demo program provided by Dr Steve Sangwine 12 | -- 13 | -- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer 14 | -- of exactly the correct size is used for decompressed data, and the last 15 | -- few bytes passed in to Zlib are checksum bytes. 16 | 17 | -- This program compresses a string of text, and then decompresses the 18 | -- compressed text into a buffer of the same size as the original text. 19 | 20 | with Ada.Streams; use Ada.Streams; 21 | with Ada.Text_IO; 22 | 23 | with ZLib; use ZLib; 24 | 25 | procedure Buffer_Demo is 26 | EOL : Character renames ASCII.LF; 27 | Text : constant String 28 | := "Four score and seven years ago our fathers brought forth," & EOL & 29 | "upon this continent, a new nation, conceived in liberty," & EOL & 30 | "and dedicated to the proposition that `all men are created equal'."; 31 | 32 | Source : Stream_Element_Array (1 .. Text'Length); 33 | for Source'Address use Text'Address; 34 | 35 | begin 36 | Ada.Text_IO.Put (Text); 37 | Ada.Text_IO.New_Line; 38 | Ada.Text_IO.Put_Line 39 | ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes"); 40 | 41 | declare 42 | Compressed_Data : Stream_Element_Array (1 .. Text'Length); 43 | L : Stream_Element_Offset; 44 | begin 45 | Compress : declare 46 | Compressor : Filter_Type; 47 | I : Stream_Element_Offset; 48 | begin 49 | Deflate_Init (Compressor); 50 | 51 | -- Compress the whole of T at once. 52 | 53 | Translate (Compressor, Source, I, Compressed_Data, L, Finish); 54 | pragma Assert (I = Source'Last); 55 | 56 | Close (Compressor); 57 | 58 | Ada.Text_IO.Put_Line 59 | ("Compressed size : " 60 | & Stream_Element_Offset'Image (L) & " bytes"); 61 | end Compress; 62 | 63 | -- Now we decompress the data, passing short blocks of data to Zlib 64 | -- (because this demonstrates the problem - the last block passed will 65 | -- contain checksum information and there will be no output, only a 66 | -- check inside Zlib that the checksum is correct). 67 | 68 | Decompress : declare 69 | Decompressor : Filter_Type; 70 | 71 | Uncompressed_Data : Stream_Element_Array (1 .. Text'Length); 72 | 73 | Block_Size : constant := 4; 74 | -- This makes sure that the last block contains 75 | -- only Adler checksum data. 76 | 77 | P : Stream_Element_Offset := Compressed_Data'First - 1; 78 | O : Stream_Element_Offset; 79 | begin 80 | Inflate_Init (Decompressor); 81 | 82 | loop 83 | Translate 84 | (Decompressor, 85 | Compressed_Data 86 | (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)), 87 | P, 88 | Uncompressed_Data 89 | (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last), 90 | O, 91 | No_Flush); 92 | 93 | Ada.Text_IO.Put_Line 94 | ("Total in : " & Count'Image (Total_In (Decompressor)) & 95 | ", out : " & Count'Image (Total_Out (Decompressor))); 96 | 97 | exit when P = L; 98 | end loop; 99 | 100 | Ada.Text_IO.New_Line; 101 | Ada.Text_IO.Put_Line 102 | ("Decompressed text matches original text : " 103 | & Boolean'Image (Uncompressed_Data = Source)); 104 | end Decompress; 105 | end; 106 | end Buffer_Demo; 107 | -------------------------------------------------------------------------------- /src/contrib/ada/mtest.adb: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | -- ZLib for Ada thick binding. -- 3 | -- -- 4 | -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 5 | -- -- 6 | -- Open source license information is in the zlib.ads file. -- 7 | ---------------------------------------------------------------- 8 | -- Continuous test for ZLib multithreading. If the test would fail 9 | -- we should provide thread safe allocation routines for the Z_Stream. 10 | -- 11 | -- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $ 12 | 13 | with ZLib; 14 | with Ada.Streams; 15 | with Ada.Numerics.Discrete_Random; 16 | with Ada.Text_IO; 17 | with Ada.Exceptions; 18 | with Ada.Task_Identification; 19 | 20 | procedure MTest is 21 | use Ada.Streams; 22 | use ZLib; 23 | 24 | Stop : Boolean := False; 25 | 26 | pragma Atomic (Stop); 27 | 28 | subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; 29 | 30 | package Random_Elements is 31 | new Ada.Numerics.Discrete_Random (Visible_Symbols); 32 | 33 | task type Test_Task; 34 | 35 | task body Test_Task is 36 | Buffer : Stream_Element_Array (1 .. 100_000); 37 | Gen : Random_Elements.Generator; 38 | 39 | Buffer_First : Stream_Element_Offset; 40 | Compare_First : Stream_Element_Offset; 41 | 42 | Deflate : Filter_Type; 43 | Inflate : Filter_Type; 44 | 45 | procedure Further (Item : in Stream_Element_Array); 46 | 47 | procedure Read_Buffer 48 | (Item : out Ada.Streams.Stream_Element_Array; 49 | Last : out Ada.Streams.Stream_Element_Offset); 50 | 51 | ------------- 52 | -- Further -- 53 | ------------- 54 | 55 | procedure Further (Item : in Stream_Element_Array) is 56 | 57 | procedure Compare (Item : in Stream_Element_Array); 58 | 59 | ------------- 60 | -- Compare -- 61 | ------------- 62 | 63 | procedure Compare (Item : in Stream_Element_Array) is 64 | Next_First : Stream_Element_Offset := Compare_First + Item'Length; 65 | begin 66 | if Buffer (Compare_First .. Next_First - 1) /= Item then 67 | raise Program_Error; 68 | end if; 69 | 70 | Compare_First := Next_First; 71 | end Compare; 72 | 73 | procedure Compare_Write is new ZLib.Write (Write => Compare); 74 | begin 75 | Compare_Write (Inflate, Item, No_Flush); 76 | end Further; 77 | 78 | ----------------- 79 | -- Read_Buffer -- 80 | ----------------- 81 | 82 | procedure Read_Buffer 83 | (Item : out Ada.Streams.Stream_Element_Array; 84 | Last : out Ada.Streams.Stream_Element_Offset) 85 | is 86 | Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; 87 | Next_First : Stream_Element_Offset; 88 | begin 89 | if Item'Length <= Buff_Diff then 90 | Last := Item'Last; 91 | 92 | Next_First := Buffer_First + Item'Length; 93 | 94 | Item := Buffer (Buffer_First .. Next_First - 1); 95 | 96 | Buffer_First := Next_First; 97 | else 98 | Last := Item'First + Buff_Diff; 99 | Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); 100 | Buffer_First := Buffer'Last + 1; 101 | end if; 102 | end Read_Buffer; 103 | 104 | procedure Translate is new Generic_Translate 105 | (Data_In => Read_Buffer, 106 | Data_Out => Further); 107 | 108 | begin 109 | Random_Elements.Reset (Gen); 110 | 111 | Buffer := (others => 20); 112 | 113 | Main : loop 114 | for J in Buffer'Range loop 115 | Buffer (J) := Random_Elements.Random (Gen); 116 | 117 | Deflate_Init (Deflate); 118 | Inflate_Init (Inflate); 119 | 120 | Buffer_First := Buffer'First; 121 | Compare_First := Buffer'First; 122 | 123 | Translate (Deflate); 124 | 125 | if Compare_First /= Buffer'Last + 1 then 126 | raise Program_Error; 127 | end if; 128 | 129 | Ada.Text_IO.Put_Line 130 | (Ada.Task_Identification.Image 131 | (Ada.Task_Identification.Current_Task) 132 | & Stream_Element_Offset'Image (J) 133 | & ZLib.Count'Image (Total_Out (Deflate))); 134 | 135 | Close (Deflate); 136 | Close (Inflate); 137 | 138 | exit Main when Stop; 139 | end loop; 140 | end loop Main; 141 | exception 142 | when E : others => 143 | Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); 144 | Stop := True; 145 | end Test_Task; 146 | 147 | Test : array (1 .. 4) of Test_Task; 148 | 149 | pragma Unreferenced (Test); 150 | 151 | Dummy : Character; 152 | 153 | begin 154 | Ada.Text_IO.Get_Immediate (Dummy); 155 | Stop := True; 156 | end MTest; 157 | -------------------------------------------------------------------------------- /src/contrib/ada/read.adb: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | -- ZLib for Ada thick binding. -- 3 | -- -- 4 | -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 5 | -- -- 6 | -- Open source license information is in the zlib.ads file. -- 7 | ---------------------------------------------------------------- 8 | 9 | -- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $ 10 | 11 | -- Test/demo program for the generic read interface. 12 | 13 | with Ada.Numerics.Discrete_Random; 14 | with Ada.Streams; 15 | with Ada.Text_IO; 16 | 17 | with ZLib; 18 | 19 | procedure Read is 20 | 21 | use Ada.Streams; 22 | 23 | ------------------------------------ 24 | -- Test configuration parameters -- 25 | ------------------------------------ 26 | 27 | File_Size : Stream_Element_Offset := 100_000; 28 | 29 | Continuous : constant Boolean := False; 30 | -- If this constant is True, the test would be repeated again and again, 31 | -- with increment File_Size for every iteration. 32 | 33 | Header : constant ZLib.Header_Type := ZLib.Default; 34 | -- Do not use Header other than Default in ZLib versions 1.1.4 and older. 35 | 36 | Init_Random : constant := 8; 37 | -- We are using the same random sequence, in case of we catch bug, 38 | -- so we would be able to reproduce it. 39 | 40 | -- End -- 41 | 42 | Pack_Size : Stream_Element_Offset; 43 | Offset : Stream_Element_Offset; 44 | 45 | Filter : ZLib.Filter_Type; 46 | 47 | subtype Visible_Symbols 48 | is Stream_Element range 16#20# .. 16#7E#; 49 | 50 | package Random_Elements is new 51 | Ada.Numerics.Discrete_Random (Visible_Symbols); 52 | 53 | Gen : Random_Elements.Generator; 54 | Period : constant Stream_Element_Offset := 200; 55 | -- Period constant variable for random generator not to be very random. 56 | -- Bigger period, harder random. 57 | 58 | Read_Buffer : Stream_Element_Array (1 .. 2048); 59 | Read_First : Stream_Element_Offset; 60 | Read_Last : Stream_Element_Offset; 61 | 62 | procedure Reset; 63 | 64 | procedure Read 65 | (Item : out Stream_Element_Array; 66 | Last : out Stream_Element_Offset); 67 | -- this procedure is for generic instantiation of 68 | -- ZLib.Read 69 | -- reading data from the File_In. 70 | 71 | procedure Read is new ZLib.Read 72 | (Read, 73 | Read_Buffer, 74 | Rest_First => Read_First, 75 | Rest_Last => Read_Last); 76 | 77 | ---------- 78 | -- Read -- 79 | ---------- 80 | 81 | procedure Read 82 | (Item : out Stream_Element_Array; 83 | Last : out Stream_Element_Offset) is 84 | begin 85 | Last := Stream_Element_Offset'Min 86 | (Item'Last, 87 | Item'First + File_Size - Offset); 88 | 89 | for J in Item'First .. Last loop 90 | if J < Item'First + Period then 91 | Item (J) := Random_Elements.Random (Gen); 92 | else 93 | Item (J) := Item (J - Period); 94 | end if; 95 | 96 | Offset := Offset + 1; 97 | end loop; 98 | end Read; 99 | 100 | ----------- 101 | -- Reset -- 102 | ----------- 103 | 104 | procedure Reset is 105 | begin 106 | Random_Elements.Reset (Gen, Init_Random); 107 | Pack_Size := 0; 108 | Offset := 1; 109 | Read_First := Read_Buffer'Last + 1; 110 | Read_Last := Read_Buffer'Last; 111 | end Reset; 112 | 113 | begin 114 | Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); 115 | 116 | loop 117 | for Level in ZLib.Compression_Level'Range loop 118 | 119 | Ada.Text_IO.Put ("Level =" 120 | & ZLib.Compression_Level'Image (Level)); 121 | 122 | -- Deflate using generic instantiation. 123 | 124 | ZLib.Deflate_Init 125 | (Filter, 126 | Level, 127 | Header => Header); 128 | 129 | Reset; 130 | 131 | Ada.Text_IO.Put 132 | (Stream_Element_Offset'Image (File_Size) & " ->"); 133 | 134 | loop 135 | declare 136 | Buffer : Stream_Element_Array (1 .. 1024); 137 | Last : Stream_Element_Offset; 138 | begin 139 | Read (Filter, Buffer, Last); 140 | 141 | Pack_Size := Pack_Size + Last - Buffer'First + 1; 142 | 143 | exit when Last < Buffer'Last; 144 | end; 145 | end loop; 146 | 147 | Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size)); 148 | 149 | ZLib.Close (Filter); 150 | end loop; 151 | 152 | exit when not Continuous; 153 | 154 | File_Size := File_Size + 1; 155 | end loop; 156 | end Read; 157 | -------------------------------------------------------------------------------- /src/contrib/ada/readme.txt: -------------------------------------------------------------------------------- 1 | ZLib for Ada thick binding (ZLib.Ada) 2 | Release 1.3 3 | 4 | ZLib.Ada is a thick binding interface to the popular ZLib data 5 | compression library, available at http://www.gzip.org/zlib/. 6 | It provides Ada-style access to the ZLib C library. 7 | 8 | 9 | Here are the main changes since ZLib.Ada 1.2: 10 | 11 | - Attension: ZLib.Read generic routine have a initialization requirement 12 | for Read_Last parameter now. It is a bit incompartible with previous version, 13 | but extends functionality, we could use new parameters Allow_Read_Some and 14 | Flush now. 15 | 16 | - Added Is_Open routines to ZLib and ZLib.Streams packages. 17 | 18 | - Add pragma Assert to check Stream_Element is 8 bit. 19 | 20 | - Fix extraction to buffer with exact known decompressed size. Error reported by 21 | Steve Sangwine. 22 | 23 | - Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits 24 | computers. Patch provided by Pascal Obry. 25 | 26 | - Add Status_Error exception definition. 27 | 28 | - Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit. 29 | 30 | 31 | How to build ZLib.Ada under GNAT 32 | 33 | You should have the ZLib library already build on your computer, before 34 | building ZLib.Ada. Make the directory of ZLib.Ada sources current and 35 | issue the command: 36 | 37 | gnatmake test -largs -L -lz 38 | 39 | Or use the GNAT project file build for GNAT 3.15 or later: 40 | 41 | gnatmake -Pzlib.gpr -L 42 | 43 | 44 | How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2 45 | 46 | 1. Make a project with all *.ads and *.adb files from the distribution. 47 | 2. Build the libz.a library from the ZLib C sources. 48 | 3. Rename libz.a to z.lib. 49 | 4. Add the library z.lib to the project. 50 | 5. Add the libc.lib library from the ObjectAda distribution to the project. 51 | 6. Build the executable using test.adb as a main procedure. 52 | 53 | 54 | How to use ZLib.Ada 55 | 56 | The source files test.adb and read.adb are small demo programs that show 57 | the main functionality of ZLib.Ada. 58 | 59 | The routines from the package specifications are commented. 60 | 61 | 62 | Homepage: http://zlib-ada.sourceforge.net/ 63 | Author: Dmitriy Anisimkov 64 | 65 | Contributors: Pascal Obry , Steve Sangwine 66 | -------------------------------------------------------------------------------- /src/contrib/ada/zlib-streams.ads: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | -- ZLib for Ada thick binding. -- 3 | -- -- 4 | -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 5 | -- -- 6 | -- Open source license information is in the zlib.ads file. -- 7 | ---------------------------------------------------------------- 8 | 9 | -- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $ 10 | 11 | package ZLib.Streams is 12 | 13 | type Stream_Mode is (In_Stream, Out_Stream, Duplex); 14 | 15 | type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; 16 | 17 | type Stream_Type is 18 | new Ada.Streams.Root_Stream_Type with private; 19 | 20 | procedure Read 21 | (Stream : in out Stream_Type; 22 | Item : out Ada.Streams.Stream_Element_Array; 23 | Last : out Ada.Streams.Stream_Element_Offset); 24 | 25 | procedure Write 26 | (Stream : in out Stream_Type; 27 | Item : in Ada.Streams.Stream_Element_Array); 28 | 29 | procedure Flush 30 | (Stream : in out Stream_Type; 31 | Mode : in Flush_Mode := Sync_Flush); 32 | -- Flush the written data to the back stream, 33 | -- all data placed to the compressor is flushing to the Back stream. 34 | -- Should not be used untill necessary, becouse it is decreasing 35 | -- compression. 36 | 37 | function Read_Total_In (Stream : in Stream_Type) return Count; 38 | pragma Inline (Read_Total_In); 39 | -- Return total number of bytes read from back stream so far. 40 | 41 | function Read_Total_Out (Stream : in Stream_Type) return Count; 42 | pragma Inline (Read_Total_Out); 43 | -- Return total number of bytes read so far. 44 | 45 | function Write_Total_In (Stream : in Stream_Type) return Count; 46 | pragma Inline (Write_Total_In); 47 | -- Return total number of bytes written so far. 48 | 49 | function Write_Total_Out (Stream : in Stream_Type) return Count; 50 | pragma Inline (Write_Total_Out); 51 | -- Return total number of bytes written to the back stream. 52 | 53 | procedure Create 54 | (Stream : out Stream_Type; 55 | Mode : in Stream_Mode; 56 | Back : in Stream_Access; 57 | Back_Compressed : in Boolean; 58 | Level : in Compression_Level := Default_Compression; 59 | Strategy : in Strategy_Type := Default_Strategy; 60 | Header : in Header_Type := Default; 61 | Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset 62 | := Default_Buffer_Size; 63 | Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset 64 | := Default_Buffer_Size); 65 | -- Create the Comression/Decompression stream. 66 | -- If mode is In_Stream then Write operation is disabled. 67 | -- If mode is Out_Stream then Read operation is disabled. 68 | 69 | -- If Back_Compressed is true then 70 | -- Data written to the Stream is compressing to the Back stream 71 | -- and data read from the Stream is decompressed data from the Back stream. 72 | 73 | -- If Back_Compressed is false then 74 | -- Data written to the Stream is decompressing to the Back stream 75 | -- and data read from the Stream is compressed data from the Back stream. 76 | 77 | -- !!! When the Need_Header is False ZLib-Ada is using undocumented 78 | -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers. 79 | 80 | function Is_Open (Stream : Stream_Type) return Boolean; 81 | 82 | procedure Close (Stream : in out Stream_Type); 83 | 84 | private 85 | 86 | use Ada.Streams; 87 | 88 | type Buffer_Access is access all Stream_Element_Array; 89 | 90 | type Stream_Type 91 | is new Root_Stream_Type with 92 | record 93 | Mode : Stream_Mode; 94 | 95 | Buffer : Buffer_Access; 96 | Rest_First : Stream_Element_Offset; 97 | Rest_Last : Stream_Element_Offset; 98 | -- Buffer for Read operation. 99 | -- We need to have this buffer in the record 100 | -- becouse not all read data from back stream 101 | -- could be processed during the read operation. 102 | 103 | Buffer_Size : Stream_Element_Offset; 104 | -- Buffer size for write operation. 105 | -- We do not need to have this buffer 106 | -- in the record becouse all data could be 107 | -- processed in the write operation. 108 | 109 | Back : Stream_Access; 110 | Reader : Filter_Type; 111 | Writer : Filter_Type; 112 | end record; 113 | 114 | end ZLib.Streams; 115 | -------------------------------------------------------------------------------- /src/contrib/ada/zlib-thin.adb: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | -- ZLib for Ada thick binding. -- 3 | -- -- 4 | -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- 5 | -- -- 6 | -- Open source license information is in the zlib.ads file. -- 7 | ---------------------------------------------------------------- 8 | 9 | -- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $ 10 | 11 | package body ZLib.Thin is 12 | 13 | ZLIB_VERSION : constant Chars_Ptr := zlibVersion; 14 | 15 | Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; 16 | 17 | -------------- 18 | -- Avail_In -- 19 | -------------- 20 | 21 | function Avail_In (Strm : in Z_Stream) return UInt is 22 | begin 23 | return Strm.Avail_In; 24 | end Avail_In; 25 | 26 | --------------- 27 | -- Avail_Out -- 28 | --------------- 29 | 30 | function Avail_Out (Strm : in Z_Stream) return UInt is 31 | begin 32 | return Strm.Avail_Out; 33 | end Avail_Out; 34 | 35 | ------------------ 36 | -- Deflate_Init -- 37 | ------------------ 38 | 39 | function Deflate_Init 40 | (strm : Z_Streamp; 41 | level : Int; 42 | method : Int; 43 | windowBits : Int; 44 | memLevel : Int; 45 | strategy : Int) 46 | return Int is 47 | begin 48 | return deflateInit2 49 | (strm, 50 | level, 51 | method, 52 | windowBits, 53 | memLevel, 54 | strategy, 55 | ZLIB_VERSION, 56 | Z_Stream_Size); 57 | end Deflate_Init; 58 | 59 | ------------------ 60 | -- Inflate_Init -- 61 | ------------------ 62 | 63 | function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is 64 | begin 65 | return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size); 66 | end Inflate_Init; 67 | 68 | ------------------------ 69 | -- Last_Error_Message -- 70 | ------------------------ 71 | 72 | function Last_Error_Message (Strm : in Z_Stream) return String is 73 | use Interfaces.C.Strings; 74 | begin 75 | if Strm.msg = Null_Ptr then 76 | return ""; 77 | else 78 | return Value (Strm.msg); 79 | end if; 80 | end Last_Error_Message; 81 | 82 | ------------ 83 | -- Set_In -- 84 | ------------ 85 | 86 | procedure Set_In 87 | (Strm : in out Z_Stream; 88 | Buffer : in Voidp; 89 | Size : in UInt) is 90 | begin 91 | Strm.Next_In := Buffer; 92 | Strm.Avail_In := Size; 93 | end Set_In; 94 | 95 | ------------------ 96 | -- Set_Mem_Func -- 97 | ------------------ 98 | 99 | procedure Set_Mem_Func 100 | (Strm : in out Z_Stream; 101 | Opaque : in Voidp; 102 | Alloc : in alloc_func; 103 | Free : in free_func) is 104 | begin 105 | Strm.opaque := Opaque; 106 | Strm.zalloc := Alloc; 107 | Strm.zfree := Free; 108 | end Set_Mem_Func; 109 | 110 | ------------- 111 | -- Set_Out -- 112 | ------------- 113 | 114 | procedure Set_Out 115 | (Strm : in out Z_Stream; 116 | Buffer : in Voidp; 117 | Size : in UInt) is 118 | begin 119 | Strm.Next_Out := Buffer; 120 | Strm.Avail_Out := Size; 121 | end Set_Out; 122 | 123 | -------------- 124 | -- Total_In -- 125 | -------------- 126 | 127 | function Total_In (Strm : in Z_Stream) return ULong is 128 | begin 129 | return Strm.Total_In; 130 | end Total_In; 131 | 132 | --------------- 133 | -- Total_Out -- 134 | --------------- 135 | 136 | function Total_Out (Strm : in Z_Stream) return ULong is 137 | begin 138 | return Strm.Total_Out; 139 | end Total_Out; 140 | 141 | end ZLib.Thin; 142 | -------------------------------------------------------------------------------- /src/contrib/ada/zlib.gpr: -------------------------------------------------------------------------------- 1 | project Zlib is 2 | 3 | for Languages use ("Ada"); 4 | for Source_Dirs use ("."); 5 | for Object_Dir use "."; 6 | for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo"); 7 | 8 | package Compiler is 9 | for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst"); 10 | end Compiler; 11 | 12 | package Linker is 13 | for Default_Switches ("ada") use ("-lz"); 14 | end Linker; 15 | 16 | package Builder is 17 | for Default_Switches ("ada") use ("-s", "-gnatQ"); 18 | end Builder; 19 | 20 | end Zlib; 21 | -------------------------------------------------------------------------------- /src/contrib/asm686/README.686: -------------------------------------------------------------------------------- 1 | This is a patched version of zlib, modified to use 2 | Pentium-Pro-optimized assembly code in the deflation algorithm. The 3 | files changed/added by this patch are: 4 | 5 | README.686 6 | match.S 7 | 8 | The speedup that this patch provides varies, depending on whether the 9 | compiler used to build the original version of zlib falls afoul of the 10 | PPro's speed traps. My own tests show a speedup of around 10-20% at 11 | the default compression level, and 20-30% using -9, against a version 12 | compiled using gcc 2.7.2.3. Your mileage may vary. 13 | 14 | Note that this code has been tailored for the PPro/PII in particular, 15 | and will not perform particuarly well on a Pentium. 16 | 17 | If you are using an assembler other than GNU as, you will have to 18 | translate match.S to use your assembler's syntax. (Have fun.) 19 | 20 | Brian Raiter 21 | breadbox@muppetlabs.com 22 | April, 1998 23 | 24 | 25 | Added for zlib 1.1.3: 26 | 27 | The patches come from 28 | http://www.muppetlabs.com/~breadbox/software/assembly.html 29 | 30 | To compile zlib with this asm file, copy match.S to the zlib directory 31 | then do: 32 | 33 | CFLAGS="-O3 -DASMV" ./configure 34 | make OBJA=match.o 35 | 36 | 37 | Update: 38 | 39 | I've been ignoring these assembly routines for years, believing that 40 | gcc's generated code had caught up with it sometime around gcc 2.95 41 | and the major rearchitecting of the Pentium 4. However, I recently 42 | learned that, despite what I believed, this code still has some life 43 | in it. On the Pentium 4 and AMD64 chips, it continues to run about 8% 44 | faster than the code produced by gcc 4.1. 45 | 46 | In acknowledgement of its continuing usefulness, I've altered the 47 | license to match that of the rest of zlib. Share and Enjoy! 48 | 49 | Brian Raiter 50 | breadbox@muppetlabs.com 51 | April, 2007 52 | -------------------------------------------------------------------------------- /src/contrib/blast/Makefile: -------------------------------------------------------------------------------- 1 | blast: blast.c blast.h 2 | cc -DTEST -o blast blast.c 3 | 4 | test: blast 5 | blast < test.pk | cmp - test.txt 6 | 7 | clean: 8 | rm -f blast blast.o 9 | -------------------------------------------------------------------------------- /src/contrib/blast/README: -------------------------------------------------------------------------------- 1 | Read blast.h for purpose and usage. 2 | 3 | Mark Adler 4 | madler@alumni.caltech.edu 5 | -------------------------------------------------------------------------------- /src/contrib/blast/blast.h: -------------------------------------------------------------------------------- 1 | /* blast.h -- interface for blast.c 2 | Copyright (C) 2003, 2012 Mark Adler 3 | version 1.2, 24 Oct 2012 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | 25 | /* 26 | * blast() decompresses the PKWare Data Compression Library (DCL) compressed 27 | * format. It provides the same functionality as the explode() function in 28 | * that library. (Note: PKWare overused the "implode" verb, and the format 29 | * used by their library implode() function is completely different and 30 | * incompatible with the implode compression method supported by PKZIP.) 31 | * 32 | * The binary mode for stdio functions should be used to assure that the 33 | * compressed data is not corrupted when read or written. For example: 34 | * fopen(..., "rb") and fopen(..., "wb"). 35 | */ 36 | 37 | 38 | typedef unsigned (*blast_in)(void *how, unsigned char **buf); 39 | typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len); 40 | /* Definitions for input/output functions passed to blast(). See below for 41 | * what the provided functions need to do. 42 | */ 43 | 44 | 45 | int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow); 46 | /* Decompress input to output using the provided infun() and outfun() calls. 47 | * On success, the return value of blast() is zero. If there is an error in 48 | * the source data, i.e. it is not in the proper format, then a negative value 49 | * is returned. If there is not enough input available or there is not enough 50 | * output space, then a positive error is returned. 51 | * 52 | * The input function is invoked: len = infun(how, &buf), where buf is set by 53 | * infun() to point to the input buffer, and infun() returns the number of 54 | * available bytes there. If infun() returns zero, then blast() returns with 55 | * an input error. (blast() only asks for input if it needs it.) inhow is for 56 | * use by the application to pass an input descriptor to infun(), if desired. 57 | * 58 | * The output function is invoked: err = outfun(how, buf, len), where the bytes 59 | * to be written are buf[0..len-1]. If err is not zero, then blast() returns 60 | * with an output error. outfun() is always called with len <= 4096. outhow 61 | * is for use by the application to pass an output descriptor to outfun(), if 62 | * desired. 63 | * 64 | * The return codes are: 65 | * 66 | * 2: ran out of input before completing decompression 67 | * 1: output error before completing decompression 68 | * 0: successful decompression 69 | * -1: literal flag not zero or one 70 | * -2: dictionary size not in 4..6 71 | * -3: distance is too far back 72 | * 73 | * At the bottom of blast.c is an example program that uses blast() that can be 74 | * compiled to produce a command-line decompression filter by defining TEST. 75 | */ 76 | -------------------------------------------------------------------------------- /src/contrib/blast/test.pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/blast/test.pk -------------------------------------------------------------------------------- /src/contrib/blast/test.txt: -------------------------------------------------------------------------------- 1 | AIAIAIAIAIAIA -------------------------------------------------------------------------------- /src/contrib/delphi/ZLibConst.pas: -------------------------------------------------------------------------------- 1 | unit ZLibConst; 2 | 3 | interface 4 | 5 | resourcestring 6 | sTargetBufferTooSmall = 'ZLib error: target buffer may be too small'; 7 | sInvalidStreamOp = 'Invalid stream operation'; 8 | 9 | implementation 10 | 11 | end. 12 | -------------------------------------------------------------------------------- /src/contrib/delphi/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | This directory contains an update to the ZLib interface unit, 6 | distributed by Borland as a Delphi supplemental component. 7 | 8 | The original ZLib unit is Copyright (c) 1997,99 Borland Corp., 9 | and is based on zlib version 1.0.4. There are a series of bugs 10 | and security problems associated with that old zlib version, and 11 | we recommend the users to update their ZLib unit. 12 | 13 | 14 | Summary of modifications 15 | ======================== 16 | 17 | - Improved makefile, adapted to zlib version 1.2.1. 18 | 19 | - Some field types from TZStreamRec are changed from Integer to 20 | Longint, for consistency with the zlib.h header, and for 64-bit 21 | readiness. 22 | 23 | - The zlib_version constant is updated. 24 | 25 | - The new Z_RLE strategy has its corresponding symbolic constant. 26 | 27 | - The allocation and deallocation functions and function types 28 | (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl, 29 | and _malloc and _free are added as C RTL stubs. As a result, 30 | the original C sources of zlib can be compiled out of the box, 31 | and linked to the ZLib unit. 32 | 33 | 34 | Suggestions for improvements 35 | ============================ 36 | 37 | Currently, the ZLib unit provides only a limited wrapper around 38 | the zlib library, and much of the original zlib functionality is 39 | missing. Handling compressed file formats like ZIP/GZIP or PNG 40 | cannot be implemented without having this functionality. 41 | Applications that handle these formats are either using their own, 42 | duplicated code, or not using the ZLib unit at all. 43 | 44 | Here are a few suggestions: 45 | 46 | - Checksum class wrappers around adler32() and crc32(), similar 47 | to the Java classes that implement the java.util.zip.Checksum 48 | interface. 49 | 50 | - The ability to read and write raw deflate streams, without the 51 | zlib stream header and trailer. Raw deflate streams are used 52 | in the ZIP file format. 53 | 54 | - The ability to read and write gzip streams, used in the GZIP 55 | file format, and normally produced by the gzip program. 56 | 57 | - The ability to select a different compression strategy, useful 58 | to PNG and MNG image compression, and to multimedia compression 59 | in general. Besides the compression level 60 | 61 | TCompressionLevel = (clNone, clFastest, clDefault, clMax); 62 | 63 | which, in fact, could have used the 'z' prefix and avoided 64 | TColor-like symbols 65 | 66 | TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax); 67 | 68 | there could be a compression strategy 69 | 70 | TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle); 71 | 72 | - ZIP and GZIP stream handling via TStreams. 73 | 74 | 75 | -- 76 | Cosmin Truta 77 | -------------------------------------------------------------------------------- /src/contrib/delphi/zlibd32.mak: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # For use with Delphi and C++ Builder under Win32 3 | # Updated for zlib 1.2.x by Cosmin Truta 4 | 5 | # ------------ Borland C++ ------------ 6 | 7 | # This project uses the Delphi (fastcall/register) calling convention: 8 | LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl 9 | 10 | CC = bcc32 11 | LD = bcc32 12 | AR = tlib 13 | # do not use "-pr" in CFLAGS 14 | CFLAGS = -a -d -k- -O2 $(LOC) 15 | LDFLAGS = 16 | 17 | 18 | # variables 19 | ZLIB_LIB = zlib.lib 20 | 21 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 22 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 23 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj 24 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 25 | 26 | 27 | # targets 28 | all: $(ZLIB_LIB) example.exe minigzip.exe 29 | 30 | .c.obj: 31 | $(CC) -c $(CFLAGS) $*.c 32 | 33 | adler32.obj: adler32.c zlib.h zconf.h 34 | 35 | compress.obj: compress.c zlib.h zconf.h 36 | 37 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 38 | 39 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 40 | 41 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 42 | 43 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 44 | 45 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 46 | 47 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 48 | 49 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 50 | inffast.h inffixed.h 51 | 52 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 53 | inffast.h 54 | 55 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 56 | inffast.h inffixed.h 57 | 58 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 59 | 60 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 61 | 62 | uncompr.obj: uncompr.c zlib.h zconf.h 63 | 64 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 65 | 66 | example.obj: test/example.c zlib.h zconf.h 67 | 68 | minigzip.obj: test/minigzip.c zlib.h zconf.h 69 | 70 | 71 | # For the sake of the old Borland make, 72 | # the command line is cut to fit in the MS-DOS 128 byte limit: 73 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) 74 | -del $(ZLIB_LIB) 75 | $(AR) $(ZLIB_LIB) $(OBJP1) 76 | $(AR) $(ZLIB_LIB) $(OBJP2) 77 | 78 | 79 | # testing 80 | test: example.exe minigzip.exe 81 | example 82 | echo hello world | minigzip | minigzip -d 83 | 84 | example.exe: example.obj $(ZLIB_LIB) 85 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) 86 | 87 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 88 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) 89 | 90 | 91 | # cleanup 92 | clean: 93 | -del *.obj 94 | -del *.exe 95 | -del *.lib 96 | -del *.tds 97 | -del zlib.bak 98 | -del foo.gz 99 | 100 | -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib.build: -------------------------------------------------------------------------------- 1 |  2 | 3 | A .Net wrapper library around ZLib1.dll 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib.chm -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET 13 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET 14 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET 15 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("DotZLib")] 10 | [assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Henrik Ravn")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("1.0.*")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified, the assembly is not signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 41 | // a key. 42 | // (*) If the KeyFile and the KeyName values are both specified, the 43 | // following processing occurs: 44 | // (1) If the KeyName can be found in the CSP, that key is used. 45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 46 | // in the KeyFile is installed into the CSP and used. 47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 48 | // When specifying the KeyFile, the location of the KeyFile should be 49 | // relative to the project output directory which is 50 | // %Project Directory%\obj\. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/ChecksumImpl.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/ChecksumImpl.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/CircularBuffer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/CircularBuffer.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/CodecBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/CodecBase.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/Deflater.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/Deflater.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/DotZLib.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/DotZLib.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/GZipStream.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/GZipStream.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/DotZLib/Inflater.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/dotzlib/DotZLib/Inflater.cs -------------------------------------------------------------------------------- /src/contrib/dotzlib/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/contrib/dotzlib/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains a .Net wrapper class library for the ZLib1.dll 2 | 3 | The wrapper includes support for inflating/deflating memory buffers, 4 | .Net streaming wrappers for the gz streams part of zlib, and wrappers 5 | for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples. 6 | 7 | Directory structure: 8 | -------------------- 9 | 10 | LICENSE_1_0.txt - License file. 11 | readme.txt - This file. 12 | DotZLib.chm - Class library documentation 13 | DotZLib.build - NAnt build file 14 | DotZLib.sln - Microsoft Visual Studio 2003 solution file 15 | 16 | DotZLib\*.cs - Source files for the class library 17 | 18 | Unit tests: 19 | ----------- 20 | The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher. 21 | To include unit tests in the build, define nunit before building. 22 | 23 | 24 | Build instructions: 25 | ------------------- 26 | 27 | 1. Using Visual Studio.Net 2003: 28 | Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll) 29 | will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on 30 | you are building the release or debug version of the library. Check 31 | DotZLib/UnitTests.cs for instructions on how to include unit tests in the 32 | build. 33 | 34 | 2. Using NAnt: 35 | Open a command prompt with access to the build environment and run nant 36 | in the same directory as the DotZLib.build file. 37 | You can define 2 properties on the nant command-line to control the build: 38 | debug={true|false} to toggle between release/debug builds (default=true). 39 | nunit={true|false} to include or esclude unit tests (default=true). 40 | Also the target clean will remove binaries. 41 | Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release 42 | or ./DotZLib/bin/debug, depending on whether you are building the release 43 | or debug version of the library. 44 | 45 | Examples: 46 | nant -D:debug=false -D:nunit=false 47 | will build a release mode version of the library without unit tests. 48 | nant 49 | will build a debug version of the library with unit tests 50 | nant clean 51 | will remove all previously built files. 52 | 53 | 54 | --------------------------------- 55 | Copyright (c) Henrik Ravn 2004 56 | 57 | Use, modification and distribution are subject to the Boost Software License, Version 1.0. 58 | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 59 | -------------------------------------------------------------------------------- /src/contrib/infback9/README: -------------------------------------------------------------------------------- 1 | See infback9.h for what this is and how to use it. 2 | -------------------------------------------------------------------------------- /src/contrib/infback9/infback9.h: -------------------------------------------------------------------------------- 1 | /* infback9.h -- header for using inflateBack9 functions 2 | * Copyright (C) 2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* 7 | * This header file and associated patches provide a decoder for PKWare's 8 | * undocumented deflate64 compression method (method 9). Use with infback9.c, 9 | * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported. 10 | * This should be compiled with zlib, since it uses zutil.h and zutil.o. 11 | * This code has not yet been tested on 16-bit architectures. See the 12 | * comments in zlib.h for inflateBack() usage. These functions are used 13 | * identically, except that there is no windowBits parameter, and a 64K 14 | * window must be provided. Also if int's are 16 bits, then a zero for 15 | * the third parameter of the "out" function actually means 65536UL. 16 | * zlib.h must be included before this header file. 17 | */ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm, 24 | in_func in, void FAR *in_desc, 25 | out_func out, void FAR *out_desc)); 26 | ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm)); 27 | ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm, 28 | unsigned char FAR *window, 29 | const char *version, 30 | int stream_size)); 31 | #define inflateBack9Init(strm, window) \ 32 | inflateBack9Init_((strm), (window), \ 33 | ZLIB_VERSION, sizeof(z_stream)) 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /src/contrib/infback9/inflate9.h: -------------------------------------------------------------------------------- 1 | /* inflate9.h -- internal inflate state definition 2 | * Copyright (C) 1995-2003 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 | /* Possible inflate modes between inflate() calls */ 12 | typedef enum { 13 | TYPE, /* i: waiting for type bits, including last-flag bit */ 14 | STORED, /* i: waiting for stored size (length and complement) */ 15 | TABLE, /* i: waiting for dynamic block table lengths */ 16 | LEN, /* i: waiting for length/lit code */ 17 | DONE, /* finished check, done -- remain here until reset */ 18 | BAD /* got a data error -- remain here until reset */ 19 | } inflate_mode; 20 | 21 | /* 22 | State transitions between above modes - 23 | 24 | (most modes can go to the BAD mode -- not shown for clarity) 25 | 26 | Read deflate blocks: 27 | TYPE -> STORED or TABLE or LEN or DONE 28 | STORED -> TYPE 29 | TABLE -> LENLENS -> CODELENS -> LEN 30 | Read deflate codes: 31 | LEN -> LEN or TYPE 32 | */ 33 | 34 | /* state maintained between inflate() calls. Approximately 7K bytes. */ 35 | struct inflate_state { 36 | /* sliding window */ 37 | unsigned char FAR *window; /* allocated sliding window, if needed */ 38 | /* dynamic table building */ 39 | unsigned ncode; /* number of code length code lengths */ 40 | unsigned nlen; /* number of length code lengths */ 41 | unsigned ndist; /* number of distance code lengths */ 42 | unsigned have; /* number of code lengths in lens[] */ 43 | code FAR *next; /* next available space in codes[] */ 44 | unsigned short lens[320]; /* temporary storage for code lengths */ 45 | unsigned short work[288]; /* work area for code table building */ 46 | code codes[ENOUGH]; /* space for code tables */ 47 | }; 48 | -------------------------------------------------------------------------------- /src/contrib/infback9/inftree9.h: -------------------------------------------------------------------------------- 1 | /* inftree9.h -- header to use inftree9.c 2 | * Copyright (C) 1995-2008 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 | 100eeeee - 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 | 1446, which is the sum of 852 for literal/length codes and 594 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 32 6 15" for distance codes returns 594. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in infback9.c. If the root table size is changed, 47 | then these maximum sizes would be need to be recalculated and updated. */ 48 | #define ENOUGH_LENS 852 49 | #define ENOUGH_DISTS 594 50 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 51 | 52 | /* Type of code to build for inflate_table9() */ 53 | typedef enum { 54 | CODES, 55 | LENS, 56 | DISTS 57 | } codetype; 58 | 59 | extern int inflate_table9 OF((codetype type, unsigned short FAR *lens, 60 | unsigned codes, code FAR * FAR *table, 61 | unsigned FAR *bits, unsigned short FAR *work)); 62 | -------------------------------------------------------------------------------- /src/contrib/iostream/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "zfstream.h" 3 | 4 | int main() { 5 | 6 | // Construct a stream object with this filebuffer. Anything sent 7 | // to this stream will go to standard out. 8 | gzofstream os( 1, ios::out ); 9 | 10 | // This text is getting compressed and sent to stdout. 11 | // To prove this, run 'test | zcat'. 12 | os << "Hello, Mommy" << endl; 13 | 14 | os << setcompressionlevel( Z_NO_COMPRESSION ); 15 | os << "hello, hello, hi, ho!" << endl; 16 | 17 | setcompressionlevel( os, Z_DEFAULT_COMPRESSION ) 18 | << "I'm compressing again" << endl; 19 | 20 | os.close(); 21 | 22 | return 0; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/contrib/iostream/zfstream.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef zfstream_h 3 | #define zfstream_h 4 | 5 | #include 6 | #include "zlib.h" 7 | 8 | class gzfilebuf : public streambuf { 9 | 10 | public: 11 | 12 | gzfilebuf( ); 13 | virtual ~gzfilebuf(); 14 | 15 | gzfilebuf *open( const char *name, int io_mode ); 16 | gzfilebuf *attach( int file_descriptor, int io_mode ); 17 | gzfilebuf *close(); 18 | 19 | int setcompressionlevel( int comp_level ); 20 | int setcompressionstrategy( int comp_strategy ); 21 | 22 | inline int is_open() const { return (file !=NULL); } 23 | 24 | virtual streampos seekoff( streamoff, ios::seek_dir, int ); 25 | 26 | virtual int sync(); 27 | 28 | protected: 29 | 30 | virtual int underflow(); 31 | virtual int overflow( int = EOF ); 32 | 33 | private: 34 | 35 | gzFile file; 36 | short mode; 37 | short own_file_descriptor; 38 | 39 | int flushbuf(); 40 | int fillbuf(); 41 | 42 | }; 43 | 44 | class gzfilestream_common : virtual public ios { 45 | 46 | friend class gzifstream; 47 | friend class gzofstream; 48 | friend gzofstream &setcompressionlevel( gzofstream &, int ); 49 | friend gzofstream &setcompressionstrategy( gzofstream &, int ); 50 | 51 | public: 52 | virtual ~gzfilestream_common(); 53 | 54 | void attach( int fd, int io_mode ); 55 | void open( const char *name, int io_mode ); 56 | void close(); 57 | 58 | protected: 59 | gzfilestream_common(); 60 | 61 | private: 62 | gzfilebuf *rdbuf(); 63 | 64 | gzfilebuf buffer; 65 | 66 | }; 67 | 68 | class gzifstream : public gzfilestream_common, public istream { 69 | 70 | public: 71 | 72 | gzifstream(); 73 | gzifstream( const char *name, int io_mode = ios::in ); 74 | gzifstream( int fd, int io_mode = ios::in ); 75 | 76 | virtual ~gzifstream(); 77 | 78 | }; 79 | 80 | class gzofstream : public gzfilestream_common, public ostream { 81 | 82 | public: 83 | 84 | gzofstream(); 85 | gzofstream( const char *name, int io_mode = ios::out ); 86 | gzofstream( int fd, int io_mode = ios::out ); 87 | 88 | virtual ~gzofstream(); 89 | 90 | }; 91 | 92 | template class gzomanip { 93 | friend gzofstream &operator<<(gzofstream &, const gzomanip &); 94 | public: 95 | gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { } 96 | private: 97 | gzofstream &(*func)(gzofstream &, T); 98 | T val; 99 | }; 100 | 101 | template gzofstream &operator<<(gzofstream &s, const gzomanip &m) 102 | { 103 | return (*m.func)(s, m.val); 104 | } 105 | 106 | inline gzofstream &setcompressionlevel( gzofstream &s, int l ) 107 | { 108 | (s.rdbuf())->setcompressionlevel(l); 109 | return s; 110 | } 111 | 112 | inline gzofstream &setcompressionstrategy( gzofstream &s, int l ) 113 | { 114 | (s.rdbuf())->setcompressionstrategy(l); 115 | return s; 116 | } 117 | 118 | inline gzomanip setcompressionlevel(int l) 119 | { 120 | return gzomanip(&setcompressionlevel,l); 121 | } 122 | 123 | inline gzomanip setcompressionstrategy(int l) 124 | { 125 | return gzomanip(&setcompressionstrategy,l); 126 | } 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /src/contrib/iostream2/zstream_test.cpp: -------------------------------------------------------------------------------- 1 | #include "zstream.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void main() { 7 | char h[256] = "Hello"; 8 | char* g = "Goodbye"; 9 | ozstream out("temp.gz"); 10 | out < "This works well" < h < g; 11 | out.close(); 12 | 13 | izstream in("temp.gz"); // read it back 14 | char *x = read_string(in), *y = new char[256], z[256]; 15 | in > y > z; 16 | in.close(); 17 | cout << x << endl << y << endl << z << endl; 18 | 19 | out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results 20 | out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl; 21 | out << z << endl << y << endl << x << endl; 22 | out << 1.1234567890123456789 << endl; 23 | 24 | delete[] x; delete[] y; 25 | } 26 | -------------------------------------------------------------------------------- /src/contrib/iostream3/README: -------------------------------------------------------------------------------- 1 | These classes provide a C++ stream interface to the zlib library. It allows you 2 | to do things like: 3 | 4 | gzofstream outf("blah.gz"); 5 | outf << "These go into the gzip file " << 123 << endl; 6 | 7 | It does this by deriving a specialized stream buffer for gzipped files, which is 8 | the way Stroustrup would have done it. :-> 9 | 10 | The gzifstream and gzofstream classes were originally written by Kevin Ruland 11 | and made available in the zlib contrib/iostream directory. The older version still 12 | compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of 13 | this version. 14 | 15 | The new classes are as standard-compliant as possible, closely following the 16 | approach of the standard library's fstream classes. It compiles under gcc versions 17 | 3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard 18 | library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs 19 | from the previous one in the following respects: 20 | - added showmanyc 21 | - added setbuf, with support for unbuffered output via setbuf(0,0) 22 | - a few bug fixes of stream behavior 23 | - gzipped output file opened with default compression level instead of maximum level 24 | - setcompressionlevel()/strategy() members replaced by single setcompression() 25 | 26 | The code is provided "as is", with the permission to use, copy, modify, distribute 27 | and sell it for any purpose without fee. 28 | 29 | Ludwig Schwardt 30 | 31 | 32 | DSP Lab 33 | Electrical & Electronic Engineering Department 34 | University of Stellenbosch 35 | South Africa 36 | -------------------------------------------------------------------------------- /src/contrib/iostream3/TODO: -------------------------------------------------------------------------------- 1 | Possible upgrades to gzfilebuf: 2 | 3 | - The ability to do putback (e.g. putbackfail) 4 | 5 | - The ability to seek (zlib supports this, but could be slow/tricky) 6 | 7 | - Simultaneous read/write access (does it make sense?) 8 | 9 | - Support for ios_base::ate open mode 10 | 11 | - Locale support? 12 | 13 | - Check public interface to see which calls give problems 14 | (due to dependence on library internals) 15 | 16 | - Override operator<<(ostream&, gzfilebuf*) to allow direct copying 17 | of stream buffer to stream ( i.e. os << is.rdbuf(); ) 18 | -------------------------------------------------------------------------------- /src/contrib/iostream3/test.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Test program for gzifstream and gzofstream 3 | * 4 | * by Ludwig Schwardt 5 | * original version by Kevin Ruland 6 | */ 7 | 8 | #include "zfstream.h" 9 | #include // for cout 10 | 11 | int main() { 12 | 13 | gzofstream outf; 14 | gzifstream inf; 15 | char buf[80]; 16 | 17 | outf.open("test1.txt.gz"); 18 | outf << "The quick brown fox sidestepped the lazy canine\n" 19 | << 1.3 << "\nPlan " << 9 << std::endl; 20 | outf.close(); 21 | std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n" 22 | << "The quick brown fox sidestepped the lazy canine\n" 23 | << 1.3 << "\nPlan " << 9 << std::endl; 24 | 25 | std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n"; 26 | inf.open("test1.txt.gz"); 27 | while (inf.getline(buf,80,'\n')) { 28 | std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; 29 | } 30 | inf.close(); 31 | 32 | outf.rdbuf()->pubsetbuf(0,0); 33 | outf.open("test2.txt.gz"); 34 | outf << setcompression(Z_NO_COMPRESSION) 35 | << "The quick brown fox sidestepped the lazy canine\n" 36 | << 1.3 << "\nPlan " << 9 << std::endl; 37 | outf.close(); 38 | std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form"; 39 | 40 | std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n"; 41 | inf.rdbuf()->pubsetbuf(0,0); 42 | inf.open("test2.txt.gz"); 43 | while (inf.getline(buf,80,'\n')) { 44 | std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; 45 | } 46 | inf.close(); 47 | 48 | return 0; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/contrib/masmx64/bld_ml64.bat: -------------------------------------------------------------------------------- 1 | ml64.exe /Flinffasx64 /c /Zi inffasx64.asm 2 | ml64.exe /Flgvmat64 /c /Zi gvmat64.asm 3 | -------------------------------------------------------------------------------- /src/contrib/masmx64/readme.txt: -------------------------------------------------------------------------------- 1 | Summary 2 | ------- 3 | This directory contains ASM implementations of the functions 4 | longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t), 5 | for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits. 6 | 7 | gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits 8 | assembly optimized version from Jean-loup Gailly original longest_match function 9 | 10 | inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing 11 | original function from Mark Adler 12 | 13 | Use instructions 14 | ---------------- 15 | Assemble the .asm files using MASM and put the object files into the zlib source 16 | directory. You can also get object files here: 17 | 18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip 19 | 20 | define ASMV and ASMINF in your project. Include inffas8664.c in your source tree, 21 | and inffasx64.obj and gvmat64.obj as object to link. 22 | 23 | 24 | Build instructions 25 | ------------------ 26 | run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe) 27 | 28 | ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK 29 | 30 | You can get Windows 2003 server DDK with ml64 and cl for AMD64 from 31 | http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) 32 | -------------------------------------------------------------------------------- /src/contrib/masmx86/bld_ml32.bat: -------------------------------------------------------------------------------- 1 | ml /coff /Zi /c /Flmatch686.lst match686.asm 2 | ml /coff /Zi /c /Flinffas32.lst inffas32.asm 3 | -------------------------------------------------------------------------------- /src/contrib/masmx86/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | Summary 3 | ------- 4 | This directory contains ASM implementations of the functions 5 | longest_match() and inflate_fast(). 6 | 7 | 8 | Use instructions 9 | ---------------- 10 | Assemble using MASM, and copy the object files into the zlib source 11 | directory, then run the appropriate makefile, as suggested below. You can 12 | donwload MASM from here: 13 | 14 | http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 15 | 16 | You can also get objects files here: 17 | 18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip 19 | 20 | Build instructions 21 | ------------------ 22 | * With Microsoft C and MASM: 23 | nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" 24 | 25 | * With Borland C and TASM: 26 | make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj" 27 | 28 | -------------------------------------------------------------------------------- /src/contrib/minizip/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-O -I../.. 3 | 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a 6 | 7 | .c.o: 8 | $(CC) -c $(CFLAGS) $*.c 9 | 10 | all: miniunz minizip 11 | 12 | miniunz: $(UNZ_OBJS) 13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) 14 | 15 | minizip: $(ZIP_OBJS) 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) 17 | 18 | test: miniunz minizip 19 | ./minizip test readme.txt 20 | ./miniunz -l test.zip 21 | mv readme.txt readme.old 22 | ./miniunz test.zip 23 | 24 | clean: 25 | /bin/rm -f *.o *~ minizip miniunz 26 | -------------------------------------------------------------------------------- /src/contrib/minizip/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libminizip.la 2 | 3 | if COND_DEMOS 4 | bin_PROGRAMS = miniunzip minizip 5 | endif 6 | 7 | zlib_top_srcdir = $(top_srcdir)/../.. 8 | zlib_top_builddir = $(top_builddir)/../.. 9 | 10 | AM_CPPFLAGS = -I$(zlib_top_srcdir) 11 | AM_LDFLAGS = -L$(zlib_top_builddir) 12 | 13 | if WIN32 14 | iowin32_src = iowin32.c 15 | iowin32_h = iowin32.h 16 | endif 17 | 18 | libminizip_la_SOURCES = \ 19 | ioapi.c \ 20 | mztools.c \ 21 | unzip.c \ 22 | zip.c \ 23 | ${iowin32_src} 24 | 25 | libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz 26 | 27 | minizip_includedir = $(includedir)/minizip 28 | minizip_include_HEADERS = \ 29 | crypt.h \ 30 | ioapi.h \ 31 | mztools.h \ 32 | unzip.h \ 33 | zip.h \ 34 | ${iowin32_h} 35 | 36 | pkgconfigdir = $(libdir)/pkgconfig 37 | pkgconfig_DATA = minizip.pc 38 | 39 | EXTRA_PROGRAMS = miniunzip minizip 40 | 41 | miniunzip_SOURCES = miniunz.c 42 | miniunzip_LDADD = libminizip.la 43 | 44 | minizip_SOURCES = minizip.c 45 | minizip_LDADD = libminizip.la -lz 46 | -------------------------------------------------------------------------------- /src/contrib/minizip/MiniZip64_Changes.txt: -------------------------------------------------------------------------------- 1 | 2 | MiniZip 1.1 was derrived from MiniZip at version 1.01f 3 | 4 | Change in 1.0 (Okt 2009) 5 | - **TODO - Add history** 6 | 7 | -------------------------------------------------------------------------------- /src/contrib/minizip/MiniZip64_info.txt: -------------------------------------------------------------------------------- 1 | MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson 2 | 3 | Introduction 4 | --------------------- 5 | MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0. 8 | All possible work was done for compatibility. 9 | 10 | 11 | Background 12 | --------------------- 13 | When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64 14 | support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ ) 15 | 16 | That was used as a starting point. And after that ZIP64 support was added to zip.c 17 | some refactoring and code cleanup was also done. 18 | 19 | 20 | Changed from MiniZip 1.0 to MiniZip 1.1 21 | --------------------------------------- 22 | * Added ZIP64 support for unzip ( by Even Rouault ) 23 | * Added ZIP64 support for zip ( by Mathias Svensson ) 24 | * Reverted some changed that Even Rouault did. 25 | * Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. 26 | * Added unzip patch for BZIP Compression method (patch create by Daniel Borca) 27 | * Added BZIP Compress method for zip 28 | * Did some refactoring and code cleanup 29 | 30 | 31 | Credits 32 | 33 | Gilles Vollant - Original MiniZip author 34 | Even Rouault - ZIP64 unzip Support 35 | Daniel Borca - BZip Compression method support in unzip 36 | Mathias Svensson - ZIP64 zip support 37 | Mathias Svensson - BZip Compression method support in zip 38 | 39 | Resources 40 | 41 | ZipLayout http://result42.com/projects/ZipFileLayout 42 | Command line tool for Windows that shows the layout and information of the headers in a zip archive. 43 | Used when debugging and validating the creation of zip files using MiniZip64 44 | 45 | 46 | ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT 47 | Zip File specification 48 | 49 | 50 | Notes. 51 | * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. 52 | 53 | License 54 | ---------------------------------------------------------- 55 | Condition of use and distribution are the same than zlib : 56 | 57 | This software is provided 'as-is', without any express or implied 58 | warranty. In no event will the authors be held liable for any damages 59 | arising from the use of this software. 60 | 61 | Permission is granted to anyone to use this software for any purpose, 62 | including commercial applications, and to alter it and redistribute it 63 | freely, subject to the following restrictions: 64 | 65 | 1. The origin of this software must not be misrepresented; you must not 66 | claim that you wrote the original software. If you use this software 67 | in a product, an acknowledgment in the product documentation would be 68 | appreciated but is not required. 69 | 2. Altered source versions must be plainly marked as such, and must not be 70 | misrepresented as being the original software. 71 | 3. This notice may not be removed or altered from any source distribution. 72 | 73 | ---------------------------------------------------------- 74 | 75 | -------------------------------------------------------------------------------- /src/contrib/minizip/configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_INIT([minizip], [1.2.8], [bugzilla.redhat.com]) 5 | AC_CONFIG_SRCDIR([minizip.c]) 6 | AM_INIT_AUTOMAKE([foreign]) 7 | LT_INIT 8 | 9 | AC_MSG_CHECKING([whether to build example programs]) 10 | AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) 11 | AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) 12 | if test "$enable_demos" = yes 13 | then 14 | AC_MSG_RESULT([yes]) 15 | else 16 | AC_MSG_RESULT([no]) 17 | fi 18 | 19 | case "${host}" in 20 | *-mingw* | mingw*) 21 | WIN32="yes" 22 | ;; 23 | *) 24 | ;; 25 | esac 26 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) 27 | 28 | 29 | AC_SUBST([HAVE_UNISTD_H], [0]) 30 | AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], []) 31 | AC_CONFIG_FILES([Makefile minizip.pc]) 32 | AC_OUTPUT 33 | -------------------------------------------------------------------------------- /src/contrib/minizip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab __unused) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(const char* passwd, /* password string */ 91 | unsigned char* buf, /* where to write header */ 92 | int bufSize, 93 | unsigned long* pkeys, 94 | const z_crc_t* pcrc_32_tab, 95 | unsigned long crcForCrypting) 96 | { 97 | int n; /* index in random header */ 98 | int t; /* temporary */ 99 | int c; /* random byte */ 100 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 | static unsigned calls = 0; /* ensure different random header each time */ 102 | 103 | if (bufSize> 7) & 0xff; 118 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 | } 120 | /* Encrypt random header (last two bytes is high word of crc) */ 121 | init_keys(passwd, pkeys, pcrc_32_tab); 122 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 | { 124 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 | } 126 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 | return n; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /src/contrib/minizip/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /src/contrib/minizip/make_vms.com: -------------------------------------------------------------------------------- 1 | $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig 2 | $ open/write zdef vmsdefs.h 3 | $ copy sys$input: zdef 4 | $ deck 5 | #define unix 6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from 7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator 8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord 9 | #define Write_EndOfCentralDirectoryRecord Write_EoDRecord 10 | $ eod 11 | $ close zdef 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h 13 | $ cc/include=[--]/prefix=all ioapi.c 14 | $ cc/include=[--]/prefix=all miniunz.c 15 | $ cc/include=[--]/prefix=all unzip.c 16 | $ cc/include=[--]/prefix=all minizip.c 17 | $ cc/include=[--]/prefix=all zip.c 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib 19 | $ link minizip,zip,ioapi,[--]libz.olb/lib 20 | $ mcr []minizip test minizip_info.txt 21 | $ mcr []miniunz -l test.zip 22 | $ rename minizip_info.txt; minizip_info.txt_old 23 | $ mcr []miniunz test.zip 24 | $ delete test.zip;* 25 | $exit 26 | -------------------------------------------------------------------------------- /src/contrib/minizip/miniunzip.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH miniunzip 1 "Nov 7, 2001" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .\" 5 | .\" Some roff macros, for reference: 6 | .\" .nh disable hyphenation 7 | .\" .hy enable hyphenation 8 | .\" .ad l left justify 9 | .\" .ad b justify to both left and right margins 10 | .\" .nf disable filling 11 | .\" .fi enable filling 12 | .\" .br insert line break 13 | .\" .sp insert n+1 empty lines 14 | .\" for manpage-specific macros, see man(7) 15 | .SH NAME 16 | miniunzip - uncompress and examine ZIP archives 17 | .SH SYNOPSIS 18 | .B miniunzip 19 | .RI [ -exvlo ] 20 | zipfile [ files_to_extract ] [-d tempdir] 21 | .SH DESCRIPTION 22 | .B minizip 23 | is a simple tool which allows the extraction of compressed file 24 | archives in the ZIP format used by the MS-DOS utility PKZIP. It was 25 | written as a demonstration of the 26 | .IR zlib (3) 27 | library and therefore lack many of the features of the 28 | .IR unzip (1) 29 | program. 30 | .SH OPTIONS 31 | A number of options are supported. With the exception of 32 | .BI \-d\ tempdir 33 | these must be supplied before any 34 | other arguments and are: 35 | .TP 36 | .BI \-l\ ,\ \-\-v 37 | List the files in the archive without extracting them. 38 | .TP 39 | .B \-o 40 | Overwrite files without prompting for confirmation. 41 | .TP 42 | .B \-x 43 | Extract files (default). 44 | .PP 45 | The 46 | .I zipfile 47 | argument is the name of the archive to process. The next argument can be used 48 | to specify a single file to extract from the archive. 49 | 50 | Lastly, the following option can be specified at the end of the command-line: 51 | .TP 52 | .BI \-d\ tempdir 53 | Extract the archive in the directory 54 | .I tempdir 55 | rather than the current directory. 56 | .SH SEE ALSO 57 | .BR minizip (1), 58 | .BR zlib (3), 59 | .BR unzip (1). 60 | .SH AUTHOR 61 | This program was written by Gilles Vollant. This manual page was 62 | written by Mark Brown . The -d tempdir option 63 | was added by Dirk Eddelbuettel . 64 | -------------------------------------------------------------------------------- /src/contrib/minizip/minizip.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH minizip 1 "May 2, 2001" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .\" 5 | .\" Some roff macros, for reference: 6 | .\" .nh disable hyphenation 7 | .\" .hy enable hyphenation 8 | .\" .ad l left justify 9 | .\" .ad b justify to both left and right margins 10 | .\" .nf disable filling 11 | .\" .fi enable filling 12 | .\" .br insert line break 13 | .\" .sp insert n+1 empty lines 14 | .\" for manpage-specific macros, see man(7) 15 | .SH NAME 16 | minizip - create ZIP archives 17 | .SH SYNOPSIS 18 | .B minizip 19 | .RI [ -o ] 20 | zipfile [ " files" ... ] 21 | .SH DESCRIPTION 22 | .B minizip 23 | is a simple tool which allows the creation of compressed file archives 24 | in the ZIP format used by the MS-DOS utility PKZIP. It was written as 25 | a demonstration of the 26 | .IR zlib (3) 27 | library and therefore lack many of the features of the 28 | .IR zip (1) 29 | program. 30 | .SH OPTIONS 31 | The first argument supplied is the name of the ZIP archive to create or 32 | .RI -o 33 | in which case it is ignored and the second argument treated as the 34 | name of the ZIP file. If the ZIP file already exists it will be 35 | overwritten. 36 | .PP 37 | Subsequent arguments specify a list of files to place in the ZIP 38 | archive. If none are specified then an empty archive will be created. 39 | .SH SEE ALSO 40 | .BR miniunzip (1), 41 | .BR zlib (3), 42 | .BR zip (1). 43 | .SH AUTHOR 44 | This program was written by Gilles Vollant. This manual page was 45 | written by Mark Brown . 46 | 47 | -------------------------------------------------------------------------------- /src/contrib/minizip/minizip.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@/minizip 5 | 6 | Name: minizip 7 | Description: Minizip zip file manipulation library 8 | Requires: 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${libdir} -lminizip 11 | Libs.private: -lz 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /src/contrib/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/contrib/pascal/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a Pascal (Delphi, Kylix) interface to the 3 | zlib data compression library. 4 | 5 | 6 | Directory listing 7 | ================= 8 | 9 | zlibd32.mak makefile for Borland C++ 10 | example.pas usage example of zlib 11 | zlibpas.pas the Pascal interface to zlib 12 | readme.txt this file 13 | 14 | 15 | Compatibility notes 16 | =================== 17 | 18 | - Although the name "zlib" would have been more normal for the 19 | zlibpas unit, this name is already taken by Borland's ZLib unit. 20 | This is somehow unfortunate, because that unit is not a genuine 21 | interface to the full-fledged zlib functionality, but a suite of 22 | class wrappers around zlib streams. Other essential features, 23 | such as checksums, are missing. 24 | It would have been more appropriate for that unit to have a name 25 | like "ZStreams", or something similar. 26 | 27 | - The C and zlib-supplied types int, uInt, long, uLong, etc. are 28 | translated directly into Pascal types of similar sizes (Integer, 29 | LongInt, etc.), to avoid namespace pollution. In particular, 30 | there is no conversion of unsigned int into a Pascal unsigned 31 | integer. The Word type is non-portable and has the same size 32 | (16 bits) both in a 16-bit and in a 32-bit environment, unlike 33 | Integer. Even if there is a 32-bit Cardinal type, there is no 34 | real need for unsigned int in zlib under a 32-bit environment. 35 | 36 | - Except for the callbacks, the zlib function interfaces are 37 | assuming the calling convention normally used in Pascal 38 | (__pascal for DOS and Windows16, __fastcall for Windows32). 39 | Since the cdecl keyword is used, the old Turbo Pascal does 40 | not work with this interface. 41 | 42 | - The gz* function interfaces are not translated, to avoid 43 | interfacing problems with the C runtime library. Besides, 44 | gzprintf(gzFile file, const char *format, ...) 45 | cannot be translated into Pascal. 46 | 47 | 48 | Legal issues 49 | ============ 50 | 51 | The zlibpas interface is: 52 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler. 53 | Copyright (C) 1998 by Bob Dellaca. 54 | Copyright (C) 2003 by Cosmin Truta. 55 | 56 | The example program is: 57 | Copyright (C) 1995-2003 by Jean-loup Gailly. 58 | Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali. 59 | Copyright (C) 2003 by Cosmin Truta. 60 | 61 | This software is provided 'as-is', without any express or implied 62 | warranty. In no event will the author be held liable for any damages 63 | arising from the use of this software. 64 | 65 | Permission is granted to anyone to use this software for any purpose, 66 | including commercial applications, and to alter it and redistribute it 67 | freely, subject to the following restrictions: 68 | 69 | 1. The origin of this software must not be misrepresented; you must not 70 | claim that you wrote the original software. If you use this software 71 | in a product, an acknowledgment in the product documentation would be 72 | appreciated but is not required. 73 | 2. Altered source versions must be plainly marked as such, and must not be 74 | misrepresented as being the original software. 75 | 3. This notice may not be removed or altered from any source distribution. 76 | 77 | -------------------------------------------------------------------------------- /src/contrib/pascal/zlibd32.mak: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # For use with Delphi and C++ Builder under Win32 3 | # Updated for zlib 1.2.x by Cosmin Truta 4 | 5 | # ------------ Borland C++ ------------ 6 | 7 | # This project uses the Delphi (fastcall/register) calling convention: 8 | LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl 9 | 10 | CC = bcc32 11 | LD = bcc32 12 | AR = tlib 13 | # do not use "-pr" in CFLAGS 14 | CFLAGS = -a -d -k- -O2 $(LOC) 15 | LDFLAGS = 16 | 17 | 18 | # variables 19 | ZLIB_LIB = zlib.lib 20 | 21 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 22 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 23 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj 24 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 25 | 26 | 27 | # targets 28 | all: $(ZLIB_LIB) example.exe minigzip.exe 29 | 30 | .c.obj: 31 | $(CC) -c $(CFLAGS) $*.c 32 | 33 | adler32.obj: adler32.c zlib.h zconf.h 34 | 35 | compress.obj: compress.c zlib.h zconf.h 36 | 37 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 38 | 39 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 40 | 41 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 42 | 43 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 44 | 45 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 46 | 47 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 48 | 49 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 50 | inffast.h inffixed.h 51 | 52 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 53 | inffast.h 54 | 55 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 56 | inffast.h inffixed.h 57 | 58 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 59 | 60 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 61 | 62 | uncompr.obj: uncompr.c zlib.h zconf.h 63 | 64 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 65 | 66 | example.obj: test/example.c zlib.h zconf.h 67 | 68 | minigzip.obj: test/minigzip.c zlib.h zconf.h 69 | 70 | 71 | # For the sake of the old Borland make, 72 | # the command line is cut to fit in the MS-DOS 128 byte limit: 73 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) 74 | -del $(ZLIB_LIB) 75 | $(AR) $(ZLIB_LIB) $(OBJP1) 76 | $(AR) $(ZLIB_LIB) $(OBJP2) 77 | 78 | 79 | # testing 80 | test: example.exe minigzip.exe 81 | example 82 | echo hello world | minigzip | minigzip -d 83 | 84 | example.exe: example.obj $(ZLIB_LIB) 85 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) 86 | 87 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 88 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) 89 | 90 | 91 | # cleanup 92 | clean: 93 | -del *.obj 94 | -del *.exe 95 | -del *.lib 96 | -del *.tds 97 | -del zlib.bak 98 | -del foo.gz 99 | 100 | -------------------------------------------------------------------------------- /src/contrib/puff/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O 2 | 3 | puff: puff.o pufftest.o 4 | 5 | puff.o: puff.h 6 | 7 | pufftest.o: puff.h 8 | 9 | test: puff 10 | puff zeros.raw 11 | 12 | puft: puff.c puff.h pufftest.o 13 | cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o 14 | 15 | # puff full coverage test (should say 100%) 16 | cov: puft 17 | @rm -f *.gcov *.gcda 18 | @puft -w zeros.raw 2>&1 | cat > /dev/null 19 | @echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 20 | @echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 21 | @echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254 22 | @echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 23 | @echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null 24 | @echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 25 | @echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 26 | @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 27 | @echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249 28 | @echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 29 | @echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null 30 | @echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 31 | @echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245 32 | @puft -f zeros.raw 2>&1 | cat > /dev/null 33 | @echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253 34 | @echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252 35 | @echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251 36 | @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248 37 | @echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250 38 | @echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247 39 | @gcov -n puff.c 40 | 41 | clean: 42 | rm -f puff puft *.o *.gc* 43 | -------------------------------------------------------------------------------- /src/contrib/puff/README: -------------------------------------------------------------------------------- 1 | Puff -- A Simple Inflate 2 | 3 Mar 2003 3 | Mark Adler 4 | madler@alumni.caltech.edu 5 | 6 | What this is -- 7 | 8 | puff.c provides the routine puff() to decompress the deflate data format. It 9 | does so more slowly than zlib, but the code is about one-fifth the size of the 10 | inflate code in zlib, and written to be very easy to read. 11 | 12 | Why I wrote this -- 13 | 14 | puff.c was written to document the deflate format unambiguously, by virtue of 15 | being working C code. It is meant to supplement RFC 1951, which formally 16 | describes the deflate format. I have received many questions on details of the 17 | deflate format, and I hope that reading this code will answer those questions. 18 | puff.c is heavily commented with details of the deflate format, especially 19 | those little nooks and cranies of the format that might not be obvious from a 20 | specification. 21 | 22 | puff.c may also be useful in applications where code size or memory usage is a 23 | very limited resource, and speed is not as important. 24 | 25 | How to use it -- 26 | 27 | Well, most likely you should just be reading puff.c and using zlib for actual 28 | applications, but if you must ... 29 | 30 | Include puff.h in your code, which provides this prototype: 31 | 32 | int puff(unsigned char *dest, /* pointer to destination pointer */ 33 | unsigned long *destlen, /* amount of output space */ 34 | unsigned char *source, /* pointer to source data pointer */ 35 | unsigned long *sourcelen); /* amount of input available */ 36 | 37 | Then you can call puff() to decompress a deflate stream that is in memory in 38 | its entirety at source, to a sufficiently sized block of memory for the 39 | decompressed data at dest. puff() is the only external symbol in puff.c The 40 | only C library functions that puff.c needs are setjmp() and longjmp(), which 41 | are used to simplify error checking in the code to improve readabilty. puff.c 42 | does no memory allocation, and uses less than 2K bytes off of the stack. 43 | 44 | If destlen is not enough space for the uncompressed data, then inflate will 45 | return an error without writing more than destlen bytes. Note that this means 46 | that in order to decompress the deflate data successfully, you need to know 47 | the size of the uncompressed data ahead of time. 48 | 49 | If needed, puff() can determine the size of the uncompressed data with no 50 | output space. This is done by passing dest equal to (unsigned char *)0. Then 51 | the initial value of *destlen is ignored and *destlen is set to the length of 52 | the uncompressed data. So if the size of the uncompressed data is not known, 53 | then two passes of puff() can be used--first to determine the size, and second 54 | to do the actual inflation after allocating the appropriate memory. Not 55 | pretty, but it works. (This is one of the reasons you should be using zlib.) 56 | 57 | The deflate format is self-terminating. If the deflate stream does not end 58 | in *sourcelen bytes, puff() will return an error without reading at or past 59 | endsource. 60 | 61 | On return, *sourcelen is updated to the amount of input data consumed, and 62 | *destlen is updated to the size of the uncompressed data. See the comments 63 | in puff.c for the possible return codes for puff(). 64 | -------------------------------------------------------------------------------- /src/contrib/puff/puff.h: -------------------------------------------------------------------------------- 1 | /* puff.h 2 | Copyright (C) 2002-2013 Mark Adler, all rights reserved 3 | version 2.3, 21 Jan 2013 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | 25 | /* 26 | * See puff.c for purpose and usage. 27 | */ 28 | #ifndef NIL 29 | # define NIL ((unsigned char *)0) /* for no output option */ 30 | #endif 31 | 32 | int puff(unsigned char *dest, /* pointer to destination pointer */ 33 | unsigned long *destlen, /* amount of output space */ 34 | const unsigned char *source, /* pointer to source data pointer */ 35 | unsigned long *sourcelen); /* amount of input available */ 36 | -------------------------------------------------------------------------------- /src/contrib/puff/zeros.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/contrib/puff/zeros.raw -------------------------------------------------------------------------------- /src/contrib/testzlib/testzlib.txt: -------------------------------------------------------------------------------- 1 | To build testzLib with Visual Studio 2005: 2 | 3 | copy to a directory file from : 4 | - root of zLib tree 5 | - contrib/testzlib 6 | - contrib/masmx86 7 | - contrib/masmx64 8 | - contrib/vstudio/vc7 9 | 10 | and open testzlib8.sln -------------------------------------------------------------------------------- /src/contrib/untgz/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-g 3 | 4 | untgz: untgz.o ../../libz.a 5 | $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz 6 | 7 | untgz.o: untgz.c ../../zlib.h 8 | $(CC) $(CFLAGS) -c -I../.. untgz.c 9 | 10 | ../../libz.a: 11 | cd ../..; ./configure; make 12 | 13 | clean: 14 | rm -f untgz untgz.o *~ 15 | -------------------------------------------------------------------------------- /src/contrib/untgz/Makefile.msc: -------------------------------------------------------------------------------- 1 | CC=cl 2 | CFLAGS=-MD 3 | 4 | untgz.exe: untgz.obj ..\..\zlib.lib 5 | $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib 6 | 7 | untgz.obj: untgz.c ..\..\zlib.h 8 | $(CC) $(CFLAGS) -c -I..\.. untgz.c 9 | 10 | ..\..\zlib.lib: 11 | cd ..\.. 12 | $(MAKE) -f win32\makefile.msc 13 | cd contrib\untgz 14 | 15 | clean: 16 | -del untgz.obj 17 | -del untgz.exe 18 | -------------------------------------------------------------------------------- /src/contrib/vstudio/readme.txt: -------------------------------------------------------------------------------- 1 | Building instructions for the DLL versions of Zlib 1.2.8 2 | ======================================================== 3 | 4 | This directory contains projects that build zlib and minizip using 5 | Microsoft Visual C++ 9.0/10.0. 6 | 7 | You don't need to build these projects yourself. You can download the 8 | binaries from: 9 | http://www.winimage.com/zLibDll 10 | 11 | More information can be found at this site. 12 | 13 | 14 | 15 | 16 | 17 | Build instructions for Visual Studio 2008 (32 bits or 64 bits) 18 | -------------------------------------------------------------- 19 | - Uncompress current zlib, including all contrib/* files 20 | - Compile assembly code (with Visual Studio Command Prompt) by running: 21 | bld_ml64.bat (in contrib\masmx64) 22 | bld_ml32.bat (in contrib\masmx86) 23 | - Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 24 | - Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" 25 | 26 | Build instructions for Visual Studio 2010 (32 bits or 64 bits) 27 | -------------------------------------------------------------- 28 | - Uncompress current zlib, including all contrib/* files 29 | - Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 30 | 31 | Build instructions for Visual Studio 2012 (32 bits or 64 bits) 32 | -------------------------------------------------------------- 33 | - Uncompress current zlib, including all contrib/* files 34 | - Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 35 | 36 | 37 | Important 38 | --------- 39 | - To use zlibwapi.dll in your application, you must define the 40 | macro ZLIB_WINAPI when compiling your application's source files. 41 | 42 | 43 | Additional notes 44 | ---------------- 45 | - This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built 46 | by Gilles Vollant from the zlib 1.1.x sources, and distributed at 47 | http://www.winimage.com/zLibDll 48 | It uses the WINAPI calling convention for the exported functions, and 49 | includes the minizip functionality. If your application needs that 50 | particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. 51 | 52 | - The new DLL was renamed because there exist several incompatible 53 | versions of zlib.dll on the Internet. 54 | 55 | - There is also an official DLL build of zlib, named zlib1.dll. This one 56 | is exporting the functions using the CDECL convention. See the file 57 | win32\DLL_FAQ.txt found in this zlib distribution. 58 | 59 | - There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol 60 | has a slightly different effect. To avoid compatibility problems, do 61 | not define it here. 62 | 63 | 64 | Gilles Vollant 65 | info@winimage.com 66 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/miniunz.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {048af943-022b-4db6-beeb-a54c34774ee2} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {c1d600d2-888f-4aea-b73e-8b0dd9befa0c} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {0844199a-966b-4f19-81db-1e0125e141b9} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/minizip.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c0419b40-bf50-40da-b153-ff74215b79de} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {bb87b070-735b-478e-92ce-7383abb2f36c} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {f46ab6a6-548f-43cb-ae96-681abb5bd5db} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/testzlib.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c1f6a2e3-5da5-4955-8653-310d3efe05a9} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {c2aaffdc-2c95-4d6f-8466-4bec5890af2c} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {c274fe07-05f2-461c-964b-f6341e4e7eb5} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/testzlibdll.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fa61a89f-93fc-4c89-b29e-36224b7592f4} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {d4b85da0-2ba2-4934-b57f-e2584e3848ee} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {e573e075-00bd-4a7d-bd67-a8cc9bfc5aca} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/zlib.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDR_VERSION1 1 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 5 | FILEVERSION 1,2,8,0 6 | PRODUCTVERSION 1,2,8,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 // not used 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | //language ID = U.S. English, char set = Windows, Multilingual 17 | 18 | BEGIN 19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" 20 | VALUE "FileVersion", "1.2.8\0" 21 | VALUE "InternalName", "zlib\0" 22 | VALUE "OriginalFilename", "zlibwapi.dll\0" 23 | VALUE "ProductName", "ZLib.DLL\0" 24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 25 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409, 1252 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/zlibstat.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {174213f6-7f66-4ae8-a3a8-a1e0a1e6ffdd} 6 | 7 | 8 | 9 | 10 | Source Files 11 | 12 | 13 | Source Files 14 | 15 | 16 | Source Files 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | 68 | 69 | Source Files 70 | 71 | 72 | 73 | 74 | Source Files 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc10/zlibvc.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {07934a85-8b61-443d-a0ee-b2eedb74f3cd} 6 | cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 7 | 8 | 9 | {1d99675b-433d-4a21-9e50-ed4ab8b19762} 10 | h;hpp;hxx;hm;inl;fi;fd 11 | 12 | 13 | {431c0958-fa71-44d0-9084-2d19d100c0cc} 14 | ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | Source Files 68 | 69 | 70 | Source Files 71 | 72 | 73 | Source Files 74 | 75 | 76 | Source Files 77 | 78 | 79 | 80 | 81 | Source Files 82 | 83 | 84 | 85 | 86 | Source Files 87 | 88 | 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | Header Files 98 | 99 | 100 | Header Files 101 | 102 | 103 | Header Files 104 | 105 | 106 | Header Files 107 | 108 | 109 | Header Files 110 | 111 | 112 | Header Files 113 | 114 | 115 | Header Files 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc11/zlib.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDR_VERSION1 1 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 5 | FILEVERSION 1,2,8,0 6 | PRODUCTVERSION 1,2,8,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 // not used 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | //language ID = U.S. English, char set = Windows, Multilingual 17 | 18 | BEGIN 19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" 20 | VALUE "FileVersion", "1.2.8\0" 21 | VALUE "InternalName", "zlib\0" 22 | VALUE "OriginalFilename", "zlibwapi.dll\0" 23 | VALUE "ProductName", "ZLib.DLL\0" 24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 25 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409, 1252 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /src/contrib/vstudio/vc9/zlib.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDR_VERSION1 1 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 5 | FILEVERSION 1,2,8,0 6 | PRODUCTVERSION 1,2,8,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 // not used 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | //language ID = U.S. English, char set = Windows, Multilingual 17 | 18 | BEGIN 19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" 20 | VALUE "FileVersion", "1.2.8\0" 21 | VALUE "InternalName", "zlib\0" 22 | VALUE "OriginalFilename", "zlibwapi.dll\0" 23 | VALUE "ProductName", "ZLib.DLL\0" 24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 25 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409, 1252 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /src/examples/README.examples: -------------------------------------------------------------------------------- 1 | This directory contains examples of the use of zlib and other relevant 2 | programs and documentation. 3 | 4 | enough.c 5 | calculation and justification of ENOUGH parameter in inftrees.h 6 | - calculates the maximum table space used in inflate tree 7 | construction over all possible Huffman codes 8 | 9 | fitblk.c 10 | compress just enough input to nearly fill a requested output size 11 | - zlib isn't designed to do this, but fitblk does it anyway 12 | 13 | gun.c 14 | uncompress a gzip file 15 | - illustrates the use of inflateBack() for high speed file-to-file 16 | decompression using call-back functions 17 | - is approximately twice as fast as gzip -d 18 | - also provides Unix uncompress functionality, again twice as fast 19 | 20 | gzappend.c 21 | append to a gzip file 22 | - illustrates the use of the Z_BLOCK flush parameter for inflate() 23 | - illustrates the use of deflatePrime() to start at any bit 24 | 25 | gzjoin.c 26 | join gzip files without recalculating the crc or recompressing 27 | - illustrates the use of the Z_BLOCK flush parameter for inflate() 28 | - illustrates the use of crc32_combine() 29 | 30 | gzlog.c 31 | gzlog.h 32 | efficiently and robustly maintain a message log file in gzip format 33 | - illustrates use of raw deflate, Z_PARTIAL_FLUSH, deflatePrime(), 34 | and deflateSetDictionary() 35 | - illustrates use of a gzip header extra field 36 | 37 | zlib_how.html 38 | painfully comprehensive description of zpipe.c (see below) 39 | - describes in excruciating detail the use of deflate() and inflate() 40 | 41 | zpipe.c 42 | reads and writes zlib streams from stdin to stdout 43 | - illustrates the proper use of deflate() and inflate() 44 | - deeply commented in zlib_how.html (see above) 45 | 46 | zran.c 47 | index a zlib or gzip stream and randomly access it 48 | - illustrates the use of Z_BLOCK, inflatePrime(), and 49 | inflateSetDictionary() to provide random access 50 | -------------------------------------------------------------------------------- /src/examples/gzlog.h: -------------------------------------------------------------------------------- 1 | /* gzlog.h 2 | Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved 3 | version 2.2, 14 Aug 2012 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | /* Version History: 25 | 1.0 26 Nov 2004 First version 26 | 2.0 25 Apr 2008 Complete redesign for recovery of interrupted operations 27 | Interface changed slightly in that now path is a prefix 28 | Compression now occurs as needed during gzlog_write() 29 | gzlog_write() now always leaves the log file as valid gzip 30 | 2.1 8 Jul 2012 Fix argument checks in gzlog_compress() and gzlog_write() 31 | 2.2 14 Aug 2012 Clean up signed comparisons 32 | */ 33 | 34 | /* 35 | The gzlog object allows writing short messages to a gzipped log file, 36 | opening the log file locked for small bursts, and then closing it. The log 37 | object works by appending stored (uncompressed) data to the gzip file until 38 | 1 MB has been accumulated. At that time, the stored data is compressed, and 39 | replaces the uncompressed data in the file. The log file is truncated to 40 | its new size at that time. After each write operation, the log file is a 41 | valid gzip file that can decompressed to recover what was written. 42 | 43 | The gzlog operations can be interupted at any point due to an application or 44 | system crash, and the log file will be recovered the next time the log is 45 | opened with gzlog_open(). 46 | */ 47 | 48 | #ifndef GZLOG_H 49 | #define GZLOG_H 50 | 51 | /* gzlog object type */ 52 | typedef void gzlog; 53 | 54 | /* Open a gzlog object, creating the log file if it does not exist. Return 55 | NULL on error. Note that gzlog_open() could take a while to complete if it 56 | has to wait to verify that a lock is stale (possibly for five minutes), or 57 | if there is significant contention with other instantiations of this object 58 | when locking the resource. path is the prefix of the file names created by 59 | this object. If path is "foo", then the log file will be "foo.gz", and 60 | other auxiliary files will be created and destroyed during the process: 61 | "foo.dict" for a compression dictionary, "foo.temp" for a temporary (next) 62 | dictionary, "foo.add" for data being added or compressed, "foo.lock" for the 63 | lock file, and "foo.repairs" to log recovery operations performed due to 64 | interrupted gzlog operations. A gzlog_open() followed by a gzlog_close() 65 | will recover a previously interrupted operation, if any. */ 66 | gzlog *gzlog_open(char *path); 67 | 68 | /* Write to a gzlog object. Return zero on success, -1 if there is a file i/o 69 | error on any of the gzlog files (this should not happen if gzlog_open() 70 | succeeded, unless the device has run out of space or leftover auxiliary 71 | files have permissions or ownership that prevent their use), -2 if there is 72 | a memory allocation failure, or -3 if the log argument is invalid (e.g. if 73 | it was not created by gzlog_open()). This function will write data to the 74 | file uncompressed, until 1 MB has been accumulated, at which time that data 75 | will be compressed. The log file will be a valid gzip file upon successful 76 | return. */ 77 | int gzlog_write(gzlog *log, void *data, size_t len); 78 | 79 | /* Force compression of any uncompressed data in the log. This should be used 80 | sparingly, if at all. The main application would be when a log file will 81 | not be appended to again. If this is used to compress frequently while 82 | appending, it will both significantly increase the execution time and 83 | reduce the compression ratio. The return codes are the same as for 84 | gzlog_write(). */ 85 | int gzlog_compress(gzlog *log); 86 | 87 | /* Close a gzlog object. Return zero on success, -3 if the log argument is 88 | invalid. The log object is freed, and so cannot be referenced again. */ 89 | int gzlog_close(gzlog *log); 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/gzclose.c: -------------------------------------------------------------------------------- 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 | } 26 | -------------------------------------------------------------------------------- /src/inffast.h: -------------------------------------------------------------------------------- 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)); 12 | -------------------------------------------------------------------------------- /src/inftrees.h: -------------------------------------------------------------------------------- 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)); 63 | -------------------------------------------------------------------------------- /src/msdos/Makefile.bor: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # Borland C++ 3 | # Last updated: 15-Mar-2003 4 | 5 | # To use, do "make -fmakefile.bor" 6 | # To compile in small model, set below: MODEL=s 7 | 8 | # WARNING: the small model is supported but only for small values of 9 | # MAX_WBITS and MAX_MEM_LEVEL. For example: 10 | # -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 11 | # If you wish to reduce the memory requirements (default 256K for big 12 | # objects plus a few K), you can add to the LOC macro below: 13 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 14 | # See zconf.h for details about the memory requirements. 15 | 16 | # ------------ Turbo C++, Borland C++ ------------ 17 | 18 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) 19 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added 20 | # to the declaration of LOC here: 21 | LOC = $(LOCAL_ZLIB) 22 | 23 | # type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. 24 | CPU_TYP = 0 25 | 26 | # memory model: one of s, m, c, l (small, medium, compact, large) 27 | MODEL=l 28 | 29 | # replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version 30 | CC=bcc 31 | LD=bcc 32 | AR=tlib 33 | 34 | # compiler flags 35 | # replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 36 | CFLAGS=-O2 -Z -m$(MODEL) $(LOC) 37 | 38 | LDFLAGS=-m$(MODEL) -f- 39 | 40 | 41 | # variables 42 | ZLIB_LIB = zlib_$(MODEL).lib 43 | 44 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 45 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 46 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj 47 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 48 | 49 | 50 | # targets 51 | all: $(ZLIB_LIB) example.exe minigzip.exe 52 | 53 | .c.obj: 54 | $(CC) -c $(CFLAGS) $*.c 55 | 56 | adler32.obj: adler32.c zlib.h zconf.h 57 | 58 | compress.obj: compress.c zlib.h zconf.h 59 | 60 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 61 | 62 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 63 | 64 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 65 | 66 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 67 | 68 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 69 | 70 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 71 | 72 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 73 | inffast.h inffixed.h 74 | 75 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 76 | inffast.h 77 | 78 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 79 | inffast.h inffixed.h 80 | 81 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 82 | 83 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 84 | 85 | uncompr.obj: uncompr.c zlib.h zconf.h 86 | 87 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 88 | 89 | example.obj: test/example.c zlib.h zconf.h 90 | 91 | minigzip.obj: test/minigzip.c zlib.h zconf.h 92 | 93 | 94 | # the command line is cut to fit in the MS-DOS 128 byte limit: 95 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) 96 | -del $(ZLIB_LIB) 97 | $(AR) $(ZLIB_LIB) $(OBJP1) 98 | $(AR) $(ZLIB_LIB) $(OBJP2) 99 | 100 | example.exe: example.obj $(ZLIB_LIB) 101 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) 102 | 103 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 104 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) 105 | 106 | test: example.exe minigzip.exe 107 | example 108 | echo hello world | minigzip | minigzip -d 109 | 110 | clean: 111 | -del *.obj 112 | -del *.lib 113 | -del *.exe 114 | -del zlib_*.bak 115 | -del foo.gz 116 | -------------------------------------------------------------------------------- /src/msdos/Makefile.dj2: -------------------------------------------------------------------------------- 1 | # Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96. 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | # To compile, or to compile and test, type: 6 | # 7 | # make -fmakefile.dj2; make test -fmakefile.dj2 8 | # 9 | # To install libz.a, zconf.h and zlib.h in the djgpp directories, type: 10 | # 11 | # make install -fmakefile.dj2 12 | # 13 | # after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as 14 | # in the sample below if the pattern of the DJGPP distribution is to 15 | # be followed. Remember that, while 'es around <=> are ignored in 16 | # makefiles, they are *not* in batch files or in djgpp.env. 17 | # - - - - - 18 | # [make] 19 | # INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include 20 | # LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib 21 | # BUTT=-m486 22 | # - - - - - 23 | # Alternately, these variables may be defined below, overriding the values 24 | # in djgpp.env, as 25 | # INCLUDE_PATH=c:\usr\include 26 | # LIBRARY_PATH=c:\usr\lib 27 | 28 | CC=gcc 29 | 30 | #CFLAGS=-MMD -O 31 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 32 | #CFLAGS=-MMD -g -DDEBUG 33 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 34 | -Wstrict-prototypes -Wmissing-prototypes 35 | 36 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . 37 | CP=copy /Y 38 | # If gnu install.exe is available, replace $(CP) with ginstall. 39 | INSTALL=$(CP) 40 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: 41 | RM=del 42 | LDLIBS=-L. -lz 43 | LD=$(CC) -s -o 44 | LDSHARED=$(CC) 45 | 46 | INCL=zlib.h zconf.h 47 | LIBS=libz.a 48 | 49 | AR=ar rcs 50 | 51 | prefix=/usr/local 52 | exec_prefix = $(prefix) 53 | 54 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ 55 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o 56 | 57 | OBJA = 58 | # to use the asm code: make OBJA=match.o 59 | 60 | TEST_OBJS = example.o minigzip.o 61 | 62 | all: example.exe minigzip.exe 63 | 64 | check: test 65 | test: all 66 | ./example 67 | echo hello world | .\minigzip | .\minigzip -d 68 | 69 | %.o : %.c 70 | $(CC) $(CFLAGS) -c $< -o $@ 71 | 72 | libz.a: $(OBJS) $(OBJA) 73 | $(AR) $@ $(OBJS) $(OBJA) 74 | 75 | %.exe : %.o $(LIBS) 76 | $(LD) $@ $< $(LDLIBS) 77 | 78 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . 79 | 80 | .PHONY : uninstall clean 81 | 82 | install: $(INCL) $(LIBS) 83 | -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) 84 | -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) 85 | $(INSTALL) zlib.h $(INCLUDE_PATH) 86 | $(INSTALL) zconf.h $(INCLUDE_PATH) 87 | $(INSTALL) libz.a $(LIBRARY_PATH) 88 | 89 | uninstall: 90 | $(RM) $(INCLUDE_PATH)\zlib.h 91 | $(RM) $(INCLUDE_PATH)\zconf.h 92 | $(RM) $(LIBRARY_PATH)\libz.a 93 | 94 | clean: 95 | $(RM) *.d 96 | $(RM) *.o 97 | $(RM) *.exe 98 | $(RM) libz.a 99 | $(RM) foo.gz 100 | 101 | DEPS := $(wildcard *.d) 102 | ifneq ($(DEPS),) 103 | include $(DEPS) 104 | endif 105 | -------------------------------------------------------------------------------- /src/msdos/Makefile.emx: -------------------------------------------------------------------------------- 1 | # Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98. 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | # To compile, or to compile and test, type: 6 | # 7 | # make -fmakefile.emx; make test -fmakefile.emx 8 | # 9 | 10 | CC=gcc 11 | 12 | #CFLAGS=-MMD -O 13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 14 | #CFLAGS=-MMD -g -DDEBUG 15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 16 | -Wstrict-prototypes -Wmissing-prototypes 17 | 18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . 19 | CP=copy /Y 20 | # If gnu install.exe is available, replace $(CP) with ginstall. 21 | INSTALL=$(CP) 22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: 23 | RM=del 24 | LDLIBS=-L. -lzlib 25 | LD=$(CC) -s -o 26 | LDSHARED=$(CC) 27 | 28 | INCL=zlib.h zconf.h 29 | LIBS=zlib.a 30 | 31 | AR=ar rcs 32 | 33 | prefix=/usr/local 34 | exec_prefix = $(prefix) 35 | 36 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ 37 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o 38 | 39 | TEST_OBJS = example.o minigzip.o 40 | 41 | all: example.exe minigzip.exe 42 | 43 | test: all 44 | ./example 45 | echo hello world | .\minigzip | .\minigzip -d 46 | 47 | %.o : %.c 48 | $(CC) $(CFLAGS) -c $< -o $@ 49 | 50 | zlib.a: $(OBJS) 51 | $(AR) $@ $(OBJS) 52 | 53 | %.exe : %.o $(LIBS) 54 | $(LD) $@ $< $(LDLIBS) 55 | 56 | 57 | .PHONY : clean 58 | 59 | clean: 60 | $(RM) *.d 61 | $(RM) *.o 62 | $(RM) *.exe 63 | $(RM) zlib.a 64 | $(RM) foo.gz 65 | 66 | DEPS := $(wildcard *.d) 67 | ifneq ($(DEPS),) 68 | include $(DEPS) 69 | endif 70 | -------------------------------------------------------------------------------- /src/msdos/Makefile.msc: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # Microsoft C 5.1 or later 3 | # Last updated: 19-Mar-2003 4 | 5 | # To use, do "make makefile.msc" 6 | # To compile in small model, set below: MODEL=S 7 | 8 | # If you wish to reduce the memory requirements (default 256K for big 9 | # objects plus a few K), you can add to the LOC macro below: 10 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 11 | # See zconf.h for details about the memory requirements. 12 | 13 | # ------------- Microsoft C 5.1 and later ------------- 14 | 15 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) 16 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added 17 | # to the declaration of LOC here: 18 | LOC = $(LOCAL_ZLIB) 19 | 20 | # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. 21 | CPU_TYP = 0 22 | 23 | # Memory model: one of S, M, C, L (small, medium, compact, large) 24 | MODEL=L 25 | 26 | CC=cl 27 | CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) 28 | #-Ox generates bad code with MSC 5.1 29 | LIB_CFLAGS=-Zl $(CFLAGS) 30 | 31 | LD=link 32 | LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode 33 | # "/farcall/packcode" are only useful for `large code' memory models 34 | # but should be a "no-op" for small code models. 35 | 36 | 37 | # variables 38 | ZLIB_LIB = zlib_$(MODEL).lib 39 | 40 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 41 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 42 | 43 | 44 | # targets 45 | all: $(ZLIB_LIB) example.exe minigzip.exe 46 | 47 | .c.obj: 48 | $(CC) -c $(LIB_CFLAGS) $*.c 49 | 50 | adler32.obj: adler32.c zlib.h zconf.h 51 | 52 | compress.obj: compress.c zlib.h zconf.h 53 | 54 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 55 | 56 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 57 | 58 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 59 | 60 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 61 | 62 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 63 | 64 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 65 | 66 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 67 | inffast.h inffixed.h 68 | 69 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 70 | inffast.h 71 | 72 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 73 | inffast.h inffixed.h 74 | 75 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 76 | 77 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 78 | 79 | uncompr.obj: uncompr.c zlib.h zconf.h 80 | 81 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 82 | 83 | example.obj: test/example.c zlib.h zconf.h 84 | $(CC) -c $(CFLAGS) $*.c 85 | 86 | minigzip.obj: test/minigzip.c zlib.h zconf.h 87 | $(CC) -c $(CFLAGS) $*.c 88 | 89 | 90 | # the command line is cut to fit in the MS-DOS 128 byte limit: 91 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) 92 | if exist $(ZLIB_LIB) del $(ZLIB_LIB) 93 | lib $(ZLIB_LIB) $(OBJ1); 94 | lib $(ZLIB_LIB) $(OBJ2); 95 | 96 | example.exe: example.obj $(ZLIB_LIB) 97 | $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); 98 | 99 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 100 | $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); 101 | 102 | test: example.exe minigzip.exe 103 | example 104 | echo hello world | minigzip | minigzip -d 105 | 106 | clean: 107 | -del *.obj 108 | -del *.lib 109 | -del *.exe 110 | -del *.map 111 | -del zlib_*.bak 112 | -del foo.gz 113 | -------------------------------------------------------------------------------- /src/msdos/Makefile.tc: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # Turbo C 2.01, Turbo C++ 1.01 3 | # Last updated: 15-Mar-2003 4 | 5 | # To use, do "make -fmakefile.tc" 6 | # To compile in small model, set below: MODEL=s 7 | 8 | # WARNING: the small model is supported but only for small values of 9 | # MAX_WBITS and MAX_MEM_LEVEL. For example: 10 | # -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 11 | # If you wish to reduce the memory requirements (default 256K for big 12 | # objects plus a few K), you can add to CFLAGS below: 13 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 14 | # See zconf.h for details about the memory requirements. 15 | 16 | # ------------ Turbo C 2.01, Turbo C++ 1.01 ------------ 17 | MODEL=l 18 | CC=tcc 19 | LD=tcc 20 | AR=tlib 21 | # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 22 | CFLAGS=-O2 -G -Z -m$(MODEL) 23 | LDFLAGS=-m$(MODEL) -f- 24 | 25 | 26 | # variables 27 | ZLIB_LIB = zlib_$(MODEL).lib 28 | 29 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 30 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 31 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj 32 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 33 | 34 | 35 | # targets 36 | all: $(ZLIB_LIB) example.exe minigzip.exe 37 | 38 | .c.obj: 39 | $(CC) -c $(CFLAGS) $*.c 40 | 41 | adler32.obj: adler32.c zlib.h zconf.h 42 | 43 | compress.obj: compress.c zlib.h zconf.h 44 | 45 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 46 | 47 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 48 | 49 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 50 | 51 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 52 | 53 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 54 | 55 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 56 | 57 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 58 | inffast.h inffixed.h 59 | 60 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 61 | inffast.h 62 | 63 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 64 | inffast.h inffixed.h 65 | 66 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 67 | 68 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 69 | 70 | uncompr.obj: uncompr.c zlib.h zconf.h 71 | 72 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 73 | 74 | example.obj: test/example.c zlib.h zconf.h 75 | 76 | minigzip.obj: test/minigzip.c zlib.h zconf.h 77 | 78 | 79 | # the command line is cut to fit in the MS-DOS 128 byte limit: 80 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) 81 | -del $(ZLIB_LIB) 82 | $(AR) $(ZLIB_LIB) $(OBJP1) 83 | $(AR) $(ZLIB_LIB) $(OBJP2) 84 | 85 | example.exe: example.obj $(ZLIB_LIB) 86 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) 87 | 88 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 89 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) 90 | 91 | test: example.exe minigzip.exe 92 | example 93 | echo hello world | minigzip | minigzip -d 94 | 95 | clean: 96 | -del *.obj 97 | -del *.lib 98 | -del *.exe 99 | -del zlib_*.bak 100 | -del foo.gz 101 | -------------------------------------------------------------------------------- /src/nintendods/Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITARM)),) 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 7 | endif 8 | 9 | include $(DEVKITARM)/ds_rules 10 | 11 | #--------------------------------------------------------------------------------- 12 | # TARGET is the name of the output 13 | # BUILD is the directory where object files & intermediate files will be placed 14 | # SOURCES is a list of directories containing source code 15 | # DATA is a list of directories containing data files 16 | # INCLUDES is a list of directories containing header files 17 | #--------------------------------------------------------------------------------- 18 | TARGET := $(shell basename $(CURDIR)) 19 | BUILD := build 20 | SOURCES := ../../ 21 | DATA := data 22 | INCLUDES := include 23 | 24 | #--------------------------------------------------------------------------------- 25 | # options for code generation 26 | #--------------------------------------------------------------------------------- 27 | ARCH := -mthumb -mthumb-interwork 28 | 29 | CFLAGS := -Wall -O2\ 30 | -march=armv5te -mtune=arm946e-s \ 31 | -fomit-frame-pointer -ffast-math \ 32 | $(ARCH) 33 | 34 | CFLAGS += $(INCLUDE) -DARM9 35 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions 36 | 37 | ASFLAGS := $(ARCH) -march=armv5te -mtune=arm946e-s 38 | LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 39 | 40 | #--------------------------------------------------------------------------------- 41 | # list of directories containing libraries, this must be the top level containing 42 | # include and lib 43 | #--------------------------------------------------------------------------------- 44 | LIBDIRS := $(LIBNDS) 45 | 46 | #--------------------------------------------------------------------------------- 47 | # no real need to edit anything past this point unless you need to add additional 48 | # rules for different file extensions 49 | #--------------------------------------------------------------------------------- 50 | ifneq ($(BUILD),$(notdir $(CURDIR))) 51 | #--------------------------------------------------------------------------------- 52 | 53 | export OUTPUT := $(CURDIR)/lib/libz.a 54 | 55 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 56 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 57 | 58 | export DEPSDIR := $(CURDIR)/$(BUILD) 59 | 60 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 61 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 62 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 63 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 64 | 65 | #--------------------------------------------------------------------------------- 66 | # use CXX for linking C++ projects, CC for standard C 67 | #--------------------------------------------------------------------------------- 68 | ifeq ($(strip $(CPPFILES)),) 69 | #--------------------------------------------------------------------------------- 70 | export LD := $(CC) 71 | #--------------------------------------------------------------------------------- 72 | else 73 | #--------------------------------------------------------------------------------- 74 | export LD := $(CXX) 75 | #--------------------------------------------------------------------------------- 76 | endif 77 | #--------------------------------------------------------------------------------- 78 | 79 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 80 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 81 | 82 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 83 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 84 | -I$(CURDIR)/$(BUILD) 85 | 86 | .PHONY: $(BUILD) clean all 87 | 88 | #--------------------------------------------------------------------------------- 89 | all: $(BUILD) 90 | @[ -d $@ ] || mkdir -p include 91 | @cp ../../*.h include 92 | 93 | lib: 94 | @[ -d $@ ] || mkdir -p $@ 95 | 96 | $(BUILD): lib 97 | @[ -d $@ ] || mkdir -p $@ 98 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 99 | 100 | #--------------------------------------------------------------------------------- 101 | clean: 102 | @echo clean ... 103 | @rm -fr $(BUILD) lib 104 | 105 | #--------------------------------------------------------------------------------- 106 | else 107 | 108 | DEPENDS := $(OFILES:.o=.d) 109 | 110 | #--------------------------------------------------------------------------------- 111 | # main targets 112 | #--------------------------------------------------------------------------------- 113 | $(OUTPUT) : $(OFILES) 114 | 115 | #--------------------------------------------------------------------------------- 116 | %.bin.o : %.bin 117 | #--------------------------------------------------------------------------------- 118 | @echo $(notdir $<) 119 | @$(bin2o) 120 | 121 | 122 | -include $(DEPENDS) 123 | 124 | #--------------------------------------------------------------------------------------- 125 | endif 126 | #--------------------------------------------------------------------------------------- 127 | -------------------------------------------------------------------------------- /src/nintendods/README: -------------------------------------------------------------------------------- 1 | This Makefile requires devkitARM (http://www.devkitpro.org/category/devkitarm/) and works inside "contrib/nds". It is based on a devkitARM template. 2 | 3 | Eduardo Costa 4 | January 3, 2009 5 | 6 | -------------------------------------------------------------------------------- /src/old/Makefile.emx: -------------------------------------------------------------------------------- 1 | # Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98. 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. 3 | # For conditions of distribution and use, see copyright notice in zlib.h 4 | 5 | # To compile, or to compile and test, type: 6 | # 7 | # make -fmakefile.emx; make test -fmakefile.emx 8 | # 9 | 10 | CC=gcc -Zwin32 11 | 12 | #CFLAGS=-MMD -O 13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 14 | #CFLAGS=-MMD -g -DDEBUG 15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 16 | -Wstrict-prototypes -Wmissing-prototypes 17 | 18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . 19 | CP=copy /Y 20 | # If gnu install.exe is available, replace $(CP) with ginstall. 21 | INSTALL=$(CP) 22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: 23 | RM=del 24 | LDLIBS=-L. -lzlib 25 | LD=$(CC) -s -o 26 | LDSHARED=$(CC) 27 | 28 | INCL=zlib.h zconf.h 29 | LIBS=zlib.a 30 | 31 | AR=ar rcs 32 | 33 | prefix=/usr/local 34 | exec_prefix = $(prefix) 35 | 36 | OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ 37 | gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o 38 | 39 | TEST_OBJS = example.o minigzip.o 40 | 41 | all: example.exe minigzip.exe 42 | 43 | test: all 44 | ./example 45 | echo hello world | .\minigzip | .\minigzip -d 46 | 47 | %.o : %.c 48 | $(CC) $(CFLAGS) -c $< -o $@ 49 | 50 | zlib.a: $(OBJS) 51 | $(AR) $@ $(OBJS) 52 | 53 | %.exe : %.o $(LIBS) 54 | $(LD) $@ $< $(LDLIBS) 55 | 56 | 57 | .PHONY : clean 58 | 59 | clean: 60 | $(RM) *.d 61 | $(RM) *.o 62 | $(RM) *.exe 63 | $(RM) zlib.a 64 | $(RM) foo.gz 65 | 66 | DEPS := $(wildcard *.d) 67 | ifneq ($(DEPS),) 68 | include $(DEPS) 69 | endif 70 | -------------------------------------------------------------------------------- /src/old/Makefile.riscos: -------------------------------------------------------------------------------- 1 | # Project: zlib_1_03 2 | # Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 3 | # test works out-of-the-box, installs `somewhere' on demand 4 | 5 | # Toolflags: 6 | CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah 7 | C++flags = -c -depend !Depend -IC: -throwback 8 | Linkflags = -aif -c++ -o $@ 9 | ObjAsmflags = -throwback -NoCache -depend !Depend 10 | CMHGflags = 11 | LibFileflags = -c -l -o $@ 12 | Squeezeflags = -o $@ 13 | 14 | # change the line below to where _you_ want the library installed. 15 | libdest = lib:zlib 16 | 17 | # Final targets: 18 | @.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ 19 | @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ 20 | @.o.uncompr @.o.zutil 21 | LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ 22 | @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ 23 | @.o.trees @.o.uncompr @.o.zutil 24 | test: @.minigzip @.example @.lib 25 | @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV 26 | @echo running tests: hang on. 27 | @/@.minigzip -f -9 libc 28 | @/@.minigzip -d libc-gz 29 | @/@.minigzip -f -1 libc 30 | @/@.minigzip -d libc-gz 31 | @/@.minigzip -h -9 libc 32 | @/@.minigzip -d libc-gz 33 | @/@.minigzip -h -1 libc 34 | @/@.minigzip -d libc-gz 35 | @/@.minigzip -9 libc 36 | @/@.minigzip -d libc-gz 37 | @/@.minigzip -1 libc 38 | @/@.minigzip -d libc-gz 39 | @diff @.lib @.libc 40 | @echo that should have reported '@.lib and @.libc identical' if you have diff. 41 | @/@.example @.fred @.fred 42 | @echo that will have given lots of hello!'s. 43 | 44 | @.minigzip: @.o.minigzip @.lib C:o.Stubs 45 | Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs 46 | @.example: @.o.example @.lib C:o.Stubs 47 | Link $(Linkflags) @.o.example @.lib C:o.Stubs 48 | 49 | install: @.lib 50 | cdir $(libdest) 51 | cdir $(libdest).h 52 | @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV 53 | @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV 54 | @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV 55 | @echo okay, installed zlib in $(libdest) 56 | 57 | clean:; remove @.minigzip 58 | remove @.example 59 | remove @.libc 60 | -wipe @.o.* F~r~cV 61 | remove @.fred 62 | 63 | # User-editable dependencies: 64 | .c.o: 65 | cc $(ccflags) -o $@ $< 66 | 67 | # Static dependencies: 68 | 69 | # Dynamic dependencies: 70 | o.example: c.example 71 | o.example: h.zlib 72 | o.example: h.zconf 73 | o.minigzip: c.minigzip 74 | o.minigzip: h.zlib 75 | o.minigzip: h.zconf 76 | o.adler32: c.adler32 77 | o.adler32: h.zlib 78 | o.adler32: h.zconf 79 | o.compress: c.compress 80 | o.compress: h.zlib 81 | o.compress: h.zconf 82 | o.crc32: c.crc32 83 | o.crc32: h.zlib 84 | o.crc32: h.zconf 85 | o.deflate: c.deflate 86 | o.deflate: h.deflate 87 | o.deflate: h.zutil 88 | o.deflate: h.zlib 89 | o.deflate: h.zconf 90 | o.gzio: c.gzio 91 | o.gzio: h.zutil 92 | o.gzio: h.zlib 93 | o.gzio: h.zconf 94 | o.infblock: c.infblock 95 | o.infblock: h.zutil 96 | o.infblock: h.zlib 97 | o.infblock: h.zconf 98 | o.infblock: h.infblock 99 | o.infblock: h.inftrees 100 | o.infblock: h.infcodes 101 | o.infblock: h.infutil 102 | o.infcodes: c.infcodes 103 | o.infcodes: h.zutil 104 | o.infcodes: h.zlib 105 | o.infcodes: h.zconf 106 | o.infcodes: h.inftrees 107 | o.infcodes: h.infblock 108 | o.infcodes: h.infcodes 109 | o.infcodes: h.infutil 110 | o.infcodes: h.inffast 111 | o.inffast: c.inffast 112 | o.inffast: h.zutil 113 | o.inffast: h.zlib 114 | o.inffast: h.zconf 115 | o.inffast: h.inftrees 116 | o.inffast: h.infblock 117 | o.inffast: h.infcodes 118 | o.inffast: h.infutil 119 | o.inffast: h.inffast 120 | o.inflate: c.inflate 121 | o.inflate: h.zutil 122 | o.inflate: h.zlib 123 | o.inflate: h.zconf 124 | o.inflate: h.infblock 125 | o.inftrees: c.inftrees 126 | o.inftrees: h.zutil 127 | o.inftrees: h.zlib 128 | o.inftrees: h.zconf 129 | o.inftrees: h.inftrees 130 | o.inftrees: h.inffixed 131 | o.infutil: c.infutil 132 | o.infutil: h.zutil 133 | o.infutil: h.zlib 134 | o.infutil: h.zconf 135 | o.infutil: h.infblock 136 | o.infutil: h.inftrees 137 | o.infutil: h.infcodes 138 | o.infutil: h.infutil 139 | o.trees: c.trees 140 | o.trees: h.deflate 141 | o.trees: h.zutil 142 | o.trees: h.zlib 143 | o.trees: h.zconf 144 | o.trees: h.trees 145 | o.uncompr: c.uncompr 146 | o.uncompr: h.zlib 147 | o.uncompr: h.zconf 148 | o.zutil: c.zutil 149 | o.zutil: h.zutil 150 | o.zutil: h.zlib 151 | o.zutil: h.zconf 152 | -------------------------------------------------------------------------------- /src/old/README: -------------------------------------------------------------------------------- 1 | This directory contains files that have not been updated for zlib 1.2.x 2 | 3 | (Volunteers are encouraged to help clean this up. Thanks.) 4 | -------------------------------------------------------------------------------- /src/old/descrip.mms: -------------------------------------------------------------------------------- 1 | # descrip.mms: MMS description file for building zlib on VMS 2 | # written by Martin P.J. Zinser 3 | 4 | cc_defs = 5 | c_deb = 6 | 7 | .ifdef __DECC__ 8 | pref = /prefix=all 9 | .endif 10 | 11 | OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\ 12 | deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\ 13 | inftrees.obj, infcodes.obj, infutil.obj, inffast.obj 14 | 15 | CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF) 16 | 17 | all : example.exe minigzip.exe 18 | @ write sys$output " Example applications available" 19 | libz.olb : libz.olb($(OBJS)) 20 | @ write sys$output " libz available" 21 | 22 | example.exe : example.obj libz.olb 23 | link example,libz.olb/lib 24 | 25 | minigzip.exe : minigzip.obj libz.olb 26 | link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib 27 | 28 | clean : 29 | delete *.obj;*,libz.olb;* 30 | 31 | 32 | # Other dependencies. 33 | adler32.obj : zutil.h zlib.h zconf.h 34 | compress.obj : zlib.h zconf.h 35 | crc32.obj : zutil.h zlib.h zconf.h 36 | deflate.obj : deflate.h zutil.h zlib.h zconf.h 37 | example.obj : zlib.h zconf.h 38 | gzio.obj : zutil.h zlib.h zconf.h 39 | infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h 40 | infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h 41 | inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h 42 | inflate.obj : zutil.h zlib.h zconf.h infblock.h 43 | inftrees.obj : zutil.h zlib.h zconf.h inftrees.h 44 | infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h 45 | minigzip.obj : zlib.h zconf.h 46 | trees.obj : deflate.h zutil.h zlib.h zconf.h 47 | uncompr.obj : zlib.h zconf.h 48 | zutil.obj : zutil.h zlib.h zconf.h 49 | -------------------------------------------------------------------------------- /src/old/os2/Makefile.os2: -------------------------------------------------------------------------------- 1 | # Makefile for zlib under OS/2 using GCC (PGCC) 2 | # For conditions of distribution and use, see copyright notice in zlib.h 3 | 4 | # To compile and test, type: 5 | # cp Makefile.os2 .. 6 | # cd .. 7 | # make -f Makefile.os2 test 8 | 9 | # This makefile will build a static library z.lib, a shared library 10 | # z.dll and a import library zdll.lib. You can use either z.lib or 11 | # zdll.lib by specifying either -lz or -lzdll on gcc's command line 12 | 13 | CC=gcc -Zomf -s 14 | 15 | CFLAGS=-O6 -Wall 16 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 17 | #CFLAGS=-g -DDEBUG 18 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 19 | # -Wstrict-prototypes -Wmissing-prototypes 20 | 21 | #################### BUG WARNING: ##################### 22 | ## infcodes.c hits a bug in pgcc-1.0, so you have to use either 23 | ## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem) 24 | ## This bug is reportedly fixed in pgcc >1.0, but this was not tested 25 | CFLAGS+=-fno-force-mem 26 | 27 | LDFLAGS=-s -L. -lzdll -Zcrtdll 28 | LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll 29 | 30 | VER=1.1.0 31 | ZLIB=z.lib 32 | SHAREDLIB=z.dll 33 | SHAREDLIBIMP=zdll.lib 34 | LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP) 35 | 36 | AR=emxomfar cr 37 | IMPLIB=emximp 38 | RANLIB=echo 39 | TAR=tar 40 | SHELL=bash 41 | 42 | prefix=/usr/local 43 | exec_prefix = $(prefix) 44 | 45 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 46 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o 47 | 48 | TEST_OBJS = example.o minigzip.o 49 | 50 | DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ 51 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ 52 | nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ 53 | contrib/asm386/*.asm contrib/asm386/*.c \ 54 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ 55 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ 56 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 57 | 58 | all: example.exe minigzip.exe 59 | 60 | test: all 61 | @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ 62 | echo hello world | ./minigzip | ./minigzip -d || \ 63 | echo ' *** minigzip test FAILED ***' ; \ 64 | if ./example; then \ 65 | echo ' *** zlib test OK ***'; \ 66 | else \ 67 | echo ' *** zlib test FAILED ***'; \ 68 | fi 69 | 70 | $(ZLIB): $(OBJS) 71 | $(AR) $@ $(OBJS) 72 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 73 | 74 | $(SHAREDLIB): $(OBJS) os2/z.def 75 | $(LDSHARED) -o $@ $^ 76 | 77 | $(SHAREDLIBIMP): os2/z.def 78 | $(IMPLIB) -o $@ $^ 79 | 80 | example.exe: example.o $(LIBS) 81 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) 82 | 83 | minigzip.exe: minigzip.o $(LIBS) 84 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 85 | 86 | clean: 87 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz 88 | 89 | distclean: clean 90 | 91 | zip: 92 | mv Makefile Makefile~; cp -p Makefile.in Makefile 93 | rm -f test.c ztest*.c 94 | v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 95 | zip -ul9 zlib$$v $(DISTFILES) 96 | mv Makefile~ Makefile 97 | 98 | dist: 99 | mv Makefile Makefile~; cp -p Makefile.in Makefile 100 | rm -f test.c ztest*.c 101 | d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 102 | rm -f $$d.tar.gz; \ 103 | if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ 104 | files=""; \ 105 | for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ 106 | cd ..; \ 107 | GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ 108 | if test ! -d $$d; then rm -f $$d; fi 109 | mv Makefile~ Makefile 110 | 111 | tags: 112 | etags *.[ch] 113 | 114 | depend: 115 | makedepend -- $(CFLAGS) -- *.[ch] 116 | 117 | # DO NOT DELETE THIS LINE -- make depend depends on it. 118 | 119 | adler32.o: zlib.h zconf.h 120 | compress.o: zlib.h zconf.h 121 | crc32.o: zlib.h zconf.h 122 | deflate.o: deflate.h zutil.h zlib.h zconf.h 123 | example.o: zlib.h zconf.h 124 | gzio.o: zutil.h zlib.h zconf.h 125 | infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h 126 | infcodes.o: zutil.h zlib.h zconf.h 127 | infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h 128 | inffast.o: zutil.h zlib.h zconf.h inftrees.h 129 | inffast.o: infblock.h infcodes.h infutil.h inffast.h 130 | inflate.o: zutil.h zlib.h zconf.h infblock.h 131 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h 132 | infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h 133 | minigzip.o: zlib.h zconf.h 134 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h 135 | uncompr.o: zlib.h zconf.h 136 | zutil.o: zutil.h zlib.h zconf.h 137 | -------------------------------------------------------------------------------- /src/old/os2/zlib.def: -------------------------------------------------------------------------------- 1 | ; 2 | ; Slightly modified version of ../nt/zlib.dnt :-) 3 | ; 4 | 5 | LIBRARY Z 6 | DESCRIPTION "Zlib compression library for OS/2" 7 | CODE PRELOAD MOVEABLE DISCARDABLE 8 | DATA PRELOAD MOVEABLE MULTIPLE 9 | 10 | EXPORTS 11 | adler32 12 | compress 13 | crc32 14 | deflate 15 | deflateCopy 16 | deflateEnd 17 | deflateInit2_ 18 | deflateInit_ 19 | deflateParams 20 | deflateReset 21 | deflateSetDictionary 22 | gzclose 23 | gzdopen 24 | gzerror 25 | gzflush 26 | gzopen 27 | gzread 28 | gzwrite 29 | inflate 30 | inflateEnd 31 | inflateInit2_ 32 | inflateInit_ 33 | inflateReset 34 | inflateSetDictionary 35 | inflateSync 36 | uncompress 37 | zlibVersion 38 | gzprintf 39 | gzputc 40 | gzgetc 41 | gzseek 42 | gzrewind 43 | gztell 44 | gzeof 45 | gzsetparams 46 | zError 47 | inflateSyncPoint 48 | get_crc_table 49 | compress2 50 | gzputs 51 | gzgets 52 | -------------------------------------------------------------------------------- /src/treebuild.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zip compression library 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 117 | -------------------------------------------------------------------------------- /src/uncompr.c: -------------------------------------------------------------------------------- 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 = (z_const 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 | } 60 | -------------------------------------------------------------------------------- /src/watcom/watcom_f.mak: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # OpenWatcom flat model 3 | # Last updated: 28-Dec-2005 4 | 5 | # To use, do "wmake -f watcom_f.mak" 6 | 7 | C_SOURCE = adler32.c compress.c crc32.c deflate.c & 8 | gzclose.c gzlib.c gzread.c gzwrite.c & 9 | infback.c inffast.c inflate.c inftrees.c & 10 | trees.c uncompr.c zutil.c 11 | 12 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj & 13 | gzclose.obj gzlib.obj gzread.obj gzwrite.obj & 14 | infback.obj inffast.obj inflate.obj inftrees.obj & 15 | trees.obj uncompr.obj zutil.obj 16 | 17 | CC = wcc386 18 | LINKER = wcl386 19 | CFLAGS = -zq -mf -3r -fp3 -s -bt=dos -oilrtfm -fr=nul -wx 20 | ZLIB_LIB = zlib_f.lib 21 | 22 | .C.OBJ: 23 | $(CC) $(CFLAGS) $[@ 24 | 25 | all: $(ZLIB_LIB) example.exe minigzip.exe 26 | 27 | $(ZLIB_LIB): $(OBJS) 28 | wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj 29 | wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj 30 | wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj 31 | wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj 32 | wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj 33 | 34 | example.exe: $(ZLIB_LIB) example.obj 35 | $(LINKER) -ldos32a -fe=example.exe example.obj $(ZLIB_LIB) 36 | 37 | minigzip.exe: $(ZLIB_LIB) minigzip.obj 38 | $(LINKER) -ldos32a -fe=minigzip.exe minigzip.obj $(ZLIB_LIB) 39 | 40 | clean: .SYMBOLIC 41 | del *.obj 42 | del $(ZLIB_LIB) 43 | @echo Cleaning done 44 | -------------------------------------------------------------------------------- /src/watcom/watcom_l.mak: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # OpenWatcom large model 3 | # Last updated: 28-Dec-2005 4 | 5 | # To use, do "wmake -f watcom_l.mak" 6 | 7 | C_SOURCE = adler32.c compress.c crc32.c deflate.c & 8 | gzclose.c gzlib.c gzread.c gzwrite.c & 9 | infback.c inffast.c inflate.c inftrees.c & 10 | trees.c uncompr.c zutil.c 11 | 12 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj & 13 | gzclose.obj gzlib.obj gzread.obj gzwrite.obj & 14 | infback.obj inffast.obj inflate.obj inftrees.obj & 15 | trees.obj uncompr.obj zutil.obj 16 | 17 | CC = wcc 18 | LINKER = wcl 19 | CFLAGS = -zq -ml -s -bt=dos -oilrtfm -fr=nul -wx 20 | ZLIB_LIB = zlib_l.lib 21 | 22 | .C.OBJ: 23 | $(CC) $(CFLAGS) $[@ 24 | 25 | all: $(ZLIB_LIB) example.exe minigzip.exe 26 | 27 | $(ZLIB_LIB): $(OBJS) 28 | wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj 29 | wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj 30 | wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj 31 | wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj 32 | wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj 33 | 34 | example.exe: $(ZLIB_LIB) example.obj 35 | $(LINKER) -fe=example.exe example.obj $(ZLIB_LIB) 36 | 37 | minigzip.exe: $(ZLIB_LIB) minigzip.obj 38 | $(LINKER) -fe=minigzip.exe minigzip.obj $(ZLIB_LIB) 39 | 40 | clean: .SYMBOLIC 41 | del *.obj 42 | del $(ZLIB_LIB) 43 | @echo Cleaning done 44 | -------------------------------------------------------------------------------- /src/win32/Makefile.bor: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # Borland C++ for Win32 3 | # 4 | # Usage: 5 | # make -f win32/Makefile.bor 6 | # make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj 7 | 8 | # ------------ Borland C++ ------------ 9 | 10 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) 11 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or 12 | # added to the declaration of LOC here: 13 | LOC = $(LOCAL_ZLIB) 14 | 15 | CC = bcc32 16 | AS = bcc32 17 | LD = bcc32 18 | AR = tlib 19 | CFLAGS = -a -d -k- -O2 $(LOC) 20 | ASFLAGS = $(LOC) 21 | LDFLAGS = $(LOC) 22 | 23 | 24 | # variables 25 | ZLIB_LIB = zlib.lib 26 | 27 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj 28 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 29 | #OBJA = 30 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj 31 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj 32 | #OBJPA= 33 | 34 | 35 | # targets 36 | all: $(ZLIB_LIB) example.exe minigzip.exe 37 | 38 | .c.obj: 39 | $(CC) -c $(CFLAGS) $< 40 | 41 | .asm.obj: 42 | $(AS) -c $(ASFLAGS) $< 43 | 44 | adler32.obj: adler32.c zlib.h zconf.h 45 | 46 | compress.obj: compress.c zlib.h zconf.h 47 | 48 | crc32.obj: crc32.c zlib.h zconf.h crc32.h 49 | 50 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 51 | 52 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h 53 | 54 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h 55 | 56 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h 57 | 58 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h 59 | 60 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 61 | inffast.h inffixed.h 62 | 63 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 64 | inffast.h 65 | 66 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 67 | inffast.h inffixed.h 68 | 69 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 70 | 71 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 72 | 73 | uncompr.obj: uncompr.c zlib.h zconf.h 74 | 75 | zutil.obj: zutil.c zutil.h zlib.h zconf.h 76 | 77 | example.obj: test/example.c zlib.h zconf.h 78 | 79 | minigzip.obj: test/minigzip.c zlib.h zconf.h 80 | 81 | 82 | # For the sake of the old Borland make, 83 | # the command line is cut to fit in the MS-DOS 128 byte limit: 84 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA) 85 | -del $(ZLIB_LIB) 86 | $(AR) $(ZLIB_LIB) $(OBJP1) 87 | $(AR) $(ZLIB_LIB) $(OBJP2) 88 | $(AR) $(ZLIB_LIB) $(OBJPA) 89 | 90 | 91 | # testing 92 | test: example.exe minigzip.exe 93 | example 94 | echo hello world | minigzip | minigzip -d 95 | 96 | example.exe: example.obj $(ZLIB_LIB) 97 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) 98 | 99 | minigzip.exe: minigzip.obj $(ZLIB_LIB) 100 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) 101 | 102 | 103 | # cleanup 104 | clean: 105 | -del $(ZLIB_LIB) 106 | -del *.obj 107 | -del *.exe 108 | -del *.tds 109 | -del zlib.bak 110 | -del foo.gz 111 | -------------------------------------------------------------------------------- /src/win32/README-WIN32.txt: -------------------------------------------------------------------------------- 1 | ZLIB DATA COMPRESSION LIBRARY 2 | 3 | zlib 1.2.8 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://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 7 | and rfc1952.txt (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). Two compiled 11 | examples are distributed in this package, example and minigzip. The example_d 12 | and minigzip_d flavors validate that the zlib1.dll file is working correctly. 13 | 14 | Questions about zlib should be sent to . The zlib home page 15 | is http://zlib.net/ . Before reporting a problem, please check this site to 16 | verify that you have the latest version of zlib; otherwise get the latest 17 | version and check whether the problem still exists or not. 18 | 19 | PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html 20 | before asking for help. 21 | 22 | 23 | Manifest: 24 | 25 | The package zlib-1.2.8-win32-x86.zip will contain the following files: 26 | 27 | README-WIN32.txt This document 28 | ChangeLog Changes since previous zlib packages 29 | DLL_FAQ.txt Frequently asked questions about zlib1.dll 30 | zlib.3.pdf Documentation of this library in Adobe Acrobat format 31 | 32 | example.exe A statically-bound example (using zlib.lib, not the dll) 33 | example.pdb Symbolic information for debugging example.exe 34 | 35 | example_d.exe A zlib1.dll bound example (using zdll.lib) 36 | example_d.pdb Symbolic information for debugging example_d.exe 37 | 38 | minigzip.exe A statically-bound test program (using zlib.lib, not the dll) 39 | minigzip.pdb Symbolic information for debugging minigzip.exe 40 | 41 | minigzip_d.exe A zlib1.dll bound test program (using zdll.lib) 42 | minigzip_d.pdb Symbolic information for debugging minigzip_d.exe 43 | 44 | zlib.h Install these files into the compilers' INCLUDE path to 45 | zconf.h compile programs which use zlib.lib or zdll.lib 46 | 47 | zdll.lib Install these files into the compilers' LIB path if linking 48 | zdll.exp a compiled program to the zlib1.dll binary 49 | 50 | zlib.lib Install these files into the compilers' LIB path to link zlib 51 | zlib.pdb into compiled programs, without zlib1.dll runtime dependency 52 | (zlib.pdb provides debugging info to the compile time linker) 53 | 54 | zlib1.dll Install this binary shared library into the system PATH, or 55 | the program's runtime directory (where the .exe resides) 56 | zlib1.pdb Install in the same directory as zlib1.dll, in order to debug 57 | an application crash using WinDbg or similar tools. 58 | 59 | All .pdb files above are entirely optional, but are very useful to a developer 60 | attempting to diagnose program misbehavior or a crash. Many additional 61 | important files for developers can be found in the zlib127.zip source package 62 | available from http://zlib.net/ - review that package's README file for details. 63 | 64 | 65 | Acknowledgments: 66 | 67 | The deflate format used by zlib was defined by Phil Katz. The deflate and 68 | zlib specifications were written by L. Peter Deutsch. Thanks to all the 69 | people who reported problems and suggested various improvements in zlib; they 70 | are too numerous to cite here. 71 | 72 | 73 | Copyright notice: 74 | 75 | (C) 1995-2012 Jean-loup Gailly and Mark Adler 76 | 77 | This software is provided 'as-is', without any express or implied 78 | warranty. In no event will the authors be held liable for any damages 79 | arising from the use of this software. 80 | 81 | Permission is granted to anyone to use this software for any purpose, 82 | including commercial applications, and to alter it and redistribute it 83 | freely, subject to the following restrictions: 84 | 85 | 1. The origin of this software must not be misrepresented; you must not 86 | claim that you wrote the original software. If you use this software 87 | in a product, an acknowledgment in the product documentation would be 88 | appreciated but is not required. 89 | 2. Altered source versions must be plainly marked as such, and must not be 90 | misrepresented as being the original software. 91 | 3. This notice may not be removed or altered from any source distribution. 92 | 93 | Jean-loup Gailly Mark Adler 94 | jloup@gzip.org madler@alumni.caltech.edu 95 | 96 | If you use the zlib library in a product, we would appreciate *not* receiving 97 | lengthy legal documents to sign. The sources are provided for free but without 98 | warranty of any kind. The library has been entirely written by Jean-loup 99 | Gailly and Mark Adler; it does not include third-party code. 100 | 101 | If you redistribute modified sources, we would appreciate that you include in 102 | the file ChangeLog history information documenting your changes. Please read 103 | the FAQ for more information on the distribution of modified source versions. 104 | -------------------------------------------------------------------------------- /src/win32/VisualC.txt: -------------------------------------------------------------------------------- 1 | 2 | To build zlib using the Microsoft Visual C++ environment, 3 | use the appropriate project from the projects/ directory. 4 | -------------------------------------------------------------------------------- /src/win32/zlib.def: -------------------------------------------------------------------------------- 1 | ; zlib data compression library 2 | EXPORTS 3 | ; basic functions 4 | zlibVersion 5 | deflate 6 | deflateEnd 7 | inflate 8 | inflateEnd 9 | ; advanced functions 10 | deflateSetDictionary 11 | deflateCopy 12 | deflateReset 13 | deflateParams 14 | deflateTune 15 | deflateBound 16 | deflatePending 17 | deflatePrime 18 | deflateSetHeader 19 | inflateSetDictionary 20 | inflateGetDictionary 21 | inflateSync 22 | inflateCopy 23 | inflateReset 24 | inflateReset2 25 | inflatePrime 26 | inflateMark 27 | inflateGetHeader 28 | inflateBack 29 | inflateBackEnd 30 | zlibCompileFlags 31 | ; utility functions 32 | compress 33 | compress2 34 | compressBound 35 | uncompress 36 | gzopen 37 | gzdopen 38 | gzbuffer 39 | gzsetparams 40 | gzread 41 | gzwrite 42 | gzprintf 43 | gzvprintf 44 | gzputs 45 | gzgets 46 | gzputc 47 | gzgetc 48 | gzungetc 49 | gzflush 50 | gzseek 51 | gzrewind 52 | gztell 53 | gzoffset 54 | gzeof 55 | gzdirect 56 | gzclose 57 | gzclose_r 58 | gzclose_w 59 | gzerror 60 | gzclearerr 61 | ; large file functions 62 | gzopen64 63 | gzseek64 64 | gztell64 65 | gzoffset64 66 | adler32_combine64 67 | crc32_combine64 68 | ; checksum functions 69 | adler32 70 | crc32 71 | adler32_combine 72 | crc32_combine 73 | ; various hacks, don't look :) 74 | deflateInit_ 75 | deflateInit2_ 76 | inflateInit_ 77 | inflateInit2_ 78 | inflateBackInit_ 79 | gzgetc_ 80 | zError 81 | inflateSyncPoint 82 | get_crc_table 83 | inflateUndermine 84 | inflateResetKeep 85 | deflateResetKeep 86 | gzopen_w 87 | -------------------------------------------------------------------------------- /src/win32/zlib1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../zlib.h" 3 | 4 | #ifdef GCC_WINDRES 5 | VS_VERSION_INFO VERSIONINFO 6 | #else 7 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 8 | #endif 9 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 10 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 11 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 12 | #ifdef _DEBUG 13 | FILEFLAGS 1 14 | #else 15 | FILEFLAGS 0 16 | #endif 17 | FILEOS VOS__WINDOWS32 18 | FILETYPE VFT_DLL 19 | FILESUBTYPE 0 // not used 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904E4" 24 | //language ID = U.S. English, char set = Windows, Multilingual 25 | BEGIN 26 | VALUE "FileDescription", "zlib data compression library\0" 27 | VALUE "FileVersion", ZLIB_VERSION "\0" 28 | VALUE "InternalName", "zlib1.dll\0" 29 | VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" 30 | VALUE "OriginalFilename", "zlib1.dll\0" 31 | VALUE "ProductName", "zlib\0" 32 | VALUE "ProductVersion", ZLIB_VERSION "\0" 33 | VALUE "Comments", "For more information visit http://www.zlib.net/\0" 34 | END 35 | END 36 | BLOCK "VarFileInfo" 37 | BEGIN 38 | VALUE "Translation", 0x0409, 1252 39 | END 40 | END 41 | -------------------------------------------------------------------------------- /src/zlib.3: -------------------------------------------------------------------------------- 1 | .TH ZLIB 3 "28 Apr 2013" 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.8 129 | Copyright (C) 1995-2013 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 152 | -------------------------------------------------------------------------------- /src/zlib.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_external_zlib/db8bc995325116d222cbbc3c376d5b200ba325e5/src/zlib.3.pdf -------------------------------------------------------------------------------- /src/zlib.map: -------------------------------------------------------------------------------- 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; 79 | 80 | ZLIB_1.2.7.1 { 81 | inflateGetDictionary; 82 | gzvprintf; 83 | } ZLIB_1.2.5.2; 84 | -------------------------------------------------------------------------------- /src/zlib.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | sharedlibdir=${libdir} 5 | includedir=${prefix}/include 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: 1.2.8 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /src/zlib.pc.cmakein: -------------------------------------------------------------------------------- 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} 14 | -------------------------------------------------------------------------------- /src/zlib.pc.in: -------------------------------------------------------------------------------- 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} 14 | -------------------------------------------------------------------------------- /src/zlib2ansi: -------------------------------------------------------------------------------- 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 | } 153 | -------------------------------------------------------------------------------- /update_zlib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Run with no arguments from any directory, with no special setup required. 3 | 4 | # Abort if any command returns an error exit status, or if an undefined 5 | # variable is used. 6 | set -e 7 | set -u 8 | 9 | base_dir=$(realpath $(dirname $0)) 10 | 11 | # Extract the latest version from the web page. 12 | new_version=$(wget -O - --no-verbose -q http://zlib.net/ | \ 13 | grep 'http://zlib.net/zlib-[0-9].*.tar.gz' | \ 14 | sed 's/.*zlib-\(.*\)\.tar\.gz.*/\1/') 15 | tgz_file="zlib-$new_version.tar.gz" 16 | 17 | echo "Upgrading zlib to version $new_version..." 18 | echo "-------------------------------------------------------------------" 19 | 20 | echo "Downloading $tgz_file..." 21 | wget -O /tmp/$tgz_file --no-verbose "http://zlib.net/$tgz_file" 22 | 23 | echo "Cleaning out old version..." 24 | src_dir=$base_dir/src 25 | rm -rf $src_dir 26 | 27 | echo "Unpacking new version..." 28 | cd $base_dir 29 | tar zxf /tmp/$tgz_file 30 | mv zlib-$new_version src 31 | 32 | echo "Configuring new version..." 33 | cd src 34 | ./configure 35 | rm Makefile configure.log 36 | cd .. 37 | 38 | echo "Fixing NOTICE file..." 39 | grep -A21 'Copyright notice:' src/README | tail -20 > NOTICE 40 | 41 | md5_sum=$(md5sum /tmp/$tgz_file) 42 | echo "MD5: $md5_sum" 43 | -------------------------------------------------------------------------------- /zconf.h: -------------------------------------------------------------------------------- 1 | src/zconf.h -------------------------------------------------------------------------------- /zlib.h: -------------------------------------------------------------------------------- 1 | src/zlib.h -------------------------------------------------------------------------------- /zutil.h: -------------------------------------------------------------------------------- 1 | src/zutil.h --------------------------------------------------------------------------------