Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Adler
639be99788 zlib 1.2.3.3 2011-09-09 23:26:29 -07:00
Mark Adler
d6231142d2 zlib 1.2.3.2 2011-09-09 23:25:38 -07:00
31 changed files with 890 additions and 925 deletions

View File

@@ -1,6 +1,29 @@
ChangeLog file for zlib ChangeLog file for zlib
Changes in 1.2.3.3 (2 October 2006)
- Make --shared the default for configure, add a --static option
- Add compile option to permit invalid distance-too-far streams
- Add inflateUndermine() function which is required to enable above
- Remove use of "this" variable name for C++ compatibility [Marquess]
- Add testing of shared library in make test, if shared library built
- Use ftello() and fseeko() if available instead of ftell() and fseek()
- Provide two versions of all functions that use the z_off_t type for
binary compatibility -- a normal version and a 64-bit offset version,
per the Large File Support Extension when _LARGEFILE64_SUPPORT is
defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
is defined to be 64
- Add a --uname= option to configure to perhaps help with cross-compiling
Changes in 1.2.3.2 (3 September 2006)
- Turn off silly Borland warnings [Hay]
- Use off64_t and define _LARGEFILE64_SOURCE when present
- Fix missing dependency on inffixed.h in Makefile.in
- Rig configure --shared to build both shared and static [Teredesai, Truta]
- Remove zconf.in.h and instead create a new zlibdefs.h file
- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
Changes in 1.2.3.1 (16 August 2006) Changes in 1.2.3.1 (16 August 2006)
- Add watcom directory with OpenWatcom make files [Daniel] - Add watcom directory with OpenWatcom make files [Daniel]
- Remove #undef of FAR in zconf.in.h for MVS [Fedtke] - Remove #undef of FAR in zconf.in.h for MVS [Fedtke]

6
INDEX
View File

@@ -6,10 +6,10 @@ Makefile.in makefile for Unix (template for configure)
README guess what README guess what
configure configure script for Unix configure configure script for Unix
make_vms.com makefile for VMS make_vms.com makefile for VMS
zconf.in.h template for zconf.h (used by configure) treebuild.xml see http://treebuild.metux.de/
zlib.3 Man page for zlib zlib.3 Man page for zlib
zlib.map Linux symbol information zlib.map Linux symbol information
zlib.pc.in ?? zlib.pc.in Template for pkg-config descriptor
amiga/ makefiles for Amiga SAS C amiga/ makefiles for Amiga SAS C
as400/ makefiles for IBM AS/400 as400/ makefiles for IBM AS/400
@@ -19,13 +19,13 @@ old/ makefiles for various architectures and zlib documentation
files that have not yet been updated for zlib 1.2.x files that have not yet been updated for zlib 1.2.x
projects/ projects for various Integrated Development Environments projects/ projects for various Integrated Development Environments
qnx/ makefiles for QNX qnx/ makefiles for QNX
todo/ works in progress
watcom/ makefiles for OpenWatcom watcom/ makefiles for OpenWatcom
win32/ makefiles for Windows win32/ makefiles for Windows
zlib public header files (required for library use): zlib public header files (required for library use):
zconf.h zconf.h
zlib.h zlib.h
zlibdefs.h
private source files used to build the zlib library: private source files used to build the zlib library:
adler32.c adler32.c

120
Makefile
View File

