Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10daf0d4d7 | ||
|
|
9712272c78 | ||
|
|
7301420248 | ||
|
|
a7d70663cf | ||
|
|
f4498bea28 | ||
|
|
7147f24cd7 |
103
ChangeLog
103
ChangeLog
@@ -1,6 +1,105 @@
|
||||
|
||||
ChangeLog file for zlib
|
||||
|
||||
Changes in 1.2.5.1 (10 Sep 2011)
|
||||
- Update FAQ entry on shared builds (#13)
|
||||
- Avoid symbolic argument to chmod in Makefile.in
|
||||
- Fix bug and add consts in contrib/puff [Oberhumer]
|
||||
- Update contrib/puff/zeros.raw test file to have all block types
|
||||
- Add full coverage test for puff in contrib/puff/Makefile
|
||||
- Fix static-only-build install in Makefile.in
|
||||
- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
|
||||
- Add libz.a dependency to shared in Makefile.in for parallel builds
|
||||
- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
|
||||
- Replace $(...) with `...` in configure for non-bash sh [Bowler]
|
||||
- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
|
||||
- Add solaris* to Linux* in configure to allow gcc use [Groffen]
|
||||
- Add *bsd* to Linux* case in configure [Bar-Lev]
|
||||
- Add inffast.obj to dependencies in win32/Makefile.msc
|
||||
- Correct spelling error in deflate.h [Kohler]
|
||||
- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
|
||||
- Add test to configure for GNU C looking for gcc in output of $cc -v
|
||||
- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
|
||||
- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
|
||||
- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
|
||||
- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
|
||||
- Make stronger test in zconf.h to include unistd.h for LFS
|
||||
- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
|
||||
- Fix zlib.h LFS support when Z_PREFIX used
|
||||
- Add updated as400 support (removed from old) [Monnerat]
|
||||
- Avoid deflate sensitivity to volatile input data
|
||||
- Avoid division in adler32_combine for NO_DIVIDE
|
||||
- Clarify the use of Z_FINISH with deflateBound() amount of space
|
||||
- Set binary for output file in puff.c
|
||||
- Use u4 type for crc_table to avoid conversion warnings
|
||||
- Apply casts in zlib.h to avoid conversion warnings
|
||||
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
|
||||
- Improve inflateSync() documentation to note indeterminancy
|
||||
- Add deflatePending() function to return the amount of pending output
|
||||
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
|
||||
- Add a check in configure for stdarg.h, use for gzprintf()
|
||||
- Check that pointers fit in ints when gzprint() compiled old style
|
||||
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
|
||||
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
|
||||
- Add debug records in assmebler code [Londer]
|
||||
- Update RFC references to use http://tools.ietf.org/html/... [Li]
|
||||
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
|
||||
|
||||
Changes in 1.2.5 (19 Apr 2010)
|
||||
- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
|
||||
- Default to libdir as sharedlibdir in configure [Nieder]
|
||||
- Update copyright dates on modified source files
|
||||
- Update trees.c to be able to generate modified trees.h
|
||||
- Exit configure for MinGW, suggesting win32/Makefile.gcc
|
||||
- Check for NULL path in gz_open [Homurlu]
|
||||
|
||||
Changes in 1.2.4.5 (18 Apr 2010)
|
||||
- Set sharedlibdir in configure [Torok]
|
||||
- Set LDFLAGS in Makefile.in [Bar-Lev]
|
||||
- Avoid mkdir objs race condition in Makefile.in [Bowler]
|
||||
- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
|
||||
- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
|
||||
- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
|
||||
|
||||
Changes in 1.2.4.4 (18 Apr 2010)
|
||||
- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
|
||||
- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
|
||||
- Try to use bash or ksh regardless of functionality of /bin/sh
|
||||
- Fix configure incompatibility with NetBSD sh
|
||||
- Remove attempt to run under bash or ksh since have better NetBSD fix
|
||||
- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
|
||||
- Add diagnostic messages when using CROSS_PREFIX in configure
|
||||
- Added --sharedlibdir option to configure [Weigelt]
|
||||
- Use hidden visibility attribute when available [Frysinger]
|
||||
|
||||
Changes in 1.2.4.3 (10 Apr 2010)
|
||||
- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
|
||||
- Use CROSS_PREFIX for nm [Bar-Lev]
|
||||
- Assume _LARGEFILE64_SOURCE defined is equivalent to true
|
||||
- Avoid use of undefined symbols in #if with && and ||
|
||||
- Make *64 prototypes in gzguts.h consistent with functions
|
||||
- Add -shared load option for MinGW in configure [Bowler]
|
||||
- Move z_off64_t to public interface, use instead of off64_t
|
||||
- Remove ! from shell test in configure (not portable to Solaris)
|
||||
- Change +0 macro tests to -0 for possibly increased portability
|
||||
|
||||
Changes in 1.2.4.2 (9 Apr 2010)
|
||||
- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
|
||||
- Really provide prototypes for *64 functions when building without LFS
|
||||
- Only define unlink() in minigzip.c if unistd.h not included
|
||||
- Update README to point to contrib/vstudio project files
|
||||
- Move projects/vc6 to old/ and remove projects/
|
||||
- Include stdlib.h in minigzip.c for setmode() definition under WinCE
|
||||
- Clean up assembler builds in win32/Makefile.msc [Rowe]
|
||||
- Include sys/types.h for Microsoft for off_t definition
|
||||
- Fix memory leak on error in gz_open()
|
||||
- Symbolize nm as $NM in configure [Weigelt]
|
||||
- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
|
||||
- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
|
||||
- Fix bug in gzeof() to take into account unused input data
|
||||
- Avoid initialization of structures with variables in puff.c
|
||||
- Updated win32/README-WIN32.txt [Rowe]
|
||||
|
||||
Changes in 1.2.4.1 (28 Mar 2010)
|
||||
- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
|
||||
- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
|
||||
@@ -123,7 +222,7 @@ Changes in 1.2.3.6 (17 Jan 2010)
|
||||
- Correct email address in configure for system options
|
||||
- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
|
||||
- Update zlib.map [Brown]
|
||||
- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [T<EFBFBD>r<EFBFBD>k]
|
||||
- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
|
||||
- Apply various fixes to CMakeLists.txt [Lowman]
|
||||
- Add checks on len in gzread() and gzwrite()
|
||||
- Add error message for no more room for gzungetc()
|
||||
@@ -207,7 +306,7 @@ Changes in 1.2.3.4 (21 Dec 2009)
|
||||
- Clear bytes after deflate lookahead to avoid use of uninitialized data
|
||||
- Change a limit in inftrees.c to be more transparent to Coverity Prevent
|
||||
- Update win32/zlib.def with exported symbols from zlib.h
|
||||
- Correct spelling error in zlib.h [Willem]
|
||||
- Correct spelling errors in zlib.h [Willem, Sobrado]
|
||||
- Allow Z_BLOCK for deflate() to force a new block
|
||||
- Allow negative bits in inflatePrime() to delete existing bit buffer
|
||||
- Add Z_TREES flush option to inflate() to return at end of trees
|
||||
|
||||
8
FAQ
8
FAQ
@@ -84,8 +84,10 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||
|
||||
13. How can I make a Unix shared library?
|
||||
|
||||
make clean
|
||||
./configure -s
|
||||
By default a shared (and a static) library is built for Unix. So:
|
||||
|
||||
make distclean
|
||||
./configure
|
||||
make
|
||||
|
||||
14. How do I install a shared zlib library on Unix?
|
||||
@@ -325,7 +327,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||
correctly points to the zlib specification in RFC 1950 for the "deflate"
|
||||
transfer encoding, there have been reports of servers and browsers that
|
||||
incorrectly produce or expect raw deflate data per the deflate
|
||||
specficiation in RFC 1951, most notably Microsoft. So even though the
|
||||
specification in RFC 1951, most notably Microsoft. So even though the
|
||||
"deflate" transfer encoding using the zlib format would be the more
|
||||
efficient approach (and in fact exactly what the zlib format was designed
|
||||
for), using the "gzip" transfer encoding is probably more reliable due to
|
||||
|
||||
2
INDEX
2
INDEX
@@ -17,12 +17,12 @@ zlib.pc.in Template for pkg-config descriptor
|
||||
zlib2ansi perl script to convert source files for C++ compilation
|
||||
|
||||
amiga/ makefiles for Amiga SAS C
|
||||
as400/ makefiles for AS/400
|
||||
doc/ documentation for formats and algorithms
|
||||
msdos/ makefiles for MSDOS
|
||||
nintendods/ makefile for Nintendo DS
|
||||
old/ makefiles for various architectures and zlib documentation
|
||||
files that have not yet been updated for zlib 1.2.x
|
||||
projects/ projects for various Integrated Development Environments
|
||||
qnx/ makefiles for QNX
|
||||
watcom/ makefiles for OpenWatcom
|
||||
win32/ makefiles for Windows
|
||||
|
||||
45
Makefile.in
45
Makefile.in
@@ -1,5 +1,5 @@
|
||||
# Makefile for zlib
|
||||
# Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||
# Copyright (C) 1995-2011 Jean-loup Gailly.
|
||||
# For conditions of distribution and use, see copyright notice in zlib.h
|
||||
|
||||
# To compile and test, type:
|
||||
@@ -25,14 +25,14 @@ CFLAGS=-O
|
||||
# -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
SFLAGS=-O
|
||||
|
||||
LDFLAGS=-L. libz.a
|
||||
LDFLAGS=
|
||||
TEST_LDFLAGS=-L. libz.a
|
||||
LDSHARED=$(CC)
|
||||
CPP=$(CC) -E
|
||||
|
||||
STATICLIB=libz.a
|
||||
SHAREDLIB=libz.so
|
||||
SHAREDLIBV=libz.so.1.2.4.1
|
||||
SHAREDLIBV=libz.so.1.2.5.1
|
||||
SHAREDLIBM=libz.so.1
|
||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
||||
|
||||
@@ -47,6 +47,7 @@ EXE=
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
libdir = ${exec_prefix}/lib
|
||||
sharedlibdir = ${libdir}
|
||||
includedir = ${prefix}/include
|
||||
mandir = ${prefix}/share/man
|
||||
man3dir = ${mandir}/man3
|
||||
@@ -131,22 +132,22 @@ minigzip64.o: minigzip.c zlib.h zconf.h
|
||||
.SUFFIXES: .lo
|
||||
|
||||
.c.lo:
|
||||
-@if [ ! -d objs ]; then mkdir objs; fi
|
||||
-@mkdir objs 2>/dev/null || test -d objs
|
||||
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
|
||||
-@mv objs/$*.o $@
|
||||
|
||||
$(SHAREDLIBV): $(PIC_OBJS)
|
||||
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC)
|
||||
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
|
||||
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
|
||||
rm -f $(SHAREDLIB) $(SHAREDLIBM)
|
||||
ln -s $@ $(SHAREDLIB)
|
||||
ln -s $@ $(SHAREDLIBM)
|
||||
-@rmdir objs
|
||||
|
||||
example$(EXE): example.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
|
||||
|
||||
minigzip$(EXE): minigzip.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
|
||||
|
||||
examplesh$(EXE): example.o $(SHAREDLIBV)
|
||||
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
|
||||
@@ -155,24 +156,28 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
|
||||
|
||||
example64$(EXE): example64.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
|
||||
|
||||
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
|
||||
|
||||
install-libs: $(LIBS)
|
||||
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
||||
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
|
||||
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
|
||||
cp $(LIBS) $(DESTDIR)$(libdir)
|
||||
cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
|
||||
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
|
||||
-@cd $(DESTDIR)$(libdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
|
||||
chmod 755 $(SHAREDLIBV); \
|
||||
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
|
||||
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
|
||||
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
|
||||
cp $(STATICLIB) $(DESTDIR)$(libdir)
|
||||
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
|
||||
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
|
||||
-@if test -n "$(SHAREDLIBV)"; then \
|
||||
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
|
||||
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
|
||||
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
|
||||
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
|
||||
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
||||
ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
|
||||
ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
||||
($(LDCONFIG) || true) >/dev/null 2>&1; \
|
||||
fi
|
||||
cp zlib.3 $(DESTDIR)$(man3dir)
|
||||
@@ -190,7 +195,7 @@ install: install-libs
|
||||
uninstall:
|
||||
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
|
||||
cd $(DESTDIR)$(libdir); rm -f libz.a; \
|
||||
if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
|
||||
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
|
||||
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
|
||||
fi
|
||||
cd $(DESTDIR)$(man3dir); rm -f zlib.3
|
||||
|
||||
13
README
13
README
@@ -1,10 +1,10 @@
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
|
||||
zlib 1.2.4.1 is a general purpose data compression library. All the code is
|
||||
zlib 1.2.5.1 is a general purpose data compression library. All the code is
|
||||
thread safe. The data format used by the zlib library is described by RFCs
|
||||
(Request for Comments) 1950 to 1952 in the files
|
||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
|
||||
and rfc1952.txt (gzip format).
|
||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||
rfc1952 (gzip format).
|
||||
|
||||
All functions of the compression library are documented in the file zlib.h
|
||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
||||
@@ -16,7 +16,8 @@ minigzip.c.
|
||||
To compile all files and run the test program, follow the instructions given at
|
||||
the top of Makefile.in. In short "./configure; make test", and if that goes
|
||||
well, "make install" should work for most flavors of Unix. For Windows, use one
|
||||
of the special makefiles in win32/ or projects/ . For VMS, use make_vms.com.
|
||||
of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
||||
make_vms.com.
|
||||
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
||||
@@ -30,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||
|
||||
The changes made in version 1.2.4.1 are documented in the file ChangeLog.
|
||||
The changes made in version 1.2.5.1 are documented in the file ChangeLog.
|
||||
|
||||
Unsupported third party contributions are provided in directory contrib/ .
|
||||
|
||||
@@ -83,7 +84,7 @@ Acknowledgments:
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||
(C) 1995-2011 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
68
adler32.c
68
adler32.c
@@ -1,5 +1,5 @@
|
||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||
* Copyright (C) 1995-2007 Mark Adler
|
||||
* Copyright (C) 1995-2011 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#define local static
|
||||
|
||||
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
|
||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||
|
||||
#define BASE 65521UL /* largest prime smaller than 65536 */
|
||||
#define BASE 65521 /* largest prime smaller than 65536 */
|
||||
#define NMAX 5552
|
||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||
|
||||
@@ -21,39 +21,44 @@ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
|
||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
||||
|
||||
/* use NO_DIVIDE if your processor does not do division in hardware */
|
||||
/* use NO_DIVIDE if your processor does not do division in hardware --
|
||||
try it both ways to see which is faster */
|
||||
#ifdef NO_DIVIDE
|
||||
# define MOD(a) \
|
||||
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
|
||||
(thank you to John Reiser for pointing this out) */
|
||||
# define CHOP(a) \
|
||||
do { \
|
||||
if (a >= (BASE << 16)) a -= (BASE << 16); \
|
||||
if (a >= (BASE << 15)) a -= (BASE << 15); \
|
||||
if (a >= (BASE << 14)) a -= (BASE << 14); \
|
||||
if (a >= (BASE << 13)) a -= (BASE << 13); \
|
||||
if (a >= (BASE << 12)) a -= (BASE << 12); \
|
||||
if (a >= (BASE << 11)) a -= (BASE << 11); \
|
||||
if (a >= (BASE << 10)) a -= (BASE << 10); \
|
||||
if (a >= (BASE << 9)) a -= (BASE << 9); \
|
||||
if (a >= (BASE << 8)) a -= (BASE << 8); \
|
||||
if (a >= (BASE << 7)) a -= (BASE << 7); \
|
||||
if (a >= (BASE << 6)) a -= (BASE << 6); \
|
||||
if (a >= (BASE << 5)) a -= (BASE << 5); \
|
||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
||||
unsigned long tmp = a >> 16; \
|
||||
a &= 0xffffUL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
} while (0)
|
||||
# define MOD28(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
# define MOD4(a) \
|
||||
# define MOD(a) \
|
||||
do { \
|
||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
||||
CHOP(a); \
|
||||
MOD28(a); \
|
||||
} while (0)
|
||||
# define MOD63(a) \
|
||||
do { /* this assumes a is not negative */ \
|
||||
z_off64_t tmp = a >> 32; \
|
||||
a &= 0xffffffffL; \
|
||||
a += (tmp << 8) - (tmp << 5) + tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
#else
|
||||
# define MOD(a) a %= BASE
|
||||
# define MOD4(a) a %= BASE
|
||||
# define MOD28(a) a %= BASE
|
||||
# define MOD63(a) a %= BASE
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
@@ -92,7 +97,7 @@ uLong ZEXPORT adler32(adler, buf, len)
|
||||
}
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
MOD4(sum2); /* only added so many BASE's */
|
||||
MOD28(sum2); /* only added so many BASE's */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
@@ -137,8 +142,13 @@ local uLong adler32_combine_(adler1, adler2, len2)
|
||||
unsigned long sum2;
|
||||
unsigned rem;
|
||||
|
||||
/* for negative len, return invalid adler32 as a clue for debugging */
|
||||
if (len2 < 0)
|
||||
return 0xffffffffUL;
|
||||
|
||||
/* the derivation of this formula is left as an exercise for the reader */
|
||||
rem = (unsigned)(len2 % BASE);
|
||||
MOD63(len2); /* assumes len2 >= 0 */
|
||||
rem = (unsigned)len2;
|
||||
sum1 = adler1 & 0xffff;
|
||||
sum2 = rem * sum1;
|
||||
MOD(sum2);
|
||||
|
||||
@@ -34,6 +34,7 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
|
||||
EXPORT SYMBOL("deflateCopy")
|
||||
EXPORT SYMBOL("deflateReset")
|
||||
EXPORT SYMBOL("deflateParams")
|
||||
EXPORT SYMBOL("deflatePending")
|
||||
EXPORT SYMBOL("deflatePrime")
|
||||
EXPORT SYMBOL("deflateInit_")
|
||||
EXPORT SYMBOL("deflateInit2_")
|
||||
@@ -129,4 +130,54 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
|
||||
|
||||
EXPORT SYMBOL("zlibCompileFlags")
|
||||
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
/* Version 1.2.5 additional entry points. */
|
||||
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("adler32_combine")
|
||||
EXPORT SYMBOL("adler32_combine64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("crc32_combine")
|
||||
EXPORT SYMBOL("crc32_combine64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZLIB ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzbuffer")
|
||||
EXPORT SYMBOL("gzoffset")
|
||||
EXPORT SYMBOL("gzoffset64")
|
||||
EXPORT SYMBOL("gzopen64")
|
||||
EXPORT SYMBOL("gzseek64")
|
||||
EXPORT SYMBOL("gztell64")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZREAD ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzclose_r")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE GZWRITE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("gzclose_w")
|
||||
|
||||
/********************************************************************/
|
||||
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
|
||||
/********************************************************************/
|
||||
|
||||
EXPORT SYMBOL("inflateMark")
|
||||
EXPORT SYMBOL("inflatePrime")
|
||||
EXPORT SYMBOL("inflateReset2")
|
||||
EXPORT SYMBOL("inflateUndermine")
|
||||
|
||||
ENDPGMEXP
|
||||
110
as400/compile.clp
Normal file
110
as400/compile.clp
Normal file
@@ -0,0 +1,110 @@
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* ZLIB */
|
||||
/* */
|
||||
/* Compile sources into modules and link them into a service program. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
PGM
|
||||
|
||||
/* Configuration adjustable parameters. */
|
||||
|
||||
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Source library. */
|
||||
DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('SOURCES') /* Source member file. */
|
||||
DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('TOOLS') /* Control member file. */
|
||||
|
||||
DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Module library. */
|
||||
|
||||
DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('LGPL') /* Service program library. */
|
||||
|
||||
DCL VAR(&CFLAGS) TYPE(*CHAR) +
|
||||
VALUE('OPTIMIZE(40)') /* Compile options. */
|
||||
|
||||
DCL VAR(&TGTRLS) TYPE(*CHAR) +
|
||||
VALUE('V5R3M0') /* Target release. */
|
||||
|
||||
|
||||
/* Working storage. */
|
||||
|
||||
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */
|
||||
DCL VAR(&CMD) TYPE(*CHAR) LEN(512)
|
||||
DCL VAR(&FIXDCMD) TYPE(*CHAR) LEN(512)
|
||||
|
||||
|
||||
/* Compile sources into modules. */
|
||||
|
||||
CHGVAR VAR(&FIXDCMD) VALUE('CRTCMOD' *BCAT &CFLAGS *BCAT +
|
||||
'SYSIFCOPT(*IFS64IO)' *BCAT +
|
||||
'DEFINE(''_LARGEFILE64_SOURCE''' *BCAT +
|
||||
'''_LFS64_LARGEFILE=1'') TGTRLS(' *TCAT &TGTRLS *TCAT +
|
||||
') SRCFILE(' *TCAT &SRCLIB *TCAT '/' *TCAT +
|
||||
&SRCFILE *TCAT ') MODULE(' *TCAT &MODLIB *TCAT '/')
|
||||
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ADLER32)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'COMPRESS)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'CRC32)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'DEFLATE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZCLOSE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZLIB)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZREAD)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZWRITE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFBACK)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFFAST)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFLATE)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFTREES)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'TREES)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'UNCOMPR)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ZUTIL)')
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
|
||||
/* Link modules into a service program. */
|
||||
|
||||
CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) +
|
||||
MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS +
|
||||
&MODLIB/CRC32 &MODLIB/DEFLATE +
|
||||
&MODLIB/GZCLOSE &MODLIB/GZLIB +
|
||||
&MODLIB/GZREAD &MODLIB/GZWRITE +
|
||||
&MODLIB/INFBACK &MODLIB/INFFAST +
|
||||
&MODLIB/INFLATE &MODLIB/INFTREES +
|
||||
&MODLIB/TREES &MODLIB/UNCOMPR +
|
||||
&MODLIB/ZUTIL) +
|
||||
SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
|
||||
TEXT('ZLIB 1.2.5.1') TGTRLS(&TGTRLS)
|
||||
|
||||
ENDPGM
|
||||
@@ -1,4 +1,4 @@
|
||||
ZLIB version 1.2.3 for AS400 installation instructions
|
||||
ZLIB version 1.2.5.1 for AS400 installation instructions
|
||||
|
||||
I) From an AS400 *SAVF file:
|
||||
|
||||
@@ -70,7 +70,10 @@ II) From the original source distribution:
|
||||
compress.c COMPRESS C ZLIB - Compress a memory buffer
|
||||
crc32.c CRC32 C ZLIB - Compute the CRC-32 of a data stream
|
||||
deflate.c DEFLATE C ZLIB - Compress data using the deflation algorithm
|
||||
gzio.c GZIO C ZLIB - IO on .gz files
|
||||
gzclose.c GZCLOSE C ZLIB - Close .gz files
|
||||
gzlib.c GZLIB C ZLIB - Miscellaneous .gz files IO support
|
||||
gzread.c GZREAD C ZLIB - Read .gz files
|
||||
gzwrite.c GZWRITE C ZLIB - Write .gz files
|
||||
infback.c INFBACK C ZLIB - Inflate using a callback interface
|
||||
inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs
|
||||
inflate.c INFLATE C ZLIB - Interface to inflate modules
|
||||
@@ -81,6 +84,7 @@ II) From the original source distribution:
|
||||
H Original ZLIB C and ILE/RPG include files
|
||||
crc32.h CRC32 C ZLIB - CRC32 tables
|
||||
deflate.h DEFLATE C ZLIB - Internal compression state
|
||||
gzguts.h GZGUTS C ZLIB - Definitions for the gzclose module
|
||||
inffast.h INFFAST C ZLIB - Header to use inffast.c
|
||||
inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes
|
||||
inflate.h INFLATE C ZLIB - Internal inflate state definitions
|
||||
@@ -108,4 +112,4 @@ Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB
|
||||
implementation does not handle conversion from/to ASCII, so
|
||||
text data code conversions must be done explicitely.
|
||||
|
||||
Always open zipped files in binary mode.
|
||||
Mainly for the reason above, always open zipped files in binary mode.
|
||||
@@ -1,7 +1,7 @@
|
||||
* ZLIB.INC - Interface to the general purpose compression library
|
||||
*
|
||||
* ILE RPG400 version by Patrick Monnerat, DATASPHERE.
|
||||
* Version 1.2.3.9
|
||||
* Version 1.2.5.1
|
||||
*
|
||||
*
|
||||
* WARNING:
|
||||
@@ -22,16 +22,25 @@
|
||||
*
|
||||
* Versioning information.
|
||||
*
|
||||
D ZLIB_VERSION C '1.2.3.9'
|
||||
D ZLIB_VERNUM C X'1239'
|
||||
D ZLIB_VERSION C '1.2.5.1'
|
||||
D ZLIB_VERNUM C X'1251'
|
||||
D ZLIB_VER_MAJOR C 1
|
||||
D ZLIB_VER_MINOR C 2
|
||||
D ZLIB_VER_REVISION...
|
||||
D C 5
|
||||
D ZLIB_VER_SUBREVISION...
|
||||
D C 0
|
||||
*
|
||||
* Other equates.
|
||||
*
|
||||
D Z_NO_FLUSH C 0
|
||||
D Z_PARTIAL_FLUSH...
|
||||
D C 1
|
||||
D Z_SYNC_FLUSH C 2
|
||||
D Z_FULL_FLUSH C 3
|
||||
D Z_FINISH C 4
|
||||
D Z_BLOCK C 5
|
||||
D Z_TREES C 6
|
||||
*
|
||||
D Z_OK C 0
|
||||
D Z_STREAM_END C 1
|
||||
@@ -72,6 +81,7 @@
|
||||
D z_streamp S * Stream struct ptr
|
||||
D gzFile S * File pointer
|
||||
D z_off_t S 10i 0 Stream offsets
|
||||
D z_off64_t S 20i 0 Stream offsets
|
||||
*
|
||||
**************************************************************************
|
||||
* Structures
|
||||
@@ -122,20 +132,36 @@
|
||||
D source 32767 const options(*varsize) Source buffer
|
||||
D sourceLen 10U 0 value Source length
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzopen PR extproc('gzopen')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
/else
|
||||
D gzopen PR extproc('gzopen64')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
*
|
||||
D gzopen64 PR extproc('gzopen64')
|
||||
D like(gzFile)
|
||||
D path * value options(*string) File pathname
|
||||
D mode * value options(*string) Open mode
|
||||
/endif
|
||||
*
|
||||
D gzdopen PR extproc('gzdopen')
|
||||
D like(gzFile)
|
||||
D fd 10i 0 value File descriptor
|
||||
D fd 10I 0 value File descriptor
|
||||
D mode * value options(*string) Open mode
|
||||
*
|
||||
D gzbuffer PR 10I 0 extproc('gzbuffer')
|
||||
D file value like(gzFile) File pointer
|
||||
D size 10U 0 value
|
||||
*
|
||||
D gzsetparams PR 10I 0 extproc('gzsetparams')
|
||||
D file value like(gzFile) File pointer
|
||||
D level 10I 0 value
|
||||
D strategy 10i 0 value
|
||||
D strategy 10I 0 value
|
||||
*
|
||||
D gzread PR 10I 0 extproc('gzread')
|
||||
D file value like(gzFile) File pointer
|
||||
@@ -160,20 +186,64 @@
|
||||
D file value like(gzFile) File pointer
|
||||
D flush 10I 0 value Type of flush
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzseek PR extproc('gzseek')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
/else
|
||||
D gzseek PR extproc('gzseek64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
*
|
||||
D gzseek64 PR extproc('gzseek64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
D offset value like(z_off64_t) Offset
|
||||
D whence 10i 0 value Origin
|
||||
/endif
|
||||
*
|
||||
D gzrewind PR 10i 0 extproc('gzrewind')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gztell PR extproc('gztell')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/else
|
||||
D gztell PR extproc('gztell64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gztell64 PR extproc('gztell64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/endif
|
||||
*
|
||||
/if not defined(LARGE_FILES)
|
||||
D gzoffset PR extproc('gzoffset')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/else
|
||||
D gzoffset PR extproc('gzoffset64')
|
||||
D like(z_off_t)
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzoffset64 PR extproc('gzoffset64')
|
||||
D like(z_off64_t)
|
||||
D file value like(gzFile) File pointer
|
||||
/endif
|
||||
*
|
||||
D gzeof PR 10i 0 extproc('gzeof')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose_r PR 10i 0 extproc('gzclose_r')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose_w PR 10i 0 extproc('gzclose_w')
|
||||
D file value like(gzFile) File pointer
|
||||
*
|
||||
D gzclose PR 10i 0 extproc('gzclose')
|
||||
@@ -253,6 +323,11 @@
|
||||
D strm like(z_stream) Compression stream
|
||||
D sourcelen 10U 0 value Compression level
|
||||
*
|
||||
D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D pending 10U 0 Pending bytes
|
||||
D bits 10I 0 Pending bits
|
||||
*
|
||||
D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
|
||||
D strm like(z_stream) Compression stream
|
||||
D bits 10I 0 value Number of bits to insert
|
||||
@@ -278,6 +353,18 @@
|
||||
D source like(z_stream) Source stream
|
||||
*
|
||||
D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream
|
||||
D strm like(z_stream) Expansion stream
|
||||
D windowBits 10I 0 value Log2(buffer size)
|
||||
*
|
||||
D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits
|
||||
D strm like(z_stream) Expansion stream
|
||||
D bits 10I 0 value Bit count
|
||||
D value 10I 0 value Bits to insert
|
||||
*
|
||||
D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info
|
||||
D strm like(z_stream) Expansion stream
|
||||
*
|
||||
D inflateBackInit...
|
||||
@@ -328,4 +415,9 @@
|
||||
*
|
||||
D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
|
||||
*
|
||||
D inflateUndermine...
|
||||
D PR 10I 0 extproc('inflateUndermine')
|
||||
D strm like(z_stream) Expansion stream
|
||||
D arg 10I 0 value Error code
|
||||
*
|
||||
/endif
|
||||
121
configure
vendored
121
configure
vendored
@@ -13,43 +13,43 @@
|
||||
# If you have problems, try without defining CC and CFLAGS before reporting
|
||||
# an error.
|
||||
|
||||
# make sure we are running under a compatible shell (stolen from ffmpeg and libnfo)
|
||||
if test "0$ZLIB_CONFIGURE_EXEC" -lt 1; then
|
||||
unset foo
|
||||
(: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
|
||||
if test "$?" -ne 0; then
|
||||
ZLIB_CONFIGURE_EXEC=1
|
||||
export ZLIB_CONFIGURE_EXEC
|
||||
type "bash" > /dev/null 2>&1 && exec bash "$0" "$@"
|
||||
type "ksh" > /dev/null 2>&1 && exec ksh "$0" "$@"
|
||||
if test -x /usr/xpg4/bin/sh; then
|
||||
exec /usr/xpg4/bin/sh "$0" "$@"
|
||||
fi
|
||||
# echo "No compatible shell script interpreter found."
|
||||
# exit 1
|
||||
# we could give up here, but go ahead and give their old sh a try
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${CHOST}" ]; then
|
||||
uname="$(echo "${CHOST}" | sed 's/.*-.*-\(.*\)-.*/\1/')"
|
||||
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
|
||||
CROSS_PREFIX="${CHOST}-"
|
||||
fi
|
||||
|
||||
STATICLIB=libz.a
|
||||
LDFLAGS="${LDFLAGS} -L. ${STATICLIB}"
|
||||
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
|
||||
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
|
||||
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
|
||||
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
|
||||
AR=${AR-"${CROSS_PREFIX}ar"}
|
||||
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
AR=${AR-"${CROSS_PREFIX}ar"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${AR}
|
||||
else
|
||||
AR=${AR-"ar"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${AR}
|
||||
fi
|
||||
AR_RC="${AR} rc"
|
||||
RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
|
||||
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${RANLIB}
|
||||
else
|
||||
RANLIB=${RANLIB-"ranlib"}
|
||||
fi
|
||||
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
||||
NM=${NM-"${CROSS_PREFIX}nm"}
|
||||
test -n "${CROSS_PREFIX}" && echo Using ${NM}
|
||||
else
|
||||
NM=${NM-"nm"}
|
||||
fi
|
||||
LDCONFIG=${LDCONFIG-"ldconfig"}
|
||||
LDSHAREDLIBC="${LDSHAREDLIBC-"-lc"}"
|
||||
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
|
||||
ARCHS=
|
||||
prefix=${prefix-/usr/local}
|
||||
exec_prefix=${exec_prefix-'${prefix}'}
|
||||
libdir=${libdir-'${exec_prefix}/lib'}
|
||||
sharedlibdir=${sharedlibdir-'${libdir}'}
|
||||
includedir=${includedir-'${prefix}/include'}
|
||||
mandir=${mandir-'${prefix}/share/man'}
|
||||
shared_ext='.so'
|
||||
@@ -66,11 +66,13 @@ case "$1" in
|
||||
-h* | --help)
|
||||
echo 'usage:'
|
||||
echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]'
|
||||
echo ' [--static] [--64] [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
|
||||
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]'
|
||||
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]'
|
||||
exit 0 ;;
|
||||
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
--sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
|
||||
-u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
|
||||
-p* | --prefix) prefix="$2"; shift; shift ;;
|
||||
@@ -81,6 +83,7 @@ case "$1" in
|
||||
-t | --static) shared=0; shift ;;
|
||||
-z* | --zprefix) zprefix=1; shift ;;
|
||||
-6* | --64) build64=1; shift ;;
|
||||
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
--sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;;
|
||||
--localstatedir=*) echo "ignored option: --localstatedir"; shift ;;
|
||||
*) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;;
|
||||
@@ -93,18 +96,22 @@ extern int getchar();
|
||||
int hello() {return getchar();}
|
||||
EOF
|
||||
|
||||
test -z "$CC" && echo Checking for gcc...
|
||||
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc...
|
||||
cc=${CC-${CROSS_PREFIX}gcc}
|
||||
cflags=${CFLAGS-"-O3"}
|
||||
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
||||
case "$cc" in
|
||||
*gcc*) gcc=1 ;;
|
||||
esac
|
||||
case `$cc -v 2>&1` in
|
||||
*gcc*) gcc=1 ;;
|
||||
esac
|
||||
|
||||
if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
|
||||
CC="$cc"
|
||||
SFLAGS="${CFLAGS-"-O3"} -fPIC"
|
||||
CFLAGS="${CFLAGS-"-O3"}"
|
||||
CFLAGS="${CFLAGS--O3} ${ARCHS}"
|
||||
SFLAGS="${CFLAGS--O3} -fPIC"
|
||||
LDFLAGS="${LDFLAGS} ${ARCHS}"
|
||||
if test $build64 -eq 1; then
|
||||
CFLAGS="${CFLAGS} -m64"
|
||||
SFLAGS="${SFLAGS} -m64"
|
||||
@@ -116,10 +123,16 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
|
||||
uname=`(uname -s || echo unknown) 2>/dev/null`
|
||||
fi
|
||||
case "$uname" in
|
||||
Linux* | linux* | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
|
||||
Linux* | linux* | GNU | GNU/* | *BSD | *bsd* | DragonFly | solaris*)
|
||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
|
||||
CYGWIN* | Cygwin* | cygwin* | OS/2*)
|
||||
EXE='.exe' ;;
|
||||
MINGW*)
|
||||
MINGW* | mingw*)
|
||||
# temporary bypass
|
||||
rm -f $test.[co] $test $test$shared_ext
|
||||
echo "Please use win32/Makefile.gcc instead."
|
||||
exit 1
|
||||
LDSHARED=${LDSHARED-"$cc -shared"}
|
||||
LDSHAREDLIBC=""
|
||||
EXE='.exe' ;;
|
||||
QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
|
||||
@@ -135,16 +148,20 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
|
||||
shared_ext='.sl'
|
||||
SHAREDLIB='libz.sl' ;;
|
||||
esac ;;
|
||||
Darwin*) shared_ext='.dylib'
|
||||
Darwin* | darwin*)
|
||||
shared_ext='.dylib'
|
||||
SHAREDLIB=libz$shared_ext
|
||||
SHAREDLIBV=libz.$VER$shared_ext
|
||||
SHAREDLIBM=libz.$VER1$shared_ext
|
||||
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} ;;
|
||||
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
||||
AR="libtool"
|
||||
AR_RC="${AR} -o" ;;
|
||||
*) LDSHARED=${LDSHARED-"$cc -shared"} ;;
|
||||
esac
|
||||
else
|
||||
# find system name and corresponding cc options
|
||||
CC=${CC-cc}
|
||||
gcc=0
|
||||
if test -z "$uname"; then
|
||||
uname=`(uname -sr || echo unknown) 2>/dev/null`
|
||||
fi
|
||||
@@ -179,7 +196,8 @@ else
|
||||
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
|
||||
CFLAGS=${CFLAGS-"-O3"}
|
||||
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
|
||||
SunOS\ 5*) LDSHARED=${LDSHARED-"cc -G"}
|
||||
SunOS\ 5* | solaris*)
|
||||
LDSHARED=${LDSHARED-"cc -G"}
|
||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
||||
i86*)
|
||||
SFLAGS=${CFLAGS-"-xpentium -fast -KPIC -R."}
|
||||
@@ -295,6 +313,18 @@ else
|
||||
echo "Checking for unistd.h... No."
|
||||
fi
|
||||
|
||||
cat > $test.c <<EOF
|
||||
#include <stdarg.h>
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
|
||||
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
echo "Checking for stdarg.h... Yes."
|
||||
else
|
||||
echo "Checking for stdarg.h... No."
|
||||
fi
|
||||
|
||||
if test $zprefix -eq 1; then
|
||||
sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
||||
mv zconf.temp.h zconf.h
|
||||
@@ -339,7 +369,6 @@ int main()
|
||||
return (mytest("Hello%d\n", 1));
|
||||
}
|
||||
EOF
|
||||
|
||||
if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
|
||||
echo "Checking for vsnprintf() in stdio.h... Yes."
|
||||
|
||||
@@ -502,10 +531,32 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$gcc" -eq 1; then
|
||||
cat > $test.c <<EOF
|
||||
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
|
||||
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
#else
|
||||
# define ZLIB_INTERNAL
|
||||
#endif
|
||||
int ZLIB_INTERNAL foo;
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
|
||||
echo "Checking for attribute(visibility) support... Yes."
|
||||
else
|
||||
CFLAGS="$CFLAGS -DNO_VIZ"
|
||||
SFLAGS="$SFLAGS -DNO_VIZ"
|
||||
echo "Checking for attribute(visibility) support... No."
|
||||
fi
|
||||
fi
|
||||
|
||||
CPP=${CPP-"$CC -E"}
|
||||
case $CFLAGS in
|
||||
*ASMV*)
|
||||
if test "`nm $test.o | grep _hello`" = ""; then
|
||||
if test "`$NM $test.o | grep _hello`" = ""; then
|
||||
CPP="$CPP -DNO_UNDERLINE"
|
||||
echo Checking for underline in external names... No.
|
||||
else
|
||||
@@ -535,6 +586,7 @@ sed < Makefile.in "
|
||||
/^prefix *=/s#=.*#=$prefix#
|
||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
||||
/^libdir *=/s#=.*#=$libdir#
|
||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
||||
/^includedir *=/s#=.*#=$includedir#
|
||||
/^mandir *=/s#=.*#=$mandir#
|
||||
/^all: */s#:.*#: $ALL#
|
||||
@@ -556,6 +608,7 @@ sed < zlib.pc.in "
|
||||
/^prefix *=/s#=.*#=$prefix#
|
||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
||||
/^libdir *=/s#=.*#=$libdir#
|
||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
||||
/^includedir *=/s#=.*#=$includedir#
|
||||
/^mandir *=/s#=.*#=$mandir#
|
||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
||||
|
||||
@@ -83,17 +83,25 @@
|
||||
.text
|
||||
|
||||
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
|
||||
.cfi_sections .debug_frame
|
||||
|
||||
longest_match:
|
||||
|
||||
.cfi_startproc
|
||||
/* Save registers that the compiler may be using, and adjust %esp to */
|
||||
/* make room for our stack frame. */
|
||||
|
||||
pushl %ebp
|
||||
.cfi_def_cfa_offset 8
|
||||
.cfi_offset ebp, -8
|
||||
pushl %edi
|
||||
.cfi_def_cfa_offset 12
|
||||
pushl %esi
|
||||
.cfi_def_cfa_offset 16
|
||||
pushl %ebx
|
||||
.cfi_def_cfa_offset 20
|
||||
subl $LocalVarsSize, %esp
|
||||
.cfi_def_cfa_offset LocalVarsSize+20
|
||||
|
||||
/* Retrieve the function arguments. %ecx will hold cur_match */
|
||||
/* throughout the entire function. %edx will hold the pointer to the */
|
||||
@@ -108,7 +116,7 @@ longest_match:
|
||||
/* if (s->prev_length >= s->good_match) { */
|
||||
/* chain_length >>= 2; */
|
||||
/* } */
|
||||
|
||||
|
||||
movl dsPrevLen(%edx), %eax
|
||||
movl dsGoodMatch(%edx), %ebx
|
||||
cmpl %ebx, %eax
|
||||
@@ -336,8 +344,14 @@ LookaheadRet:
|
||||
/* Restore the stack and return from whence we came. */
|
||||
|
||||
addl $LocalVarsSize, %esp
|
||||
.cfi_def_cfa_offset 20
|
||||
popl %ebx
|
||||
.cfi_def_cfa_offset 16
|
||||
popl %esi
|
||||
.cfi_def_cfa_offset 12
|
||||
popl %edi
|
||||
.cfi_def_cfa_offset 8
|
||||
popl %ebp
|
||||
.cfi_def_cfa_offset 4
|
||||
.cfi_endproc
|
||||
match_init: ret
|
||||
|
||||
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
|
||||
const OutBuf: Pointer; BufSize: Integer);
|
||||
|
||||
const
|
||||
zlib_version = '1.2.4.1';
|
||||
zlib_version = '1.2.5.1';
|
||||
|
||||
type
|
||||
EZlibError = class(Exception);
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace DotZLibTests
|
||||
public void Info_Version()
|
||||
{
|
||||
Info info = new Info();
|
||||
Assert.AreEqual("1.2.4.1", Info.Version);
|
||||
Assert.AreEqual("1.2.5.1", Info.Version);
|
||||
Assert.AreEqual(32, info.SizeOfUInt);
|
||||
Assert.AreEqual(32, info.SizeOfULong);
|
||||
Assert.AreEqual(32, info.SizeOfPointer);
|
||||
@@ -271,4 +271,4 @@ namespace DotZLibTests
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define MAXBITS 15
|
||||
|
||||
const char inflate9_copyright[] =
|
||||
" inflate9 1.2.4.1 Copyright 1995-2010 Mark Adler ";
|
||||
" inflate9 1.2.5.1 Copyright 1995-2010 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
@@ -64,7 +64,7 @@ unsigned short FAR *work;
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
||||
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
||||
133, 133, 133, 133, 144, 67, 206};
|
||||
133, 133, 133, 133, 144, 205, 203};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
||||
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||
|
||||
@@ -12,10 +12,10 @@ inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing
|
||||
|
||||
Use instructions
|
||||
----------------
|
||||
Assemble the .asm files using MASM and put the object files into the zlib source
|
||||
directory. You can also get object files here:
|
||||
|
||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
||||
Assemble the .asm files using MASM and put the object files into the zlib source
|
||||
directory. You can also get object files here:
|
||||
|
||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
||||
|
||||
define ASMV and ASMINF in your project. Include inffas8664.c in your source tree,
|
||||
and inffasx64.obj and gvmat64.obj as object to link.
|
||||
|
||||
@@ -73,11 +73,6 @@ inflate_fast_use_mmx:
|
||||
|
||||
|
||||
_TEXT segment
|
||||
PUBLIC _inflate_fast
|
||||
|
||||
ALIGN 4
|
||||
_inflate_fast:
|
||||
jmp inflate_fast_entry
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +158,8 @@ distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */
|
||||
;SECTION .text
|
||||
|
||||
ALIGN 4
|
||||
inflate_fast_entry:
|
||||
_inflate_fast proc near
|
||||
.FPO (16, 4, 0, 0, 1, 0)
|
||||
push edi
|
||||
push esi
|
||||
push ebp
|
||||
@@ -1078,6 +1074,7 @@ L_done:
|
||||
pop esi
|
||||
pop edi
|
||||
ret
|
||||
_inflate_fast endp
|
||||
|
||||
_TEXT ends
|
||||
end
|
||||
|
||||
@@ -195,6 +195,7 @@ dsNiceMatch equ 136+zlib1222add
|
||||
ELSE
|
||||
_longest_match proc near
|
||||
ENDIF
|
||||
.FPO (9, 4, 0, 0, 1, 0)
|
||||
|
||||
;;; Save registers that the compiler may be using, and adjust esp to
|
||||
;;; make room for our stack frame.
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
|
||||
Summary
|
||||
-------
|
||||
This directory contains ASM implementations of the functions
|
||||
longest_match() and inflate_fast().
|
||||
|
||||
|
||||
Use instructions
|
||||
----------------
|
||||
Assemble using MASM, and copy the object files into the zlib source
|
||||
directory, then run the appropriate makefile, as suggested below. You can
|
||||
donwload MASM from here:
|
||||
|
||||
|
||||
Summary
|
||||
-------
|
||||
This directory contains ASM implementations of the functions
|
||||
longest_match() and inflate_fast().
|
||||
|
||||
|
||||
Use instructions
|
||||
----------------
|
||||
Assemble using MASM, and copy the object files into the zlib source
|
||||
directory, then run the appropriate makefile, as suggested below. You can
|
||||
donwload MASM from here:
|
||||
|
||||
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
|
||||
|
||||
You can also get objects files here:
|
||||
|
||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
||||
|
||||
Build instructions
|
||||
------------------
|
||||
* With Microsoft C and MASM:
|
||||
nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj"
|
||||
|
||||
* With Borland C and TASM:
|
||||
make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"
|
||||
|
||||
|
||||
You can also get objects files here:
|
||||
|
||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
||||
|
||||
Build instructions
|
||||
------------------
|
||||
* With Microsoft C and MASM:
|
||||
nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj"
|
||||
|
||||
* With Borland C and TASM:
|
||||
make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"
|
||||
|
||||
|
||||
@@ -14,6 +14,18 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
|
||||
#else
|
||||
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
|
||||
#include "ioapi.h"
|
||||
|
||||
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
|
||||
@@ -112,7 +124,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = fopen64((const char*)filename, mode_fopen);
|
||||
file = FOPEN_FUNC((const char*)filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -142,7 +154,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
ZPOS64_T ret;
|
||||
ret = ftello64((FILE *)stream);
|
||||
ret = FTELLO_FUNC((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -188,7 +200,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
|
||||
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef _ZLIBIOAPI64_H
|
||||
#define _ZLIBIOAPI64_H
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32))
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
|
||||
// Linux needs this to support file operation on files larger then 4+GB
|
||||
// But might need better if/def to select just the platforms that needs them.
|
||||
@@ -38,6 +38,7 @@
|
||||
#ifndef _FILE_OFFSET_BIT
|
||||
#define _FILE_OFFSET_BIT 64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
#endif
|
||||
@@ -27,6 +27,18 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
|
||||
#else
|
||||
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -34,14 +46,15 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef unix
|
||||
# include <unistd.h>
|
||||
# include <utime.h>
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <utime.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "unzip.h"
|
||||
|
||||
#define CASESENSITIVITY (0)
|
||||
@@ -84,7 +97,7 @@ void change_file_date(filename,dosdate,tmu_date)
|
||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||
CloseHandle(hFile);
|
||||
#else
|
||||
#ifdef unix
|
||||
#ifdef unix || __APPLE__
|
||||
struct utimbuf ut;
|
||||
struct tm newdate;
|
||||
newdate.tm_sec = tmu_date.tm_sec;
|
||||
@@ -114,10 +127,10 @@ int mymkdir(dirname)
|
||||
int ret=0;
|
||||
#ifdef _WIN32
|
||||
ret = _mkdir(dirname);
|
||||
#else
|
||||
#ifdef unix
|
||||
#elif unix
|
||||
ret = mkdir (dirname,0775);
|
||||
#elif __APPLE__
|
||||
ret = mkdir (dirname,0775);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@@ -364,7 +377,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
||||
{
|
||||
char rep=0;
|
||||
FILE* ftestexist;
|
||||
ftestexist = fopen64(write_filename,"rb");
|
||||
ftestexist = FOPEN_FUNC(write_filename,"rb");
|
||||
if (ftestexist!=NULL)
|
||||
{
|
||||
fclose(ftestexist);
|
||||
@@ -395,8 +408,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
||||
|
||||
if ((skip==0) && (err==UNZ_OK))
|
||||
{
|
||||
fout=fopen64(write_filename,"wb");
|
||||
|
||||
fout=FOPEN_FUNC(write_filename,"wb");
|
||||
/* some zipfile don't contain directory alone before file */
|
||||
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||
(filename_withoutpath!=(char*)filename_inzip))
|
||||
@@ -405,7 +417,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
||||
*(filename_withoutpath-1)='\0';
|
||||
makedir(write_filename);
|
||||
*(filename_withoutpath-1)=c;
|
||||
fout=fopen64(write_filename,"wb");
|
||||
fout=FOPEN_FUNC(write_filename,"wb");
|
||||
}
|
||||
|
||||
if (fout==NULL)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
#endif
|
||||
@@ -28,6 +28,19 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
|
||||
#else
|
||||
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -35,14 +48,14 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef unix
|
||||
#ifdef _WIN32
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <utime.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#else
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#include "zip.h"
|
||||
@@ -81,7 +94,7 @@ uLong filetime(f, tmzip, dt)
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#ifdef unix
|
||||
#ifdef unix || __APPLE__
|
||||
uLong filetime(f, tmzip, dt)
|
||||
char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
@@ -142,7 +155,7 @@ int check_exist_file(filename)
|
||||
{
|
||||
FILE* ftestexist;
|
||||
int ret = 1;
|
||||
ftestexist = fopen64(filename,"rb");
|
||||
ftestexist = FOPEN_FUNC(filename,"rb");
|
||||
if (ftestexist==NULL)
|
||||
ret = 0;
|
||||
else
|
||||
@@ -173,7 +186,8 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
|
||||
{
|
||||
unsigned long calculate_crc=0;
|
||||
int err=ZIP_OK;
|
||||
FILE * fin = fopen64(filenameinzip,"rb");
|
||||
FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
|
||||
unsigned long size_read = 0;
|
||||
unsigned long total_read = 0;
|
||||
if (fin==NULL)
|
||||
@@ -211,13 +225,12 @@ int isLargeFile(const char* filename)
|
||||
{
|
||||
int largeFile = 0;
|
||||
ZPOS64_T pos = 0;
|
||||
FILE* pFile = fopen64(filename, "rb");
|
||||
FILE* pFile = FOPEN_FUNC(filename, "rb");
|
||||
|
||||
if(pFile != NULL)
|
||||
{
|
||||
int n = fseeko64(pFile, 0, SEEK_END);
|
||||
|
||||
pos = ftello64(pFile);
|
||||
int n = FSEEKO_FUNC(pFile, 0, SEEK_END);
|
||||
pos = FTELLO_FUNC(pFile);
|
||||
|
||||
printf("File : %s is %lld bytes\n", filename, pos);
|
||||
|
||||
@@ -447,7 +460,7 @@ int main(argc,argv)
|
||||
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||
else
|
||||
{
|
||||
fin = fopen64(filenameinzip,"rb");
|
||||
fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
if (fin==NULL)
|
||||
{
|
||||
err=ZIP_ERRNO;
|
||||
|
||||
@@ -1145,7 +1145,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||
szFileName,fileNameBufferSize,
|
||||
extraField,extraFieldBufferSize,
|
||||
szComment,commentBufferSize);
|
||||
if (err==UNZ_OK)
|
||||
if ((err==UNZ_OK) && (pfile_info != NULL))
|
||||
{
|
||||
pfile_info->version = file_info64.version;
|
||||
pfile_info->version_needed = file_info64.version_needed;
|
||||
|
||||
@@ -10,7 +10,7 @@ unit zlibpas;
|
||||
interface
|
||||
|
||||
const
|
||||
ZLIB_VERSION = '1.2.4.1';
|
||||
ZLIB_VERSION = '1.2.5.1';
|
||||
|
||||
type
|
||||
alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
|
||||
@@ -97,6 +97,7 @@ function deflateCopy(var dest, source: z_stream): Integer;
|
||||
function deflateReset(var strm: z_stream): Integer;
|
||||
function deflateParams(var strm: z_stream; level, strategy: Integer): Integer;
|
||||
function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt;
|
||||
function deflatePending(var strm: z_stream; var pending: Integer; var bits: Integer): Integer;
|
||||
function deflatePrime(var strm: z_stream; bits, value: Integer): Integer;
|
||||
function inflateInit2(var strm: z_stream; windowBits: Integer): Integer;
|
||||
function inflateSetDictionary(var strm: z_stream; const dictionary: PChar;
|
||||
@@ -166,6 +167,7 @@ function deflateEnd; external;
|
||||
function deflateInit_; external;
|
||||
function deflateInit2_; external;
|
||||
function deflateParams; external;
|
||||
function deflatePending; external;
|
||||
function deflatePrime; external;
|
||||
function deflateReset; external;
|
||||
function deflateSetDictionary; external;
|
||||
|
||||
@@ -1,8 +1,42 @@
|
||||
puff: puff.c puff.h
|
||||
cc -DTEST -o puff puff.c
|
||||
CFLAGS=-O
|
||||
|
||||
puff: puff.o pufftest.o
|
||||
|
||||
puff.o: puff.h
|
||||
|
||||
pufftest.o: puff.h
|
||||
|
||||
test: puff
|
||||
puff zeros.raw
|
||||
|
||||
puft: puff.c puff.h pufftest.o
|
||||
cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o
|
||||
|
||||
# puff full coverage test (should say 100%)
|
||||
cov: puft
|
||||
@rm -f *.gcov *.gcda
|
||||
@puft -w zeros.raw 2>&1 | cat > /dev/null
|
||||
@echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
|
||||
@echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
|
||||
@echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254
|
||||
@echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
|
||||
@echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
|
||||
@echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
|
||||
@echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
@echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
|
||||
@echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
|
||||
@echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245
|
||||
@puft -f zeros.raw 2>&1 | cat > /dev/null
|
||||
@echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253
|
||||
@echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252
|
||||
@echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251
|
||||
@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
|
||||
@echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250
|
||||
@echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247
|
||||
@gcov -n puff.c
|
||||
|
||||
clean:
|
||||
rm -f puff puff.o
|
||||
rm -f puff puft *.o *.gc*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* puff.c
|
||||
* Copyright (C) 2002-2008 Mark Adler
|
||||
* Copyright (C) 2002-2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in puff.h
|
||||
* version 2.0, 25 Jul 2008
|
||||
* version 2.2, 25 Apr 2010
|
||||
*
|
||||
* puff.c is a simple inflate written to be an unambiguous way to specify the
|
||||
* deflate format. It is not written for speed but rather simplicity. As a
|
||||
@@ -49,9 +49,9 @@
|
||||
* - Fix fixed codes table error
|
||||
* - Provide a scanning mode for determining size of
|
||||
* uncompressed data
|
||||
* 1.3 20 Mar 2002 - Go back to lengths for puff() parameters [Jean-loup]
|
||||
* 1.3 20 Mar 2002 - Go back to lengths for puff() parameters [Gailly]
|
||||
* - Add a puff.h file for the interface
|
||||
* - Add braces in puff() for else do [Jean-loup]
|
||||
* - Add braces in puff() for else do [Gailly]
|
||||
* - Use indexes instead of pointers for readability
|
||||
* 1.4 31 Mar 2002 - Simplify construct() code set check
|
||||
* - Fix some comments
|
||||
@@ -67,13 +67,21 @@
|
||||
* - Add option in TEST code for puff to write the data
|
||||
* - Add option in TEST code to skip input bytes
|
||||
* - Allow TEST code to read from piped stdin
|
||||
* 2.1 4 Apr 2010 - Avoid variable initialization for happier compilers
|
||||
* - Avoid unsigned comparisons for even happier compilers
|
||||
* 2.2 25 Apr 2010 - Fix bug in variable initializations [Oberhumer]
|
||||
* - Add const where appropriate [Oberhumer]
|
||||
* - Split if's and ?'s for coverage testing
|
||||
* - Break out test code to separate file
|
||||
* - Move NIL to puff.h
|
||||
* - Allow incomplete code only if single code length is 1
|
||||
* - Add full code coverage test to Makefile
|
||||
*/
|
||||
|
||||
#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
|
||||
#include "puff.h" /* prototype for puff() */
|
||||
|
||||
#define local static /* for local function definitions */
|
||||
#define NIL ((unsigned char *)0) /* for no output option */
|
||||
|
||||
/*
|
||||
* Maximums for allocations and loops. It is not useful to change these --
|
||||
@@ -93,7 +101,7 @@ struct state {
|
||||
unsigned long outcnt; /* bytes written to out so far */
|
||||
|
||||
/* input state */
|
||||
unsigned char *in; /* input buffer */
|
||||
const unsigned char *in; /* input buffer */
|
||||
unsigned long inlen; /* available input at in */
|
||||
unsigned long incnt; /* bytes read so far */
|
||||
int bitbuf; /* bit buffer */
|
||||
@@ -121,7 +129,8 @@ local int bits(struct state *s, int need)
|
||||
/* load at least need bits into val */
|
||||
val = s->bitbuf;
|
||||
while (s->bitcnt < need) {
|
||||
if (s->incnt == s->inlen) longjmp(s->env, 1); /* out of input */
|
||||
if (s->incnt == s->inlen)
|
||||
longjmp(s->env, 1); /* out of input */
|
||||
val |= (long)(s->in[s->incnt++]) << s->bitcnt; /* load eight bits */
|
||||
s->bitcnt += 8;
|
||||
}
|
||||
@@ -160,7 +169,8 @@ local int stored(struct state *s)
|
||||
s->bitcnt = 0;
|
||||
|
||||
/* get length and check against its one's complement */
|
||||
if (s->incnt + 4 > s->inlen) return 2; /* not enough input */
|
||||
if (s->incnt + 4 > s->inlen)
|
||||
return 2; /* not enough input */
|
||||
len = s->in[s->incnt++];
|
||||
len |= s->in[s->incnt++] << 8;
|
||||
if (s->in[s->incnt++] != (~len & 0xff) ||
|
||||
@@ -168,7 +178,8 @@ local int stored(struct state *s)
|
||||
return -2; /* didn't match complement! */
|
||||
|
||||
/* copy len bytes from in to out */
|
||||
if (s->incnt + len > s->inlen) return 2; /* not enough input */
|
||||
if (s->incnt + len > s->inlen)
|
||||
return 2; /* not enough input */
|
||||
if (s->out != NIL) {
|
||||
if (s->outcnt + len > s->outlen)
|
||||
return 1; /* not enough output space */
|
||||
@@ -220,7 +231,7 @@ struct huffman {
|
||||
* in the deflate format. See the format notes for fixed() and dynamic().
|
||||
*/
|
||||
#ifdef SLOW
|
||||
local int decode(struct state *s, struct huffman *h)
|
||||
local int decode(struct state *s, const struct huffman *h)
|
||||
{
|
||||
int len; /* current number of bits in code */
|
||||
int code; /* len bits being decoded */
|
||||
@@ -248,7 +259,7 @@ local int decode(struct state *s, struct huffman *h)
|
||||
* a few percent larger.
|
||||
*/
|
||||
#else /* !SLOW */
|
||||
local int decode(struct state *s, struct huffman *h)
|
||||
local int decode(struct state *s, const struct huffman *h)
|
||||
{
|
||||
int len; /* current number of bits in code */
|
||||
int code; /* len bits being decoded */
|
||||
@@ -281,10 +292,13 @@ local int decode(struct state *s, struct huffman *h)
|
||||
len++;
|
||||
}
|
||||
left = (MAXBITS+1) - len;
|
||||
if (left == 0) break;
|
||||
if (s->incnt == s->inlen) longjmp(s->env, 1); /* out of input */
|
||||
if (left == 0)
|
||||
break;
|
||||
if (s->incnt == s->inlen)
|
||||
longjmp(s->env, 1); /* out of input */
|
||||
bitbuf = s->in[s->incnt++];
|
||||
if (left > 8) left = 8;
|
||||
if (left > 8)
|
||||
left = 8;
|
||||
}
|
||||
return -10; /* ran out of codes */
|
||||
}
|
||||
@@ -322,7 +336,7 @@ local int decode(struct state *s, struct huffman *h)
|
||||
* - Within a given code length, the symbols are kept in ascending order for
|
||||
* the code bits definition.
|
||||
*/
|
||||
local int construct(struct huffman *h, short *length, int n)
|
||||
local int construct(struct huffman *h, const short *length, int n)
|
||||
{
|
||||
int symbol; /* current symbol when stepping through length[] */
|
||||
int len; /* current length when stepping through h->count[] */
|
||||
@@ -342,7 +356,8 @@ local int construct(struct huffman *h, short *length, int n)
|
||||
for (len = 1; len <= MAXBITS; len++) {
|
||||
left <<= 1; /* one more bit, double codes left */
|
||||
left -= h->count[len]; /* deduct count from possible codes */
|
||||
if (left < 0) return left; /* over-subscribed--return negative */
|
||||
if (left < 0)
|
||||
return left; /* over-subscribed--return negative */
|
||||
} /* left > 0 means incomplete */
|
||||
|
||||
/* generate offsets into symbol table for each length for sorting */
|
||||
@@ -418,8 +433,8 @@ local int construct(struct huffman *h, short *length, int n)
|
||||
* defined to do the wrong thing in this case.
|
||||
*/
|
||||
local int codes(struct state *s,
|
||||
struct huffman *lencode,
|
||||
struct huffman *distcode)
|
||||
const struct huffman *lencode,
|
||||
const struct huffman *distcode)
|
||||
{
|
||||
int symbol; /* decoded symbol */
|
||||
int len; /* length for copy */
|
||||
@@ -442,11 +457,13 @@ local int codes(struct state *s,
|
||||
/* decode literals and length/distance pairs */
|
||||
do {
|
||||
symbol = decode(s, lencode);
|
||||
if (symbol < 0) return symbol; /* invalid symbol */
|
||||
if (symbol < 0)
|
||||
return symbol; /* invalid symbol */
|
||||
if (symbol < 256) { /* literal: symbol is the byte */
|
||||
/* write out the literal */
|
||||
if (s->out != NIL) {
|
||||
if (s->outcnt == s->outlen) return 1;
|
||||
if (s->outcnt == s->outlen)
|
||||
return 1;
|
||||
s->out[s->outcnt] = symbol;
|
||||
}
|
||||
s->outcnt++;
|
||||
@@ -454,12 +471,14 @@ local int codes(struct state *s,
|
||||
else if (symbol > 256) { /* length */
|
||||
/* get and compute length */
|
||||
symbol -= 257;
|
||||
if (symbol >= 29) return -10; /* invalid fixed code */
|
||||
if (symbol >= 29)
|
||||
return -10; /* invalid fixed code */
|
||||
len = lens[symbol] + bits(s, lext[symbol]);
|
||||
|
||||
/* get and check distance */
|
||||
symbol = decode(s, distcode);
|
||||
if (symbol < 0) return symbol; /* invalid symbol */
|
||||
if (symbol < 0)
|
||||
return symbol; /* invalid symbol */
|
||||
dist = dists[symbol] + bits(s, dext[symbol]);
|
||||
#ifndef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
if (dist > s->outcnt)
|
||||
@@ -468,13 +487,15 @@ local int codes(struct state *s,
|
||||
|
||||
/* copy length bytes from distance bytes back */
|
||||
if (s->out != NIL) {
|
||||
if (s->outcnt + len > s->outlen) return 1;
|
||||
if (s->outcnt + len > s->outlen)
|
||||
return 1;
|
||||
while (len--) {
|
||||
s->out[s->outcnt] =
|
||||
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
dist > s->outcnt ? 0 :
|
||||
dist > s->outcnt ?
|
||||
0 :
|
||||
#endif
|
||||
s->out[s->outcnt - dist];
|
||||
s->out[s->outcnt - dist];
|
||||
s->outcnt++;
|
||||
}
|
||||
}
|
||||
@@ -516,14 +537,19 @@ local int fixed(struct state *s)
|
||||
static int virgin = 1;
|
||||
static short lencnt[MAXBITS+1], lensym[FIXLCODES];
|
||||
static short distcnt[MAXBITS+1], distsym[MAXDCODES];
|
||||
static struct huffman lencode = {lencnt, lensym};
|
||||
static struct huffman distcode = {distcnt, distsym};
|
||||
static struct huffman lencode, distcode;
|
||||
|
||||
/* build fixed huffman tables if first call (may not be thread safe) */
|
||||
if (virgin) {
|
||||
int symbol;
|
||||
short lengths[FIXLCODES];
|
||||
|
||||
/* construct lencode and distcode */
|
||||
lencode.count = lencnt;
|
||||
lencode.symbol = lensym;
|
||||
distcode.count = distcnt;
|
||||
distcode.symbol = distsym;
|
||||
|
||||
/* literal/length table */
|
||||
for (symbol = 0; symbol < 144; symbol++)
|
||||
lengths[symbol] = 8;
|
||||
@@ -643,11 +669,16 @@ local int dynamic(struct state *s)
|
||||
short lengths[MAXCODES]; /* descriptor code lengths */
|
||||
short lencnt[MAXBITS+1], lensym[MAXLCODES]; /* lencode memory */
|
||||
short distcnt[MAXBITS+1], distsym[MAXDCODES]; /* distcode memory */
|
||||
struct huffman lencode = {lencnt, lensym}; /* length code */
|
||||
struct huffman distcode = {distcnt, distsym}; /* distance code */
|
||||
struct huffman lencode, distcode; /* length and distance codes */
|
||||
static const short order[19] = /* permutation of code length codes */
|
||||
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
||||
|
||||
/* construct lencode and distcode */
|
||||
lencode.count = lencnt;
|
||||
lencode.symbol = lensym;
|
||||
distcode.count = distcnt;
|
||||
distcode.symbol = distsym;
|
||||
|
||||
/* get number of lengths in each table, check lengths */
|
||||
nlen = bits(s, 5) + 257;
|
||||
ndist = bits(s, 5) + 1;
|
||||
@@ -663,7 +694,8 @@ local int dynamic(struct state *s)
|
||||
|
||||
/* build huffman table for code lengths codes (use lencode temporarily) */
|
||||
err = construct(&lencode, lengths, 19);
|
||||
if (err != 0) return -4; /* require complete code set here */
|
||||
if (err != 0) /* require complete code set here */
|
||||
return -4;
|
||||
|
||||
/* read length/literal and distance code length tables */
|
||||
index = 0;
|
||||
@@ -677,7 +709,8 @@ local int dynamic(struct state *s)
|
||||
else { /* repeat instruction */
|
||||
len = 0; /* assume repeating zeros */
|
||||
if (symbol == 16) { /* repeat last length 3..6 times */
|
||||
if (index == 0) return -5; /* no last length! */
|
||||
if (index == 0)
|
||||
return -5; /* no last length! */
|
||||
len = lengths[index - 1]; /* last length */
|
||||
symbol = 3 + bits(s, 2);
|
||||
}
|
||||
@@ -698,13 +731,13 @@ local int dynamic(struct state *s)
|
||||
|
||||
/* build huffman table for literal/length codes */
|
||||
err = construct(&lencode, lengths, nlen);
|
||||
if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
|
||||
return -7; /* only allow incomplete codes if just one code */
|
||||
if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
|
||||
return -7; /* incomplete code ok only for single length 1 code */
|
||||
|
||||
/* build huffman table for distance codes */
|
||||
err = construct(&distcode, lengths + nlen, ndist);
|
||||
if (err < 0 || (err > 0 && ndist - distcode.count[0] != 1))
|
||||
return -8; /* only allow incomplete codes if just one code */
|
||||
if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
|
||||
return -8; /* incomplete code ok only for single length 1 code */
|
||||
|
||||
/* decode data until end-of-block code */
|
||||
return codes(s, &lencode, &distcode);
|
||||
@@ -756,7 +789,7 @@ local int dynamic(struct state *s)
|
||||
*/
|
||||
int puff(unsigned char *dest, /* pointer to destination pointer */
|
||||
unsigned long *destlen, /* amount of output space */
|
||||
unsigned char *source, /* pointer to source data pointer */
|
||||
const unsigned char *source, /* pointer to source data pointer */
|
||||
unsigned long *sourcelen) /* amount of input available */
|
||||
{
|
||||
struct state s; /* input/output state */
|
||||
@@ -783,11 +816,15 @@ int puff(unsigned char *dest, /* pointer to destination pointer */
|
||||
do {
|
||||
last = bits(&s, 1); /* one if last block */
|
||||
type = bits(&s, 2); /* block type 0..3 */
|
||||
err = type == 0 ? stored(&s) :
|
||||
(type == 1 ? fixed(&s) :
|
||||
(type == 2 ? dynamic(&s) :
|
||||
-1)); /* type == 3, invalid */
|
||||
if (err != 0) break; /* return with error */
|
||||
err = type == 0 ?
|
||||
stored(&s) :
|
||||
(type == 1 ?
|
||||
fixed(&s) :
|
||||
(type == 2 ?
|
||||
dynamic(&s) :
|
||||
-1)); /* type == 3, invalid */
|
||||
if (err != 0)
|
||||
break; /* return with error */
|
||||
} while (!last);
|
||||
}
|
||||
|
||||
@@ -798,145 +835,3 @@ int puff(unsigned char *dest, /* pointer to destination pointer */
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
/* Examples of how to use puff().
|
||||
|
||||
Usage: puff [-w] [-nnn] file
|
||||
... | puff [-w] [-nnn]
|
||||
|
||||
where file is the input file with deflate data, nnn is the number of bytes
|
||||
of input to skip before inflating (e.g. to skip a zlib or gzip header), and
|
||||
-w is used to write the decompressed data to stdout */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Return size times approximately the cube root of 2, keeping the result as 1,
|
||||
3, or 5 times a power of 2 -- the result is always > size, until the result
|
||||
is the maximum value of an unsigned long, where it remains. This is useful
|
||||
to keep reallocations less than ~33% over the actual data. */
|
||||
local size_t bythirds(size_t size)
|
||||
{
|
||||
int n;
|
||||
size_t m;
|
||||
|
||||
m = size;
|
||||
for (n = 0; m; n++)
|
||||
m >>= 1;
|
||||
if (n < 3)
|
||||
return size + 1;
|
||||
n -= 3;
|
||||
m = size >> n;
|
||||
m += m == 6 ? 2 : 1;
|
||||
m <<= n;
|
||||
return m > size ? m : (size_t)(-1);
|
||||
}
|
||||
|
||||
/* Read the input file *name, or stdin if name is NULL, into allocated memory.
|
||||
Reallocate to larger buffers until the entire file is read in. Return a
|
||||
pointer to the allocated data, or NULL if there was a memory allocation
|
||||
failure. *len is the number of bytes of data read from the input file (even
|
||||
if load() returns NULL). If the input file was empty or could not be opened
|
||||
or read, *len is zero. */
|
||||
local void *load(char *name, size_t *len)
|
||||
{
|
||||
size_t size;
|
||||
void *buf, *swap;
|
||||
FILE *in;
|
||||
|
||||
*len = 0;
|
||||
buf = malloc(size = 4096);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
in = name == NULL ? stdin : fopen(name, "rb");
|
||||
if (in != NULL) {
|
||||
for (;;) {
|
||||
*len += fread((char *)buf + *len, 1, size - *len, in);
|
||||
if (*len < size) break;
|
||||
size = bythirds(size);
|
||||
if (size == *len || (swap = realloc(buf, size)) == NULL) {
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
break;
|
||||
}
|
||||
buf = swap;
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret, skip = 0, put = 0;
|
||||
char *arg, *name = NULL;
|
||||
unsigned char *source = NULL, *dest;
|
||||
size_t len = 0;
|
||||
unsigned long sourcelen, destlen;
|
||||
|
||||
/* process arguments */
|
||||
while (arg = *++argv, --argc)
|
||||
if (arg[0] == '-') {
|
||||
if (arg[1] == 'w' && arg[2] == 0)
|
||||
put = 1;
|
||||
else if (arg[1] >= '0' && arg[1] <= '9')
|
||||
skip = atoi(arg + 1);
|
||||
else {
|
||||
fprintf(stderr, "invalid option %s\n", arg);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
else if (name != NULL) {
|
||||
fprintf(stderr, "only one file name allowed\n");
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
name = arg;
|
||||
source = load(name, &len);
|
||||
if (source == NULL) {
|
||||
fprintf(stderr, "memory allocation failure\n");
|
||||
return 4;
|
||||
}
|
||||
if (len == 0) {
|
||||
fprintf(stderr, "could not read %s, or it was empty\n",
|
||||
name == NULL ? "<stdin>" : name);
|
||||
free(source);
|
||||
return 3;
|
||||
}
|
||||
if (skip >= len) {
|
||||
fprintf(stderr, "skip request of %d leaves no input\n", skip);
|
||||
free(source);
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* test inflate data with offset skip */
|
||||
len -= skip;
|
||||
sourcelen = (unsigned long)len;
|
||||
ret = puff(NIL, &destlen, source + skip, &sourcelen);
|
||||
if (ret)
|
||||
fprintf(stderr, "puff() failed with return code %d\n", ret);
|
||||
else {
|
||||
fprintf(stderr, "puff() succeeded uncompressing %lu bytes\n", destlen);
|
||||
if (sourcelen < len) fprintf(stderr, "%lu compressed bytes unused\n",
|
||||
len - sourcelen);
|
||||
}
|
||||
|
||||
/* if requested, inflate again and write decompressd data to stdout */
|
||||
if (put) {
|
||||
dest = malloc(destlen);
|
||||
if (dest == NULL) {
|
||||
fprintf(stderr, "memory allocation failure\n");
|
||||
free(source);
|
||||
return 4;
|
||||
}
|
||||
puff(dest, &destlen, source + skip, &sourcelen);
|
||||
fwrite(dest, 1, destlen, stdout);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
free(source);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* puff.h
|
||||
Copyright (C) 2002-2008 Mark Adler, all rights reserved
|
||||
version 1.9, 10 Jan 2008
|
||||
Copyright (C) 2002-2010 Mark Adler, all rights reserved
|
||||
version 2.2, 25 Apr 2010
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
@@ -25,7 +25,11 @@
|
||||
/*
|
||||
* See puff.c for purpose and usage.
|
||||
*/
|
||||
#ifndef NIL
|
||||
# define NIL ((unsigned char *)0) /* for no output option */
|
||||
#endif
|
||||
|
||||
int puff(unsigned char *dest, /* pointer to destination pointer */
|
||||
unsigned long *destlen, /* amount of output space */
|
||||
unsigned char *source, /* pointer to source data pointer */
|
||||
const unsigned char *source, /* pointer to source data pointer */
|
||||
unsigned long *sourcelen); /* amount of input available */
|
||||
|
||||
165
contrib/puff/pufftest.c
Normal file
165
contrib/puff/pufftest.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* pufftest.c
|
||||
* Copyright (C) 2002-2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in puff.h
|
||||
* version 2.2, 25 Apr 2010
|
||||
*/
|
||||
|
||||
/* Example of how to use puff().
|
||||
|
||||
Usage: puff [-w] [-f] [-nnn] file
|
||||
... | puff [-w] [-f] [-nnn]
|
||||
|
||||
where file is the input file with deflate data, nnn is the number of bytes
|
||||
of input to skip before inflating (e.g. to skip a zlib or gzip header), and
|
||||
-w is used to write the decompressed data to stdout. -f is for coverage
|
||||
testing, and causes pufftest to fail with not enough output space (-f does
|
||||
a write like -w, so -w is not required). */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "puff.h"
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(file)
|
||||
#endif
|
||||
|
||||
#define local static
|
||||
|
||||
/* Return size times approximately the cube root of 2, keeping the result as 1,
|
||||
3, or 5 times a power of 2 -- the result is always > size, until the result
|
||||
is the maximum value of an unsigned long, where it remains. This is useful
|
||||
to keep reallocations less than ~33% over the actual data. */
|
||||
local size_t bythirds(size_t size)
|
||||
{
|
||||
int n;
|
||||
size_t m;
|
||||
|
||||
m = size;
|
||||
for (n = 0; m; n++)
|
||||
m >>= 1;
|
||||
if (n < 3)
|
||||
return size + 1;
|
||||
n -= 3;
|
||||
m = size >> n;
|
||||
m += m == 6 ? 2 : 1;
|
||||
m <<= n;
|
||||
return m > size ? m : (size_t)(-1);
|
||||
}
|
||||
|
||||
/* Read the input file *name, or stdin if name is NULL, into allocated memory.
|
||||
Reallocate to larger buffers until the entire file is read in. Return a
|
||||
pointer to the allocated data, or NULL if there was a memory allocation
|
||||
failure. *len is the number of bytes of data read from the input file (even
|
||||
if load() returns NULL). If the input file was empty or could not be opened
|
||||
or read, *len is zero. */
|
||||
local void *load(const char *name, size_t *len)
|
||||
{
|
||||
size_t size;
|
||||
void *buf, *swap;
|
||||
FILE *in;
|
||||
|
||||
*len = 0;
|
||||
buf = malloc(size = 4096);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
in = name == NULL ? stdin : fopen(name, "rb");
|
||||
if (in != NULL) {
|
||||
for (;;) {
|
||||
*len += fread((char *)buf + *len, 1, size - *len, in);
|
||||
if (*len < size) break;
|
||||
size = bythirds(size);
|
||||
if (size == *len || (swap = realloc(buf, size)) == NULL) {
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
break;
|
||||
}
|
||||
buf = swap;
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret, put = 0, fail = 0;
|
||||
unsigned skip = 0;
|
||||
char *arg, *name = NULL;
|
||||
unsigned char *source = NULL, *dest;
|
||||
size_t len = 0;
|
||||
unsigned long sourcelen, destlen;
|
||||
|
||||
/* process arguments */
|
||||
while (arg = *++argv, --argc)
|
||||
if (arg[0] == '-') {
|
||||
if (arg[1] == 'w' && arg[2] == 0)
|
||||
put = 1;
|
||||
else if (arg[1] == 'f' && arg[2] == 0)
|
||||
fail = 1, put = 1;
|
||||
else if (arg[1] >= '0' && arg[1] <= '9')
|
||||
skip = (unsigned)atoi(arg + 1);
|
||||
else {
|
||||
fprintf(stderr, "invalid option %s\n", arg);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
else if (name != NULL) {
|
||||
fprintf(stderr, "only one file name allowed\n");
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
name = arg;
|
||||
source = load(name, &len);
|
||||
if (source == NULL) {
|
||||
fprintf(stderr, "memory allocation failure\n");
|
||||
return 4;
|
||||
}
|
||||
if (len == 0) {
|
||||
fprintf(stderr, "could not read %s, or it was empty\n",
|
||||
name == NULL ? "<stdin>" : name);
|
||||
free(source);
|
||||
return 3;
|
||||
}
|
||||
if (skip >= len) {
|
||||
fprintf(stderr, "skip request of %d leaves no input\n", skip);
|
||||
free(source);
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* test inflate data with offset skip */
|
||||
len -= skip;
|
||||
sourcelen = (unsigned long)len;
|
||||
ret = puff(NIL, &destlen, source + skip, &sourcelen);
|
||||
if (ret)
|
||||
fprintf(stderr, "puff() failed with return code %d\n", ret);
|
||||
else {
|
||||
fprintf(stderr, "puff() succeeded uncompressing %lu bytes\n", destlen);
|
||||
if (sourcelen < len) fprintf(stderr, "%lu compressed bytes unused\n",
|
||||
len - sourcelen);
|
||||
}
|
||||
|
||||
/* if requested, inflate again and write decompressd data to stdout */
|
||||
if (put && ret == 0) {
|
||||
if (fail)
|
||||
destlen >>= 1;
|
||||
dest = malloc(destlen);
|
||||
if (dest == NULL) {
|
||||
fprintf(stderr, "memory allocation failure\n");
|
||||
free(source);
|
||||
return 4;
|
||||
}
|
||||
puff(dest, &destlen, source + skip, &sourcelen);
|
||||
SET_BINARY_MODE(stdout);
|
||||
fwrite(dest, 1, destlen, stdout);
|
||||
free(dest);
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
free(source);
|
||||
return ret;
|
||||
}
|
||||
Binary file not shown.
@@ -2,8 +2,8 @@
|
||||
|
||||
#define IDR_VERSION1 1
|
||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||
FILEVERSION 1,2,4,1
|
||||
PRODUCTVERSION 1,2,4,1
|
||||
FILEVERSION 1.2.5.1,1
|
||||
PRODUCTVERSION 1.2.5.1,1
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_DOS_WINDOWS32
|
||||
@@ -17,7 +17,7 @@ BEGIN
|
||||
|
||||
BEGIN
|
||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||
VALUE "FileVersion", "1.2.4.1\0"
|
||||
VALUE "FileVersion", "1.2.5.1\0"
|
||||
VALUE "InternalName", "zlib\0"
|
||||
VALUE "OriginalFilename", "zlib.dll\0"
|
||||
VALUE "ProductName", "ZLib.DLL\0"
|
||||
|
||||
@@ -55,6 +55,7 @@ EXPORTS
|
||||
gzungetc @49
|
||||
zlibCompileFlags @50
|
||||
deflatePrime @51
|
||||
deflatePending @52
|
||||
|
||||
unzOpen @61
|
||||
unzClose @62
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#define IDR_VERSION1 1
|
||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||
FILEVERSION 1,2,4,1
|
||||
PRODUCTVERSION 1,2,4,1
|
||||
FILEVERSION 1.2.5.1,1
|
||||
PRODUCTVERSION 1.2.5.1,1
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_DOS_WINDOWS32
|
||||
@@ -17,7 +17,7 @@ BEGIN
|
||||
|
||||
BEGIN
|
||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||
VALUE "FileVersion", "1.2.4.1\0"
|
||||
VALUE "FileVersion", "1.2.5.1\0"
|
||||
VALUE "InternalName", "zlib\0"
|
||||
VALUE "OriginalFilename", "zlib.dll\0"
|
||||
VALUE "ProductName", "ZLib.DLL\0"
|
||||
|
||||
@@ -55,6 +55,7 @@ EXPORTS
|
||||
gzungetc @49
|
||||
zlibCompileFlags @50
|
||||
deflatePrime @51
|
||||
deflatePending @52
|
||||
|
||||
unzOpen @61
|
||||
unzClose @62
|
||||
|
||||
31
crc32.c
31
crc32.c
@@ -1,5 +1,5 @@
|
||||
/* crc32.c -- compute the CRC-32 of a data stream
|
||||
* Copyright (C) 1995-2006 Mark Adler
|
||||
* Copyright (C) 1995-2006, 2010, 2011 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*
|
||||
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
||||
@@ -17,6 +17,8 @@
|
||||
of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
|
||||
first call get_crc_table() to initialize the tables before allowing more than
|
||||
one thread to use crc32().
|
||||
|
||||
DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
|
||||
*/
|
||||
|
||||
#ifdef MAKECRCH
|
||||
@@ -53,6 +55,7 @@
|
||||
|
||||
/* Definitions for doing the crc four data bytes at a time. */
|
||||
#ifdef BYFOUR
|
||||
typedef u4 crc_table_t;
|
||||
# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
|
||||
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
|
||||
local unsigned long crc32_little OF((unsigned long,
|
||||
@@ -61,6 +64,7 @@
|
||||
const unsigned char FAR *, unsigned));
|
||||
# define TBLS 8
|
||||
#else
|
||||
typedef unsigned long crc_table_t;
|
||||
# define TBLS 1
|
||||
#endif /* BYFOUR */
|
||||
|
||||
@@ -68,16 +72,16 @@
|
||||
local unsigned long gf2_matrix_times OF((unsigned long *mat,
|
||||
unsigned long vec));
|
||||
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
|
||||
local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
|
||||
local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
|
||||
|
||||
|
||||
#ifdef DYNAMIC_CRC_TABLE
|
||||
|
||||
local volatile int crc_table_empty = 1;
|
||||
local unsigned long FAR crc_table[TBLS][256];
|
||||
local crc_table_t FAR crc_table[TBLS][256];
|
||||
local void make_crc_table OF((void));
|
||||
#ifdef MAKECRCH
|
||||
local void write_table OF((FILE *, const unsigned long FAR *));
|
||||
local void write_table OF((FILE *, const crc_table_t FAR *));
|
||||
#endif /* MAKECRCH */
|
||||
/*
|
||||
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
|
||||
@@ -107,9 +111,9 @@ local void make_crc_table OF((void));
|
||||
*/
|
||||
local void make_crc_table()
|
||||
{
|
||||
unsigned long c;
|
||||
crc_table_t c;
|
||||
int n, k;
|
||||
unsigned long poly; /* polynomial exclusive-or pattern */
|
||||
crc_table_t poly; /* polynomial exclusive-or pattern */
|
||||
/* terms of polynomial defining this crc (except x^32): */
|
||||
static volatile int first = 1; /* flag to limit concurrent making */
|
||||
static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
|
||||
@@ -121,13 +125,13 @@ local void make_crc_table()
|
||||
first = 0;
|
||||
|
||||
/* make exclusive-or pattern from polynomial (0xedb88320UL) */
|
||||
poly = 0UL;
|
||||
for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
|
||||
poly |= 1UL << (31 - p[n]);
|
||||
poly = 0;
|
||||
for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
|
||||
poly |= (crc_table_t)1 << (31 - p[n]);
|
||||
|
||||
/* generate a crc for every 8-bit value */
|
||||
for (n = 0; n < 256; n++) {
|
||||
c = (unsigned long)n;
|
||||
c = (crc_table_t)n;
|
||||
for (k = 0; k < 8; k++)
|
||||
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
|
||||
crc_table[0][n] = c;
|
||||
@@ -164,7 +168,7 @@ local void make_crc_table()
|
||||
if (out == NULL) return;
|
||||
fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
|
||||
fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
|
||||
fprintf(out, "local const unsigned long FAR ");
|
||||
fprintf(out, "local const crc_table_t FAR ");
|
||||
fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
|
||||
write_table(out, crc_table[0]);
|
||||
# ifdef BYFOUR
|
||||
@@ -184,12 +188,13 @@ local void make_crc_table()
|
||||
#ifdef MAKECRCH
|
||||
local void write_table(out, table)
|
||||
FILE *out;
|
||||
const unsigned long FAR *table;
|
||||
const crc_table_t FAR *table;
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n = 0; n < 256; n++)
|
||||
fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
|
||||
fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
|
||||
(unsigned long)(table[n]),
|
||||
n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
|
||||
}
|
||||
#endif /* MAKECRCH */
|
||||
|
||||
2
crc32.h
2
crc32.h
@@ -2,7 +2,7 @@
|
||||
* Generated automatically by crc32.c
|
||||
*/
|
||||
|
||||
local const unsigned long FAR crc_table[TBLS][256] =
|
||||
local const crc_table_t FAR crc_table[TBLS][256] =
|
||||
{
|
||||
{
|
||||
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
|
||||
|
||||
24
deflate.c
24
deflate.c
@@ -1,5 +1,5 @@
|
||||
/* deflate.c -- compress data using the deflation algorithm
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||
* Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
* REFERENCES
|
||||
*
|
||||
* Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
|
||||
* Available in http://www.ietf.org/rfc/rfc1951.txt
|
||||
* Available in http://tools.ietf.org/html/rfc1951
|
||||
*
|
||||
* A description of the Rabin and Karp algorithm is given in the book
|
||||
* "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "deflate.h"
|
||||
|
||||
const char deflate_copyright[] =
|
||||
" deflate 1.2.4.1 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
|
||||
" deflate 1.2.5.1 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
@@ -396,6 +396,18 @@ int ZEXPORT deflateSetHeader (strm, head)
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflatePending (strm, pending, bits)
|
||||
unsigned *pending;
|
||||
int *bits;
|
||||
z_streamp strm;
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||
*pending = strm->state->pending;
|
||||
*bits = strm->state->bi_valid;
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflatePrime (strm, bits, value)
|
||||
z_streamp strm;
|
||||
@@ -1001,15 +1013,15 @@ local int read_buf(strm, buf, size)
|
||||
|
||||
strm->avail_in -= len;
|
||||
|
||||
zmemcpy(buf, strm->next_in, len);
|
||||
if (strm->state->wrap == 1) {
|
||||
strm->adler = adler32(strm->adler, strm->next_in, len);
|
||||
strm->adler = adler32(strm->adler, buf, len);
|
||||
}
|
||||
#ifdef GZIP
|
||||
else if (strm->state->wrap == 2) {
|
||||
strm->adler = crc32(strm->adler, strm->next_in, len);
|
||||
strm->adler = crc32(strm->adler, buf, len);
|
||||
}
|
||||
#endif
|
||||
zmemcpy(buf, strm->next_in, len);
|
||||
strm->next_in += len;
|
||||
strm->total_in += len;
|
||||
|
||||
|
||||
26
deflate.h
26
deflate.h
@@ -1,5 +1,5 @@
|
||||
/* deflate.h -- internal compression state
|
||||
* Copyright (C) 1995-2009 Jean-loup Gailly
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -188,7 +188,7 @@ typedef struct internal_state {
|
||||
int nice_match; /* Stop searching when current match exceeds this */
|
||||
|
||||
/* used by trees.c: */
|
||||
/* Didn't use ct_data typedef below to supress compiler warning */
|
||||
/* Didn't use ct_data typedef below to suppress compiler warning */
|
||||
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
||||
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
||||
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
||||
@@ -290,13 +290,13 @@ typedef struct internal_state {
|
||||
memory checker errors from longest match routines */
|
||||
|
||||
/* in trees.c */
|
||||
void _tr_init OF((deflate_state *s));
|
||||
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||
int last));
|
||||
void _tr_align OF((deflate_state *s));
|
||||
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||
int last));
|
||||
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
|
||||
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
|
||||
ulg stored_len, int last));
|
||||
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
|
||||
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||
ulg stored_len, int last));
|
||||
|
||||
#define d_code(dist) \
|
||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||
@@ -309,11 +309,11 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||
/* Inline versions of _tr_tally for speed: */
|
||||
|
||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||
extern uch _length_code[];
|
||||
extern uch _dist_code[];
|
||||
extern uch ZLIB_INTERNAL _length_code[];
|
||||
extern uch ZLIB_INTERNAL _dist_code[];
|
||||
#else
|
||||
extern const uch _length_code[];
|
||||
extern const uch _dist_code[];
|
||||
extern const uch ZLIB_INTERNAL _length_code[];
|
||||
extern const uch ZLIB_INTERNAL _dist_code[];
|
||||
#endif
|
||||
|
||||
# define _tr_tally_lit(s, c, flush) \
|
||||
|
||||
@@ -206,4 +206,4 @@ Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
|
||||
pp. 337-343.
|
||||
|
||||
``DEFLATE Compressed Data Format Specification'' available in
|
||||
http://www.ietf.org/rfc/rfc1951.txt
|
||||
http://tools.ietf.org/html/rfc1951
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* example.c -- usage example of the zlib compression library
|
||||
* Copyright (C) 1995-2006 Jean-loup Gailly.
|
||||
* Copyright (C) 1995-2006, 2011 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -438,7 +438,7 @@ void test_dict_deflate(compr, comprLen)
|
||||
CHECK_ERR(err, "deflateInit");
|
||||
|
||||
err = deflateSetDictionary(&c_stream,
|
||||
(const Bytef*)dictionary, sizeof(dictionary));
|
||||
(const Bytef*)dictionary, (int)sizeof(dictionary));
|
||||
CHECK_ERR(err, "deflateSetDictionary");
|
||||
|
||||
dictId = c_stream.adler;
|
||||
@@ -491,7 +491,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
|
||||
exit(1);
|
||||
}
|
||||
err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
|
||||
sizeof(dictionary));
|
||||
(int)sizeof(dictionary));
|
||||
}
|
||||
CHECK_ERR(err, "inflate with dict");
|
||||
}
|
||||
|
||||
24
gzguts.h
24
gzguts.h
@@ -3,7 +3,7 @@
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#if _LARGEFILE64_SOURCE == 1
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
# ifndef _LARGEFILE_SOURCE
|
||||
# define _LARGEFILE_SOURCE 1
|
||||
# endif
|
||||
@@ -12,7 +12,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
|
||||
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
#else
|
||||
# define ZLIB_INTERNAL
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "zlib.h"
|
||||
@@ -56,10 +60,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _LARGEFILE64_SOURCE == 1
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# define z_off64_t z_off_t
|
||||
/* provide prototypes for these when building zlib without LFS */
|
||||
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
#endif
|
||||
|
||||
/* default i/o buffer size -- double this for output when reading */
|
||||
@@ -110,9 +116,9 @@ typedef struct {
|
||||
typedef gz_state FAR *gz_statep;
|
||||
|
||||
/* shared functions */
|
||||
ZEXTERN void ZEXPORT gz_error OF((gz_statep, int, const char *));
|
||||
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
||||
#if defined UNDER_CE
|
||||
ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error));
|
||||
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
||||
#endif
|
||||
|
||||
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||
@@ -121,6 +127,6 @@ ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error));
|
||||
#ifdef INT_MAX
|
||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
||||
#else
|
||||
ZEXTERN unsigned ZEXPORT gz_intmax OF((void));
|
||||
unsigned ZLIB_INTERNAL gz_intmax OF((void));
|
||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
||||
#endif
|
||||
|
||||
16
gzlib.c
16
gzlib.c
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "gzguts.h"
|
||||
|
||||
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define LSEEK lseek64
|
||||
#else
|
||||
# define LSEEK lseek
|
||||
@@ -26,7 +26,7 @@ local gzFile gz_open OF((const char *, int, const char *));
|
||||
|
||||
The gz_strwinerror function does not change the current setting of
|
||||
GetLastError. */
|
||||
char ZEXPORT *gz_strwinerror (error)
|
||||
char ZLIB_INTERNAL *gz_strwinerror (error)
|
||||
DWORD error;
|
||||
{
|
||||
static char buf[1024];
|
||||
@@ -91,6 +91,10 @@ local gzFile gz_open(path, fd, mode)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
/* check input */
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
|
||||
/* allocate gzFile structure to return */
|
||||
state = malloc(sizeof(gz_state));
|
||||
if (state == NULL)
|
||||
@@ -172,6 +176,7 @@ local gzFile gz_open(path, fd, mode)
|
||||
O_APPEND))),
|
||||
0666);
|
||||
if (state->fd == -1) {
|
||||
free(state->path);
|
||||
free(state);
|
||||
return NULL;
|
||||
}
|
||||
@@ -432,7 +437,8 @@ int ZEXPORT gzeof(file)
|
||||
return 0;
|
||||
|
||||
/* return end-of-file state */
|
||||
return state->mode == GZ_READ ? (state->eof && state->have == 0) : 0;
|
||||
return state->mode == GZ_READ ?
|
||||
(state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
|
||||
}
|
||||
|
||||
/* -- see zlib.h -- */
|
||||
@@ -480,7 +486,7 @@ void ZEXPORT gzclearerr(file)
|
||||
memory). Simply save the error message as a static string. If there is an
|
||||
allocation failure constructing the error message, then convert the error to
|
||||
out of memory. */
|
||||
void ZEXPORT gz_error(state, err, msg)
|
||||
void ZLIB_INTERNAL gz_error(state, err, msg)
|
||||
gz_statep state;
|
||||
int err;
|
||||
const char *msg;
|
||||
@@ -520,7 +526,7 @@ void ZEXPORT gz_error(state, err, msg)
|
||||
available) -- we need to do this to cover cases where 2's complement not
|
||||
used, since C standard permits 1's complement and sign-bit representations,
|
||||
otherwise we could just use ((unsigned)-1) >> 1 */
|
||||
unsigned ZEXPORT gz_intmax()
|
||||
unsigned ZLIB_INTERNAL gz_intmax()
|
||||
{
|
||||
unsigned p, q;
|
||||
|
||||
|
||||
10
gzwrite.c
10
gzwrite.c
@@ -1,5 +1,5 @@
|
||||
/* gzwrite.c -- zlib functions for writing gzip files
|
||||
* Copyright (C) 2004, 2005, 2010 Mark Adler
|
||||
* Copyright (C) 2004, 2005, 2010, 2011 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -274,7 +274,7 @@ int ZEXPORT gzputs(file, str)
|
||||
return ret == 0 && len != 0 ? -1 : ret;
|
||||
}
|
||||
|
||||
#ifdef STDC
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
#include <stdarg.h>
|
||||
|
||||
/* -- see zlib.h -- */
|
||||
@@ -346,7 +346,7 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
|
||||
return len;
|
||||
}
|
||||
|
||||
#else /* !STDC */
|
||||
#else /* !STDC && !Z_HAVE_STDARG_H */
|
||||
|
||||
/* -- see zlib.h -- */
|
||||
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||
@@ -366,6 +366,10 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||
state = (gz_statep)file;
|
||||
strm = &(state->strm);
|
||||
|
||||
/* check that can really pass pointer in ints */
|
||||
if (sizeof(int) != sizeof(void *))
|
||||
return 0;
|
||||
|
||||
/* check that we're writing and that there's no error */
|
||||
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* inffast.c -- fast decoding
|
||||
* Copyright (C) 1995-2008 Mark Adler
|
||||
* Copyright (C) 1995-2008, 2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
void inflate_fast(strm, start)
|
||||
void ZLIB_INTERNAL inflate_fast(strm, start)
|
||||
z_streamp strm;
|
||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* inffast.h -- header to use inffast.c
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* Copyright (C) 1995-2003, 2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
void inflate_fast OF((z_streamp strm, unsigned start));
|
||||
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define MAXBITS 15
|
||||
|
||||
const char inflate_copyright[] =
|
||||
" inflate 1.2.4.1 Copyright 1995-2010 Mark Adler ";
|
||||
" inflate 1.2.5.1 Copyright 1995-2010 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
@@ -29,7 +29,7 @@ const char inflate_copyright[] =
|
||||
table index bits. It will differ if the request is greater than the
|
||||
longest code or if it is less than the shortest code.
|
||||
*/
|
||||
int inflate_table(type, lens, codes, table, bits, work)
|
||||
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
|
||||
codetype type;
|
||||
unsigned short FAR *lens;
|
||||
unsigned codes;
|
||||
@@ -62,7 +62,7 @@ unsigned short FAR *work;
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 67, 206};
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 205, 203};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* inftrees.h -- header to use inftrees.c
|
||||
* Copyright (C) 1995-2005 Mark Adler
|
||||
* Copyright (C) 1995-2005, 2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -57,6 +57,6 @@ typedef enum {
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
extern int inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# ifdef UNDER_CE
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(file)
|
||||
@@ -50,9 +53,11 @@
|
||||
# include <unix.h> /* for fileno */
|
||||
#endif
|
||||
|
||||
#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE)
|
||||
#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
|
||||
extern int unlink OF((const char *));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(UNDER_CE)
|
||||
# include <windows.h>
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* ZLIB */
|
||||
/* */
|
||||
/* Compile sources into modules and link them into a service program. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
PGM
|
||||
|
||||
/* Configuration adjustable parameters. */
|
||||
|
||||
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Source library. */
|
||||
DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('SOURCES') /* Source member file. */
|
||||
DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('TOOLS') /* Control member file. */
|
||||
|
||||
DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('ZLIB') /* Module library. */
|
||||
|
||||
DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
|
||||
VALUE('LGPL') /* Service program library. */
|
||||
|
||||
DCL VAR(&CFLAGS) TYPE(*CHAR) +
|
||||
VALUE('OPTIMIZE(40)') /* Compile options. */
|
||||
|
||||
|
||||
/* Working storage. */
|
||||
|
||||
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */
|
||||
DCL VAR(&CMD) TYPE(*CHAR) LEN(512)
|
||||
|
||||
|
||||
/* Compile sources into modules. */
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/ADLER32) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/COMPRESS) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/CRC32) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/DEFLATE) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/GZIO) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/INFBACK) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/INFFAST) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/INFLATE) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/INFTREES) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/TREES) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/UNCOMPR) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
|
||||
'/ZUTIL) SRCFILE(' *TCAT +
|
||||
&SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
|
||||
') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
|
||||
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
|
||||
|
||||
|
||||
/* Link modules into a service program. */
|
||||
|
||||
CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) +
|
||||
MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS +
|
||||
&MODLIB/CRC32 &MODLIB/DEFLATE +
|
||||
&MODLIB/GZIO &MODLIB/INFBACK +
|
||||
&MODLIB/INFFAST &MODLIB/INFLATE +
|
||||
&MODLIB/INFTREES &MODLIB/TREES +
|
||||
&MODLIB/UNCOMPR &MODLIB/ZUTIL) +
|
||||
SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
|
||||
TEXT('ZLIB 1.2.3') TGTRLS(V4R4M0)
|
||||
|
||||
ENDPGM
|
||||
@@ -1,41 +0,0 @@
|
||||
This directory contains project files for building zlib under various
|
||||
Integrated Development Environments (IDE).
|
||||
|
||||
If you wish to submit a new project to this directory, you should comply
|
||||
to the following requirements. Otherwise (e.g. if you wish to integrate
|
||||
a custom piece of code that changes the zlib interface or its behavior),
|
||||
please consider submitting the project to the contrib directory.
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
- The project must build zlib using the source files from the official
|
||||
zlib source distribution, exclusively.
|
||||
|
||||
- If the project produces redistributable builds (e.g. shared objects
|
||||
or DLL files), these builds must be compatible to those produced by
|
||||
makefiles, if such makefiles exist in the zlib distribution.
|
||||
In particular, if the project produces a DLL build for the Win32
|
||||
platform, this build must comply to the officially-ammended Win32 DLL
|
||||
Application Binary Interface (ABI), described in win32/DLL_FAQ.txt.
|
||||
|
||||
- The project may provide additional build targets, which depend on
|
||||
3rd-party (unofficially-supported) software, present in the contrib
|
||||
directory. For example, it is possible to provide an "ASM build",
|
||||
besides the officially-supported build, and have ASM source files
|
||||
among its dependencies.
|
||||
|
||||
- If there are significant differences between the project files created
|
||||
by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name
|
||||
of the project directory should contain the version number of the IDE
|
||||
for which the project is intended (e.g. "visualc6" for Visual C++ 6.0,
|
||||
or "visualc7" for Visual C++ 7.0 and 7.1).
|
||||
|
||||
|
||||
Current projects
|
||||
================
|
||||
|
||||
visualc6/ by Simon-Pierre Cadieux <methodex@methodex.ca>
|
||||
and Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
||||
Project for Microsoft Visual C++ 6.0
|
||||
@@ -25,10 +25,10 @@
|
||||
<QPG:Files>
|
||||
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||
<QPG:Add file="../libz.so.1.2.4.1" install="/opt/lib/" user="root:bin" permission="644"/>
|
||||
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.4.1"/>
|
||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.4.1"/>
|
||||
<QPG:Add file="../libz.so.1.2.4.1" install="/opt/lib/" component="slib"/>
|
||||
<QPG:Add file="../libz.so.1.2.5.1" install="/opt/lib/" user="root:bin" permission="644"/>
|
||||
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.5.1"/>
|
||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.5.1"/>
|
||||
<QPG:Add file="../libz.so.1.2.5.1" install="/opt/lib/" component="slib"/>
|
||||
</QPG:Files>
|
||||
|
||||
<QPG:PackageFilter>
|
||||
@@ -63,7 +63,7 @@
|
||||
</QPM:ProductDescription>
|
||||
|
||||
<QPM:ReleaseDescription>
|
||||
<QPM:ReleaseVersion>1.2.4.1</QPM:ReleaseVersion>
|
||||
<QPM:ReleaseVersion>1.2.5.1</QPM:ReleaseVersion>
|
||||
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
||||
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
||||
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" ?>
|
||||
<package name="zlib" version="1.2.4.1">
|
||||
<library name="zlib" dlversion="1.2.4.1" dlname="z">
|
||||
<package name="zlib" version="1.2.5.1">
|
||||
<library name="zlib" dlversion="1.2.5.1" dlname="z">
|
||||
<property name="description"> zip compression library </property>
|
||||
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
|
||||
|
||||
|
||||
17
trees.c
17
trees.c
@@ -1,5 +1,5 @@
|
||||
/* trees.c -- output deflated data using Huffman coding
|
||||
* Copyright (C) 1995-2009 Jean-loup Gailly
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly
|
||||
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
@@ -351,13 +351,14 @@ void gen_trees_header()
|
||||
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
|
||||
}
|
||||
|
||||
fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
|
||||
fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
|
||||
for (i = 0; i < DIST_CODE_LEN; i++) {
|
||||
fprintf(header, "%2u%s", _dist_code[i],
|
||||
SEPARATOR(i, DIST_CODE_LEN-1, 20));
|
||||
}
|
||||
|
||||
fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
|
||||
fprintf(header,
|
||||
"const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
|
||||
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
|
||||
fprintf(header, "%2u%s", _length_code[i],
|
||||
SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
|
||||
@@ -382,7 +383,7 @@ void gen_trees_header()
|
||||
/* ===========================================================================
|
||||
* Initialize the tree data structures for a new zlib stream.
|
||||
*/
|
||||
void _tr_init(s)
|
||||
void ZLIB_INTERNAL _tr_init(s)
|
||||
deflate_state *s;
|
||||
{
|
||||
tr_static_init();
|
||||
@@ -867,7 +868,7 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
|
||||
/* ===========================================================================
|
||||
* Send a stored block
|
||||
*/
|
||||
void _tr_stored_block(s, buf, stored_len, last)
|
||||
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
||||
deflate_state *s;
|
||||
charf *buf; /* input block */
|
||||
ulg stored_len; /* length of input block */
|
||||
@@ -892,7 +893,7 @@ void _tr_stored_block(s, buf, stored_len, last)
|
||||
* To simplify the code, we assume the worst case of last real code encoded
|
||||
* on one bit only.
|
||||
*/
|
||||
void _tr_align(s)
|
||||
void ZLIB_INTERNAL _tr_align(s)
|
||||
deflate_state *s;
|
||||
{
|
||||
send_bits(s, STATIC_TREES<<1, 3);
|
||||
@@ -921,7 +922,7 @@ void _tr_align(s)
|
||||
* Determine the best encoding for the current block: dynamic trees, static
|
||||
* trees or store, and output the encoded block to the zip file.
|
||||
*/
|
||||
void _tr_flush_block(s, buf, stored_len, last)
|
||||
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||
deflate_state *s;
|
||||
charf *buf; /* input block, or NULL if too old */
|
||||
ulg stored_len; /* length of input block */
|
||||
@@ -1022,7 +1023,7 @@ void _tr_flush_block(s, buf, stored_len, last)
|
||||
* Save the match info and tally the frequency counts. Return true if
|
||||
* the current block must be flushed.
|
||||
*/
|
||||
int _tr_tally (s, dist, lc)
|
||||
int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
||||
deflate_state *s;
|
||||
unsigned dist; /* distance of matched string */
|
||||
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
||||
|
||||
4
trees.h
4
trees.h
@@ -70,7 +70,7 @@ local const ct_data static_dtree[D_CODES] = {
|
||||
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
|
||||
};
|
||||
|
||||
const uch _dist_code[DIST_CODE_LEN] = {
|
||||
const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
|
||||
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
@@ -99,7 +99,7 @@ const uch _dist_code[DIST_CODE_LEN] = {
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
||||
};
|
||||
|
||||
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
||||
const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
|
||||
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
|
||||
|
||||
@@ -25,7 +25,12 @@
|
||||
|
||||
STATICLIB = libz.a
|
||||
SHAREDLIB = zlib1.dll
|
||||
IMPLIB = libzdll.a
|
||||
IMPLIB = libz.dll.a
|
||||
|
||||
#
|
||||
# Set to 1 if shared object needs to be installed
|
||||
#
|
||||
SHARED_MODE=0
|
||||
|
||||
#LOC = -DASMV
|
||||
#LOC = -DDEBUG -g
|
||||
@@ -33,12 +38,13 @@ IMPLIB = libzdll.a
|
||||
PREFIX =
|
||||
CC = $(PREFIX)gcc
|
||||
CFLAGS = $(LOC) -O3 -Wall
|
||||
EXTRA_CFLAGS = -DNO_VIZ
|
||||
|
||||
AS = $(CC)
|
||||
ASFLAGS = $(LOC) -Wall
|
||||
|
||||
LD = $(CC)
|
||||
LDFLAGS = $(LOC) -s
|
||||
LDFLAGS = $(LOC)
|
||||
|
||||
AR = $(PREFIX)ar
|
||||
ARFLAGS = rcs
|
||||
@@ -53,7 +59,7 @@ CP = cp -fp
|
||||
INSTALL = $(CP)
|
||||
RM = rm -f
|
||||
|
||||
prefix = /usr/local
|
||||
prefix ?= /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
|
||||
OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
|
||||
@@ -71,7 +77,7 @@ testdll: example_d.exe minigzip_d.exe
|
||||
echo hello world | ./minigzip_d | ./minigzip_d -d
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
.S.o:
|
||||
$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
@@ -82,43 +88,62 @@ $(STATICLIB): $(OBJS) $(OBJA)
|
||||
$(IMPLIB): $(SHAREDLIB)
|
||||
|
||||
$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
|
||||
$(CC) -shared -Wl,--out-implib,$(IMPLIB) \
|
||||
$(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
|
||||
-o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
|
||||
$(STRIP) $@
|
||||
|
||||
example.exe: example.o $(STATICLIB)
|
||||
$(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
|
||||
$(STRIP) $@
|
||||
|
||||
minigzip.exe: minigzip.o $(STATICLIB)
|
||||
$(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
|
||||
$(STRIP) $@
|
||||
|
||||
example_d.exe: example.o $(IMPLIB)
|
||||
$(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
|
||||
$(STRIP) $@
|
||||
|
||||
minigzip_d.exe: minigzip.o $(IMPLIB)
|
||||
$(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
|
||||
$(STRIP) $@
|
||||
|
||||
zlibrc.o: win32/zlib1.rc
|
||||
$(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
|
||||
|
||||
|
||||
# INCLUDE_PATH and LIBRARY_PATH must be set.
|
||||
# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
|
||||
|
||||
.PHONY: install uninstall clean
|
||||
|
||||
install: zlib.h zconf.h $(LIB)
|
||||
install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
|
||||
-@mkdir -p $(INCLUDE_PATH)
|
||||
-@mkdir -p $(LIBRARY_PATH)
|
||||
-@mkdir -p $(LIBRARY_PATH) $(LIBRARY_PATH)/pkgconfig
|
||||
-if [ "$(SHARED_MODE)" = "1" ]; then \
|
||||
mkdir -p $(BINARY_PATH); \
|
||||
$(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \
|
||||
$(INSTALL) $(IMPLIB) $(LIBRARY_PATH); \
|
||||
fi
|
||||
-$(INSTALL) zlib.h $(INCLUDE_PATH)
|
||||
-$(INSTALL) zconf.h $(INCLUDE_PATH)
|
||||
-$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
|
||||
-$(INSTALL) $(IMPLIB) $(LIBRARY_PATH)
|
||||
sed \
|
||||
-e 's|@prefix@|${prefix}|g' \
|
||||
-e 's|@exec_prefix@|${exec_prefix}|g' \
|
||||
-e 's|@libdir@|$(LIBRARY_PATH)|g' \
|
||||
-e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
|
||||
-e 's|@includedir@|$(INCLUDE_PATH)|g' \
|
||||
-e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
|
||||
zlib.pc.in > $(LIBRARY_PATH)/pkgconfig/zlib.pc
|
||||
|
||||
uninstall:
|
||||
-if [ "$(SHARED_MODE)" = "1" ]; then \
|
||||
$(RM) $(BINARY_PATH)/$(SHAREDLIB); \
|
||||
$(RM) $(LIBRARY_PATH)/$(IMPLIB); \
|
||||
fi
|
||||
-$(RM) $(INCLUDE_PATH)/zlib.h
|
||||
-$(RM) $(INCLUDE_PATH)/zconf.h
|
||||
-$(RM) $(LIBRARY_PATH)/$(STATICLIB)
|
||||
-$(RM) $(LIBRARY_PATH)/$(IMPLIB)
|
||||
|
||||
clean:
|
||||
-$(RM) $(STATICLIB)
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
|
||||
#
|
||||
# Usage:
|
||||
# nmake -f win32/Makefile.msc (standard build)
|
||||
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
|
||||
# nmake -f win32/Makefile.msc LOC=-DASMV OBJA=match.obj (use ASM code)
|
||||
|
||||
# nmake -f win32/Makefile.msc (standard build)
|
||||
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
|
||||
# nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
|
||||
# OBJA="inffas32.obj match686.obj" (use ASM code, x86)
|
||||
# nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF" \
|
||||
# OBJA="inffasx64.obj gvmat64.obj inffas8664.c" (use ASM code, x64)
|
||||
|
||||
# optional build flags
|
||||
LOC =
|
||||
|
||||
|
||||
# variables
|
||||
STATICLIB = zlib.lib
|
||||
SHAREDLIB = zlib1.dll
|
||||
@@ -23,13 +24,13 @@ AR = lib
|
||||
RC = rc
|
||||
CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
|
||||
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
|
||||
ASFLAGS = -coff -Zi
|
||||
ASFLAGS = -coff -Zi $(LOC)
|
||||
LDFLAGS = -nologo -debug -incremental:no -opt:ref
|
||||
ARFLAGS = -nologo
|
||||
RCFLAGS = /dWIN32 /r
|
||||
|
||||
OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
|
||||
gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
|
||||
gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
|
||||
OBJA =
|
||||
|
||||
|
||||
@@ -71,7 +72,13 @@ minigzip_d.exe: minigzip.obj $(IMPLIB)
|
||||
.c.obj:
|
||||
$(CC) -c $(WFLAGS) $(CFLAGS) $<
|
||||
|
||||
.asm.obj:
|
||||
{contrib/masmx64}.c.obj:
|
||||
$(CC) -c $(WFLAGS) $(CFLAGS) $<
|
||||
|
||||
{contrib/masmx64}.asm.obj:
|
||||
$(AS) -c $(ASFLAGS) $<
|
||||
|
||||
{contrib/masmx86}.asm.obj:
|
||||
$(AS) -c $(ASFLAGS) $<
|
||||
|
||||
adler32.obj: adler32.c zlib.h zconf.h
|
||||
@@ -107,6 +114,17 @@ uncompr.obj: uncompr.c zlib.h zconf.h
|
||||
|
||||
zutil.obj: zutil.c zutil.h zlib.h zconf.h
|
||||
|
||||
gvmat64.obj: contrib\masmx64\gvmat64.asm
|
||||
|
||||
inffasx64.obj: contrib\masmx64\inffasx64.asm
|
||||
|
||||
inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \
|
||||
inftrees.h inflate.h inffast.h
|
||||
|
||||
inffas32.obj: contrib\masmx86\inffas32.asm
|
||||
|
||||
match686.obj: contrib\masmx86\match686.asm
|
||||
|
||||
example.obj: example.c zlib.h zconf.h
|
||||
|
||||
minigzip.obj: minigzip.c zlib.h zconf.h
|
||||
|
||||
@@ -47,9 +47,9 @@ The package zlib-1.2.4-win32-x86.zip contains the following files:
|
||||
zdll.lib Install these files into the compilers' LIB path if linking
|
||||
zdll.exp a compiled program to the zlib1.dll binary
|
||||
|
||||
zlib.lib Install these files into the compilers' LIB path if linking
|
||||
zlib.pdb a compiled program to the zlib1.dll binary (zlib.pdb ensures
|
||||
that the resulting program may be debugged)
|
||||
zlib.lib Install these files into the compilers' LIB path to link zlib
|
||||
zlib.pdb into compiled programs, without zlib1.dll runtime dependency
|
||||
(zlib.pdb provides debugging info to the compile time linker)
|
||||
|
||||
zlib1.dll Install this binary shared library into the system PATH, or
|
||||
the program's runtime directory (where the .exe resides)
|
||||
|
||||
@@ -15,6 +15,7 @@ EXPORTS
|
||||
deflateParams
|
||||
deflateTune
|
||||
deflateBound
|
||||
deflatePending
|
||||
deflatePrime
|
||||
deflateSetHeader
|
||||
inflateSetDictionary
|
||||
|
||||
45
zconf.h
45
zconf.h
@@ -1,5 +1,5 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||
* Copyright (C) 1995-2011 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* this permanently in zconf.h using "./configure --zprefix".
|
||||
*/
|
||||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||
# define Z_PREFIX_SET
|
||||
|
||||
/* all linked symbols */
|
||||
# define _dist_code z__dist_code
|
||||
@@ -40,6 +41,7 @@
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflatePending z_deflatePending
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
@@ -243,6 +245,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ON /* function prototypes for stdarg */
|
||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# define ON(args) args
|
||||
# else
|
||||
# define ON(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
@@ -315,10 +325,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VISIBILITY_PRAGMA
|
||||
# define ZEXTERN __attribute__((visibility ("default"))) extern
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
@@ -364,8 +370,29 @@ typedef uLong FAR uLongf;
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || _LARGEFILE64_SOURCE == 1
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
#ifdef STDC
|
||||
# include <sys/types.h> /* for off_t */
|
||||
#endif
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LARGE
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
@@ -385,6 +412,12 @@ typedef uLong FAR uLongf;
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# define z_off64_t z_off_t
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||
* Copyright (C) 1995-2011 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* this permanently in zconf.h using "./configure --zprefix".
|
||||
*/
|
||||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||
# define Z_PREFIX_SET
|
||||
|
||||
/* all linked symbols */
|
||||
# define _dist_code z__dist_code
|
||||
@@ -42,6 +43,7 @@
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflatePending z_deflatePending
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
@@ -245,6 +247,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ON /* function prototypes for stdarg */
|
||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# define ON(args) args
|
||||
# else
|
||||
# define ON(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
@@ -317,10 +327,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VISIBILITY_PRAGMA
|
||||
# define ZEXTERN __attribute__((visibility ("default"))) extern
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
@@ -366,8 +372,29 @@ typedef uLong FAR uLongf;
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || _LARGEFILE64_SOURCE == 1
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
#ifdef STDC
|
||||
# include <sys/types.h> /* for off_t */
|
||||
#endif
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LARGE
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
@@ -387,6 +414,12 @@ typedef uLong FAR uLongf;
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# define z_off64_t z_off_t
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
45
zconf.h.in
45
zconf.h.in
@@ -1,5 +1,5 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||
* Copyright (C) 1995-2011 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* this permanently in zconf.h using "./configure --zprefix".
|
||||
*/
|
||||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||
# define Z_PREFIX_SET
|
||||
|
||||
/* all linked symbols */
|
||||
# define _dist_code z__dist_code
|
||||
@@ -40,6 +41,7 @@
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflatePending z_deflatePending
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
@@ -243,6 +245,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ON /* function prototypes for stdarg */
|
||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# define ON(args) args
|
||||
# else
|
||||
# define ON(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
@@ -315,10 +325,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VISIBILITY_PRAGMA
|
||||
# define ZEXTERN __attribute__((visibility ("default"))) extern
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
@@ -364,8 +370,29 @@ typedef uLong FAR uLongf;
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || _LARGEFILE64_SOURCE == 1
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
#ifdef STDC
|
||||
# include <sys/types.h> /* for off_t */
|
||||
#endif
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LARGE
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
@@ -385,6 +412,12 @@ typedef uLong FAR uLongf;
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# define z_off64_t z_off_t
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
12
zlib.3
12
zlib.3
@@ -1,4 +1,4 @@
|
||||
.TH ZLIB 3 "28 Mar 2010"
|
||||
.TH ZLIB 3 "10 Sep 2011"
|
||||
.SH NAME
|
||||
zlib \- compression/decompression library
|
||||
.SH SYNOPSIS
|
||||
@@ -95,11 +95,11 @@ http://zlib.net/
|
||||
The data format used by the zlib library is described by RFC
|
||||
(Request for Comments) 1950 to 1952 in the files:
|
||||
.IP
|
||||
http://www.ietf.org/rfc/rfc1950.txt (for the zlib header and trailer format)
|
||||
http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format)
|
||||
.br
|
||||
http://www.ietf.org/rfc/rfc1951.txt (for the deflate compressed data format)
|
||||
http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format)
|
||||
.br
|
||||
http://www.ietf.org/rfc/rfc1952.txt (for the gzip header and trailer format)
|
||||
http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format)
|
||||
.LP
|
||||
Mark Nelson wrote an article about
|
||||
.I zlib
|
||||
@@ -125,8 +125,8 @@ before asking for help.
|
||||
Send questions and/or comments to zlib@gzip.org,
|
||||
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
||||
.SH AUTHORS
|
||||
Version 1.2.4.1
|
||||
Copyright (C) 1995-2010 Jean-loup Gailly (jloup@gzip.org)
|
||||
Version 1.2.5.1
|
||||
Copyright (C) 1995-2011 Jean-loup Gailly (jloup@gzip.org)
|
||||
and Mark Adler (madler@alumni.caltech.edu).
|
||||
.LP
|
||||
This software is provided "as-is,"
|
||||
|
||||
BIN
zlib.3.pdf
BIN
zlib.3.pdf
Binary file not shown.
142
zlib.h
142
zlib.h
@@ -1,7 +1,7 @@
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.2.4.1, March 28th, 2010
|
||||
version 1.2.5.1, September 10th, 2011
|
||||
|
||||
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||
Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
|
||||
The data format used by the zlib library is described by RFCs (Request for
|
||||
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
|
||||
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
|
||||
Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
|
||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||
*/
|
||||
|
||||
#ifndef ZLIB_H
|
||||
@@ -37,11 +37,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ZLIB_VERSION "1.2.4.1"
|
||||
#define ZLIB_VERNUM 0x1241
|
||||
#define ZLIB_VERSION "1.2.5.1"
|
||||
#define ZLIB_VERNUM 0x1251
|
||||
#define ZLIB_VER_MAJOR 1
|
||||
#define ZLIB_VER_MINOR 2
|
||||
#define ZLIB_VER_REVISION 4
|
||||
#define ZLIB_VER_REVISION 5
|
||||
#define ZLIB_VER_SUBREVISION 1
|
||||
|
||||
/*
|
||||
@@ -85,11 +85,11 @@ struct internal_state;
|
||||
typedef struct z_stream_s {
|
||||
Bytef *next_in; /* next input byte */
|
||||
uInt avail_in; /* number of bytes available at next_in */
|
||||
uLong total_in; /* total nb of input bytes read so far */
|
||||
uLong total_in; /* total number of input bytes read so far */
|
||||
|
||||
Bytef *next_out; /* next output byte should be put there */
|
||||
uInt avail_out; /* remaining free space at next_out */
|
||||
uLong total_out; /* total nb of bytes output so far */
|
||||
uLong total_out; /* total number of bytes output so far */
|
||||
|
||||
char *msg; /* last error message, NULL if no error */
|
||||
struct internal_state FAR *state; /* not visible by applications */
|
||||
@@ -327,8 +327,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||
|
||||
Z_FINISH can be used immediately after deflateInit if all the compression
|
||||
is to be done in a single step. In this case, avail_out must be at least the
|
||||
value returned by deflateBound (see below). If deflate does not return
|
||||
Z_STREAM_END, then it must be called again as described above.
|
||||
value returned by deflateBound (see below). Then deflate is guaranteed to
|
||||
return Z_STREAM_END. If not enough output space is provided, deflate will
|
||||
not return Z_STREAM_END, and it must be called again as described above.
|
||||
|
||||
deflate() sets strm->adler to the adler32 checksum of all input read
|
||||
so far (that is, total_in bytes).
|
||||
@@ -688,8 +689,27 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
|
||||
deflation of sourceLen bytes. It must be called after deflateInit() or
|
||||
deflateInit2(), and after deflateSetHeader(), if used. This would be used
|
||||
to allocate an output buffer for deflation in a single pass, and so would be
|
||||
called before deflate().
|
||||
called before deflate(). If that first deflate() call is provided the
|
||||
sourceLen input bytes, an output buffer allocated to the size returned by
|
||||
deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
|
||||
to return Z_STREAM_END. Note that it is possible for the compressed size to
|
||||
be larger than the value returned by deflateBound() if flush options other
|
||||
than Z_FINISH or Z_NO_FLUSH are used.
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
|
||||
unsigned *pending,
|
||||
int *bits));
|
||||
/*
|
||||
deflatePending() returns the number of bytes and bits of output that have
|
||||
been generated, but not yet provided in the available output. The bytes not
|
||||
provided would be due to the available output space having being consumed.
|
||||
The number of bits of output not provided are between 0 and 7, where they
|
||||
await more bits to join them in order to fill out a full byte.
|
||||
|
||||
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent.
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
|
||||
int bits,
|
||||
@@ -805,17 +825,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||
|
||||
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
|
||||
/*
|
||||
Skips invalid compressed data until a full flush point (see above the
|
||||
description of deflate with Z_FULL_FLUSH) can be found, or until all
|
||||
Skips invalid compressed data until a possible full flush point (see above
|
||||
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
|
||||
available input is skipped. No output is provided.
|
||||
|
||||
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
|
||||
if no more input was provided, Z_DATA_ERROR if no flush point has been
|
||||
found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
|
||||
success case, the application may save the current current value of total_in
|
||||
which indicates where valid compressed data was found. In the error case,
|
||||
the application may repeatedly call inflateSync, providing more input each
|
||||
time, until success or end of the input data.
|
||||
inflateSync searches for a 00 00 FF FF pattern in the compressed data.
|
||||
All full flush points have this pattern, but not all occurences of this
|
||||
pattern are full flush points.
|
||||
|
||||
inflateSync returns Z_OK if a possible full flush point has been found,
|
||||
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
||||
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
||||
In the success case, the application may save the current current value of
|
||||
total_in which indicates where valid compressed data was found. In the
|
||||
error case, the application may repeatedly call inflateSync, providing more
|
||||
input each time, until success or end of the input data.
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
|
||||
@@ -962,7 +986,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
|
||||
See inflateBack() for the usage of these routines.
|
||||
|
||||
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
|
||||
the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
|
||||
the parameters are invalid, Z_MEM_ERROR if the internal state could not be
|
||||
allocated, or Z_VERSION_ERROR if the version of the library does not match
|
||||
the version of the header file.
|
||||
*/
|
||||
@@ -1256,7 +1280,7 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
|
||||
error.
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
|
||||
ZEXTERN int ZEXPORTVA gzprintf ON((gzFile file, const char *format, ...));
|
||||
/*
|
||||
Converts, formats, and writes the arguments to the compressed file under
|
||||
control of the format string, as in fprintf. gzprintf returns the number of
|
||||
@@ -1492,7 +1516,9 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
|
||||
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
|
||||
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
|
||||
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
|
||||
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
|
||||
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
|
||||
that the z_off_t type (like off_t) is a signed integer. If len2 is
|
||||
negative, the result has no meaning or utility.
|
||||
*/
|
||||
|
||||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||
@@ -1544,41 +1570,57 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
||||
const char *version,
|
||||
int stream_size));
|
||||
#define deflateInit(strm, level) \
|
||||
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
|
||||
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||
#define inflateInit(strm) \
|
||||
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
|
||||
inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
|
||||
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
|
||||
(strategy), ZLIB_VERSION, sizeof(z_stream))
|
||||
(strategy), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||
#define inflateInit2(strm, windowBits) \
|
||||
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
|
||||
inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
||||
(int)sizeof(z_stream))
|
||||
#define inflateBackInit(strm, windowBits, window) \
|
||||
inflateBackInit_((strm), (windowBits), (window), \
|
||||
ZLIB_VERSION, sizeof(z_stream))
|
||||
ZLIB_VERSION, (int)sizeof(z_stream))
|
||||
|
||||
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
|
||||
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
||||
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
|
||||
* both are true, the application gets the *64 functions, and the regular
|
||||
* functions are changed to 64 bits) -- in case these are set on systems
|
||||
* without large file support, _LFS64_LARGEFILE must also be true
|
||||
*/
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||
ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int));
|
||||
ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
|
||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
|
||||
#endif
|
||||
|
||||
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64 && _LFS64_LARGEFILE == 1
|
||||
# define gzopen gzopen64
|
||||
# define gzseek gzseek64
|
||||
# define gztell gztell64
|
||||
# define gzoffset gzoffset64
|
||||
# define adler32_combine adler32_combine64
|
||||
# define crc32_combine crc32_combine64
|
||||
# if _LARGEFILE64_SOURCE != 1
|
||||
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
|
||||
# ifdef Z_PREFIX_SET
|
||||
# define z_gzopen z_gzopen64
|
||||
# define z_gzseek z_gzseek64
|
||||
# define z_gztell z_gztell64
|
||||
# define z_gzoffset z_gzoffset64
|
||||
# define z_adler32_combine z_adler32_combine64
|
||||
# define z_crc32_combine z_crc32_combine64
|
||||
# else
|
||||
# define gzopen gzopen64
|
||||
# define gzseek gzseek64
|
||||
# define gztell gztell64
|
||||
# define gzoffset gzoffset64
|
||||
# define adler32_combine adler32_combine64
|
||||
# define crc32_combine crc32_combine64
|
||||
# endif
|
||||
# ifndef _LARGEFILE64_SOURCE
|
||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||
ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
|
||||
ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t));
|
||||
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
|
||||
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
||||
# endif
|
||||
#else
|
||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
|
||||
@@ -1589,10 +1631,12 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
||||
#endif
|
||||
|
||||
/* hack for buggy compilers */
|
||||
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
|
||||
struct internal_state {int dummy;}; /* hack for buggy compilers */
|
||||
struct internal_state {int dummy;};
|
||||
#endif
|
||||
|
||||
/* undocumented functions */
|
||||
ZEXTERN const char * ZEXPORT zError OF((int));
|
||||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
|
||||
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
|
||||
|
||||
4
zlib.map
4
zlib.map
@@ -66,3 +66,7 @@ ZLIB_1.2.3.5 {
|
||||
gzclose_r;
|
||||
gzclose_w;
|
||||
} ZLIB_1.2.3.4;
|
||||
|
||||
ZLIB_1.2.5.1 {
|
||||
deflatePending;
|
||||
} ZLIB_1.2.5;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
sharedlibdir=@sharedlibdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: zlib
|
||||
@@ -8,5 +9,5 @@ Description: zlib compression library
|
||||
Version: @VERSION@
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -lz
|
||||
Libs: -L${libdir} -L${sharedlibdir} -lz
|
||||
Cflags: -I${includedir}
|
||||
|
||||
26
zutil.c
26
zutil.c
@@ -1,5 +1,5 @@
|
||||
/* zutil.c -- target dependent utility functions for the compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* Copyright (C) 1995-2005, 2010, 2011 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ uLong ZEXPORT zlibCompileFlags()
|
||||
#ifdef FASTEST
|
||||
flags += 1L << 21;
|
||||
#endif
|
||||
#ifdef STDC
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# ifdef NO_vsnprintf
|
||||
flags += 1L << 25;
|
||||
# ifdef HAS_vsprintf_void
|
||||
@@ -117,9 +117,9 @@ uLong ZEXPORT zlibCompileFlags()
|
||||
# ifndef verbose
|
||||
# define verbose 0
|
||||
# endif
|
||||
int z_verbose = verbose;
|
||||
int ZLIB_INTERNAL z_verbose = verbose;
|
||||
|
||||
void z_error (m)
|
||||
void ZLIB_INTERNAL z_error (m)
|
||||
char *m;
|
||||
{
|
||||
fprintf(stderr, "%s\n", m);
|
||||
@@ -146,7 +146,7 @@ const char * ZEXPORT zError(err)
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
|
||||
void zmemcpy(dest, source, len)
|
||||
void ZLIB_INTERNAL zmemcpy(dest, source, len)
|
||||
Bytef* dest;
|
||||
const Bytef* source;
|
||||
uInt len;
|
||||
@@ -157,7 +157,7 @@ void zmemcpy(dest, source, len)
|
||||
} while (--len != 0);
|
||||
}
|
||||
|
||||
int zmemcmp(s1, s2, len)
|
||||
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
||||
const Bytef* s1;
|
||||
const Bytef* s2;
|
||||
uInt len;
|
||||
@@ -170,7 +170,7 @@ int zmemcmp(s1, s2, len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zmemzero(dest, len)
|
||||
void ZLIB_INTERNAL zmemzero(dest, len)
|
||||
Bytef* dest;
|
||||
uInt len;
|
||||
{
|
||||
@@ -213,7 +213,7 @@ local ptr_table table[MAX_PTR];
|
||||
* a protected system like OS/2. Use Microsoft C instead.
|
||||
*/
|
||||
|
||||
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||
{
|
||||
voidpf buf = opaque; /* just to make some compilers happy */
|
||||
ulg bsize = (ulg)items*size;
|
||||
@@ -237,7 +237,7 @@ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||
return buf;
|
||||
}
|
||||
|
||||
void zcfree (voidpf opaque, voidpf ptr)
|
||||
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||
{
|
||||
int n;
|
||||
if (*(ush*)&ptr != 0) { /* object < 64K */
|
||||
@@ -272,13 +272,13 @@ void zcfree (voidpf opaque, voidpf ptr)
|
||||
# define _hfree hfree
|
||||
#endif
|
||||
|
||||
voidpf zcalloc (voidpf opaque, uInt items, uInt size)
|
||||
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
|
||||
{
|
||||
if (opaque) opaque = 0; /* to make compiler happy */
|
||||
return _halloc((long)items, size);
|
||||
}
|
||||
|
||||
void zcfree (voidpf opaque, voidpf ptr)
|
||||
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||
{
|
||||
if (opaque) opaque = 0; /* to make compiler happy */
|
||||
_hfree(ptr);
|
||||
@@ -297,7 +297,7 @@ extern voidp calloc OF((uInt items, uInt size));
|
||||
extern void free OF((voidpf ptr));
|
||||
#endif
|
||||
|
||||
voidpf zcalloc (opaque, items, size)
|
||||
voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
|
||||
voidpf opaque;
|
||||
unsigned items;
|
||||
unsigned size;
|
||||
@@ -307,7 +307,7 @@ voidpf zcalloc (opaque, items, size)
|
||||
(voidpf)calloc(items, size);
|
||||
}
|
||||
|
||||
void zcfree (opaque, ptr)
|
||||
void ZLIB_INTERNAL zcfree (opaque, ptr)
|
||||
voidpf opaque;
|
||||
voidpf ptr;
|
||||
{
|
||||
|
||||
38
zutil.h
38
zutil.h
@@ -13,7 +13,12 @@
|
||||
#ifndef ZUTIL_H
|
||||
#define ZUTIL_H
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
|
||||
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
#else
|
||||
# define ZLIB_INTERNAL
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef STDC
|
||||
@@ -154,20 +159,10 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
#pragma warn -8066
|
||||
#endif
|
||||
|
||||
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# define z_off64_t z_off_t
|
||||
#endif
|
||||
|
||||
/* provide prototypes for these when building zlib without LFS */
|
||||
#if _LARGEFILE64_SOURCE != 1 || _LFS64_LARGEFILE != 1
|
||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||
ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
|
||||
ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t));
|
||||
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
||||
#endif
|
||||
|
||||
/* common defaults */
|
||||
@@ -241,16 +236,16 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||
# endif
|
||||
#else
|
||||
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||
extern void zmemzero OF((Bytef* dest, uInt len));
|
||||
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||
int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
|
||||
#endif
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
extern int z_verbose;
|
||||
extern void z_error OF((char *m));
|
||||
extern int ZLIB_INTERNAL z_verbose;
|
||||
extern void ZLIB_INTERNAL z_error OF((char *m));
|
||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||
@@ -267,8 +262,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
#endif
|
||||
|
||||
|
||||
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
||||
void zcfree OF((voidpf opaque, voidpf ptr));
|
||||
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
|
||||
unsigned size));
|
||||
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
||||
|
||||
#define ZALLOC(strm, items, size) \
|
||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||
|
||||
Reference in New Issue
Block a user