@@ -24,13 +24,15 @@ CFLAGS=-O
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes # -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=libz.a LDFLAGS=libz.a
LDSHARED=$(CC) LDSHARED=$(CC)
CPP=$(CC) -E CPP=$(CC) -E
LIBS=libz.a LIBS=libz.a
SHAREDLIB=libz.so SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.3.1 SHAREDLIBV=libz.so.1.2.3.3
SHAREDLIBM=libz.so.1 SHAREDLIBM=libz.so.1
AR=ar AR=ar
@@ -47,20 +49,26 @@ mandir = ${prefix}/share/man
man3dir = ${mandir}/man3 man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig pkgconfigdir = ${libdir}/pkgconfig
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o zutil.o inflate.o infback.o inftrees.o inffast.o
OBJA = OBJA =
# to use the asm code: make OBJA=match.o # to use the asm code: make OBJA=match.o
OBJS = $(OBJC) $(OBJA)
PIC_OBJS = $(OBJS:%.o=%.lo)
TEST_OBJS = example.o minigzip.o TEST_OBJS = example.o minigzip.o
all: example$(EXE) minigzip$(EXE) allstatic: example$(EXE) minigzip$(EXE)
check: test allshared: examplesh$(EXE) minigzipsh$(EXE)
test: all
@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ all: allstatic allshared
echo hello world | ./minigzip | ./minigzip -d || \
teststatic: allstatic
@echo hello world | ./minigzip | ./minigzip -d || \
echo ' *** minigzip test FAILED ***' ; \ echo ' *** minigzip test FAILED ***' ; \
if ./example; then \ if ./example; then \
echo ' *** zlib test OK ***'; \ echo ' *** zlib test OK ***'; \
@@ -68,8 +76,24 @@ test: all
echo ' *** zlib test FAILED ***'; \ echo ' *** zlib test FAILED ***'; \
fi fi
libz.a: $(OBJS) $(OBJA) testshared: allshared
$(AR) $@ $(OBJS) $(OBJA) @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
echo hello world | ./minigzipsh | ./minigzipsh -d || \
echo ' *** minigzip shared test FAILED ***' ; \
if ./examplesh; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; \
fi
test: teststatic testshared
check: test
libz.a: $(OBJS)
$(AR) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S match.o: match.S
@@ -78,8 +102,17 @@ match.o: match.S
mv _match.o match.o mv _match.o match.o
rm -f _match.s rm -f _match.s
$(SHAREDLIBV): $(OBJS) match.lo: match.S
$(LDSHARED) -o $@ $(OBJS) $(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.lo
rm -f _match.s
%.lo: %.c
$(CC) $(SFLAGS) -DPIC -c $< -o $@
$(SHAREDLIBV): $(PIC_OBJS)
$(LDSHARED) -o $@ $(PIC_OBJS) -lc
rm -f $(SHAREDLIB) $(SHAREDLIBM) rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB) ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM) ln -s $@ $(SHAREDLIBM)
@@ -90,14 +123,17 @@ example$(EXE): example.o $(LIBS)
minigzip$(EXE): minigzip.o $(LIBS) minigzip$(EXE): minigzip.o $(LIBS)
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
install: $(LIBS) examplesh$(EXE): example.o $(LIBS)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB)
minigzipsh$(EXE): minigzip.o $(LIBS)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB)
install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
cp zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(LIBS) $(DESTDIR)$(libdir) cp $(LIBS) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir); chmod 755 $(LIBS) cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
@@ -114,8 +150,13 @@ install: $(LIBS)
# The ranlib in install is needed on NeXTSTEP which checks file times # The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux # ldconfig is for Linux
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
cp zlib.h zconf.h zlibdefs.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h $(DESTDIR)$(includedir)/zlibdefs.h
uninstall: uninstall:
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h zlibdefs.h
cd $(DESTDIR)$(libdir); rm -f libz.a; \ cd $(DESTDIR)$(libdir); rm -f libz.a; \
if test -f $(SHAREDLIBV); then \ if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
@@ -125,14 +166,16 @@ uninstall:
mostlyclean: clean mostlyclean: clean
clean: clean:
rm -f *.o *~ example$(EXE) minigzip$(EXE) \ rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
libz.* foo.gz so_locations \ libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o _match.s maketree contrib/infback9/*.o
maintainer-clean: distclean maintainer-clean: distclean
distclean: clean distclean: clean
cp -p Makefile.in Makefile cp -p Makefile.in Makefile
cp -p zconf.in.h zconf.h rm zlibdefs.h
touch -r configure zlibdefs.h
rm -f zlib.pc .DS_Store rm -f zlib.pc .DS_Store
tags: tags:
@@ -143,17 +186,30 @@ depend:
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zlib.h zconf.h adler32.o: zlib.h zconf.h zlibdefs.h
compress.o: zlib.h zconf.h compress.o: zlib.h zconf.h zlibdefs.h
crc32.o: crc32.h zlib.h zconf.h crc32.o: crc32.h zlib.h zconf.h zlibdefs.h
deflate.o: deflate.h zutil.h zlib.h zconf.h deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
example.o: zlib.h zconf.h example.o: zlib.h zconf.h zlibdefs.h
gzio.o: zutil.h zlib.h zconf.h gzio.o: zutil.h zlib.h zconf.h zlibdefs.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h infback.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
minigzip.o: zlib.h zconf.h minigzip.o: zlib.h zconf.h zlibdefs.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
uncompr.o: zlib.h zconf.h uncompr.o: zlib.h zconf.h zlibdefs.h
zutil.o: zutil.h zlib.h zconf.h zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
adler32.lo: zlib.h zconf.h zlibdefs.h
compress.lo: zlib.h zconf.h zlibdefs.h
crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h
deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h
inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
uncompr.lo: zlib.h zconf.h zlibdefs.h
zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h

View File

@@ -24,13 +24,15 @@ CFLAGS=-O
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes # -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=libz.a LDFLAGS=libz.a
LDSHARED=$(CC) LDSHARED=$(CC)
CPP=$(CC) -E CPP=$(CC) -E
LIBS=libz.a LIBS=libz.a
SHAREDLIB=libz.so SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.3.1 SHAREDLIBV=libz.so.1.2.3.3
SHAREDLIBM=libz.so.1 SHAREDLIBM=libz.so.1
AR=ar AR=ar
@@ -47,20 +49,26 @@ mandir = ${prefix}/share/man
man3dir = ${mandir}/man3 man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig pkgconfigdir = ${libdir}/pkgconfig
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o zutil.o inflate.o infback.o inftrees.o inffast.o
OBJA = OBJA =
# to use the asm code: make OBJA=match.o # to use the asm code: make OBJA=match.o
OBJS = $(OBJC) $(OBJA)
PIC_OBJS = $(OBJS:%.o=%.lo)
TEST_OBJS = example.o minigzip.o TEST_OBJS = example.o minigzip.o
all: example$(EXE) minigzip$(EXE) allstatic: example$(EXE) minigzip$(EXE)
check: test allshared: examplesh$(EXE) minigzipsh$(EXE)
test: all
@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ all: allstatic allshared
echo hello world | ./minigzip | ./minigzip -d || \
teststatic: allstatic
@echo hello world | ./minigzip | ./minigzip -d || \
echo ' *** minigzip test FAILED ***' ; \ echo ' *** minigzip test FAILED ***' ; \
if ./example; then \ if ./example; then \
echo ' *** zlib test OK ***'; \ echo ' *** zlib test OK ***'; \
@@ -68,8 +76,24 @@ test: all
echo ' *** zlib test FAILED ***'; \ echo ' *** zlib test FAILED ***'; \
fi fi
libz.a: $(OBJS) $(OBJA) testshared: allshared
$(AR) $@ $(OBJS) $(OBJA) @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
echo hello world | ./minigzipsh | ./minigzipsh -d || \
echo ' *** minigzip shared test FAILED ***' ; \
if ./examplesh; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; \
fi
test: teststatic testshared
check: test
libz.a: $(OBJS)
$(AR) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S match.o: match.S
@@ -78,8 +102,17 @@ match.o: match.S
mv _match.o match.o mv _match.o match.o
rm -f _match.s rm -f _match.s
$(SHAREDLIBV): $(OBJS) match.lo: match.S
$(LDSHARED) -o $@ $(OBJS) $(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.lo
rm -f _match.s
%.lo: %.c
$(CC) $(SFLAGS) -DPIC -c $< -o $@
$(SHAREDLIBV): $(PIC_OBJS)
$(LDSHARED) -o $@ $(PIC_OBJS) -lc
rm -f $(SHAREDLIB) $(SHAREDLIBM) rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB) ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM) ln -s $@ $(SHAREDLIBM)
@@ -90,14 +123,17 @@ example$(EXE): example.o $(LIBS)
minigzip$(EXE): minigzip.o $(LIBS) minigzip$(EXE): minigzip.o $(LIBS)
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
install: $(LIBS) examplesh$(EXE): example.o $(LIBS)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB)
minigzipsh$(EXE): minigzip.o $(LIBS)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB)
install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
cp zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(LIBS) $(DESTDIR)$(libdir) cp $(LIBS) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir); chmod 755 $(LIBS) cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
@@ -114,8 +150,13 @@ install: $(LIBS)
# The ranlib in install is needed on NeXTSTEP which checks file times # The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux # ldconfig is for Linux
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
cp zlib.h zconf.h zlibdefs.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h $(DESTDIR)$(includedir)/zlibdefs.h
uninstall: uninstall:
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h zlibdefs.h
cd $(DESTDIR)$(libdir); rm -f libz.a; \ cd $(DESTDIR)$(libdir); rm -f libz.a; \
if test -f $(SHAREDLIBV); then \ if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
@@ -125,14 +166,16 @@ uninstall:
mostlyclean: clean mostlyclean: clean
clean: clean:
rm -f *.o *~ example$(EXE) minigzip$(EXE) \ rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
libz.* foo.gz so_locations \ libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o _match.s maketree contrib/infback9/*.o
maintainer-clean: distclean maintainer-clean: distclean
distclean: clean distclean: clean
cp -p Makefile.in Makefile cp -p Makefile.in Makefile
cp -p zconf.in.h zconf.h rm zlibdefs.h
touch -r configure zlibdefs.h
rm -f zlib.pc .DS_Store rm -f zlib.pc .DS_Store
tags: tags:
@@ -143,17 +186,30 @@ depend:
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zlib.h zconf.h adler32.o: zlib.h zconf.h zlibdefs.h
compress.o: zlib.h zconf.h compress.o: zlib.h zconf.h zlibdefs.h
crc32.o: crc32.h zlib.h zconf.h crc32.o: crc32.h zlib.h zconf.h zlibdefs.h
deflate.o: deflate.h zutil.h zlib.h zconf.h deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
example.o: zlib.h zconf.h example.o: zlib.h zconf.h zlibdefs.h
gzio.o: zutil.h zlib.h zconf.h gzio.o: zutil.h zlib.h zconf.h zlibdefs.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h infback.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
minigzip.o: zlib.h zconf.h minigzip.o: zlib.h zconf.h zlibdefs.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
uncompr.o: zlib.h zconf.h uncompr.o: zlib.h zconf.h zlibdefs.h
zutil.o: zutil.h zlib.h zconf.h zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
adler32.lo: zlib.h zconf.h zlibdefs.h
compress.lo: zlib.h zconf.h zlibdefs.h
crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h
deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h
inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
uncompr.lo: zlib.h zconf.h zlibdefs.h
zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h

4
README
View File

@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.3.1 is a general purpose data compression library. All the code is zlib 1.2.3.3 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 thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files (Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -33,7 +33,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 in issue of Dr. Dobb's Journal; a copy of the article is available in
http://dogma.net/markn/articles/zlibtool/zlibtool.htm http://dogma.net/markn/articles/zlibtool/zlibtool.htm
The changes made in version 1.2.3.1 are documented in the file ChangeLog. The changes made in version 1.2.3.3 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory "contrib". Unsupported third party contributions are provided in directory "contrib".

View File

@@ -1,5 +1,5 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream /* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2004 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -8,6 +8,15 @@
#define ZLIB_INTERNAL #define ZLIB_INTERNAL
#include "zlib.h" #include "zlib.h"
#define local static
#ifdef _LARGEFILE64_SOURCE
local uLong adler32_combine_(uLong adler1, uLong adler2, off64_t len2);
#else
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off_t len2);
#endif
#define BASE 65521UL /* largest prime smaller than 65536 */ #define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552 #define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@@ -125,10 +134,14 @@ uLong ZEXPORT adler32(adler, buf, len)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2) local uLong adler32_combine_(adler1, adler2, len2)
uLong adler1; uLong adler1;
uLong adler2; uLong adler2;
#ifdef _LARGEFILE64_SOURCE
off64_t len2;
#else
z_off_t len2; z_off_t len2;
#endif
{ {
unsigned long sum1; unsigned long sum1;
unsigned long sum2; unsigned long sum2;
@@ -147,3 +160,30 @@ uLong ZEXPORT adler32_combine(adler1, adler2, len2)
if (sum2 > BASE) sum2 -= BASE; if (sum2 > BASE) sum2 -= BASE;
return sum1 | (sum2 << 16); return sum1 | (sum2 << 16);
} }
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}
#ifdef _LARGEFILE64_SOURCE
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
off64_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}
#else
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}
#endif

View File

@@ -1,7 +1,7 @@
* ZLIB.INC - Interface to the general purpose compression library * ZLIB.INC - Interface to the general purpose compression library
* *
* ILE RPG400 version by Patrick Monnerat, DATASPHERE. * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
* Version 1.2.3.1 * Version 1.2.3.3
* *
* *
* WARNING: * WARNING:
@@ -22,8 +22,8 @@
* *
* Versioning information. * Versioning information.
* *
D ZLIB_VERSION C '1.2.3.1' D ZLIB_VERSION C '1.2.3.3'
D ZLIB_VERNUM C X'1231' D ZLIB_VERNUM C X'1233'
* *
* Other equates. * Other equates.
* *

78
configure vendored
View File

@@ -32,7 +32,7 @@ libdir=${libdir-'${exec_prefix}/lib'}
includedir=${includedir-'${prefix}/include'} includedir=${includedir-'${prefix}/include'}
mandir=${mandir-'${prefix}/share/man'} mandir=${mandir-'${prefix}/share/man'}
shared_ext='.so' shared_ext='.so'
shared=0 shared=1
zprefix=0 zprefix=0
gcc=0 gcc=0
old_cc="$CC" old_cc="$CC"
@@ -50,11 +50,13 @@ case "$1" in
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
-u*=* | --uname=*) uname=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
-p* | --prefix) prefix="$2"; shift; shift;; -p* | --prefix) prefix="$2"; shift; shift;;
-e* | --eprefix) exec_prefix="$2"; shift; shift;; -e* | --eprefix) exec_prefix="$2"; shift; shift;;
-l* | --libdir) libdir="$2"; shift; shift;; -l* | --libdir) libdir="$2"; shift; shift;;
-i* | --includedir) includedir="$2"; shift; shift;; -i* | --includedir) includedir="$2"; shift; shift;;
-s* | --shared | --enable-shared) shared=1; shift;; -s* | --shared | --enable-shared) shared=1; shift;;
-t | --static) shared=0; shift;;
-z* | --zprefix) zprefix=1; shift;; -z* | --zprefix) zprefix=1; shift;;
--sysconfdir=*) echo "ignored option: --sysconfdir"; shift;; --sysconfdir=*) echo "ignored option: --sysconfdir"; shift;;
--localstatedir=*) echo "ignored option: --localstatedir"; shift;; --localstatedir=*) echo "ignored option: --localstatedir"; shift;;
@@ -79,8 +81,11 @@ esac
if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
CC="$cc" CC="$cc"
SFLAGS="${CFLAGS-"-O3"} -fPIC" SFLAGS="${CFLAGS-"-O3"} -fPIC"
CFLAGS="$cflags" CFLAGS="${CFLAGS-"-O3"}"
case `(uname -s || echo unknown) 2>/dev/null` in if test -z $uname; then
uname=`(uname -s || echo unknown) 2>/dev/null`
fi
case "$uname" in
Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"};; Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"};;
CYGWIN* | Cygwin* | cygwin* | OS/2* ) CYGWIN* | Cygwin* | cygwin* | OS/2* )
EXE='.exe';; EXE='.exe';;
@@ -107,7 +112,10 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
else else
# find system name and corresponding cc options # find system name and corresponding cc options
CC=${CC-cc} CC=${CC-cc}
case `(uname -sr || echo unknown) 2>/dev/null` in if test -z $uname; then
uname=`(uname -sr || echo unknown) 2>/dev/null`
fi
case "$uname" in
HP-UX*) SFLAGS=${CFLAGS-"-O +z"} HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
CFLAGS=${CFLAGS-"-O"} CFLAGS=${CFLAGS-"-O"}
# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
@@ -184,8 +192,7 @@ if test $shared -eq 1; then
# we must test in two steps (cc then ld), required at least on SunOS 4.x # we must test in two steps (cc then ld), required at least on SunOS 4.x
if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
CFLAGS="$SFLAGS" LIBS="$LIBS $SHAREDLIBV"
LIBS="$SHAREDLIBV"
echo Building shared library $SHAREDLIBV with $CC. echo Building shared library $SHAREDLIBV with $CC.
elif test -z "$old_cc" -a -z "$old_cflags"; then elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library support. echo No shared library support.
@@ -201,9 +208,47 @@ if test $shared -eq 1; then
fi fi
if test $shared -eq 0; then if test $shared -eq 0; then
LDSHARED="$CC" LDSHARED="$CC"
ALL="allstatic"
TEST="teststatic"
echo Building static library $LIBS version $VER with $CC. echo Building static library $LIBS version $VER with $CC.
else else
LDFLAGS="-L. ${SHAREDLIBV}" ALL="allstatic allshared"
TEST="teststatic testshared"
fi
cat > zlibdefs.h << EOF
/* zlibdefs.h -- compile-time definitions for the zlib compression library
* Copyright (C) 1995-2006 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
EOF
cat > $test.c <<EOF
#include <sys/types.h>
off64_t dummy = 0;
EOF
if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
echo "Checking for off64_t... Yes."
echo "Checking for fseeko... Yes."
else
echo "Checking for off64_t... No."
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
fseeko(NULL, 0, 0);
return 0;
}
EOF
if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
echo "Checking for fseeko... Yes."
else
CFLAGS="${CFLAGS} -DNO_FSEEKO"
SFLAGS="${SFLAGS} -DNO_FSEEKO"
echo "Checking for fseeko... No."
fi
fi fi
cat > $test.c <<EOF cat > $test.c <<EOF
@@ -211,10 +256,18 @@ cat > $test.c <<EOF
int main() { return 0; } int main() { return 0; }
EOF EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h cat >> zlibdefs.h <<EOF
#include <sys/types.h> /* for off_t */
#include <unistd.h> /* for SEEK_* and off_t */
#ifdef VMS
# include <unixio.h> /* for off_t */
#endif
#ifndef z_off_t
# define z_off_t off_t
#endif
EOF
echo "Checking for unistd.h... Yes." echo "Checking for unistd.h... Yes."
else else
cp -p zconf.in.h zconf.h
echo "Checking for unistd.h... No." echo "Checking for unistd.h... No."
fi fi
@@ -462,8 +515,10 @@ rm -f $test.[co] $test $test$shared_ext
sed < Makefile.in " sed < Makefile.in "
/^CC *=/s#=.*#=$CC# /^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS# /^CFLAGS *=/s#=.*#=$CFLAGS#
/^CPP *=/s#=.*#=$CPP# /^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
/^LDSHARED *=/s#=.*#=$LDSHARED# /^LDSHARED *=/s#=.*#=$LDSHARED#
/^CPP *=/s#=.*#=$CPP#
/^LIBS *=/s#=.*#=$LIBS# /^LIBS *=/s#=.*#=$LIBS#
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
@@ -476,7 +531,8 @@ sed < Makefile.in "
/^libdir *=/s#=.*#=$libdir# /^libdir *=/s#=.*#=$libdir#
/^includedir *=/s#=.*#=$includedir# /^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir# /^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS# /^all: */s#:.*#: $ALL#
/^test: */s#:.*#: $TEST#
" > Makefile " > Makefile
sed < zlib.pc.in " sed < zlib.pc.in "

View File

@@ -1,5 +1,5 @@
/* infback9.c -- inflate deflate64 data using a call-back interface /* infback9.c -- inflate deflate64 data using a call-back interface
* Copyright (C) 1995-2003 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -242,7 +242,7 @@ void FAR *out_desc;
code const FAR *distcode; /* starting table for distance codes */ code const FAR *distcode; /* starting table for distance codes */
unsigned lenbits; /* index bits for lencode */ unsigned lenbits; /* index bits for lencode */
unsigned distbits; /* index bits for distcode */ unsigned distbits; /* index bits for distcode */
code this; /* current decoding table entry */ code here; /* current decoding table entry */
code last; /* parent table entry */ code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */ unsigned len; /* length to copy for repeats, bits to drop */
int ret; /* return code */ int ret; /* return code */
@@ -384,19 +384,19 @@ void FAR *out_desc;
state->have = 0; state->have = 0;
while (state->have < state->nlen + state->ndist) { while (state->have < state->nlen + state->ndist) {
for (;;) { for (;;) {
this = lencode[BITS(lenbits)]; here = lencode[BITS(lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.val < 16) { if (here.val < 16) {
NEEDBITS(this.bits); NEEDBITS(here.bits);
DROPBITS(this.bits); DROPBITS(here.bits);
state->lens[state->have++] = this.val; state->lens[state->have++] = here.val;
} }
else { else {
if (this.val == 16) { if (here.val == 16) {
NEEDBITS(this.bits + 2); NEEDBITS(here.bits + 2);
DROPBITS(this.bits); DROPBITS(here.bits);
if (state->have == 0) { if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat"; strm->msg = (char *)"invalid bit length repeat";
mode = BAD; mode = BAD;
@@ -406,16 +406,16 @@ void FAR *out_desc;
copy = 3 + BITS(2); copy = 3 + BITS(2);
DROPBITS(2); DROPBITS(2);
} }
else if (this.val == 17) { else if (here.val == 17) {
NEEDBITS(this.bits + 3); NEEDBITS(here.bits + 3);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 3 + BITS(3); copy = 3 + BITS(3);
DROPBITS(3); DROPBITS(3);
} }
else { else {
NEEDBITS(this.bits + 7); NEEDBITS(here.bits + 7);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 11 + BITS(7); copy = 11 + BITS(7);
DROPBITS(7); DROPBITS(7);
@@ -460,28 +460,28 @@ void FAR *out_desc;
case LEN: case LEN:
/* get a literal, length, or end-of-block code */ /* get a literal, length, or end-of-block code */
for (;;) { for (;;) {
this = lencode[BITS(lenbits)]; here = lencode[BITS(lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.op && (this.op & 0xf0) == 0) { if (here.op && (here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = lencode[last.val + here = lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
length = (unsigned)this.val; length = (unsigned)here.val;
/* process literal */ /* process literal */
if (this.op == 0) { if (here.op == 0) {
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
"inflate: literal '%c'\n" : "inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", this.val)); "inflate: literal 0x%02x\n", here.val));
ROOM(); ROOM();
*put++ = (unsigned char)(length); *put++ = (unsigned char)(length);
left--; left--;
@@ -490,21 +490,21 @@ void FAR *out_desc;
} }
/* process end of block */ /* process end of block */
if (this.op & 32) { if (here.op & 32) {
Tracevv((stderr, "inflate: end of block\n")); Tracevv((stderr, "inflate: end of block\n"));
mode = TYPE; mode = TYPE;
break; break;
} }
/* invalid code */ /* invalid code */
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid literal/length code"; strm->msg = (char *)"invalid literal/length code";
mode = BAD; mode = BAD;
break; break;
} }
/* length code -- get extra bits, if any */ /* length code -- get extra bits, if any */
extra = (unsigned)(this.op) & 31; extra = (unsigned)(here.op) & 31;
if (extra != 0) { if (extra != 0) {
NEEDBITS(extra); NEEDBITS(extra);
length += BITS(extra); length += BITS(extra);
@@ -514,30 +514,30 @@ void FAR *out_desc;
/* get distance code */ /* get distance code */
for (;;) { for (;;) {
this = distcode[BITS(distbits)]; here = distcode[BITS(distbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if ((this.op & 0xf0) == 0) { if ((here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = distcode[last.val + here = distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid distance code"; strm->msg = (char *)"invalid distance code";
mode = BAD; mode = BAD;
break; break;
} }
offset = (unsigned)this.val; offset = (unsigned)here.val;
/* get distance extra bits, if any */ /* get distance extra bits, if any */
extra = (unsigned)(this.op) & 15; extra = (unsigned)(here.op) & 15;
if (extra != 0) { if (extra != 0) {
NEEDBITS(extra); NEEDBITS(extra);
offset += BITS(extra); offset += BITS(extra);

View File

@@ -1,5 +1,5 @@
/* inftree9.c -- generate Huffman trees for efficient decoding /* inftree9.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -9,7 +9,7 @@
#define MAXBITS 15 #define MAXBITS 15
const char inflate9_copyright[] = const char inflate9_copyright[] =
" inflate9 1.2.3.1 Copyright 1995-2005 Mark Adler "; " inflate9 1.2.3.3 Copyright 1995-2006 Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 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 */ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
133, 133, 133, 133, 144, 74, 196}; 133, 133, 133, 133, 144, 201, 203};
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,

View File

@@ -1163,6 +1163,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
s->pfile_in_zip_read = pfile_in_zip_read_info; s->pfile_in_zip_read = pfile_in_zip_read_info;
s->encrypted = 0;
# ifndef NOUNCRYPT # ifndef NOUNCRYPT
if (password != NULL) if (password != NULL)
{ {

View File

@@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1,2,3,1 FILEVERSION 1,2,3,3
PRODUCTVERSION 1,2,3,1 PRODUCTVERSION 1,2,3,3
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression library\0" VALUE "FileDescription", "zlib data compression library\0"
VALUE "FileVersion", "1.2.3.1\0" VALUE "FileVersion", "1.2.3.3\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlib.dll\0" VALUE "OriginalFilename", "zlib.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2006 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

41
crc32.c
View File

@@ -1,5 +1,5 @@
/* crc32.c -- compute the CRC-32 of a data stream /* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * 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 * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
@@ -68,6 +68,12 @@
local unsigned long gf2_matrix_times OF((unsigned long *mat, local unsigned long gf2_matrix_times OF((unsigned long *mat,
unsigned long vec)); unsigned long vec));
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
#ifdef _LARGEFILE64_SOURCE
local uLong crc32_combine_(uLong crc1, uLong crc2, off64_t len2);
#else
local uLong crc32_combine_(uLong crc1, uLong crc2, z_off_t len2);
#endif
#ifdef DYNAMIC_CRC_TABLE #ifdef DYNAMIC_CRC_TABLE
@@ -367,10 +373,14 @@ local void gf2_matrix_square(square, mat)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2) local uLong crc32_combine_(crc1, crc2, len2)
uLong crc1; uLong crc1;
uLong crc2; uLong crc2;
#ifdef _LARGEFILE64_SOURCE
off64_t len2;
#else
z_off_t len2; z_off_t len2;
#endif
{ {
int n; int n;
unsigned long row; unsigned long row;
@@ -421,3 +431,30 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
crc1 ^= crc2; crc1 ^= crc2;
return crc1; return crc1;
} }
/* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
uLong crc1;
uLong crc2;
z_off_t len2;
{
return crc32_combine_(crc1, crc2, len2);
}
#ifdef _LARGEFILE64_SOURCE
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
uLong crc1;
uLong crc2;
off64_t len2;
{
return crc32_combine_(crc1, crc2, len2);
}
#else
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
uLong crc1;
uLong crc2;
z_off_t len2;
{
return crc32_combine_(crc1, crc2, len2);
}
#endif

View File

@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm /* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2005 Jean-loup Gailly. * Copyright (C) 1995-2006 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -52,7 +52,7 @@
#include "deflate.h" #include "deflate.h"
const char deflate_copyright[] = const char deflate_copyright[] =
" deflate 1.2.3.1 Copyright 1995-2005 Jean-loup Gailly "; " deflate 1.2.3.3 Copyright 1995-2006 Jean-loup Gailly ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot

121
gzio.c
View File

@@ -7,6 +7,15 @@
/* @(#) $Id$ */ /* @(#) $Id$ */
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE
# endif
# ifdef _FILE_OFFSET_BITS
# undef _FILE_OFFSET_BITS
# endif
#endif
#include "zutil.h" #include "zutil.h"
#include <stdio.h> #include <stdio.h>
@@ -39,6 +48,14 @@ extern voidp malloc OF((uInt size));
extern void free OF((voidpf ptr)); extern void free OF((voidpf ptr));
#endif #endif
#ifdef NO_FSEEKO
# define FSEEK fseek
# define FTELL ftell
#else
# define FSEEK fseeko
# define FTELL ftello
#endif
#define ALLOC(size) malloc(size) #define ALLOC(size) malloc(size)
#define TRYFREE(p) {if (p) free(p);} #define TRYFREE(p) {if (p) free(p);}
@@ -64,15 +81,27 @@ typedef struct gz_stream {
char *path; /* path name for debugging only */ char *path; /* path name for debugging only */
int transparent; /* 1 if input file is not a .gz file */ int transparent; /* 1 if input file is not a .gz file */
char mode; /* 'w' or 'r' */ char mode; /* 'w' or 'r' */
#ifdef _LARGEFILE64_SOURCE
off64_t start; /* start of compressed data in file (header skipped) */
off64_t in; /* bytes into deflate or inflate */
off64_t out; /* bytes out of deflate or inflate */
#else
z_off_t start; /* start of compressed data in file (header skipped) */ z_off_t start; /* start of compressed data in file (header skipped) */
z_off_t in; /* bytes into deflate or inflate */ z_off_t in; /* bytes into deflate or inflate */
z_off_t out; /* bytes out of deflate or inflate */ z_off_t out; /* bytes out of deflate or inflate */
#endif
int back; /* one character push-back */ int back; /* one character push-back */
int last; /* true if push-back is last character */ int last; /* true if push-back is last character */
} gz_stream; } gz_stream;
local gzFile gz_open OF((const char *path, const char *mode, int fd)); local gzFile gz_open OF((const char *path, const char *mode, int fd,
int use64));
#ifdef _LARGEFILE64_SOURCE
local off64_t gz_seek OF((gzFile file, off64_t offset, int whence, int use64));
#else
local z_off_t gz_seek OF((gzFile file, z_off_t offset, int whence, int use64));
#endif
local int do_flush OF((gzFile file, int flush)); local int do_flush OF((gzFile file, int flush));
local int get_byte OF((gz_stream *s)); local int get_byte OF((gz_stream *s));
local void check_header OF((gz_stream *s)); local void check_header OF((gz_stream *s));
@@ -89,10 +118,11 @@ local uLong getLong OF((gz_stream *s));
can be checked to distinguish the two cases (if errno is zero, the can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). zlib error is Z_MEM_ERROR).
*/ */
local gzFile gz_open (path, mode, fd) local gzFile gz_open (path, mode, fd, use64)
const char *path; const char *path;
const char *mode; const char *mode;
int fd; int fd;
int use64;
{ {
int err; int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */ int level = Z_DEFAULT_COMPRESSION; /* compression level */
@@ -164,12 +194,7 @@ local gzFile gz_open (path, mode, fd)
s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
err = inflateInit2(&(s->stream), -MAX_WBITS); err = inflateInit2(&(s->stream), -MAX_WBITS);
/* windowBits is passed < 0 to tell that there is no zlib header. /* windowBits is passed < 0 to tell that there is no zlib header */
* Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and
* return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
* present after the compressed stream.
*/
if (err != Z_OK || s->inbuf == Z_NULL) { if (err != Z_OK || s->inbuf == Z_NULL) {
return destroy(s), (gzFile)Z_NULL; return destroy(s), (gzFile)Z_NULL;
} }
@@ -177,7 +202,8 @@ local gzFile gz_open (path, mode, fd)
s->stream.avail_out = Z_BUFSIZE; s->stream.avail_out = Z_BUFSIZE;
errno = 0; errno = 0;
s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); s->file = fd < 0 ? (use64 ? F_OPEN64(path, fmode) : F_OPEN(path, fmode)) :
(FILE*)fdopen(fd, fmode);
if (s->file == NULL) { if (s->file == NULL) {
return destroy(s), (gzFile)Z_NULL; return destroy(s), (gzFile)Z_NULL;
@@ -198,7 +224,7 @@ local gzFile gz_open (path, mode, fd)
*/ */
} else { } else {
check_header(s); /* skip the .gz header */ check_header(s); /* skip the .gz header */
s->start = ftell(s->file) - s->stream.avail_in; s->start = FTELL(s->file) - s->stream.avail_in;
} }
return (gzFile)s; return (gzFile)s;
@@ -211,7 +237,17 @@ gzFile ZEXPORT gzopen (path, mode)
const char *path; const char *path;
const char *mode; const char *mode;
{ {
return gz_open (path, mode, -1); return gz_open (path, mode, -1, 0);
}
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing for 64-bit offsets
*/
gzFile ZEXPORT gzopen64 (path, mode)
const char *path;
const char *mode;
{
return gz_open (path, mode, -1, 1);
} }
/* =========================================================================== /* ===========================================================================
@@ -227,7 +263,7 @@ gzFile ZEXPORT gzdopen (fd, mode)
if (fd < 0) return (gzFile)Z_NULL; if (fd < 0) return (gzFile)Z_NULL;
sprintf(name, "<fd:%d>", fd); /* for debugging */ sprintf(name, "<fd:%d>", fd); /* for debugging */
return gz_open (name, mode, fd); return gz_open (name, mode, fd, 0);
} }
/* =========================================================================== /* ===========================================================================
@@ -767,10 +803,17 @@ int ZEXPORT gzflush (file, flush)
SEEK_END is not implemented, returns error. SEEK_END is not implemented, returns error.
In this version of the library, gzseek can be extremely slow. In this version of the library, gzseek can be extremely slow.
*/ */
z_off_t ZEXPORT gzseek (file, offset, whence) #ifdef _LARGEFILE64_SOURCE
local off64_t gz_seek (file, offset, whence, use64)
gzFile file;
off64_t offset;
#else
local z_off_t gz_seek (file, offset, whence, use64)
gzFile file; gzFile file;
z_off_t offset; z_off_t offset;
#endif
int whence; int whence;
int use64;
{ {
gz_stream *s = (gz_stream*)file; gz_stream *s = (gz_stream*)file;
@@ -819,7 +862,13 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
s->back = EOF; s->back = EOF;
s->stream.avail_in = 0; s->stream.avail_in = 0;
s->stream.next_in = s->inbuf; s->stream.next_in = s->inbuf;
if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; #ifdef _LARGEFILE64_SOURCE
if ((use64 ? fseeko64(s->file, offset, SEEK_SET) :
FSEEK(s->file, offset, SEEK_SET)) < 0)
return -1L;
#else
if (FSEEK(s->file, offset, SEEK_SET) < 0) return -1L;
#endif
s->in = s->out = offset; s->in = s->out = offset;
return offset; return offset;
@@ -854,6 +903,35 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
return s->out; return s->out;
} }
/* ===========================================================================
Define external functions gzseek() and gzseek64() using local gz_seek().
*/
z_off_t ZEXPORT gzseek (file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
{
return (z_off_t)gz_seek(file, offset, whence, 0);
}
#ifdef _LARGEFILE64_SOURCE
off64_t ZEXPORT gzseek64 (file, offset, whence)
gzFile file;
off64_t offset;
int whence;
{
return gz_seek(file, offset, whence, 1);
}
#else
z_off_t ZEXPORT gzseek64 (file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
{
return gz_seek(file, offset, whence, 0);
}
#endif
/* =========================================================================== /* ===========================================================================
Rewinds input file. Rewinds input file.
*/ */
@@ -873,7 +951,7 @@ int ZEXPORT gzrewind (file)
if (!s->transparent) (void)inflateReset(&s->stream); if (!s->transparent) (void)inflateReset(&s->stream);
s->in = 0; s->in = 0;
s->out = 0; s->out = 0;
return fseek(s->file, s->start, SEEK_SET); return FSEEK(s->file, s->start, SEEK_SET);
} }
/* =========================================================================== /* ===========================================================================
@@ -887,6 +965,19 @@ z_off_t ZEXPORT gztell (file)
return gzseek(file, 0L, SEEK_CUR); return gzseek(file, 0L, SEEK_CUR);
} }
/* ===========================================================================
64-bit version
*/
#ifdef _LARGEFILE64_SOURCE
off64_t ZEXPORT gztell64 (file)
#else
z_off_t ZEXPORT gztell64 (file)
#endif
gzFile file;
{
return gzseek64(file, 0L, SEEK_CUR);
}
/* =========================================================================== /* ===========================================================================
Returns 1 when EOF has previously been detected reading the given Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero. input stream, otherwise zero.

View File

@@ -1,5 +1,5 @@
/* infback.c -- inflate using a call-back interface /* infback.c -- inflate using a call-back interface
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -253,7 +253,7 @@ void FAR *out_desc;
unsigned bits; /* bits in bit buffer */ unsigned bits; /* bits in bit buffer */
unsigned copy; /* number of stored or match bytes to copy */ unsigned copy; /* number of stored or match bytes to copy */
unsigned char FAR *from; /* where to copy match bytes from */ unsigned char FAR *from; /* where to copy match bytes from */
code this; /* current decoding table entry */ code here; /* current decoding table entry */
code last; /* parent table entry */ code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */ unsigned len; /* length to copy for repeats, bits to drop */
int ret; /* return code */ int ret; /* return code */
@@ -389,19 +389,19 @@ void FAR *out_desc;
state->have = 0; state->have = 0;
while (state->have < state->nlen + state->ndist) { while (state->have < state->nlen + state->ndist) {
for (;;) { for (;;) {
this = state->lencode[BITS(state->lenbits)]; here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.val < 16) { if (here.val < 16) {
NEEDBITS(this.bits); NEEDBITS(here.bits);
DROPBITS(this.bits); DROPBITS(here.bits);
state->lens[state->have++] = this.val; state->lens[state->have++] = here.val;
} }
else { else {
if (this.val == 16) { if (here.val == 16) {
NEEDBITS(this.bits + 2); NEEDBITS(here.bits + 2);
DROPBITS(this.bits); DROPBITS(here.bits);
if (state->have == 0) { if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat"; strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD; state->mode = BAD;
@@ -411,16 +411,16 @@ void FAR *out_desc;
copy = 3 + BITS(2); copy = 3 + BITS(2);
DROPBITS(2); DROPBITS(2);
} }
else if (this.val == 17) { else if (here.val == 17) {
NEEDBITS(this.bits + 3); NEEDBITS(here.bits + 3);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 3 + BITS(3); copy = 3 + BITS(3);
DROPBITS(3); DROPBITS(3);
} }
else { else {
NEEDBITS(this.bits + 7); NEEDBITS(here.bits + 7);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 11 + BITS(7); copy = 11 + BITS(7);
DROPBITS(7); DROPBITS(7);
@@ -474,28 +474,28 @@ void FAR *out_desc;
/* get a literal, length, or end-of-block code */ /* get a literal, length, or end-of-block code */
for (;;) { for (;;) {
this = state->lencode[BITS(state->lenbits)]; here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.op && (this.op & 0xf0) == 0) { if (here.op && (here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = state->lencode[last.val + here = state->lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
state->length = (unsigned)this.val; state->length = (unsigned)here.val;
/* process literal */ /* process literal */
if (this.op == 0) { if (here.op == 0) {
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
"inflate: literal '%c'\n" : "inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", this.val)); "inflate: literal 0x%02x\n", here.val));
ROOM(); ROOM();
*put++ = (unsigned char)(state->length); *put++ = (unsigned char)(state->length);
left--; left--;
@@ -504,21 +504,21 @@ void FAR *out_desc;
} }
/* process end of block */ /* process end of block */
if (this.op & 32) { if (here.op & 32) {
Tracevv((stderr, "inflate: end of block\n")); Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE; state->mode = TYPE;
break; break;
} }
/* invalid code */ /* invalid code */
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid literal/length code"; strm->msg = (char *)"invalid literal/length code";
state->mode = BAD; state->mode = BAD;
break; break;
} }
/* length code -- get extra bits, if any */ /* length code -- get extra bits, if any */
state->extra = (unsigned)(this.op) & 15; state->extra = (unsigned)(here.op) & 15;
if (state->extra != 0) { if (state->extra != 0) {
NEEDBITS(state->extra); NEEDBITS(state->extra);
state->length += BITS(state->extra); state->length += BITS(state->extra);
@@ -528,30 +528,30 @@ void FAR *out_desc;
/* get distance code */ /* get distance code */
for (;;) { for (;;) {
this = state->distcode[BITS(state->distbits)]; here = state->distcode[BITS(state->distbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if ((this.op & 0xf0) == 0) { if ((here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = state->distcode[last.val + here = state->distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid distance code"; strm->msg = (char *)"invalid distance code";
state->mode = BAD; state->mode = BAD;
break; break;
} }
state->offset = (unsigned)this.val; state->offset = (unsigned)here.val;
/* get distance extra bits, if any */ /* get distance extra bits, if any */
state->extra = (unsigned)(this.op) & 15; state->extra = (unsigned)(here.op) & 15;
if (state->extra != 0) { if (state->extra != 0) {
NEEDBITS(state->extra); NEEDBITS(state->extra);
state->offset += BITS(state->extra); state->offset += BITS(state->extra);

View File

@@ -1,5 +1,5 @@
/* inffast.c -- fast decoding /* inffast.c -- fast decoding
* Copyright (C) 1995-2004 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -87,7 +87,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
code const FAR *dcode; /* local strm->distcode */ code const FAR *dcode; /* local strm->distcode */
unsigned lmask; /* mask for first level of length codes */ unsigned lmask; /* mask for first level of length codes */
unsigned dmask; /* mask for first level of distance codes */ unsigned dmask; /* mask for first level of distance codes */
code this; /* retrieved table entry */ code here; /* retrieved table entry */
unsigned op; /* code bits, operation, extra bits, or */ unsigned op; /* code bits, operation, extra bits, or */
/* window position, window bytes to copy */ /* window position, window bytes to copy */
unsigned len; /* match length, unused bytes */ unsigned len; /* match length, unused bytes */
@@ -124,20 +124,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
hold += (unsigned long)(PUP(in)) << bits; hold += (unsigned long)(PUP(in)) << bits;
bits += 8; bits += 8;
} }
this = lcode[hold & lmask]; here = lcode[hold & lmask];
dolen: dolen:
op = (unsigned)(this.bits); op = (unsigned)(here.bits);
hold >>= op; hold >>= op;
bits -= op; bits -= op;
op = (unsigned)(this.op); op = (unsigned)(here.op);
if (op == 0) { /* literal */ if (op == 0) { /* literal */
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
"inflate: literal '%c'\n" : "inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", this.val)); "inflate: literal 0x%02x\n", here.val));
PUP(out) = (unsigned char)(this.val); PUP(out) = (unsigned char)(here.val);
} }
else if (op & 16) { /* length base */ else if (op & 16) { /* length base */
len = (unsigned)(this.val); len = (unsigned)(here.val);
op &= 15; /* number of extra bits */ op &= 15; /* number of extra bits */
if (op) { if (op) {
if (bits < op) { if (bits < op) {
@@ -155,14 +155,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
hold += (unsigned long)(PUP(in)) << bits; hold += (unsigned long)(PUP(in)) << bits;
bits += 8; bits += 8;
} }
this = dcode[hold & dmask]; here = dcode[hold & dmask];
dodist: dodist:
op = (unsigned)(this.bits); op = (unsigned)(here.bits);
hold >>= op; hold >>= op;
bits -= op; bits -= op;
op = (unsigned)(this.op); op = (unsigned)(here.op);
if (op & 16) { /* distance base */ if (op & 16) { /* distance base */
dist = (unsigned)(this.val); dist = (unsigned)(here.val);
op &= 15; /* number of extra bits */ op &= 15; /* number of extra bits */
if (bits < op) { if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits; hold += (unsigned long)(PUP(in)) << bits;
@@ -187,9 +187,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
if (dist > op) { /* see if copy from window */ if (dist > op) { /* see if copy from window */
op = dist - op; /* distance back in window */ op = dist - op; /* distance back in window */
if (op > whave) { if (op > whave) {
strm->msg = (char *)"invalid distance too far back"; if (state->sane) {
state->mode = BAD; strm->msg = (char *)"invalid distance too far back";
break; state->mode = BAD;
break;
}
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
if (len <= op - whave) {
do {
PUP(out) = 0;
} while (--len);
continue;
}
len -= op - whave;
do {
PUP(out) = 0;
} while (--op > whave);
if (op == 0) {
from = out - dist;
do {
PUP(out) = PUP(from);
} while (--len);
continue;
}
#endif
} }
from = window - OFF; from = window - OFF;
if (write == 0) { /* very common case */ if (write == 0) { /* very common case */
@@ -259,7 +280,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
} }
} }
else if ((op & 64) == 0) { /* 2nd level distance code */ else if ((op & 64) == 0) { /* 2nd level distance code */
this = dcode[this.val + (hold & ((1U << op) - 1))]; here = dcode[here.val + (hold & ((1U << op) - 1))];
goto dodist; goto dodist;
} }
else { else {
@@ -269,7 +290,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
} }
} }
else if ((op & 64) == 0) { /* 2nd level length code */ else if ((op & 64) == 0) { /* 2nd level length code */
this = lcode[this.val + (hold & ((1U << op) - 1))]; here = lcode[here.val + (hold & ((1U << op) - 1))];
goto dolen; goto dolen;
} }
else if (op & 32) { /* end-of-block */ else if (op & 32) { /* end-of-block */

123
inflate.c
View File

@@ -1,5 +1,5 @@
/* inflate.c -- zlib decompression /* inflate.c -- zlib decompression
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -121,6 +121,7 @@ z_streamp strm;
state->hold = 0; state->hold = 0;
state->bits = 0; state->bits = 0;
state->lencode = state->distcode = state->next = state->codes; state->lencode = state->distcode = state->next = state->codes;
state->sane = 1;
Tracev((stderr, "inflate: reset\n")); Tracev((stderr, "inflate: reset\n"));
return Z_OK; return Z_OK;
} }
@@ -564,7 +565,7 @@ int flush;
unsigned in, out; /* save starting available input and output */ unsigned in, out; /* save starting available input and output */
unsigned copy; /* number of stored or match bytes to copy */ unsigned copy; /* number of stored or match bytes to copy */
unsigned char FAR *from; /* where to copy match bytes from */ unsigned char FAR *from; /* where to copy match bytes from */
code this; /* current decoding table entry */ code here; /* current decoding table entry */
code last; /* parent table entry */ code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */ unsigned len; /* length to copy for repeats, bits to drop */
int ret; /* return code */ int ret; /* return code */
@@ -876,19 +877,19 @@ int flush;
case CODELENS: case CODELENS:
while (state->have < state->nlen + state->ndist) { while (state->have < state->nlen + state->ndist) {
for (;;) { for (;;) {
this = state->lencode[BITS(state->lenbits)]; here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.val < 16) { if (here.val < 16) {
NEEDBITS(this.bits); NEEDBITS(here.bits);
DROPBITS(this.bits); DROPBITS(here.bits);
state->lens[state->have++] = this.val; state->lens[state->have++] = here.val;
} }
else { else {
if (this.val == 16) { if (here.val == 16) {
NEEDBITS(this.bits + 2); NEEDBITS(here.bits + 2);
DROPBITS(this.bits); DROPBITS(here.bits);
if (state->have == 0) { if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat"; strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD; state->mode = BAD;
@@ -898,16 +899,16 @@ int flush;
copy = 3 + BITS(2); copy = 3 + BITS(2);
DROPBITS(2); DROPBITS(2);
} }
else if (this.val == 17) { else if (here.val == 17) {
NEEDBITS(this.bits + 3); NEEDBITS(here.bits + 3);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 3 + BITS(3); copy = 3 + BITS(3);
DROPBITS(3); DROPBITS(3);
} }
else { else {
NEEDBITS(this.bits + 7); NEEDBITS(here.bits + 7);
DROPBITS(this.bits); DROPBITS(here.bits);
len = 0; len = 0;
copy = 11 + BITS(7); copy = 11 + BITS(7);
DROPBITS(7); DROPBITS(7);
@@ -955,40 +956,40 @@ int flush;
break; break;
} }
for (;;) { for (;;) {
this = state->lencode[BITS(state->lenbits)]; here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if (this.op && (this.op & 0xf0) == 0) { if (here.op && (here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = state->lencode[last.val + here = state->lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
state->length = (unsigned)this.val; state->length = (unsigned)here.val;
if ((int)(this.op) == 0) { if ((int)(here.op) == 0) {
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
"inflate: literal '%c'\n" : "inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", this.val)); "inflate: literal 0x%02x\n", here.val));
state->mode = LIT; state->mode = LIT;
break; break;
} }
if (this.op & 32) { if (here.op & 32) {
Tracevv((stderr, "inflate: end of block\n")); Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE; state->mode = TYPE;
break; break;
} }
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid literal/length code"; strm->msg = (char *)"invalid literal/length code";
state->mode = BAD; state->mode = BAD;
break; break;
} }
state->extra = (unsigned)(this.op) & 15; state->extra = (unsigned)(here.op) & 15;
state->mode = LENEXT; state->mode = LENEXT;
case LENEXT: case LENEXT:
if (state->extra) { if (state->extra) {
@@ -1000,28 +1001,28 @@ int flush;
state->mode = DIST; state->mode = DIST;
case DIST: case DIST:
for (;;) { for (;;) {
this = state->distcode[BITS(state->distbits)]; here = state->distcode[BITS(state->distbits)];
if ((unsigned)(this.bits) <= bits) break; if ((unsigned)(here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
if ((this.op & 0xf0) == 0) { if ((here.op & 0xf0) == 0) {
last = this; last = here;
for (;;) { for (;;) {
this = state->distcode[last.val + here = state->distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)]; (BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break; if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE(); PULLBYTE();
} }
DROPBITS(last.bits); DROPBITS(last.bits);
} }
DROPBITS(this.bits); DROPBITS(here.bits);
if (this.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid distance code"; strm->msg = (char *)"invalid distance code";
state->mode = BAD; state->mode = BAD;
break; break;
} }
state->offset = (unsigned)this.val; state->offset = (unsigned)here.val;
state->extra = (unsigned)(this.op) & 15; state->extra = (unsigned)(here.op) & 15;
state->mode = DISTEXT; state->mode = DISTEXT;
case DISTEXT: case DISTEXT:
if (state->extra) { if (state->extra) {
@@ -1036,11 +1037,6 @@ int flush;
break; break;
} }
#endif #endif
if (state->offset > state->whave + out - left) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
Tracevv((stderr, "inflate: distance %u\n", state->offset)); Tracevv((stderr, "inflate: distance %u\n", state->offset));
state->mode = MATCH; state->mode = MATCH;
case MATCH: case MATCH:
@@ -1048,6 +1044,26 @@ int flush;
copy = out - left; copy = out - left;
if (state->offset > copy) { /* copy from window */ if (state->offset > copy) { /* copy from window */
copy = state->offset - copy; copy = state->offset - copy;
if (copy > state->whave) {
if (state->sane) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
Trace((stderr, "inflate.c too far\n"));
copy -= state->whave;
if (copy > state->length) copy = state->length;
if (copy > left) copy = left;
left -= copy;
state->length -= copy;
do {
*put++ = 0;
} while (--copy);
if (state->length == 0) state->mode = LEN;
break;
#endif
}
if (copy > state->write) { if (copy > state->write) {
copy -= state->write; copy -= state->write;
from = state->window + (state->wsize - copy); from = state->window + (state->wsize - copy);
@@ -1366,3 +1382,20 @@ z_streamp source;
dest->state = (struct internal_state FAR *)copy; dest->state = (struct internal_state FAR *)copy;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateUndermine(strm, subvert)
z_streamp strm;
int subvert;
{
struct inflate_state FAR *state;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
state->sane = !subvert;
return Z_OK;
#else
state->sane = 1;
return Z_DATA_ERROR;
#endif
}

View File

@@ -112,4 +112,5 @@ struct inflate_state {
unsigned short lens[320]; /* temporary storage for code lengths */ unsigned short lens[320]; /* temporary storage for code lengths */
unsigned short work[288]; /* work area for code table building */ unsigned short work[288]; /* work area for code table building */
code codes[ENOUGH]; /* space for code tables */ code codes[ENOUGH]; /* space for code tables */
int sane; /* if false, allow invalid distance too far */
}; };

View File

@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding /* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -9,7 +9,7 @@
#define MAXBITS 15 #define MAXBITS 15
const char inflate_copyright[] = const char inflate_copyright[] =
" inflate 1.2.3.1 Copyright 1995-2005 Mark Adler "; " inflate 1.2.3.3 Copyright 1995-2006 Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@@ -50,7 +50,7 @@ unsigned short FAR *work;
unsigned fill; /* index for replicating entries */ unsigned fill; /* index for replicating entries */
unsigned low; /* low bits for current root entry */ unsigned low; /* low bits for current root entry */
unsigned mask; /* mask for low root bits */ unsigned mask; /* mask for low root bits */
code this; /* table entry for duplication */ code here; /* table entry for duplication */
code FAR *next; /* next available space in table */ code FAR *next; /* next available space in table */
const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */ const unsigned short FAR *extra; /* extra bits table to use */
@@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 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 */ 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, 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, 74, 196}; 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 203};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 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, 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, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -115,11 +115,11 @@ unsigned short FAR *work;
if (count[max] != 0) break; if (count[max] != 0) break;
if (root > max) root = max; if (root > max) root = max;
if (max == 0) { /* no symbols to code at all */ if (max == 0) { /* no symbols to code at all */
this.op = (unsigned char)64; /* invalid code marker */ here.op = (unsigned char)64; /* invalid code marker */
this.bits = (unsigned char)1; here.bits = (unsigned char)1;
this.val = (unsigned short)0; here.val = (unsigned short)0;
*(*table)++ = this; /* make a table to force an error */ *(*table)++ = here; /* make a table to force an error */
*(*table)++ = this; *(*table)++ = here;
*bits = 1; *bits = 1;
return 0; /* no symbols, but wait for decoding to report error */ return 0; /* no symbols, but wait for decoding to report error */
} }
@@ -215,18 +215,18 @@ unsigned short FAR *work;
/* process all codes and make table entries */ /* process all codes and make table entries */
for (;;) { for (;;) {
/* create table entry */ /* create table entry */
this.bits = (unsigned char)(len - drop); here.bits = (unsigned char)(len - drop);
if ((int)(work[sym]) < end) { if ((int)(work[sym]) < end) {
this.op = (unsigned char)0; here.op = (unsigned char)0;
this.val = work[sym]; here.val = work[sym];
} }
else if ((int)(work[sym]) > end) { else if ((int)(work[sym]) > end) {
this.op = (unsigned char)(extra[work[sym]]); here.op = (unsigned char)(extra[work[sym]]);
this.val = base[work[sym]]; here.val = base[work[sym]];
} }
else { else {
this.op = (unsigned char)(32 + 64); /* end of block */ here.op = (unsigned char)(32 + 64); /* end of block */
this.val = 0; here.val = 0;
} }
/* replicate for those indices with low len bits equal to huff */ /* replicate for those indices with low len bits equal to huff */
@@ -235,7 +235,7 @@ unsigned short FAR *work;
min = fill; /* save offset to next table */ min = fill; /* save offset to next table */
do { do {
fill -= incr; fill -= incr;
next[(huff >> drop) + fill] = this; next[(huff >> drop) + fill] = here;
} while (fill != 0); } while (fill != 0);
/* backwards increment the len-bit code huff */ /* backwards increment the len-bit code huff */
@@ -295,20 +295,20 @@ unsigned short FAR *work;
through high index bits. When the current sub-table is filled, the loop through high index bits. When the current sub-table is filled, the loop
drops back to the root table to fill in any remaining entries there. drops back to the root table to fill in any remaining entries there.
*/ */
this.op = (unsigned char)64; /* invalid code marker */ here.op = (unsigned char)64; /* invalid code marker */
this.bits = (unsigned char)(len - drop); here.bits = (unsigned char)(len - drop);
this.val = (unsigned short)0; here.val = (unsigned short)0;
while (huff != 0) { while (huff != 0) {
/* when done with sub-table, drop back to root table */ /* when done with sub-table, drop back to root table */
if (drop != 0 && (huff & mask) != low) { if (drop != 0 && (huff & mask) != low) {
drop = 0; drop = 0;
len = root; len = root;
next = *table; next = *table;
this.bits = (unsigned char)len; here.bits = (unsigned char)len;
} }
/* put invalid code marker in table */ /* put invalid code marker in table */
next[huff >> drop] = this; next[huff >> drop] = here;
/* backwards increment the len-bit code huff */ /* backwards increment the len-bit code huff */
incr = 1U << (len - 1); incr = 1U << (len - 1);

View File

@@ -77,40 +77,40 @@ $ if make.eqs.""
$ then $ then
$ dele example.obj;*,minigzip.obj;* $ dele example.obj;*,minigzip.obj;*
$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
adler32.c zlib.h zconf.h adler32.c zlib.h zconf.h zlibdefs.h
$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
compress.c zlib.h zconf.h compress.c zlib.h zconf.h zlibdefs.h
$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
crc32.c zlib.h zconf.h crc32.c zlib.h zconf.h zlibdefs.h
$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
deflate.c deflate.h zutil.h zlib.h zconf.h deflate.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - $ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
gzio.c zutil.h zlib.h zconf.h gzio.c zutil.h zlib.h zconf.h zlibdefs.h
$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - $ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - $ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
inffast.c zutil.h zlib.h zconf.h inffast.h inffast.c zutil.h zlib.h zconf.h zlibdefs.h inffast.h
$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - $ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
inflate.c zutil.h zlib.h zconf.h infblock.h inflate.c zutil.h zlib.h zconf.h zlibdefs.h infblock.h
$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - $ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
inftrees.c zutil.h zlib.h zconf.h inftrees.h inftrees.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - $ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
trees.c deflate.h zutil.h zlib.h zconf.h trees.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - $ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
uncompr.c zlib.h zconf.h uncompr.c zlib.h zconf.h zlibdefs.h
$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - $ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
zutil.c zutil.h zlib.h zconf.h zutil.c zutil.h zlib.h zconf.h zlibdefs.h
$ write sys$output "Building Zlib ..." $ write sys$output "Building Zlib ..."
$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ $ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
$ write sys$output "Building example..." $ write sys$output "Building example..."
$ CALL MAKE example.OBJ "CC ''CCOPT' example" - $ CALL MAKE example.OBJ "CC ''CCOPT' example" -
example.c zlib.h zconf.h example.c zlib.h zconf.h zlibdefs.h
$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb $ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
$ if f$search("x11vms:xvmsutils.olb") .nes. "" $ if f$search("x11vms:xvmsutils.olb") .nes. ""
$ then $ then
$ write sys$output "Building minigzip..." $ write sys$output "Building minigzip..."
$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - $ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
minigzip.c zlib.h zconf.h minigzip.c zlib.h zconf.h zlibdefs.h
$ call make minigzip.exe - $ call make minigzip.exe -
"LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
minigzip.obj libz.olb minigzip.obj libz.olb
@@ -328,19 +328,19 @@ clean :
# Other dependencies. # Other dependencies.
adler32.obj : adler32.c zutil.h zlib.h zconf.h adler32.obj : adler32.c zutil.h zlib.h zconf.h zlibdefs.h
compress.obj : compress.c zlib.h zconf.h compress.obj : compress.c zlib.h zconf.h zlibdefs.h
crc32.obj : crc32.c zutil.h zlib.h zconf.h crc32.obj : crc32.c zutil.h zlib.h zconf.h zlibdefs.h
deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
example.obj : example.c zlib.h zconf.h example.obj : example.c zlib.h zconf.h zlibdefs.h
gzio.obj : gzio.c zutil.h zlib.h zconf.h gzio.obj : gzio.c zutil.h zlib.h zconf.h zlibdefs.h
inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h inffast.obj : inffast.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inffast.h
inflate.obj : inflate.c zutil.h zlib.h zconf.h inflate.obj : inflate.c zutil.h zlib.h zconf.h zlibdefs.h
inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h inftrees.obj : inftrees.c zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
minigzip.obj : minigzip.c zlib.h zconf.h minigzip.obj : minigzip.c zlib.h zconf.h zlibdefs.h
trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h zlibdefs.h
uncompr.obj : uncompr.c zlib.h zconf.h uncompr.obj : uncompr.c zlib.h zconf.h zlibdefs.h
zutil.obj : zutil.c zutil.h zlib.h zconf.h zutil.obj : zutil.c zutil.h zlib.h zconf.h zlibdefs.h
infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
$ eod $ eod
$ close out $ close out

View File

@@ -25,10 +25,10 @@
<QPG:Files> <QPG:Files>
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> <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="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
<QPG:Add file="../libz.so.1.2.3.1" install="/opt/lib/" user="root:bin" permission="644"/> <QPG:Add file="../libz.so.1.2.3.3" 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.3.1"/> <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.3.3"/>
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3.1"/> <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3.3"/>
<QPG:Add file="../libz.so.1.2.3.1" install="/opt/lib/" component="slib"/> <QPG:Add file="../libz.so.1.2.3.3" install="/opt/lib/" component="slib"/>
</QPG:Files> </QPG:Files>
<QPG:PackageFilter> <QPG:PackageFilter>
@@ -63,7 +63,7 @@
</QPM:ProductDescription> </QPM:ProductDescription>
<QPM:ReleaseDescription> <QPM:ReleaseDescription>
<QPM:ReleaseVersion>1.2.3.1</QPM:ReleaseVersion> <QPM:ReleaseVersion>1.2.3.3</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability> <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>

View File

@@ -1,201 +0,0 @@
# Makefile for zlib
# Copyright (C) 1995-2006 Jean-loup Gailly.
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
# The call of configure is optional if you don't have special requirements
# If you wish to build zlib as a shared library, use: ./configure -s
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=$(CFLAGS)
#SFLAGS=$(CFLAGS) -fPIC
LD=$(CC)
LDFLAGS=libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.3
SHAREDLIBM=libz.so.1
EXE=
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar rc
RANLIB=ranlib
TAR=tar
SHELL=/bin/sh
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
mandir=${prefix}/share/man
man3dir=${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o
OBJA =
#OBJA = match.o
# to use the asm code: make OBJA=match.o
TEST_OBJS = example.o minigzip.o
OBJS_PIC = $(OBJS:.o=.pic.o)
OBJA_PIC = $(OBJA:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(SFLAGS) -o $@ $*.c
all: $(STATICLIB) example$(EXE) minigzip$(EXE)
#all: $(STATICLIB) $(SHAREDLIBV) example$(EXE) minigzip$(EXE)
check: test
test: all
@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
echo hello world | ./minigzip | ./minigzip -d || \
echo ' *** minigzip test FAILED ***' ; \
if ./example; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; \
fi
match.o: match.S
$(CPP) match.S > _match.s
$(CC) -c _match.s
mv _match.o match.o
rm -f _match.s
match.pic.o: match.S
$(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.pic.o
rm -f _match.s
$(STATICLIB): $(OBJS) $(OBJA)
$(AR) $@ $(OBJS) $(OBJA)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
$(SHAREDLIBV): $(OBJS_PIC) $(OBJA_PIC)
$(LDSHARED) -o $@ $(OBJS_PIC) $(OBJA_PIC)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
example$(EXE): example.o $(STATICLIB)
$(LD) -o $@ example.o $(LDFLAGS)
minigzip$(EXE): minigzip.o $(STATICLIB)
$(LD) -o $@ minigzip.o $(LDFLAGS)
install: $(LIBS)
mkdir -p $(DESTDIR)$(exec_prefix)
mkdir -p $(DESTDIR)$(includedir)
mkdir -p $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(man3dir)
mkdir -p $(DESTDIR)$(pkgconfigdir)
cp zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(LIBS) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
-@(cd $(DESTDIR)$(libdir); $(RANLIB) $(STATICLIB) || true) >/dev/null 2>&1
cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
(ldconfig || true) >/dev/null 2>&1; \
fi
cp zlib.3 $(DESTDIR)$(man3dir)
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
uninstall:
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
cd $(DESTDIR)$(libdir); rm -f $(STATICLIB); \
if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
cd $(DESTDIR)$(man3dir); rm -f zlib.3
cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
mostlyclean: clean
clean:
rm -f *.o *~ example$(EXE) minigzip$(EXE) \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
maintainer-clean: distclean
distclean: clean
cp -p Makefile.in Makefile
cp -p zconf.in.h zconf.h
rm -f zlib.pc .DS_Store
tags:
etags *.[ch]
depend:
makedepend -- $(CFLAGS) -- *.[ch]
# "fake" targets: not real filenames and no deps (else "touch clean" defeats)
.PHONY: install uninstall clean tags depend
# DO NOT DELETE THIS LINE -- "make depend" depends on it.
adler32.o: zlib.h zconf.h
adler32.pic.o: zlib.h zconf.h
compress.o: zlib.h zconf.h
compress.pic.o: zlib.h zconf.h
crc32.o: crc32.h zlib.h zconf.h
crc32.pic.o: crc32.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
deflate.pic.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
example.pic.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
gzio.pic.o: zutil.h zlib.h zconf.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inffast.pic.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.pic.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.pic.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
inftrees.pic.o: zutil.h zlib.h zconf.h inftrees.h
minigzip.o: zlib.h zconf.h
minigzip.pic.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
trees.pic.o: deflate.h zutil.h zlib.h zconf.h trees.h
uncompr.o: zlib.h zconf.h
uncompr.pic.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h
zutil.pic.o: zutil.h zlib.h zconf.h

View File

@@ -1 +0,0 @@
This "todo" directory contains works in progress. Nothing in here works, so don't try to use it!

114
treebuild.xml Normal file
View File

@@ -0,0 +1,114 @@
<?xml version="1.0" ?>
<package name="zlib" version="1.2.3">
<library name="zlib" dlversion="1.2.3" dlname="z">
<property name="description"> zip compression library </property>
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
<!-- fixme: not implemented yet -->
<property name="compiler/c/inline" value="yes" />
<include-file name="zlib.h" scope="public" mode="644" />
<include-file name="zconf.h" scope="public" mode="644" />
<include-file name="zlibdefs.h" scope="public" mode="644" />
<source name="adler32.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
</source>
<source name="compress.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
</source>
<source name="crc32.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="crc32.h" />
</source>
<source name="gzio.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
</source>
<source name="uncompr.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
</source>
<source name="deflate.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="deflate.h" />
</source>
<source name="trees.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="deflate.h" />
<depend name="trees.h" />
</source>
<source name="zutil.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
</source>
<source name="inflate.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="inftrees.h" />
<depend name="inflate.h" />
<depend name="inffast.h" />
</source>
<source name="infback.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="inftrees.h" />
<depend name="inflate.h" />
<depend name="inffast.h" />
</source>
<source name="inftrees.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="inftrees.h" />
</source>
<source name="inffast.c">
<depend name="zlib.h" />
<depend name="zconf.h" />
<depend name="zlibdefs.h" />
<depend name="zutil.h" />
<depend name="inftrees.h" />
<depend name="inflate.h" />
<depend name="inffast.h" />
</source>
</library>
</package>
<!--
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
# OBJA =
# to use the asm code: make OBJA=match.o
#
match.o: match.S
$(CPP) match.S > _match.s
$(CC) -c _match.s
mv _match.o match.o
rm -f _match.s
-->

10
zconf.h
View File

@@ -351,14 +351,8 @@ typedef uLong FAR uLongf;
typedef Byte *voidp; typedef Byte *voidp;
#endif #endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ #include "zlibdefs.h" /* created by configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET #ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_CUR 1 /* Seek from current position. */

View File

@@ -1,396 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2006 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgets z_gzgets
# define gzopen z_gzopen
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# define uncompress z_uncompress
# define zError z_zError
# define z_errmsg z_z_errmsg
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# define gzFile z_gzFile
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpc z_voidpc
# define voidpf z_voidpf
# define voidpf z_voidpf
# define z_stream z_z_stream
# define z_streamp z_z_streamp
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
# define z_stream_s z_z_stream_s
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(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
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifdef HAVE_VISIBILITY_PRAGMA
# define ZEXTERN __attribute__((visibility ("default"))) extern
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

6
zlib.3
View File

@@ -1,4 +1,4 @@
.TH ZLIB 3 "16 August 2006" .TH ZLIB 3 "2 October 2006"
.SH NAME .SH NAME
zlib \- compression/decompression library zlib \- compression/decompression library
.SH SYNOPSIS .SH SYNOPSIS
@@ -133,8 +133,8 @@ before asking for help.
Send questions and/or comments to zlib@gzip.org, Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS .SH AUTHORS
Version 1.2.3.1 Version 1.2.3.3
Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org) Copyright (C) 1995-2006 Jean-loup Gailly (jloup@gzip.org)
and Mark Adler (madler@alumni.caltech.edu). and Mark Adler (madler@alumni.caltech.edu).
.LP .LP
This software is provided "as-is," This software is provided "as-is,"

45
zlib.h
View File

@@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library /* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.3.1, August 16th, 2006 version 1.2.3.3, October 2nd, 2006
Copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
@@ -37,8 +37,8 @@
extern "C" { extern "C" {
#endif #endif
#define ZLIB_VERSION "1.2.3.1" #define ZLIB_VERSION "1.2.3.3"
#define ZLIB_VERNUM 0x1231 #define ZLIB_VERNUM 0x1233
#define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2 #define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 3 #define ZLIB_VER_REVISION 3
@@ -1077,8 +1077,9 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
typedef voidp gzFile; typedef voidp gzFile;
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/* /*
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
Opens a gzip (.gz) file for reading or writing. The mode parameter Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb") but can also include a compression level is as in fopen ("rb" or "wb") but can also include a compression level
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
@@ -1192,9 +1193,10 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
degrade compression. degrade compression.
*/ */
/*
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence)); z_off_t offset, int whence));
/*
Sets the starting position for the next gzread or gzwrite on the Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2); uncompressed data stream. The whence parameter is defined as in lseek(2);
@@ -1217,8 +1219,9 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/ */
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/* /*
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
Returns the starting position for the next gzread or gzwrite on the Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the given compressed file. This position represents a number of bytes in the
uncompressed data stream. uncompressed data stream.
@@ -1289,9 +1292,10 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error(); if (adler != original_adler) error();
*/ */
/*
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
z_off_t len2)); z_off_t len2));
/*
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 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 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 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
@@ -1314,9 +1318,9 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error(); if (crc != original_crc) error();
*/ */
/*
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
/*
Combine two CRC-32 check values into one. For two sequences of bytes, Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
@@ -1357,13 +1361,36 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
inflateBackInit_((strm), (windowBits), (window), \ inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, sizeof(z_stream)) ZLIB_VERSION, sizeof(z_stream))
#ifdef _LARGEFILE64_SOURCE
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 uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
#endif
#if _FILE_OFFSET_BITS == 64
# define gzopen gzopen64
# define gzseek gzseek64
# define gztell gztell64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
#else
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;}; /* hack for buggy compilers */ struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif #endif
ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
#ifdef __cplusplus #ifdef __cplusplus
} }

0
zlibdefs.h Normal file
View File

12
zutil.h
View File

@@ -159,6 +159,12 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# else # else
# define fdopen(fd,type) _fdopen(fd,type) # define fdopen(fd,type) _fdopen(fd,type)
# endif # endif
#endif
#if defined(__BORLANDC__)
#pragma warn -8004
#pragma warn -8008
#pragma warn -8066
#endif #endif
/* common defaults */ /* common defaults */
@@ -169,6 +175,12 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#ifndef F_OPEN #ifndef F_OPEN
# define F_OPEN(name, mode) fopen((name), (mode)) # define F_OPEN(name, mode) fopen((name), (mode))
#endif
#ifdef _LARGEFILE64_SOURCE
# define F_OPEN64(name, mode) fopen64((name), (mode))
#else
# define F_OPEN64(name, mode) fopen((name), (mode))
#endif #endif
/* functions */ /* functions */