diff options
Diffstat (limited to '')
58 files changed, 3773 insertions, 588 deletions
| @@ -1,6 +1,54 @@ | |||
| 1 | 1 | ||
| 2 | ChangeLog file for zlib | 2 | ChangeLog file for zlib |
| 3 | 3 | ||
| 4 | Changes in 1.1.3 (9 July 1998) | ||
| 5 | - fix "an inflate input buffer bug that shows up on rare but persistent | ||
| 6 | occasions" (Mark) | ||
| 7 | - fix gzread and gztell for concatenated .gz files (Didier Le Botlan) | ||
| 8 | - fix gzseek(..., SEEK_SET) in write mode | ||
| 9 | - fix crc check after a gzeek (Frank Faubert) | ||
| 10 | - fix miniunzip when the last entry in a zip file is itself a zip file | ||
| 11 | (J Lillge) | ||
| 12 | - add contrib/asm586 and contrib/asm686 (Brian Raiter) | ||
| 13 | See http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
| 14 | - add support for Delphi 3 in contrib/delphi (Bob Dellaca) | ||
| 15 | - add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) | ||
| 16 | - do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) | ||
| 17 | - use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) | ||
| 18 | - added a FAQ file | ||
| 19 | |||
| 20 | - Support gzdopen on Mac with Metrowerks (Jason Linhart) | ||
| 21 | - Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) | ||
| 22 | - define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) | ||
| 23 | - avoid some warnings with Borland C (Tom Tanner) | ||
| 24 | - fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) | ||
| 25 | - emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) | ||
| 26 | - allow several arguments to configure (Tim Mooney, Frodo Looijaard) | ||
| 27 | - use libdir and includedir in Makefile.in (Tim Mooney) | ||
| 28 | - support shared libraries on OSF1 V4 (Tim Mooney) | ||
| 29 | - remove so_locations in "make clean" (Tim Mooney) | ||
| 30 | - fix maketree.c compilation error (Glenn, Mark) | ||
| 31 | - Python interface to zlib now in Python 1.5 (Jeremy Hylton) | ||
| 32 | - new Makefile.riscos (Rich Walker) | ||
| 33 | - initialize static descriptors in trees.c for embedded targets (Nick Smith) | ||
| 34 | - use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) | ||
| 35 | - add the OS/2 files in Makefile.in too (Andrew Zabolotny) | ||
| 36 | - fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) | ||
| 37 | - fix maketree.c to allow clean compilation of inffixed.h (Mark) | ||
| 38 | - fix parameter check in deflateCopy (Gunther Nikl) | ||
| 39 | - cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) | ||
| 40 | - Many portability patches by Christian Spieler: | ||
| 41 | . zutil.c, zutil.h: added "const" for zmem* | ||
| 42 | . Make_vms.com: fixed some typos | ||
| 43 | . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists | ||
| 44 | . msdos/Makefile.msc: remove "default rtl link library" info from obj files | ||
| 45 | . msdos/Makefile.*: use model-dependent name for the built zlib library | ||
| 46 | . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: | ||
| 47 | new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) | ||
| 48 | - use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) | ||
| 49 | - replace __far with _far for better portability (Christian Spieler, Tom Lane) | ||
| 50 | - fix test for errno.h in configure (Tim Newsham) | ||
| 51 | |||
| 4 | Changes in 1.1.2 (19 March 98) | 52 | Changes in 1.1.2 (19 March 98) |
| 5 | - added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) | 53 | - added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) |
| 6 | See http://www.winimage.com/zLibDll/unzip.html | 54 | See http://www.winimage.com/zLibDll/unzip.html |
| @@ -0,0 +1,72 @@ | |||
| 1 | |||
| 2 | Frequently Asked Questions about zlib | ||
| 3 | |||
| 4 | |||
| 5 | If your question is not there, please check the zlib home page | ||
| 6 | http://www.cdrom.com/pub/infozip/zlib/ which may have more recent information. | ||
| 7 | |||
| 8 | |||
| 9 | 1) I need a Windows DLL | ||
| 10 | 2) I need a Visual Basic interface to zlib | ||
| 11 | 3) compress() returns Z_BUF_ERROR | ||
| 12 | 4) deflate or inflate returns Z_BUF_ERROR | ||
| 13 | 5) Where is the zlib documentation (man pages, etc...)? | ||
| 14 | 6) Why don't you use GNU autoconf, libtool, etc...? | ||
| 15 | 7) There is a bug in zlib. | ||
| 16 | 8) I get "undefined reference to gzputc" | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | 1) I need a Windows DLL | ||
| 21 | |||
| 22 | The zlib sources can be compiled without change to produce a DLL. | ||
| 23 | If you want a precompiled DLL, see http://www.winimage.com/zLibDll | ||
| 24 | |||
| 25 | |||
| 26 | 2) I need a Visual Basic interface to zlib | ||
| 27 | |||
| 28 | See http://www.tcfb.com/dowseware/cmp-z-it.zip | ||
| 29 | http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm | ||
| 30 | and contrib/visual-basic.txt | ||
| 31 | |||
| 32 | 3) compress() returns Z_BUF_ERROR | ||
| 33 | |||
| 34 | Make sure that before the call of compress, the length of the | ||
| 35 | compressed buffer is equal to the total size of the compressed buffer | ||
| 36 | and not zero. For Visual Basic, check that this parameter is passed | ||
| 37 | by reference ("as any"), not by value ("as long"). | ||
| 38 | |||
| 39 | |||
| 40 | 4) deflate or inflate returns Z_BUF_ERROR | ||
| 41 | |||
| 42 | Make sure that before the call avail_in and avail_out are not zero. | ||
| 43 | |||
| 44 | |||
| 45 | 5) Where is the zlib documentation (man pages, etc...)? | ||
| 46 | |||
| 47 | It's in zlib.h for the moment. Volunteers to transform this | ||
| 48 | to man pages, please contact jloup@gzip.org. Examples of zlib usage | ||
| 49 | are in the files example.c and minigzip.c. | ||
| 50 | |||
| 51 | |||
| 52 | 6) Why don't you use GNU autoconf, libtool, etc...? | ||
| 53 | |||
| 54 | Because we would like to keep zlib as a very small and simple package. | ||
| 55 | zlib is rather portable and doesn't need much configuration. | ||
| 56 | |||
| 57 | |||
| 58 | 7) There is a bug in zlib. | ||
| 59 | |||
| 60 | Most of the time, such problems are due to an incorrect usage | ||
| 61 | of zlib. Please try to reproduce the problem with a small | ||
| 62 | program and send us the corresponding source at zlib@quest.jpl.nasa.gov | ||
| 63 | Do not send multi-megabyte data files without prior agreement. | ||
| 64 | |||
| 65 | |||
| 66 | 8) I get "undefined reference to gzputc" | ||
| 67 | |||
| 68 | If "make test" produces something like | ||
| 69 | example.o(.text+0x174): | ||
| 70 | check that you don't have old files libz.* in /usr/lib, /usr/local/lib | ||
| 71 | or /usr/X11R6/lib. Remove old versions then do "make install". | ||
| 72 | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | ChangeLog history of changes | 1 | ChangeLog history of changes |
| 2 | INDEX this file | 2 | INDEX this file |
| 3 | FAQ Frequently Asked Questions about zlib | ||
| 3 | Make_vms.com script for Vax/VMS | 4 | Make_vms.com script for Vax/VMS |
| 4 | Makefile makefile for Unix (generated by configure) | 5 | Makefile makefile for Unix (generated by configure) |
| 5 | Makefile.in makefile for Unix (template for configure) | 6 | Makefile.in makefile for Unix (template for configure) |
| 6 | Makefile.msc makefile for Microsoft C 16-bit | ||
| 7 | Makefile.riscos makefile for RISCOS | 7 | Makefile.riscos makefile for RISCOS |
| 8 | README guess what | 8 | README guess what |
| 9 | algorithm.txt description of the (de)compression algorithm | 9 | algorithm.txt description of the (de)compression algorithm |
| @@ -19,6 +19,8 @@ msdos/Makefile.w32 makefile for Microsoft Visual C++ 32-bit | |||
| 19 | msdos/Makefile.b32 makefile for Borland C++ 32-bit | 19 | msdos/Makefile.b32 makefile for Borland C++ 32-bit |
| 20 | msdos/Makefile.bor makefile for Borland C/C++ 16-bit | 20 | msdos/Makefile.bor makefile for Borland C/C++ 16-bit |
| 21 | msdos/Makefile.dj2 makefile for DJGPP 2.x | 21 | msdos/Makefile.dj2 makefile for DJGPP 2.x |
| 22 | msdos/Makefile.emx makefile for EMX 0.9c (32-bit DOS/OS2) | ||
| 23 | msdos/Makefile.msc makefile for Microsoft C 16-bit | ||
| 22 | msdos/Makefile.tc makefile for Turbo C | 24 | msdos/Makefile.tc makefile for Turbo C |
| 23 | msdos/Makefile.wat makefile for Watcom C | 25 | msdos/Makefile.wat makefile for Watcom C |
| 24 | msdos/zlib.def definition file for Windows DLL | 26 | msdos/zlib.def definition file for Windows DLL |
| @@ -26,6 +28,8 @@ msdos/zlib.rc definition file for Windows DLL | |||
| 26 | 28 | ||
| 27 | nt/Makefile.nt makefile for Windows NT | 29 | nt/Makefile.nt makefile for Windows NT |
| 28 | nt/zlib.dnt definition file for Windows NT DLL | 30 | nt/zlib.dnt definition file for Windows NT DLL |
| 31 | nt/Makefile.emx makefile for EMX 0.9c/RSXNT 1.41 (Win32 Intel) | ||
| 32 | nt/Makefile.gcc makefile for Windows NT using GCC (mingw32) | ||
| 29 | 33 | ||
| 30 | 34 | ||
| 31 | zlib public header files (must be kept): | 35 | zlib public header files (must be kept): |
diff --git a/Make_vms.com b/Make_vms.com index 0008d00..1c57e8f 100644 --- a/Make_vms.com +++ b/Make_vms.com | |||
| @@ -28,15 +28,15 @@ $ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" | |||
| 28 | $ then | 28 | $ then |
| 29 | $ dele example.obj;*,minigzip.obj;* | 29 | $ dele example.obj;*,minigzip.obj;* |
| 30 | $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - | 30 | $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - |
| 31 | adler32.c zutil.h zlib.h zconf.h | 31 | adler32.c zlib.h zconf.h |
| 32 | $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - | 32 | $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - |
| 33 | compress.c zlib.h zconf.h | 33 | compress.c zlib.h zconf.h |
| 34 | $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - | 34 | $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - |
| 35 | crc32.c zutil.h zlib.h zconf.h | 35 | crc32.c zlib.h zconf.h |
| 36 | $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - | 36 | $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - |
| 37 | deflatec.c deflate.h zutil.h zlib.h zconf.h | 37 | deflate.c deflate.h zutil.h zlib.h zconf.h |
| 38 | $ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - | 38 | $ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - |
| 39 | gsio.c zutil.h zlib.h zconf.h | 39 | gzio.c zutil.h zlib.h zconf.h |
| 40 | $ CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" - | 40 | $ CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" - |
| 41 | infblock.c zutil.h zlib.h zconf.h infblock.h | 41 | infblock.c zutil.h zlib.h zconf.h infblock.h |
| 42 | $ CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" - | 42 | $ CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" - |
| @@ -22,8 +22,9 @@ CFLAGS=-O | |||
| 22 | 22 | ||
| 23 | LDFLAGS=-L. -lz | 23 | LDFLAGS=-L. -lz |
| 24 | LDSHARED=$(CC) | 24 | LDSHARED=$(CC) |
| 25 | CPP=$(CC) -E | ||
| 25 | 26 | ||
| 26 | VER=1.1.2 | 27 | VER=1.1.3 |
| 27 | LIBS=libz.a | 28 | LIBS=libz.a |
| 28 | SHAREDLIB=libz.so | 29 | SHAREDLIB=libz.so |
| 29 | 30 | ||
| @@ -34,21 +35,27 @@ SHELL=/bin/sh | |||
| 34 | 35 | ||
| 35 | prefix = /usr/local | 36 | prefix = /usr/local |
| 36 | exec_prefix = ${prefix} | 37 | exec_prefix = ${prefix} |
| 38 | libdir = ${exec_prefix}/lib | ||
| 39 | includedir = ${prefix}/include | ||
| 37 | 40 | ||
| 38 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | 41 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ |
| 39 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | 42 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o |
| 40 | 43 | ||
| 44 | OBJA = | ||
| 45 | # to use the asm code: make OBJA=match.o | ||
| 46 | |||
| 41 | TEST_OBJS = example.o minigzip.o | 47 | TEST_OBJS = example.o minigzip.o |
| 42 | 48 | ||
| 43 | DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ | 49 | DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ |
| 44 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ | 50 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ |
| 45 | nt/Makefile.nt nt/zlib.dnt amiga/Make*.??? contrib/README.contrib \ | 51 | nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \ |
| 46 | contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ | 52 | contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ |
| 47 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ | 53 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \ |
| 54 | contrib/asm[56]86/*.S contrib/iostream/*.cpp \ | ||
| 48 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ | 55 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ |
| 49 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ | 56 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ |
| 50 | contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? | 57 | contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \ |
| 51 | 58 | contrib/delphi*/*.??? | |
| 52 | 59 | ||
| 53 | all: example minigzip | 60 | all: example minigzip |
| 54 | 61 | ||
| @@ -62,10 +69,16 @@ test: all | |||
| 62 | echo ' *** zlib test FAILED ***'; \ | 69 | echo ' *** zlib test FAILED ***'; \ |
| 63 | fi | 70 | fi |
| 64 | 71 | ||
| 65 | libz.a: $(OBJS) | 72 | libz.a: $(OBJS) $(OBJA) |
| 66 | $(AR) $@ $(OBJS) | 73 | $(AR) $@ $(OBJS) $(OBJA) |
| 67 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 74 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
| 68 | 75 | ||
| 76 | match.o: match.S | ||
| 77 | $(CPP) match.S > _match.s | ||
| 78 | $(CC) -c _match.s | ||
| 79 | mv _match.o match.o | ||
| 80 | rm -f _match.s | ||
| 81 | |||
| 69 | $(SHAREDLIB).$(VER): $(OBJS) | 82 | $(SHAREDLIB).$(VER): $(OBJS) |
| 70 | $(LDSHARED) -o $@ $(OBJS) | 83 | $(LDSHARED) -o $@ $(OBJS) |
| 71 | rm -f $(SHAREDLIB) $(SHAREDLIB).1 | 84 | rm -f $(SHAREDLIB) $(SHAREDLIB).1 |
| @@ -79,14 +92,14 @@ minigzip: minigzip.o $(LIBS) | |||
| 79 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 92 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
| 80 | 93 | ||
| 81 | install: $(LIBS) | 94 | install: $(LIBS) |
| 82 | -@if [ ! -d $(prefix)/include ]; then mkdir $(prefix)/include; fi | 95 | -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi |
| 83 | -@if [ ! -d $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi | 96 | -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi |
| 84 | cp zlib.h zconf.h $(prefix)/include | 97 | cp zlib.h zconf.h $(includedir) |
| 85 | chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h | 98 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h |
| 86 | cp $(LIBS) $(exec_prefix)/lib | 99 | cp $(LIBS) $(libdir) |
| 87 | cd $(exec_prefix)/lib; chmod 755 $(LIBS) | 100 | cd $(libdir); chmod 755 $(LIBS) |
| 88 | -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1 | 101 | -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 |
| 89 | cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \ | 102 | cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \ |
| 90 | rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ | 103 | rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ |
| 91 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ | 104 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ |
| 92 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ | 105 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ |
| @@ -96,19 +109,20 @@ install: $(LIBS) | |||
| 96 | # ldconfig is for Linux | 109 | # ldconfig is for Linux |
| 97 | 110 | ||
| 98 | uninstall: | 111 | uninstall: |
| 99 | cd $(prefix)/include; \ | 112 | cd $(includedir); \ |
| 100 | v=$(VER); \ | 113 | v=$(VER); \ |
| 101 | if test -f zlib.h; then \ | 114 | if test -f zlib.h; then \ |
| 102 | v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ | 115 | v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ |
| 103 | rm -f zlib.h zconf.h; \ | 116 | rm -f zlib.h zconf.h; \ |
| 104 | fi; \ | 117 | fi; \ |
| 105 | cd $(exec_prefix)/lib; rm -f libz.a; \ | 118 | cd $(libdir); rm -f libz.a; \ |
| 106 | if test -f $(SHAREDLIB).$$v; then \ | 119 | if test -f $(SHAREDLIB).$$v; then \ |
| 107 | rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ | 120 | rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ |
| 108 | fi | 121 | fi |
| 109 | 122 | ||
| 110 | clean: | 123 | clean: |
| 111 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz | 124 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ |
| 125 | _match.s maketree | ||
| 112 | 126 | ||
| 113 | distclean: clean | 127 | distclean: clean |
| 114 | 128 | ||
diff --git a/Makefile.in b/Makefile.in index c8bb6e9..3a3b116 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -22,8 +22,9 @@ CFLAGS=-O | |||
| 22 | 22 | ||
| 23 | LDFLAGS=-L. -lz | 23 | LDFLAGS=-L. -lz |
| 24 | LDSHARED=$(CC) | 24 | LDSHARED=$(CC) |
| 25 | CPP=$(CC) -E | ||
| 25 | 26 | ||
| 26 | VER=1.1.2 | 27 | VER=1.1.3 |
| 27 | LIBS=libz.a | 28 | LIBS=libz.a |
| 28 | SHAREDLIB=libz.so | 29 | SHAREDLIB=libz.so |
| 29 | 30 | ||
| @@ -34,21 +35,27 @@ SHELL=/bin/sh | |||
| 34 | 35 | ||
| 35 | prefix = /usr/local | 36 | prefix = /usr/local |
| 36 | exec_prefix = ${prefix} | 37 | exec_prefix = ${prefix} |
| 38 | libdir = ${exec_prefix}/lib | ||
| 39 | includedir = ${prefix}/include | ||
| 37 | 40 | ||
| 38 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | 41 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ |
| 39 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | 42 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o |
| 40 | 43 | ||
| 44 | OBJA = | ||
| 45 | # to use the asm code: make OBJA=match.o | ||
| 46 | |||
| 41 | TEST_OBJS = example.o minigzip.o | 47 | TEST_OBJS = example.o minigzip.o |
| 42 | 48 | ||
| 43 | DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ | 49 | DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ |
| 44 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ | 50 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ |
| 45 | nt/Makefile.nt nt/zlib.dnt amiga/Make*.??? contrib/README.contrib \ | 51 | nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \ |
| 46 | contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ | 52 | contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ |
| 47 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ | 53 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \ |
| 54 | contrib/asm[56]86/*.S contrib/iostream/*.cpp \ | ||
| 48 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ | 55 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ |
| 49 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ | 56 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ |
| 50 | contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? | 57 | contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \ |
| 51 | 58 | contrib/delphi*/*.??? | |
| 52 | 59 | ||
| 53 | all: example minigzip | 60 | all: example minigzip |
| 54 | 61 | ||
| @@ -62,10 +69,16 @@ test: all | |||
| 62 | echo ' *** zlib test FAILED ***'; \ | 69 | echo ' *** zlib test FAILED ***'; \ |
| 63 | fi | 70 | fi |
| 64 | 71 | ||
| 65 | libz.a: $(OBJS) | 72 | libz.a: $(OBJS) $(OBJA) |
| 66 | $(AR) $@ $(OBJS) | 73 | $(AR) $@ $(OBJS) $(OBJA) |
| 67 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 74 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
| 68 | 75 | ||
| 76 | match.o: match.S | ||
| 77 | $(CPP) match.S > _match.s | ||
| 78 | $(CC) -c _match.s | ||
| 79 | mv _match.o match.o | ||
| 80 | rm -f _match.s | ||
| 81 | |||
| 69 | $(SHAREDLIB).$(VER): $(OBJS) | 82 | $(SHAREDLIB).$(VER): $(OBJS) |
| 70 | $(LDSHARED) -o $@ $(OBJS) | 83 | $(LDSHARED) -o $@ $(OBJS) |
| 71 | rm -f $(SHAREDLIB) $(SHAREDLIB).1 | 84 | rm -f $(SHAREDLIB) $(SHAREDLIB).1 |
| @@ -79,14 +92,14 @@ minigzip: minigzip.o $(LIBS) | |||
| 79 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 92 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
| 80 | 93 | ||
| 81 | install: $(LIBS) | 94 | install: $(LIBS) |
| 82 | -@if [ ! -d $(prefix)/include ]; then mkdir $(prefix)/include; fi | 95 | -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi |
| 83 | -@if [ ! -d $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi | 96 | -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi |
| 84 | cp zlib.h zconf.h $(prefix)/include | 97 | cp zlib.h zconf.h $(includedir) |
| 85 | chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h | 98 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h |
| 86 | cp $(LIBS) $(exec_prefix)/lib | 99 | cp $(LIBS) $(libdir) |
| 87 | cd $(exec_prefix)/lib; chmod 755 $(LIBS) | 100 | cd $(libdir); chmod 755 $(LIBS) |
| 88 | -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1 | 101 | -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 |
| 89 | cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \ | 102 | cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \ |
| 90 | rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ | 103 | rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ |
| 91 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ | 104 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ |
| 92 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ | 105 | ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ |
| @@ -96,19 +109,20 @@ install: $(LIBS) | |||
| 96 | # ldconfig is for Linux | 109 | # ldconfig is for Linux |
| 97 | 110 | ||
| 98 | uninstall: | 111 | uninstall: |
| 99 | cd $(prefix)/include; \ | 112 | cd $(includedir); \ |
| 100 | v=$(VER); \ | 113 | v=$(VER); \ |
| 101 | if test -f zlib.h; then \ | 114 | if test -f zlib.h; then \ |
| 102 | v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ | 115 | v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ |
| 103 | rm -f zlib.h zconf.h; \ | 116 | rm -f zlib.h zconf.h; \ |
| 104 | fi; \ | 117 | fi; \ |
| 105 | cd $(exec_prefix)/lib; rm -f libz.a; \ | 118 | cd $(libdir); rm -f libz.a; \ |
| 106 | if test -f $(SHAREDLIB).$$v; then \ | 119 | if test -f $(SHAREDLIB).$$v; then \ |
| 107 | rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ | 120 | rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ |
| 108 | fi | 121 | fi |
| 109 | 122 | ||
| 110 | clean: | 123 | clean: |
| 111 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz | 124 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ |
| 125 | _match.s maketree | ||
| 112 | 126 | ||
| 113 | distclean: clean | 127 | distclean: clean |
| 114 | 128 | ||
diff --git a/Makefile.riscos b/Makefile.riscos index 0f10aa8..d97f449 100644 --- a/Makefile.riscos +++ b/Makefile.riscos | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | # Project: zlib_1_03 | 1 | # Project: zlib_1_03 |
| 2 | 2 | # Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 | |
| 3 | # test works out-of-the-box, installs `somewhere' on demand | ||
| 3 | 4 | ||
| 4 | # Toolflags: | 5 | # Toolflags: |
| 5 | CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fnah | 6 | CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah |
| 6 | C++flags = -c -depend !Depend -IC: -throwback | 7 | C++flags = -c -depend !Depend -IC: -throwback |
| 7 | Linkflags = -aif -c++ -o $@ | 8 | Linkflags = -aif -c++ -o $@ |
| 8 | ObjAsmflags = -throwback -NoCache -depend !Depend | 9 | ObjAsmflags = -throwback -NoCache -depend !Depend |
| @@ -10,37 +11,141 @@ CMHGflags = | |||
| 10 | LibFileflags = -c -l -o $@ | 11 | LibFileflags = -c -l -o $@ |
| 11 | Squeezeflags = -o $@ | 12 | Squeezeflags = -o $@ |
| 12 | 13 | ||
| 14 | # change the line below to where _you_ want the library installed. | ||
| 15 | libdest = lib:zlib | ||
| 13 | 16 | ||
| 14 | # Final targets: | 17 | # Final targets: |
| 15 | @.zlib_lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ | 18 | @.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ |
| 16 | @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ | 19 | @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ |
| 17 | @.o.uncompress @.o.zutil | 20 | @.o.uncompr @.o.zutil |
| 18 | LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ | 21 | LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ |
| 19 | @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ | 22 | @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ |
| 20 | @.o.trees @.o.uncompress @.o.zutil | 23 | @.o.trees @.o.uncompr @.o.zutil |
| 21 | @.test: @.tests.minigzip @.tests.example | 24 | test: @.minigzip @.example @.lib |
| 22 | echo Please run "Test" in directory tests | 25 | @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV |
| 23 | @.tests.minigzip: @.o.minigzip @.zlib_lib C:o.Stubs | 26 | @echo running tests: hang on. |
| 24 | Link $(Linkflags) @.o.minigzip @.zlib_lib C:o.Stubs | 27 | @/@.minigzip -f -9 libc |
| 25 | @.tests.example: @.o.example @.zlib_lib C:o.Stubs | 28 | @/@.minigzip -d libc-gz |
| 26 | Link $(Linkflags) @.o.example @.zlib_lib C:o.Stubs | 29 | @/@.minigzip -f -1 libc |
| 30 | @/@.minigzip -d libc-gz | ||
| 31 | @/@.minigzip -h -9 libc | ||
| 32 | @/@.minigzip -d libc-gz | ||
| 33 | @/@.minigzip -h -1 libc | ||
| 34 | @/@.minigzip -d libc-gz | ||
| 35 | @/@.minigzip -9 libc | ||
| 36 | @/@.minigzip -d libc-gz | ||
| 37 | @/@.minigzip -1 libc | ||
| 38 | @/@.minigzip -d libc-gz | ||
| 39 | @diff @.lib @.libc | ||
| 40 | @echo that should have reported '@.lib and @.libc identical' if you have diff. | ||
| 41 | @/@.example @.fred @.fred | ||
| 42 | @echo that will have given lots of hello!'s. | ||
| 43 | |||
| 44 | @.minigzip: @.o.minigzip @.lib C:o.Stubs | ||
| 45 | Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs | ||
| 46 | @.example: @.o.example @.lib C:o.Stubs | ||
| 47 | Link $(Linkflags) @.o.example @.lib C:o.Stubs | ||
| 27 | 48 | ||
| 49 | install: @.lib | ||
| 50 | cdir $(libdest) | ||
| 51 | cdir $(libdest).h | ||
| 52 | @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV | ||
| 53 | @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV | ||
| 54 | @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV | ||
| 55 | @echo okay, installed zlib in $(libdest) | ||
| 56 | |||
| 57 | clean:; remove @.minigzip | ||
| 58 | remove @.example | ||
| 59 | remove @.libc | ||
| 60 | -wipe @.o.* F~r~cV | ||
| 61 | remove @.fred | ||
| 28 | 62 | ||
| 29 | # User-editable dependencies: | 63 | # User-editable dependencies: |
| 30 | .c.o: | 64 | .c.o: |
| 31 | cc $(ccflags) -o $@ $< | 65 | cc $(ccflags) -o $@ $< |
| 32 | 66 | ||
| 33 | # Static dependencies: | 67 | # Static dependencies: |
| 34 | @.o.example: @.tests.c.example | ||
| 35 | cc $(ccflags) -o @.o.example @.tests.c.example | ||
| 36 | @.o.minigzip: @.tests.c.minigzip | ||
| 37 | cc $(ccflags) -o @.o.minigzip @.tests.c.minigzip | ||
| 38 | |||
| 39 | 68 | ||
| 40 | # Dynamic dependencies: | 69 | # Dynamic dependencies: |
| 41 | o.minigzip: tests.c.minigzip | 70 | o.example: c.example |
| 42 | o.minigzip: h.zlib | ||
| 43 | o.minigzip: h.zconf | ||
| 44 | o.example: tests.c.example | ||
| 45 | o.example: h.zlib | 71 | o.example: h.zlib |
| 46 | o.example: h.zconf | 72 | o.example: h.zconf |
| 73 | o.minigzip: c.minigzip | ||
| 74 | o.minigzip: h.zlib | ||
| 75 | o.minigzip: h.zconf | ||
| 76 | o.adler32: c.adler32 | ||
| 77 | o.adler32: h.zlib | ||
| 78 | o.adler32: h.zconf | ||
| 79 | o.compress: c.compress | ||
| 80 | o.compress: h.zlib | ||
| 81 | o.compress: h.zconf | ||
| 82 | o.crc32: c.crc32 | ||
| 83 | o.crc32: h.zlib | ||
| 84 | o.crc32: h.zconf | ||
| 85 | o.deflate: c.deflate | ||
| 86 | o.deflate: h.deflate | ||
| 87 | o.deflate: h.zutil | ||
| 88 | o.deflate: h.zlib | ||
| 89 | o.deflate: h.zconf | ||
| 90 | o.gzio: c.gzio | ||
| 91 | o.gzio: h.zutil | ||
| 92 | o.gzio: h.zlib | ||
| 93 | o.gzio: h.zconf | ||
| 94 | o.infblock: c.infblock | ||
| 95 | o.infblock: h.zutil | ||
| 96 | o.infblock: h.zlib | ||
| 97 | o.infblock: h.zconf | ||
| 98 | o.infblock: h.infblock | ||
| 99 | o.infblock: h.inftrees | ||
| 100 | o.infblock: h.infcodes | ||
| 101 | o.infblock: h.infutil | ||
| 102 | o.infcodes: c.infcodes | ||
| 103 | o.infcodes: h.zutil | ||
| 104 | o.infcodes: h.zlib | ||
| 105 | o.infcodes: h.zconf | ||
| 106 | o.infcodes: h.inftrees | ||
| 107 | o.infcodes: h.infblock | ||
| 108 | o.infcodes: h.infcodes | ||
| 109 | o.infcodes: h.infutil | ||
| 110 | o.infcodes: h.inffast | ||
| 111 | o.inffast: c.inffast | ||
| 112 | o.inffast: h.zutil | ||
| 113 | o.inffast: h.zlib | ||
| 114 | o.inffast: h.zconf | ||
| 115 | o.inffast: h.inftrees | ||
| 116 | o.inffast: h.infblock | ||
| 117 | o.inffast: h.infcodes | ||
| 118 | o.inffast: h.infutil | ||
| 119 | o.inffast: h.inffast | ||
| 120 | o.inflate: c.inflate | ||
| 121 | o.inflate: h.zutil | ||
| 122 | o.inflate: h.zlib | ||
| 123 | o.inflate: h.zconf | ||
| 124 | o.inflate: h.infblock | ||
| 125 | o.inftrees: c.inftrees | ||
| 126 | o.inftrees: h.zutil | ||
| 127 | o.inftrees: h.zlib | ||
| 128 | o.inftrees: h.zconf | ||
| 129 | o.inftrees: h.inftrees | ||
| 130 | o.inftrees: h.inffixed | ||
| 131 | o.infutil: c.infutil | ||
| 132 | o.infutil: h.zutil | ||
| 133 | o.infutil: h.zlib | ||
| 134 | o.infutil: h.zconf | ||
| 135 | o.infutil: h.infblock | ||
| 136 | o.infutil: h.inftrees | ||
| 137 | o.infutil: h.infcodes | ||
| 138 | o.infutil: h.infutil | ||
| 139 | o.trees: c.trees | ||
| 140 | o.trees: h.deflate | ||
| 141 | o.trees: h.zutil | ||
| 142 | o.trees: h.zlib | ||
| 143 | o.trees: h.zconf | ||
| 144 | o.trees: h.trees | ||
| 145 | o.uncompr: c.uncompr | ||
| 146 | o.uncompr: h.zlib | ||
| 147 | o.uncompr: h.zconf | ||
| 148 | o.zutil: c.zutil | ||
| 149 | o.zutil: h.zutil | ||
| 150 | o.zutil: h.zlib | ||
| 151 | o.zutil: h.zconf | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | zlib 1.1.2 is a general purpose data compression library. All the code | 1 | zlib 1.1.3 is a general purpose data compression library. All the code |
| 2 | is thread safe. The data format used by the zlib library | 2 | is thread safe. The data format used by the zlib library |
| 3 | is described by RFCs (Request for Comments) 1950 to 1952 in the files | 3 | is described by RFCs (Request for Comments) 1950 to 1952 in the files |
| 4 | ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate | 4 | ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate |
| @@ -14,35 +14,41 @@ except example.c and minigzip.c. | |||
| 14 | 14 | ||
| 15 | To compile all files and run the test program, follow the instructions | 15 | To compile all files and run the test program, follow the instructions |
| 16 | given at the top of Makefile. In short "make test; make install" | 16 | given at the top of Makefile. In short "make test; make install" |
| 17 | should work for most machines. For MSDOS, use one of the special | 17 | should work for most machines. For Unix: "configure; make test; make install" |
| 18 | makefiles such as Makefile.msc; for VMS, use Make_vms.com or descrip.mms. | 18 | For MSDOS, use one of the special makefiles such as Makefile.msc. |
| 19 | For VMS, use Make_vms.com or descrip.mms. | ||
| 19 | 20 | ||
| 20 | Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov> or, | 21 | Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov>, or to |
| 21 | if this fails, to the addresses given below in the Copyright section. | 22 | Gilles Vollant <info@winimage.com> for the Windows DLL version. |
| 22 | The zlib home page is http://www.cdrom.com/pub/infozip/zlib/ | 23 | The zlib home page is http://www.cdrom.com/pub/infozip/zlib/ |
| 23 | The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/ | 24 | The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/ |
| 25 | Before reporting a problem, please check those sites to verify that | ||
| 26 | you have the latest version of zlib; otherwise get the latest version and | ||
| 27 | check whether the problem still exists or not. | ||
| 28 | |||
| 24 | Mark Nelson <markn@tiny.com> wrote an article about zlib for the Jan. 1997 | 29 | Mark Nelson <markn@tiny.com> wrote an article about zlib for the Jan. 1997 |
| 25 | issue of Dr. Dobb's Journal; a copy of the article is available in | 30 | issue of Dr. Dobb's Journal; a copy of the article is available in |
| 26 | http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm | 31 | http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm |
| 27 | 32 | ||
| 28 | The changes made in version 1.1.2 are documented in the file ChangeLog. | 33 | The changes made in version 1.1.3 are documented in the file ChangeLog. |
| 29 | The main changes since 1.1.1 are: | 34 | The main changes since 1.1.2 are: |
| 30 | 35 | ||
| 31 | - added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) | 36 | - fix "an inflate input buffer bug that shows up on rare but persistent |
| 32 | See http://www.winimage.com/zLibDll/unzip.html | 37 | occasions" (Mark) |
| 33 | - preinitialize the inflate tables for fixed codes, to make the code | 38 | - fix gzread and gztell for concatenated .gz files (Didier Le Botlan) |
| 34 | completely thread safe (Mark) | 39 | - fix gzseek(..., SEEK_SET) in write mode |
| 35 | - some simplifications and slight speed-up to the inflate code (Mark) | 40 | - fix crc check after a gzeek (Frank Faubert) |
| 36 | - fix gzeof on non-compressed files (Allan Schrum) | 41 | - fix miniunzip when the last entry in a zip file is itself a zip file |
| 37 | - add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) | 42 | (J Lillge) |
| 38 | - use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) | 43 | - add contrib/asm586 and contrib/asm686 (Brian Raiter) |
| 39 | - added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) | 44 | See http://www.muppetlabs.com/~breadbox/software/assembly.html |
| 40 | - add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) | 45 | - add support for Delphi 3 in contrib/delphi (Bob Dellaca) |
| 41 | - do not wrap extern "C" around system includes (Tom Lane) | 46 | - add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) |
| 42 | - added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) | 47 | - do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) |
| 43 | - allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) | 48 | - use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) |
| 44 | - allow "configure --prefix $HOME" (Tim Mooney) | 49 | - added a FAQ file |
| 45 | 50 | ||
| 51 | plus many changes for portability. | ||
| 46 | 52 | ||
| 47 | Unsupported third party contributions are provided in directory "contrib". | 53 | Unsupported third party contributions are provided in directory "contrib". |
| 48 | 54 | ||
| @@ -55,8 +61,8 @@ is in the CPAN (Comprehensive Perl Archive Network) sites, such as: | |||
| 55 | ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* | 61 | ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* |
| 56 | 62 | ||
| 57 | A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> | 63 | A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> |
| 58 | is available from the Python Software Association sites, such as: | 64 | is available in Python 1.5 and later versions, see |
| 59 | ftp://ftp.python.org/pub/python/contrib/Encoding/zlib*.tar.gz | 65 | http://www.python.org/doc/lib/module-zlib.html |
| 60 | 66 | ||
| 61 | A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> | 67 | A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> |
| 62 | is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html | 68 | is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html |
| @@ -77,8 +83,8 @@ Notes for some targets: | |||
| 77 | 83 | ||
| 78 | From Visual Basic, you can call the DLL functions which do not take | 84 | From Visual Basic, you can call the DLL functions which do not take |
| 79 | a structure as argument: compress, uncompress and all gz* functions. | 85 | a structure as argument: compress, uncompress and all gz* functions. |
| 80 | See contrib/visual-basic.txt for more information. | 86 | See contrib/visual-basic.txt for more information, or get |
| 81 | I don't know how to handle structures in Visual Basic, sorry. | 87 | http://www.tcfb.com/dowseware/cmp-z-it.zip |
| 82 | 88 | ||
| 83 | - For 64-bit Irix, deflate.c must be compiled without any optimization. | 89 | - For 64-bit Irix, deflate.c must be compiled without any optimization. |
| 84 | With -O, one libpng test fails. The test works in 32 bit mode (with | 90 | With -O, one libpng test fails. The test works in 32 bit mode (with |
| @@ -93,15 +99,14 @@ Notes for some targets: | |||
| 93 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works | 99 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works |
| 94 | with other compilers. Use "make test" to check your compiler. | 100 | with other compilers. Use "make test" to check your compiler. |
| 95 | 101 | ||
| 96 | - For shared memory multiprocessors, the decompression code assumes that | ||
| 97 | writes to pointers are atomic. Also the functions zalloc and zfree passed | ||
| 98 | to deflateInit must be multi-threaded in this case. | ||
| 99 | |||
| 100 | - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. | 102 | - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. |
| 101 | 103 | ||
| 102 | - For Turbo C the small model is supported only with reduced performance to | 104 | - For Turbo C the small model is supported only with reduced performance to |
| 103 | avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | 105 | avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 |
| 104 | 106 | ||
| 107 | - For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html | ||
| 108 | Per Harald Myrvang <perm@stud.cs.uit.no> | ||
| 109 | |||
| 105 | 110 | ||
| 106 | Acknowledgments: | 111 | Acknowledgments: |
| 107 | 112 | ||
| @@ -24,18 +24,34 @@ VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | |||
| 24 | AR=${AR-"ar rc"} | 24 | AR=${AR-"ar rc"} |
| 25 | RANLIB=${RANLIB-"ranlib"} | 25 | RANLIB=${RANLIB-"ranlib"} |
| 26 | prefix=${prefix-/usr/local} | 26 | prefix=${prefix-/usr/local} |
| 27 | exec_prefix=${exec_prefix-'${prefix}'} | ||
| 28 | libdir=${libdir-'${exec_prefix}/lib'} | ||
| 29 | includedir=${includedir-'${prefix}/include'} | ||
| 27 | shared_ext='.so' | 30 | shared_ext='.so' |
| 28 | shared=0 | 31 | shared=0 |
| 29 | gcc=0 | 32 | gcc=0 |
| 30 | old_cc="$CC" | 33 | old_cc="$CC" |
| 31 | old_cflags="$CFLAGS" | 34 | old_cflags="$CFLAGS" |
| 32 | 35 | ||
| 36 | while test $# -ge 1 | ||
| 37 | do | ||
| 33 | case "$1" in | 38 | case "$1" in |
| 34 | -h* | --h*) echo 'syntax: configure [ --shared ] [--prefix PREFIX]'; exit 0;; | 39 | -h* | --h*) |
| 35 | -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | 40 | echo 'usage:' |
| 36 | -p* | --p*) prefix="$2"; shift; shift;; | 41 | echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]' |
| 37 | -s* | --s*) shared=1; shift;; | 42 | echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]' |
| 38 | esac | 43 | exit 0;; |
| 44 | -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | ||
| 45 | -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | ||
| 46 | -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | ||
| 47 | -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; | ||
| 48 | -p* | --p*) prefix="$2"; shift; shift;; | ||
| 49 | -e* | --e*) exec_prefix="$2"; shift; shift;; | ||
| 50 | -l* | --l*) libdir="$2"; shift; shift;; | ||
| 51 | -i* | --i*) includedir="$2"; shift; shift;; | ||
| 52 | -s* | --s*) shared=1; shift;; | ||
| 53 | esac | ||
| 54 | done | ||
| 39 | 55 | ||
| 40 | test=ztest$$ | 56 | test=ztest$$ |
| 41 | cat > $test.c <<EOF | 57 | cat > $test.c <<EOF |
| @@ -46,6 +62,7 @@ EOF | |||
| 46 | test -z "$CC" && echo Checking for gcc... | 62 | test -z "$CC" && echo Checking for gcc... |
| 47 | cc=${CC-gcc} | 63 | cc=${CC-gcc} |
| 48 | cflags=${CFLAGS-"-O3"} | 64 | cflags=${CFLAGS-"-O3"} |
| 65 | # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure | ||
| 49 | case "$cc" in | 66 | case "$cc" in |
| 50 | *gcc*) gcc=1;; | 67 | *gcc*) gcc=1;; |
| 51 | esac | 68 | esac |
| @@ -71,7 +88,10 @@ else | |||
| 71 | IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} | 88 | IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} |
| 72 | CFLAGS=${CFLAGS-"-ansi -O2"} | 89 | CFLAGS=${CFLAGS-"-ansi -O2"} |
| 73 | LDSHARED=${LDSHARED-"cc -shared"};; | 90 | LDSHARED=${LDSHARED-"cc -shared"};; |
| 74 | OSF1) SFLAGS=${CFLAGS-"-O -std1"} | 91 | OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} |
| 92 | CFLAGS=${CFLAGS-"-O -std1"} | ||
| 93 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};; | ||
| 94 | OSF1*) SFLAGS=${CFLAGS-"-O -std1"} | ||
| 75 | CFLAGS=${CFLAGS-"-O -std1"} | 95 | CFLAGS=${CFLAGS-"-O -std1"} |
| 76 | LDSHARED=${LDSHARED-"cc -shared"};; | 96 | LDSHARED=${LDSHARED-"cc -shared"};; |
| 77 | QNX*) SFLAGS=${CFLAGS-"-4 -O"} | 97 | QNX*) SFLAGS=${CFLAGS-"-4 -O"} |
| @@ -124,11 +144,25 @@ if test $shared -eq 0; then | |||
| 124 | echo Building static library $LIBS version $VER with $CC. | 144 | echo Building static library $LIBS version $VER with $CC. |
| 125 | fi | 145 | fi |
| 126 | 146 | ||
| 127 | if test -f /usr/include/unistd.h; then | 147 | cat > $test.c <<EOF |
| 148 | #include <unistd.h> | ||
| 149 | int main() { return 0; } | ||
| 150 | EOF | ||
| 151 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 128 | CFLAGS="$CFLAGS -DHAVE_UNISTD_H" | 152 | CFLAGS="$CFLAGS -DHAVE_UNISTD_H" |
| 153 | echo "Checking for unistd.h... Yes." | ||
| 154 | else | ||
| 155 | echo "Checking for unistd.h... No." | ||
| 129 | fi | 156 | fi |
| 130 | 157 | ||
| 131 | if test ! -f /usr/include/errno.h; then | 158 | cat > $test.c <<EOF |
| 159 | #include <errno.h> | ||
| 160 | int main() { return 0; } | ||
| 161 | EOF | ||
| 162 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 163 | echo "Checking for errno.h... Yes." | ||
| 164 | else | ||
| 165 | echo "Checking for errno.h... No." | ||
| 132 | CFLAGS="$CFLAGS -DNO_ERRNO_H" | 166 | CFLAGS="$CFLAGS -DNO_ERRNO_H" |
| 133 | fi | 167 | fi |
| 134 | 168 | ||
| @@ -147,12 +181,24 @@ else | |||
| 147 | echo Checking for mmap support... No. | 181 | echo Checking for mmap support... No. |
| 148 | fi | 182 | fi |
| 149 | 183 | ||
| 184 | CPP=${CPP-"$CC -E"} | ||
| 185 | case $CFLAGS in | ||
| 186 | *ASMV*) | ||
| 187 | if test "`nm $test.o | grep _hello`" = ""; then | ||
| 188 | CPP="$CPP -DNO_UNDERLINE" | ||
| 189 | echo Checking for underline in external names... No. | ||
| 190 | else | ||
| 191 | echo Checking for underline in external names... Yes. | ||
| 192 | fi;; | ||
| 193 | esac | ||
| 194 | |||
| 150 | rm -f $test.[co] $test$shared_ext | 195 | rm -f $test.[co] $test$shared_ext |
| 151 | 196 | ||
| 152 | # udpate Makefile | 197 | # udpate Makefile |
| 153 | sed < Makefile.in " | 198 | sed < Makefile.in " |
| 154 | /^CC *=/s%=.*%=$CC% | 199 | /^CC *=/s%=.*%=$CC% |
| 155 | /^CFLAGS *=/s%=.*%=$CFLAGS% | 200 | /^CFLAGS *=/s%=.*%=$CFLAGS% |
| 201 | /^CPP *=/s%=.*%=$CPP% | ||
| 156 | /^LDSHARED *=/s%=.*%=$LDSHARED% | 202 | /^LDSHARED *=/s%=.*%=$LDSHARED% |
| 157 | /^LIBS *=/s%=.*%=$LIBS% | 203 | /^LIBS *=/s%=.*%=$LIBS% |
| 158 | /^SHAREDLIB *=/s%=.*%=$SHAREDLIB% | 204 | /^SHAREDLIB *=/s%=.*%=$SHAREDLIB% |
| @@ -160,4 +206,7 @@ sed < Makefile.in " | |||
| 160 | /^RANLIB *=/s%=.*%=$RANLIB% | 206 | /^RANLIB *=/s%=.*%=$RANLIB% |
| 161 | /^VER *=/s%=.*%=$VER% | 207 | /^VER *=/s%=.*%=$VER% |
| 162 | /^prefix *=/s%=.*%=$prefix% | 208 | /^prefix *=/s%=.*%=$prefix% |
| 209 | /^exec_prefix *=/s%=.*%=$exec_prefix% | ||
| 210 | /^libdir *=/s%=.*%=$libdir% | ||
| 211 | /^includedir *=/s%=.*%=$includedir% | ||
| 163 | " > Makefile | 212 | " > Makefile |
diff --git a/contrib/README.contrib b/contrib/README.contrib index dfe9031..7ad191c 100644 --- a/contrib/README.contrib +++ b/contrib/README.contrib | |||
| @@ -7,6 +7,16 @@ for help about these, not the zlib authors. Thanks. | |||
| 7 | asm386/ by Gilles Vollant <info@winimage.com> | 7 | asm386/ by Gilles Vollant <info@winimage.com> |
| 8 | 386 asm code replacing longest_match(), for Visual C++ 4.2 and ML 6.11c | 8 | 386 asm code replacing longest_match(), for Visual C++ 4.2 and ML 6.11c |
| 9 | 9 | ||
| 10 | asm586/ and asm686/ by Brian Raiter <breadbox@muppetlabs.com> | ||
| 11 | asm code for Pentium and Pentium Pro | ||
| 12 | See http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
| 13 | |||
| 14 | delphi/ by Bob Dellaca <bobdl@xtra.co.nz> | ||
| 15 | Support for Delphi | ||
| 16 | |||
| 17 | delphi2/ by Davide Moretti <dave@rimini.com> | ||
| 18 | Another support for C++Builder and Delphi | ||
| 19 | |||
| 10 | minizip/ by Gilles Vollant <info@winimage.com> | 20 | minizip/ by Gilles Vollant <info@winimage.com> |
| 11 | Mini zip and unzip based on zlib | 21 | Mini zip and unzip based on zlib |
| 12 | See http://www.winimage.com/zLibDll/unzip.html | 22 | See http://www.winimage.com/zLibDll/unzip.html |
diff --git a/contrib/asm586/README.586 b/contrib/asm586/README.586 new file mode 100644 index 0000000..6bb78f3 --- /dev/null +++ b/contrib/asm586/README.586 | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | This is a patched version of zlib modified to use | ||
| 2 | Pentium-optimized assembly code in the deflation algorithm. The files | ||
| 3 | changed/added by this patch are: | ||
| 4 | |||
| 5 | README.586 | ||
| 6 | match.S | ||
| 7 | |||
| 8 | The effectiveness of these modifications is a bit marginal, as the the | ||
| 9 | program's bottleneck seems to be mostly L1-cache contention, for which | ||
| 10 | there is no real way to work around without rewriting the basic | ||
| 11 | algorithm. The speedup on average is around 5-10% (which is generally | ||
| 12 | less than the amount of variance between subsequent executions). | ||
| 13 | However, when used at level 9 compression, the cache contention can | ||
| 14 | drop enough for the assembly version to achieve 10-20% speedup (and | ||
| 15 | sometimes more, depending on the amount of overall redundancy in the | ||
| 16 | files). Even here, though, cache contention can still be the limiting | ||
| 17 | factor, depending on the nature of the program using the zlib library. | ||
| 18 | This may also mean that better improvements will be seen on a Pentium | ||
| 19 | with MMX, which suffers much less from L1-cache contention, but I have | ||
| 20 | not yet verified this. | ||
| 21 | |||
| 22 | Note that this code has been tailored for the Pentium in particular, | ||
| 23 | and will not perform well on the Pentium Pro (due to the use of a | ||
| 24 | partial register in the inner loop). | ||
| 25 | |||
| 26 | If you are using an assembler other than GNU as, you will have to | ||
| 27 | translate match.S to use your assembler's syntax. (Have fun.) | ||
| 28 | |||
| 29 | Brian Raiter | ||
| 30 | breadbox@muppetlabs.com | ||
| 31 | April, 1998 | ||
| 32 | |||
| 33 | |||
| 34 | Added for zlib 1.1.3: | ||
| 35 | |||
| 36 | The patches come from | ||
| 37 | http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
| 38 | |||
| 39 | To compile zlib with this asm file, copy match.S to the zlib directory | ||
| 40 | then do: | ||
| 41 | |||
| 42 | CFLAGS="-O3 -DASMV" ./configure | ||
| 43 | make OBJA=match.o | ||
diff --git a/contrib/asm586/match.S b/contrib/asm586/match.S new file mode 100644 index 0000000..8f16140 --- /dev/null +++ b/contrib/asm586/match.S | |||
| @@ -0,0 +1,354 @@ | |||
| 1 | /* match.s -- Pentium-optimized version of longest_match() | ||
| 2 | * Written for zlib 1.1.2 | ||
| 3 | * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com> | ||
| 4 | * | ||
| 5 | * This is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef NO_UNDERLINE | ||
| 10 | #define match_init _match_init | ||
| 11 | #define longest_match _longest_match | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #define MAX_MATCH (258) | ||
| 15 | #define MIN_MATCH (3) | ||
| 16 | #define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) | ||
| 17 | #define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) | ||
| 18 | |||
| 19 | /* stack frame offsets */ | ||
| 20 | |||
| 21 | #define wmask 0 /* local copy of s->wmask */ | ||
| 22 | #define window 4 /* local copy of s->window */ | ||
| 23 | #define windowbestlen 8 /* s->window + bestlen */ | ||
| 24 | #define chainlenscanend 12 /* high word: current chain len */ | ||
| 25 | /* low word: last bytes sought */ | ||
| 26 | #define scanstart 16 /* first two bytes of string */ | ||
| 27 | #define scanalign 20 /* dword-misalignment of string */ | ||
| 28 | #define nicematch 24 /* a good enough match size */ | ||
| 29 | #define bestlen 28 /* size of best match so far */ | ||
| 30 | #define scan 32 /* ptr to string wanting match */ | ||
| 31 | |||
| 32 | #define LocalVarsSize (36) | ||
| 33 | /* saved ebx 36 */ | ||
| 34 | /* saved edi 40 */ | ||
| 35 | /* saved esi 44 */ | ||
| 36 | /* saved ebp 48 */ | ||
| 37 | /* return address 52 */ | ||
| 38 | #define deflatestate 56 /* the function arguments */ | ||
| 39 | #define curmatch 60 | ||
| 40 | |||
| 41 | /* Offsets for fields in the deflate_state structure. These numbers | ||
| 42 | * are calculated from the definition of deflate_state, with the | ||
| 43 | * assumption that the compiler will dword-align the fields. (Thus, | ||
| 44 | * changing the definition of deflate_state could easily cause this | ||
| 45 | * program to crash horribly, without so much as a warning at | ||
| 46 | * compile time. Sigh.) | ||
| 47 | */ | ||
| 48 | #define dsWSize 36 | ||
| 49 | #define dsWMask 44 | ||
| 50 | #define dsWindow 48 | ||
| 51 | #define dsPrev 56 | ||
| 52 | #define dsMatchLen 88 | ||
| 53 | #define dsPrevMatch 92 | ||
| 54 | #define dsStrStart 100 | ||
| 55 | #define dsMatchStart 104 | ||
| 56 | #define dsLookahead 108 | ||
| 57 | #define dsPrevLen 112 | ||
| 58 | #define dsMaxChainLen 116 | ||
| 59 | #define dsGoodMatch 132 | ||
| 60 | #define dsNiceMatch 136 | ||
| 61 | |||
| 62 | |||
| 63 | .file "match.S" | ||
| 64 | |||
| 65 | .globl match_init, longest_match | ||
| 66 | |||
| 67 | .text | ||
| 68 | |||
| 69 | /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ | ||
| 70 | |||
| 71 | longest_match: | ||
| 72 | |||
| 73 | /* Save registers that the compiler may be using, and adjust %esp to */ | ||
| 74 | /* make room for our stack frame. */ | ||
| 75 | |||
| 76 | pushl %ebp | ||
| 77 | pushl %edi | ||
| 78 | pushl %esi | ||
| 79 | pushl %ebx | ||
| 80 | subl $LocalVarsSize, %esp | ||
| 81 | |||
| 82 | /* Retrieve the function arguments. %ecx will hold cur_match */ | ||
| 83 | /* throughout the entire function. %edx will hold the pointer to the */ | ||
| 84 | /* deflate_state structure during the function's setup (before */ | ||
| 85 | /* entering the main loop). */ | ||
| 86 | |||
| 87 | movl deflatestate(%esp), %edx | ||
| 88 | movl curmatch(%esp), %ecx | ||
| 89 | |||
| 90 | /* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ | ||
| 91 | |||
| 92 | movl dsNiceMatch(%edx), %eax | ||
| 93 | movl dsLookahead(%edx), %ebx | ||
| 94 | cmpl %eax, %ebx | ||
| 95 | jl LookaheadLess | ||
| 96 | movl %eax, %ebx | ||
| 97 | LookaheadLess: movl %ebx, nicematch(%esp) | ||
| 98 | |||
| 99 | /* register Bytef *scan = s->window + s->strstart; */ | ||
| 100 | |||
| 101 | movl dsWindow(%edx), %esi | ||
| 102 | movl %esi, window(%esp) | ||
| 103 | movl dsStrStart(%edx), %ebp | ||
| 104 | lea (%esi,%ebp), %edi | ||
| 105 | movl %edi, scan(%esp) | ||
| 106 | |||
| 107 | /* Determine how many bytes the scan ptr is off from being */ | ||
| 108 | /* dword-aligned. */ | ||
| 109 | |||
| 110 | movl %edi, %eax | ||
| 111 | negl %eax | ||
| 112 | andl $3, %eax | ||
| 113 | movl %eax, scanalign(%esp) | ||
| 114 | |||
| 115 | /* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ | ||
| 116 | /* s->strstart - (IPos)MAX_DIST(s) : NIL; */ | ||
| 117 | |||
| 118 | movl dsWSize(%edx), %eax | ||
| 119 | subl $MIN_LOOKAHEAD, %eax | ||
| 120 | subl %eax, %ebp | ||
| 121 | jg LimitPositive | ||
| 122 | xorl %ebp, %ebp | ||
| 123 | LimitPositive: | ||
| 124 | |||
| 125 | /* unsigned chain_length = s->max_chain_length; */ | ||
| 126 | /* if (s->prev_length >= s->good_match) { */ | ||
| 127 | /* chain_length >>= 2; */ | ||
| 128 | /* } */ | ||
| 129 | |||
| 130 | movl dsPrevLen(%edx), %eax | ||
| 131 | movl dsGoodMatch(%edx), %ebx | ||
| 132 | cmpl %ebx, %eax | ||
| 133 | movl dsMaxChainLen(%edx), %ebx | ||
| 134 | jl LastMatchGood | ||
| 135 | shrl $2, %ebx | ||
| 136 | LastMatchGood: | ||
| 137 | |||
| 138 | /* chainlen is decremented once beforehand so that the function can */ | ||
| 139 | /* use the sign flag instead of the zero flag for the exit test. */ | ||
| 140 | /* It is then shifted into the high word, to make room for the scanend */ | ||
| 141 | /* scanend value, which it will always accompany. */ | ||
| 142 | |||
| 143 | decl %ebx | ||
| 144 | shll $16, %ebx | ||
| 145 | |||
| 146 | /* int best_len = s->prev_length; */ | ||
| 147 | |||
| 148 | movl dsPrevLen(%edx), %eax | ||
| 149 | movl %eax, bestlen(%esp) | ||
| 150 | |||
| 151 | /* Store the sum of s->window + best_len in %esi locally, and in %esi. */ | ||
| 152 | |||
| 153 | addl %eax, %esi | ||
| 154 | movl %esi, windowbestlen(%esp) | ||
| 155 | |||
| 156 | /* register ush scan_start = *(ushf*)scan; */ | ||
| 157 | /* register ush scan_end = *(ushf*)(scan+best_len-1); */ | ||
| 158 | |||
| 159 | movw (%edi), %bx | ||
| 160 | movw %bx, scanstart(%esp) | ||
| 161 | movw -1(%edi,%eax), %bx | ||
| 162 | movl %ebx, chainlenscanend(%esp) | ||
| 163 | |||
| 164 | /* Posf *prev = s->prev; */ | ||
| 165 | /* uInt wmask = s->w_mask; */ | ||
| 166 | |||
| 167 | movl dsPrev(%edx), %edi | ||
| 168 | movl dsWMask(%edx), %edx | ||
| 169 | mov %edx, wmask(%esp) | ||
| 170 | |||
| 171 | /* Jump into the main loop. */ | ||
| 172 | |||
| 173 | jmp LoopEntry | ||
| 174 | |||
| 175 | .balign 16 | ||
| 176 | |||
| 177 | /* do { | ||
| 178 | * match = s->window + cur_match; | ||
| 179 | * if (*(ushf*)(match+best_len-1) != scan_end || | ||
| 180 | * *(ushf*)match != scan_start) continue; | ||
| 181 | * [...] | ||
| 182 | * } while ((cur_match = prev[cur_match & wmask]) > limit | ||
| 183 | * && --chain_length != 0); | ||
| 184 | * | ||
| 185 | * Here is the inner loop of the function. The function will spend the | ||
| 186 | * majority of its time in this loop, and majority of that time will | ||
| 187 | * be spent in the first ten instructions. | ||
| 188 | * | ||
| 189 | * Within this loop: | ||
| 190 | * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend) | ||
| 191 | * %ecx = curmatch | ||
| 192 | * %edx = curmatch & wmask | ||
| 193 | * %esi = windowbestlen - i.e., (window + bestlen) | ||
| 194 | * %edi = prev | ||
| 195 | * %ebp = limit | ||
| 196 | * | ||
| 197 | * Two optimization notes on the choice of instructions: | ||
| 198 | * | ||
| 199 | * The first instruction uses a 16-bit address, which costs an extra, | ||
| 200 | * unpairable cycle. This is cheaper than doing a 32-bit access and | ||
| 201 | * zeroing the high word, due to the 3-cycle misalignment penalty which | ||
| 202 | * would occur half the time. This also turns out to be cheaper than | ||
| 203 | * doing two separate 8-bit accesses, as the memory is so rarely in the | ||
| 204 | * L1 cache. | ||
| 205 | * | ||
| 206 | * The window buffer, however, apparently spends a lot of time in the | ||
| 207 | * cache, and so it is faster to retrieve the word at the end of the | ||
| 208 | * match string with two 8-bit loads. The instructions that test the | ||
| 209 | * word at the beginning of the match string, however, are executed | ||
| 210 | * much less frequently, and there it was cheaper to use 16-bit | ||
| 211 | * instructions, which avoided the necessity of saving off and | ||
| 212 | * subsequently reloading one of the other registers. | ||
| 213 | */ | ||
| 214 | LookupLoop: | ||
| 215 | /* 1 U & V */ | ||
| 216 | movw (%edi,%edx,2), %cx /* 2 U pipe */ | ||
| 217 | movl wmask(%esp), %edx /* 2 V pipe */ | ||
| 218 | cmpl %ebp, %ecx /* 3 U pipe */ | ||
| 219 | jbe LeaveNow /* 3 V pipe */ | ||
| 220 | subl $0x00010000, %ebx /* 4 U pipe */ | ||
| 221 | js LeaveNow /* 4 V pipe */ | ||
| 222 | LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */ | ||
| 223 | andl %ecx, %edx /* 5 V pipe */ | ||
| 224 | cmpb %bl, %al /* 6 U pipe */ | ||
| 225 | jnz LookupLoop /* 6 V pipe */ | ||
| 226 | movb (%esi,%ecx), %ah | ||
| 227 | cmpb %bh, %ah | ||
| 228 | jnz LookupLoop | ||
| 229 | movl window(%esp), %eax | ||
| 230 | movw (%eax,%ecx), %ax | ||
| 231 | cmpw scanstart(%esp), %ax | ||
| 232 | jnz LookupLoop | ||
| 233 | |||
| 234 | /* Store the current value of chainlen. */ | ||
| 235 | |||
| 236 | movl %ebx, chainlenscanend(%esp) | ||
| 237 | |||
| 238 | /* Point %edi to the string under scrutiny, and %esi to the string we */ | ||
| 239 | /* are hoping to match it up with. In actuality, %esi and %edi are */ | ||
| 240 | /* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ | ||
| 241 | /* initialized to -(MAX_MATCH_8 - scanalign). */ | ||
| 242 | |||
| 243 | movl window(%esp), %esi | ||
| 244 | movl scan(%esp), %edi | ||
| 245 | addl %ecx, %esi | ||
| 246 | movl scanalign(%esp), %eax | ||
| 247 | movl $(-MAX_MATCH_8), %edx | ||
| 248 | lea MAX_MATCH_8(%edi,%eax), %edi | ||
| 249 | lea MAX_MATCH_8(%esi,%eax), %esi | ||
| 250 | |||
| 251 | /* Test the strings for equality, 8 bytes at a time. At the end, | ||
| 252 | * adjust %edx so that it is offset to the exact byte that mismatched. | ||
| 253 | * | ||
| 254 | * We already know at this point that the first three bytes of the | ||
| 255 | * strings match each other, and they can be safely passed over before | ||
| 256 | * starting the compare loop. So what this code does is skip over 0-3 | ||
| 257 | * bytes, as much as necessary in order to dword-align the %edi | ||
| 258 | * pointer. (%esi will still be misaligned three times out of four.) | ||
| 259 | * | ||
| 260 | * It should be confessed that this loop usually does not represent | ||
| 261 | * much of the total running time. Replacing it with a more | ||
| 262 | * straightforward "rep cmpsb" would not drastically degrade | ||
| 263 | * performance. | ||
| 264 | */ | ||
| 265 | LoopCmps: | ||
| 266 | movl (%esi,%edx), %eax | ||
| 267 | movl (%edi,%edx), %ebx | ||
| 268 | xorl %ebx, %eax | ||
| 269 | jnz LeaveLoopCmps | ||
| 270 | movl 4(%esi,%edx), %eax | ||
| 271 | movl 4(%edi,%edx), %ebx | ||
| 272 | xorl %ebx, %eax | ||
| 273 | jnz LeaveLoopCmps4 | ||
| 274 | addl $8, %edx | ||
| 275 | jnz LoopCmps | ||
| 276 | jmp LenMaximum | ||
| 277 | LeaveLoopCmps4: addl $4, %edx | ||
| 278 | LeaveLoopCmps: testl $0x0000FFFF, %eax | ||
| 279 | jnz LenLower | ||
| 280 | addl $2, %edx | ||
| 281 | shrl $16, %eax | ||
| 282 | LenLower: subb $1, %al | ||
| 283 | adcl $0, %edx | ||
| 284 | |||
| 285 | /* Calculate the length of the match. If it is longer than MAX_MATCH, */ | ||
| 286 | /* then automatically accept it as the best possible match and leave. */ | ||
| 287 | |||
| 288 | lea (%edi,%edx), %eax | ||
| 289 | movl scan(%esp), %edi | ||
| 290 | subl %edi, %eax | ||
| 291 | cmpl $MAX_MATCH, %eax | ||
| 292 | jge LenMaximum | ||
| 293 | |||
| 294 | /* If the length of the match is not longer than the best match we */ | ||
| 295 | /* have so far, then forget it and return to the lookup loop. */ | ||
| 296 | |||
| 297 | movl deflatestate(%esp), %edx | ||
| 298 | movl bestlen(%esp), %ebx | ||
| 299 | cmpl %ebx, %eax | ||
| 300 | jg LongerMatch | ||
| 301 | movl chainlenscanend(%esp), %ebx | ||
| 302 | movl windowbestlen(%esp), %esi | ||
| 303 | movl dsPrev(%edx), %edi | ||
| 304 | movl wmask(%esp), %edx | ||
| 305 | andl %ecx, %edx | ||
| 306 | jmp LookupLoop | ||
| 307 | |||
| 308 | /* s->match_start = cur_match; */ | ||
| 309 | /* best_len = len; */ | ||
| 310 | /* if (len >= nice_match) break; */ | ||
| 311 | /* scan_end = *(ushf*)(scan+best_len-1); */ | ||
| 312 | |||
| 313 | LongerMatch: movl nicematch(%esp), %ebx | ||
| 314 | movl %eax, bestlen(%esp) | ||
| 315 | movl %ecx, dsMatchStart(%edx) | ||
| 316 | cmpl %ebx, %eax | ||
| 317 | jge LeaveNow | ||
| 318 | movl window(%esp), %esi | ||
| 319 | addl %eax, %esi | ||
| 320 | movl %esi, windowbestlen(%esp) | ||
| 321 | movl chainlenscanend(%esp), %ebx | ||
| 322 | movw -1(%edi,%eax), %bx | ||
| 323 | movl dsPrev(%edx), %edi | ||
| 324 | movl %ebx, chainlenscanend(%esp) | ||
| 325 | movl wmask(%esp), %edx | ||
| 326 | andl %ecx, %edx | ||
| 327 | jmp LookupLoop | ||
| 328 | |||
| 329 | /* Accept the current string, with the maximum possible length. */ | ||
| 330 | |||
| 331 | LenMaximum: movl deflatestate(%esp), %edx | ||
| 332 | movl $MAX_MATCH, bestlen(%esp) | ||
| 333 | movl %ecx, dsMatchStart(%edx) | ||
| 334 | |||
| 335 | /* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ | ||
| 336 | /* return s->lookahead; */ | ||
| 337 | |||
| 338 | LeaveNow: | ||
| 339 | movl deflatestate(%esp), %edx | ||
| 340 | movl bestlen(%esp), %ebx | ||
| 341 | movl dsLookahead(%edx), %eax | ||
| 342 | cmpl %eax, %ebx | ||
| 343 | jg LookaheadRet | ||
| 344 | movl %ebx, %eax | ||
| 345 | LookaheadRet: | ||
| 346 | |||
| 347 | /* Restore the stack and return from whence we came. */ | ||
| 348 | |||
| 349 | addl $LocalVarsSize, %esp | ||
| 350 | popl %ebx | ||
| 351 | popl %esi | ||
| 352 | popl %edi | ||
| 353 | popl %ebp | ||
| 354 | match_init: ret | ||
diff --git a/contrib/asm686/README.686 b/contrib/asm686/README.686 new file mode 100644 index 0000000..a593f23 --- /dev/null +++ b/contrib/asm686/README.686 | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | This is a patched version of zlib, modified to use | ||
| 2 | Pentium-Pro-optimized assembly code in the deflation algorithm. The | ||
| 3 | files changed/added by this patch are: | ||
| 4 | |||
| 5 | README.686 | ||
| 6 | match.S | ||
| 7 | |||
| 8 | The speedup that this patch provides varies, depending on whether the | ||
| 9 | compiler used to build the original version of zlib falls afoul of the | ||
| 10 | PPro's speed traps. My own tests show a speedup of around 10-20% at | ||
| 11 | the default compression level, and 20-30% using -9, against a version | ||
| 12 | compiled using gcc 2.7.2.3. Your mileage may vary. | ||
| 13 | |||
| 14 | Note that this code has been tailored for the PPro/PII in particular, | ||
| 15 | and will not perform particuarly well on a Pentium. | ||
| 16 | |||
| 17 | If you are using an assembler other than GNU as, you will have to | ||
| 18 | translate match.S to use your assembler's syntax. (Have fun.) | ||
| 19 | |||
| 20 | Brian Raiter | ||
| 21 | breadbox@muppetlabs.com | ||
| 22 | April, 1998 | ||
| 23 | |||
| 24 | |||
| 25 | Added for zlib 1.1.3: | ||
| 26 | |||
| 27 | The patches come from | ||
| 28 | http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
| 29 | |||
| 30 | To compile zlib with this asm file, copy match.S to the zlib directory | ||
| 31 | then do: | ||
| 32 | |||
| 33 | CFLAGS="-O3 -DASMV" ./configure | ||
| 34 | make OBJA=match.o | ||
diff --git a/contrib/asm686/match.S b/contrib/asm686/match.S new file mode 100644 index 0000000..8e86c33 --- /dev/null +++ b/contrib/asm686/match.S | |||
| @@ -0,0 +1,327 @@ | |||
| 1 | /* match.s -- Pentium-Pro-optimized version of longest_match() | ||
| 2 | * Written for zlib 1.1.2 | ||
| 3 | * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com> | ||
| 4 | * | ||
| 5 | * This is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef NO_UNDERLINE | ||
| 10 | #define match_init _match_init | ||
| 11 | #define longest_match _longest_match | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #define MAX_MATCH (258) | ||
| 15 | #define MIN_MATCH (3) | ||
| 16 | #define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) | ||
| 17 | #define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) | ||
| 18 | |||
| 19 | /* stack frame offsets */ | ||
| 20 | |||
| 21 | #define chainlenwmask 0 /* high word: current chain len */ | ||
| 22 | /* low word: s->wmask */ | ||
| 23 | #define window 4 /* local copy of s->window */ | ||
| 24 | #define windowbestlen 8 /* s->window + bestlen */ | ||
| 25 | #define scanstart 16 /* first two bytes of string */ | ||
| 26 | #define scanend 12 /* last two bytes of string */ | ||
| 27 | #define scanalign 20 /* dword-misalignment of string */ | ||
| 28 | #define nicematch 24 /* a good enough match size */ | ||
| 29 | #define bestlen 28 /* size of best match so far */ | ||
| 30 | #define scan 32 /* ptr to string wanting match */ | ||
| 31 | |||
| 32 | #define LocalVarsSize (36) | ||
| 33 | /* saved ebx 36 */ | ||
| 34 | /* saved edi 40 */ | ||
| 35 | /* saved esi 44 */ | ||
| 36 | /* saved ebp 48 */ | ||
| 37 | /* return address 52 */ | ||
| 38 | #define deflatestate 56 /* the function arguments */ | ||
| 39 | #define curmatch 60 | ||
| 40 | |||
| 41 | /* Offsets for fields in the deflate_state structure. These numbers | ||
| 42 | * are calculated from the definition of deflate_state, with the | ||
| 43 | * assumption that the compiler will dword-align the fields. (Thus, | ||
| 44 | * changing the definition of deflate_state could easily cause this | ||
| 45 | * program to crash horribly, without so much as a warning at | ||
| 46 | * compile time. Sigh.) | ||
| 47 | */ | ||
| 48 | #define dsWSize 36 | ||
| 49 | #define dsWMask 44 | ||
| 50 | #define dsWindow 48 | ||
| 51 | #define dsPrev 56 | ||
| 52 | #define dsMatchLen 88 | ||
| 53 | #define dsPrevMatch 92 | ||
| 54 | #define dsStrStart 100 | ||
| 55 | #define dsMatchStart 104 | ||
| 56 | #define dsLookahead 108 | ||
| 57 | #define dsPrevLen 112 | ||
| 58 | #define dsMaxChainLen 116 | ||
| 59 | #define dsGoodMatch 132 | ||
| 60 | #define dsNiceMatch 136 | ||
| 61 | |||
| 62 | |||
| 63 | .file "match.S" | ||
| 64 | |||
| 65 | .globl match_init, longest_match | ||
| 66 | |||
| 67 | .text | ||
| 68 | |||
| 69 | /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ | ||
| 70 | |||
| 71 | longest_match: | ||
| 72 | |||
| 73 | /* Save registers that the compiler may be using, and adjust %esp to */ | ||
| 74 | /* make room for our stack frame. */ | ||
| 75 | |||
| 76 | pushl %ebp | ||
| 77 | pushl %edi | ||
| 78 | pushl %esi | ||
| 79 | pushl %ebx | ||
| 80 | subl $LocalVarsSize, %esp | ||
| 81 | |||
| 82 | /* Retrieve the function arguments. %ecx will hold cur_match */ | ||
| 83 | /* throughout the entire function. %edx will hold the pointer to the */ | ||
| 84 | /* deflate_state structure during the function's setup (before */ | ||
| 85 | /* entering the main loop). */ | ||
| 86 | |||
| 87 | movl deflatestate(%esp), %edx | ||
| 88 | movl curmatch(%esp), %ecx | ||
| 89 | |||
| 90 | /* uInt wmask = s->w_mask; */ | ||
| 91 | /* unsigned chain_length = s->max_chain_length; */ | ||
| 92 | /* if (s->prev_length >= s->good_match) { */ | ||
| 93 | /* chain_length >>= 2; */ | ||
| 94 | /* } */ | ||
| 95 | |||
| 96 | movl dsPrevLen(%edx), %eax | ||
| 97 | movl dsGoodMatch(%edx), %ebx | ||
| 98 | cmpl %ebx, %eax | ||
| 99 | movl dsWMask(%edx), %eax | ||
| 100 | movl dsMaxChainLen(%edx), %ebx | ||
| 101 | jl LastMatchGood | ||
| 102 | shrl $2, %ebx | ||
| 103 | LastMatchGood: | ||
| 104 | |||
| 105 | /* chainlen is decremented once beforehand so that the function can */ | ||
| 106 | /* use the sign flag instead of the zero flag for the exit test. */ | ||
| 107 | /* It is then shifted into the high word, to make room for the wmask */ | ||
| 108 | /* value, which it will always accompany. */ | ||
| 109 | |||
| 110 | decl %ebx | ||
| 111 | shll $16, %ebx | ||
| 112 | orl %eax, %ebx | ||
| 113 | movl %ebx, chainlenwmask(%esp) | ||
| 114 | |||
| 115 | /* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ | ||
| 116 | |||
| 117 | movl dsNiceMatch(%edx), %eax | ||
| 118 | movl dsLookahead(%edx), %ebx | ||
| 119 | cmpl %eax, %ebx | ||
| 120 | jl LookaheadLess | ||
| 121 | movl %eax, %ebx | ||
| 122 | LookaheadLess: movl %ebx, nicematch(%esp) | ||
| 123 | |||
| 124 | /* register Bytef *scan = s->window + s->strstart; */ | ||
| 125 | |||
| 126 | movl dsWindow(%edx), %esi | ||
| 127 | movl %esi, window(%esp) | ||
| 128 | movl dsStrStart(%edx), %ebp | ||
| 129 | lea (%esi,%ebp), %edi | ||
| 130 | movl %edi, scan(%esp) | ||
| 131 | |||
| 132 | /* Determine how many bytes the scan ptr is off from being */ | ||
| 133 | /* dword-aligned. */ | ||
| 134 | |||
| 135 | movl %edi, %eax | ||
| 136 | negl %eax | ||
| 137 | andl $3, %eax | ||
| 138 | movl %eax, scanalign(%esp) | ||
| 139 | |||
| 140 | /* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ | ||
| 141 | /* s->strstart - (IPos)MAX_DIST(s) : NIL; */ | ||
| 142 | |||
| 143 | movl dsWSize(%edx), %eax | ||
| 144 | subl $MIN_LOOKAHEAD, %eax | ||
| 145 | subl %eax, %ebp | ||
| 146 | jg LimitPositive | ||
| 147 | xorl %ebp, %ebp | ||
| 148 | LimitPositive: | ||
| 149 | |||
| 150 | /* int best_len = s->prev_length; */ | ||
| 151 | |||
| 152 | movl dsPrevLen(%edx), %eax | ||
| 153 | movl %eax, bestlen(%esp) | ||
| 154 | |||
| 155 | /* Store the sum of s->window + best_len in %esi locally, and in %esi. */ | ||
| 156 | |||
| 157 | addl %eax, %esi | ||
| 158 | movl %esi, windowbestlen(%esp) | ||
| 159 | |||
| 160 | /* register ush scan_start = *(ushf*)scan; */ | ||
| 161 | /* register ush scan_end = *(ushf*)(scan+best_len-1); */ | ||
| 162 | /* Posf *prev = s->prev; */ | ||
| 163 | |||
| 164 | movzwl (%edi), %ebx | ||
| 165 | movl %ebx, scanstart(%esp) | ||
| 166 | movzwl -1(%edi,%eax), %ebx | ||
| 167 | movl %ebx, scanend(%esp) | ||
| 168 | movl dsPrev(%edx), %edi | ||
| 169 | |||
| 170 | /* Jump into the main loop. */ | ||
| 171 | |||
| 172 | movl chainlenwmask(%esp), %edx | ||
| 173 | jmp LoopEntry | ||
| 174 | |||
| 175 | .balign 16 | ||
| 176 | |||
| 177 | /* do { | ||
| 178 | * match = s->window + cur_match; | ||
| 179 | * if (*(ushf*)(match+best_len-1) != scan_end || | ||
| 180 | * *(ushf*)match != scan_start) continue; | ||
| 181 | * [...] | ||
| 182 | * } while ((cur_match = prev[cur_match & wmask]) > limit | ||
| 183 | * && --chain_length != 0); | ||
| 184 | * | ||
| 185 | * Here is the inner loop of the function. The function will spend the | ||
| 186 | * majority of its time in this loop, and majority of that time will | ||
| 187 | * be spent in the first ten instructions. | ||
| 188 | * | ||
| 189 | * Within this loop: | ||
| 190 | * %ebx = scanend | ||
| 191 | * %ecx = curmatch | ||
| 192 | * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) | ||
| 193 | * %esi = windowbestlen - i.e., (window + bestlen) | ||
| 194 | * %edi = prev | ||
| 195 | * %ebp = limit | ||
| 196 | */ | ||
| 197 | LookupLoop: | ||
| 198 | andl %edx, %ecx | ||
| 199 | movzwl (%edi,%ecx,2), %ecx | ||
| 200 | cmpl %ebp, %ecx | ||
| 201 | jbe LeaveNow | ||
| 202 | subl $0x00010000, %edx | ||
| 203 | js LeaveNow | ||
| 204 | LoopEntry: movzwl -1(%esi,%ecx), %eax | ||
| 205 | cmpl %ebx, %eax | ||
| 206 | jnz LookupLoop | ||
| 207 | movl window(%esp), %eax | ||
| 208 | movzwl (%eax,%ecx), %eax | ||
| 209 | cmpl scanstart(%esp), %eax | ||
| 210 | jnz LookupLoop | ||
| 211 | |||
| 212 | /* Store the current value of chainlen. */ | ||
| 213 | |||
| 214 | movl %edx, chainlenwmask(%esp) | ||
| 215 | |||
| 216 | /* Point %edi to the string under scrutiny, and %esi to the string we */ | ||
| 217 | /* are hoping to match it up with. In actuality, %esi and %edi are */ | ||
| 218 | /* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ | ||
| 219 | /* initialized to -(MAX_MATCH_8 - scanalign). */ | ||
| 220 | |||
| 221 | movl window(%esp), %esi | ||
| 222 | movl scan(%esp), %edi | ||
| 223 | addl %ecx, %esi | ||
| 224 | movl scanalign(%esp), %eax | ||
| 225 | movl $(-MAX_MATCH_8), %edx | ||
| 226 | lea MAX_MATCH_8(%edi,%eax), %edi | ||
| 227 | lea MAX_MATCH_8(%esi,%eax), %esi | ||
| 228 | |||
| 229 | /* Test the strings for equality, 8 bytes at a time. At the end, | ||
| 230 | * adjust %edx so that it is offset to the exact byte that mismatched. | ||
| 231 | * | ||
| 232 | * We already know at this point that the first three bytes of the | ||
| 233 | * strings match each other, and they can be safely passed over before | ||
| 234 | * starting the compare loop. So what this code does is skip over 0-3 | ||
| 235 | * bytes, as much as necessary in order to dword-align the %edi | ||
| 236 | * pointer. (%esi will still be misaligned three times out of four.) | ||
| 237 | * | ||
| 238 | * It should be confessed that this loop usually does not represent | ||
| 239 | * much of the total running time. Replacing it with a more | ||
| 240 | * straightforward "rep cmpsb" would not drastically degrade | ||
| 241 | * performance. | ||
| 242 | */ | ||
| 243 | LoopCmps: | ||
| 244 | movl (%esi,%edx), %eax | ||
| 245 | xorl (%edi,%edx), %eax | ||
| 246 | jnz LeaveLoopCmps | ||
| 247 | movl 4(%esi,%edx), %eax | ||
| 248 | xorl 4(%edi,%edx), %eax | ||
| 249 | jnz LeaveLoopCmps4 | ||
| 250 | addl $8, %edx | ||
| 251 | jnz LoopCmps | ||
| 252 | jmp LenMaximum | ||
| 253 | LeaveLoopCmps4: addl $4, %edx | ||
| 254 | LeaveLoopCmps: testl $0x0000FFFF, %eax | ||
| 255 | jnz LenLower | ||
| 256 | addl $2, %edx | ||
| 257 | shrl $16, %eax | ||
| 258 | LenLower: subb $1, %al | ||
| 259 | adcl $0, %edx | ||
| 260 | |||
| 261 | /* Calculate the length of the match. If it is longer than MAX_MATCH, */ | ||
| 262 | /* then automatically accept it as the best possible match and leave. */ | ||
| 263 | |||
| 264 | lea (%edi,%edx), %eax | ||
| 265 | movl scan(%esp), %edi | ||
| 266 | subl %edi, %eax | ||
| 267 | cmpl $MAX_MATCH, %eax | ||
| 268 | jge LenMaximum | ||
| 269 | |||
| 270 | /* If the length of the match is not longer than the best match we */ | ||
| 271 | /* have so far, then forget it and return to the lookup loop. */ | ||
| 272 | |||
| 273 | movl deflatestate(%esp), %edx | ||
| 274 | movl bestlen(%esp), %ebx | ||
| 275 | cmpl %ebx, %eax | ||
| 276 | jg LongerMatch | ||
| 277 | movl windowbestlen(%esp), %esi | ||
| 278 | movl dsPrev(%edx), %edi | ||
| 279 | movl scanend(%esp), %ebx | ||
| 280 | movl chainlenwmask(%esp), %edx | ||
| 281 | jmp LookupLoop | ||
| 282 | |||
| 283 | /* s->match_start = cur_match; */ | ||
| 284 | /* best_len = len; */ | ||
| 285 | /* if (len >= nice_match) break; */ | ||
| 286 | /* scan_end = *(ushf*)(scan+best_len-1); */ | ||
| 287 | |||
| 288 | LongerMatch: movl nicematch(%esp), %ebx | ||
| 289 | movl %eax, bestlen(%esp) | ||
| 290 | movl %ecx, dsMatchStart(%edx) | ||
| 291 | cmpl %ebx, %eax | ||
| 292 | jge LeaveNow | ||
| 293 | movl window(%esp), %esi | ||
| 294 | addl %eax, %esi | ||
| 295 | movl %esi, windowbestlen(%esp) | ||
| 296 | movzwl -1(%edi,%eax), %ebx | ||
| 297 | movl dsPrev(%edx), %edi | ||
| 298 | movl %ebx, scanend(%esp) | ||
| 299 | movl chainlenwmask(%esp), %edx | ||
| 300 | jmp LookupLoop | ||
| 301 | |||
| 302 | /* Accept the current string, with the maximum possible length. */ | ||
| 303 | |||
| 304 | LenMaximum: movl deflatestate(%esp), %edx | ||
| 305 | movl $MAX_MATCH, bestlen(%esp) | ||
| 306 | movl %ecx, dsMatchStart(%edx) | ||
| 307 | |||
| 308 | /* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ | ||
| 309 | /* return s->lookahead; */ | ||
| 310 | |||
| 311 | LeaveNow: | ||
| 312 | movl deflatestate(%esp), %edx | ||
| 313 | movl bestlen(%esp), %ebx | ||
| 314 | movl dsLookahead(%edx), %eax | ||
| 315 | cmpl %eax, %ebx | ||
| 316 | jg LookaheadRet | ||
| 317 | movl %ebx, %eax | ||
| 318 | LookaheadRet: | ||
| 319 | |||
| 320 | /* Restore the stack and return from whence we came. */ | ||
| 321 | |||
| 322 | addl $LocalVarsSize, %esp | ||
| 323 | popl %ebx | ||
| 324 | popl %esi | ||
| 325 | popl %edi | ||
| 326 | popl %ebp | ||
| 327 | match_init: ret | ||
diff --git a/contrib/delphi/zlib.mak b/contrib/delphi/zlib.mak new file mode 100644 index 0000000..ba557e2 --- /dev/null +++ b/contrib/delphi/zlib.mak | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # Makefile for zlib32bd.lib | ||
| 2 | # ------------- Borland C++ 4.5 ------------- | ||
| 3 | |||
| 4 | # The (32-bit) zlib32bd.lib made with this makefile is intended for use | ||
| 5 | # in making the (32-bit) DLL, png32bd.dll. It uses the "stdcall" calling | ||
| 6 | # convention. | ||
| 7 | |||
| 8 | CFLAGS= -ps -O2 -C -K -N- -k- -d -3 -r- -w-par -w-aus -WDE | ||
| 9 | CC=f:\bc45\bin\bcc32 | ||
| 10 | LIBFLAGS= /C | ||
| 11 | LIB=f:\bc45\bin\tlib | ||
| 12 | ZLIB=zlib32bd.lib | ||
| 13 | |||
| 14 | .autodepend | ||
| 15 | .c.obj: | ||
| 16 | $(CC) -c $(CFLAGS) $< | ||
| 17 | |||
| 18 | OBJ1=adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj | ||
| 19 | OBJ2=infcodes.obj inflate.obj inftrees.obj infutil.obj inffast.obj | ||
| 20 | OBJ3=trees.obj uncompr.obj zutil.obj | ||
| 21 | pOBJ1=+adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infblock.obj | ||
| 22 | pOBJ2=+infcodes.obj+inflate.obj+inftrees.obj+infutil.obj+inffast.obj | ||
| 23 | pOBJ3=+trees.obj+uncompr.obj+zutil.obj | ||
| 24 | |||
| 25 | all: $(ZLIB) | ||
| 26 | |||
| 27 | $(ZLIB): $(OBJ1) $(OBJ2) $(OBJ3) | ||
| 28 | @if exist $@ del $@ | ||
| 29 | $(LIB) @&&| | ||
| 30 | $@ $(LIBFLAGS) & | ||
| 31 | $(pOBJ1) & | ||
| 32 | $(pOBJ2) & | ||
| 33 | $(pOBJ3) | ||
| 34 | | | ||
| 35 | |||
| 36 | # End of makefile for zlib32bd.lib | ||
diff --git a/contrib/delphi/zlibdef.pas b/contrib/delphi/zlibdef.pas new file mode 100644 index 0000000..4f96b7d --- /dev/null +++ b/contrib/delphi/zlibdef.pas | |||
| @@ -0,0 +1,169 @@ | |||
| 1 | unit zlibdef; | ||
| 2 | |||
| 3 | interface | ||
| 4 | |||
| 5 | uses | ||
| 6 | Windows; | ||
| 7 | |||
| 8 | const | ||
| 9 | ZLIB_VERSION = '1.1.3'; | ||
| 10 | |||
| 11 | type | ||
| 12 | voidpf = Pointer; | ||
| 13 | int = Integer; | ||
| 14 | uInt = Cardinal; | ||
| 15 | pBytef = PChar; | ||
| 16 | uLong = Cardinal; | ||
| 17 | |||
| 18 | alloc_func = function(opaque: voidpf; items, size: uInt): voidpf; | ||
| 19 | stdcall; | ||
| 20 | free_func = procedure(opaque, address: voidpf); | ||
| 21 | stdcall; | ||
| 22 | |||
| 23 | internal_state = Pointer; | ||
| 24 | |||
| 25 | z_streamp = ^z_stream; | ||
| 26 | z_stream = packed record | ||
| 27 | next_in: pBytef; // next input byte | ||
| 28 | avail_in: uInt; // number of bytes available at next_in | ||
| 29 | total_in: uLong; // total nb of input bytes read so far | ||
| 30 | |||
| 31 | next_out: pBytef; // next output byte should be put there | ||
| 32 | avail_out: uInt; // remaining free space at next_out | ||
| 33 | total_out: uLong; // total nb of bytes output so far | ||
| 34 | |||
| 35 | msg: PChar; // last error message, NULL if no error | ||
| 36 | state: internal_state; // not visible by applications | ||
| 37 | |||
| 38 | zalloc: alloc_func; // used to allocate the internal state | ||
| 39 | zfree: free_func; // used to free the internal state | ||
| 40 | opaque: voidpf; // private data object passed to zalloc and zfree | ||
| 41 | |||
| 42 | data_type: int; // best guess about the data type: ascii or binary | ||
| 43 | adler: uLong; // adler32 value of the uncompressed data | ||
| 44 | reserved: uLong; // reserved for future use | ||
| 45 | end; | ||
| 46 | |||
| 47 | const | ||
| 48 | Z_NO_FLUSH = 0; | ||
| 49 | Z_SYNC_FLUSH = 2; | ||
| 50 | Z_FULL_FLUSH = 3; | ||
| 51 | Z_FINISH = 4; | ||
| 52 | |||
| 53 | Z_OK = 0; | ||
| 54 | Z_STREAM_END = 1; | ||
| 55 | |||
| 56 | Z_NO_COMPRESSION = 0; | ||
| 57 | Z_BEST_SPEED = 1; | ||
| 58 | Z_BEST_COMPRESSION = 9; | ||
| 59 | Z_DEFAULT_COMPRESSION = -1; | ||
| 60 | |||
| 61 | Z_FILTERED = 1; | ||
| 62 | Z_HUFFMAN_ONLY = 2; | ||
| 63 | Z_DEFAULT_STRATEGY = 0; | ||
| 64 | |||
| 65 | Z_BINARY = 0; | ||
| 66 | Z_ASCII = 1; | ||
| 67 | Z_UNKNOWN = 2; | ||
| 68 | |||
| 69 | Z_DEFLATED = 8; | ||
| 70 | |||
| 71 | MAX_MEM_LEVEL = 9; | ||
| 72 | |||
| 73 | function adler32(adler: uLong; const buf: pBytef; len: uInt): uLong; | ||
| 74 | stdcall; | ||
| 75 | function crc32(crc: uLong; const buf: pBytef; len: uInt): uLong; | ||
| 76 | stdcall; | ||
| 77 | function deflate(strm: z_streamp; flush: int): int; | ||
| 78 | stdcall; | ||
| 79 | function deflateCopy(dest, source: z_streamp): int; | ||
| 80 | stdcall; | ||
| 81 | function deflateEnd(strm: z_streamp): int; | ||
| 82 | stdcall; | ||
| 83 | function deflateInit2_(strm: z_streamp; level, method, | ||
| 84 | windowBits, memLevel, strategy: int; | ||
| 85 | const version: PChar; stream_size: int): int; | ||
| 86 | stdcall; | ||
| 87 | function deflateInit_(strm: z_streamp; level: int; | ||
| 88 | const version: PChar; stream_size: int): int; | ||
| 89 | stdcall; | ||
| 90 | function deflateParams(strm: z_streamp; level, strategy: int): int; | ||
| 91 | stdcall; | ||
| 92 | function deflateReset(strm: z_streamp): int; | ||
| 93 | stdcall; | ||
| 94 | function deflateSetDictionary(strm: z_streamp; | ||
| 95 | const dictionary: pBytef; | ||
| 96 | dictLength: uInt): int; | ||
| 97 | stdcall; | ||
| 98 | function inflate(strm: z_streamp; flush: int): int; | ||
| 99 | stdcall; | ||
| 100 | function inflateEnd(strm: z_streamp): int; | ||
| 101 | stdcall; | ||
| 102 | function inflateInit2_(strm: z_streamp; windowBits: int; | ||
| 103 | const version: PChar; stream_size: int): int; | ||
| 104 | stdcall; | ||
| 105 | function inflateInit_(strm: z_streamp; const version: PChar; | ||
| 106 | stream_size: int): int; | ||
| 107 | stdcall; | ||
| 108 | function inflateReset(strm: z_streamp): int; | ||
| 109 | stdcall; | ||
| 110 | function inflateSetDictionary(strm: z_streamp; | ||
| 111 | const dictionary: pBytef; | ||
| 112 | dictLength: uInt): int; | ||
| 113 | stdcall; | ||
| 114 | function inflateSync(strm: z_streamp): int; | ||
| 115 | stdcall; | ||
| 116 | |||
| 117 | function deflateInit(strm: z_streamp; level: int): int; | ||
| 118 | function deflateInit2(strm: z_streamp; level, method, windowBits, | ||
| 119 | memLevel, strategy: int): int; | ||
| 120 | function inflateInit(strm: z_streamp): int; | ||
| 121 | function inflateInit2(strm: z_streamp; windowBits: int): int; | ||
| 122 | |||
| 123 | implementation | ||
| 124 | |||
| 125 | function deflateInit(strm: z_streamp; level: int): int; | ||
| 126 | begin | ||
| 127 | Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream)); | ||
| 128 | end; | ||
| 129 | |||
| 130 | function deflateInit2(strm: z_streamp; level, method, windowBits, | ||
| 131 | memLevel, strategy: int): int; | ||
| 132 | begin | ||
| 133 | Result := deflateInit2_(strm, level, method, windowBits, memLevel, | ||
| 134 | strategy, ZLIB_VERSION, sizeof(z_stream)); | ||
| 135 | end; | ||
| 136 | |||
| 137 | function inflateInit(strm: z_streamp): int; | ||
| 138 | begin | ||
| 139 | Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream)); | ||
| 140 | end; | ||
| 141 | |||
| 142 | function inflateInit2(strm: z_streamp; windowBits: int): int; | ||
| 143 | begin | ||
| 144 | Result := inflateInit2_(strm, windowBits, ZLIB_VERSION, | ||
| 145 | sizeof(z_stream)); | ||
| 146 | end; | ||
| 147 | |||
| 148 | const | ||
| 149 | zlibDLL = 'png32bd.dll'; | ||
| 150 | |||
| 151 | function adler32; external zlibDLL; | ||
| 152 | function crc32; external zlibDLL; | ||
| 153 | function deflate; external zlibDLL; | ||
| 154 | function deflateCopy; external zlibDLL; | ||
| 155 | function deflateEnd; external zlibDLL; | ||
| 156 | function deflateInit2_; external zlibDLL; | ||
| 157 | function deflateInit_; external zlibDLL; | ||
| 158 | function deflateParams; external zlibDLL; | ||
| 159 | function deflateReset; external zlibDLL; | ||
| 160 | function deflateSetDictionary; external zlibDLL; | ||
| 161 | function inflate; external zlibDLL; | ||
| 162 | function inflateEnd; external zlibDLL; | ||
| 163 | function inflateInit2_; external zlibDLL; | ||
| 164 | function inflateInit_; external zlibDLL; | ||
| 165 | function inflateReset; external zlibDLL; | ||
| 166 | function inflateSetDictionary; external zlibDLL; | ||
| 167 | function inflateSync; external zlibDLL; | ||
| 168 | |||
| 169 | end. | ||
diff --git a/contrib/delphi2/d_zlib.bpr b/contrib/delphi2/d_zlib.bpr new file mode 100644 index 0000000..78bb254 --- /dev/null +++ b/contrib/delphi2/d_zlib.bpr | |||
| @@ -0,0 +1,224 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = d_zlib.lib | ||
| 17 | OBJFILES = d_zlib.obj adler32.obj deflate.obj infblock.obj infcodes.obj inffast.obj \ | ||
| 18 | inflate.obj inftrees.obj infutil.obj trees.obj | ||
| 19 | RESFILES = | ||
| 20 | RESDEPEN = $(RESFILES) | ||
| 21 | LIBFILES = | ||
| 22 | LIBRARIES = VCL35.lib | ||
| 23 | SPARELIBS = VCL35.lib | ||
| 24 | DEFFILE = | ||
| 25 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 26 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 27 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 28 | # --------------------------------------------------------------------------- | ||
| 29 | PATHCPP = .; | ||
| 30 | PATHASM = .; | ||
| 31 | PATHPAS = .; | ||
| 32 | PATHRC = .; | ||
| 33 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 34 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 35 | # --------------------------------------------------------------------------- | ||
| 36 | CFLAG1 = -O2 -Ve -d -k- -vi | ||
| 37 | CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm | ||
| 38 | CFLAG3 = -ff -pr -5 | ||
| 39 | PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M | ||
| 40 | RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl | ||
| 41 | AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn | ||
| 42 | LFLAGS = | ||
| 43 | IFLAGS = -g -Gn | ||
| 44 | # --------------------------------------------------------------------------- | ||
| 45 | ALLOBJ = c0w32.obj $(OBJFILES) | ||
| 46 | ALLRES = $(RESFILES) | ||
| 47 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib | ||
| 48 | # --------------------------------------------------------------------------- | ||
| 49 | !!ifdef IDEOPTIONS | ||
| 50 | |||
| 51 | [Version Info] | ||
| 52 | IncludeVerInfo=0 | ||
| 53 | AutoIncBuild=0 | ||
| 54 | MajorVer=1 | ||
| 55 | MinorVer=0 | ||
| 56 | Release=0 | ||
| 57 | Build=0 | ||
| 58 | Debug=0 | ||
| 59 | PreRelease=0 | ||
| 60 | Special=0 | ||
| 61 | Private=0 | ||
| 62 | DLL=0 | ||
| 63 | Locale=1040 | ||
| 64 | CodePage=1252 | ||
| 65 | |||
| 66 | [Version Info Keys] | ||
| 67 | CompanyName= | ||
| 68 | FileDescription= | ||
| 69 | FileVersion=1.0.0.0 | ||
| 70 | InternalName= | ||
| 71 | LegalCopyright= | ||
| 72 | LegalTrademarks= | ||
| 73 | OriginalFilename= | ||
| 74 | ProductName= | ||
| 75 | ProductVersion=1.0.0.0 | ||
| 76 | Comments= | ||
| 77 | |||
| 78 | [HistoryLists\hlIncludePath] | ||
| 79 | Count=2 | ||
| 80 | Item0=$(BCB)\include | ||
| 81 | Item1=$(BCB)\include;$(BCB)\include\vcl | ||
| 82 | |||
| 83 | [HistoryLists\hlLibraryPath] | ||
| 84 | Count=1 | ||
| 85 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 86 | |||
| 87 | [HistoryLists\hlDebugSourcePath] | ||
| 88 | Count=1 | ||
| 89 | Item0=$(BCB)\source\vcl | ||
| 90 | |||
| 91 | [Debugging] | ||
| 92 | DebugSourceDirs= | ||
| 93 | |||
| 94 | [Parameters] | ||
| 95 | RunParams= | ||
| 96 | HostApplication= | ||
| 97 | |||
| 98 | !endif | ||
| 99 | |||
| 100 | --------------------------------------------------------------------------- | ||
| 101 | # MAKE SECTION | ||
| 102 | # --------------------------------------------------------------------------- | ||
| 103 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 104 | # the benefit of building from the command-line using the MAKE utility. | ||
| 105 | # --------------------------------------------------------------------------- | ||
| 106 | |||
| 107 | .autodepend | ||
| 108 | # --------------------------------------------------------------------------- | ||
| 109 | !if !$d(BCC32) | ||
| 110 | BCC32 = bcc32 | ||
| 111 | !endif | ||
| 112 | |||
| 113 | !if !$d(DCC32) | ||
| 114 | DCC32 = dcc32 | ||
| 115 | !endif | ||
| 116 | |||
| 117 | !if !$d(TASM32) | ||
| 118 | TASM32 = tasm32 | ||
| 119 | !endif | ||
| 120 | |||
| 121 | !if !$d(LINKER) | ||
| 122 | LINKER = TLib | ||
| 123 | !endif | ||
| 124 | |||
| 125 | !if !$d(BRCC32) | ||
| 126 | BRCC32 = brcc32 | ||
| 127 | !endif | ||
| 128 | # --------------------------------------------------------------------------- | ||
| 129 | !if $d(PATHCPP) | ||
| 130 | .PATH.CPP = $(PATHCPP) | ||
| 131 | .PATH.C = $(PATHCPP) | ||
| 132 | !endif | ||
| 133 | |||
| 134 | !if $d(PATHPAS) | ||
| 135 | .PATH.PAS = $(PATHPAS) | ||
| 136 | !endif | ||
| 137 | |||
| 138 | !if $d(PATHASM) | ||
| 139 | .PATH.ASM = $(PATHASM) | ||
| 140 | !endif | ||
| 141 | |||
| 142 | !if $d(PATHRC) | ||
| 143 | .PATH.RC = $(PATHRC) | ||
| 144 | !endif | ||
| 145 | # --------------------------------------------------------------------------- | ||
| 146 | !ifdef IDEOPTIONS | ||
| 147 | |||
| 148 | [Version Info] | ||
| 149 | IncludeVerInfo=0 | ||
| 150 | AutoIncBuild=0 | ||
| 151 | MajorVer=1 | ||
| 152 | MinorVer=0 | ||
| 153 | Release=0 | ||
| 154 | Build=0 | ||
| 155 | Debug=0 | ||
| 156 | PreRelease=0 | ||
| 157 | Special=0 | ||
| 158 | Private=0 | ||
| 159 | DLL=0 | ||
| 160 | Locale=1040 | ||
| 161 | CodePage=1252 | ||
| 162 | |||
| 163 | [Version Info Keys] | ||
| 164 | CompanyName= | ||
| 165 | FileDescription= | ||
| 166 | FileVersion=1.0.0.0 | ||
| 167 | InternalName= | ||
| 168 | LegalCopyright= | ||
| 169 | LegalTrademarks= | ||
| 170 | OriginalFilename= | ||
| 171 | ProductName= | ||
| 172 | ProductVersion=1.0.0.0 | ||
| 173 | Comments= | ||
| 174 | |||
| 175 | [HistoryLists\hlIncludePath] | ||
| 176 | Count=2 | ||
| 177 | Item0=$(BCB)\include;$(BCB)\include\vcl | ||
| 178 | Item1=$(BCB)\include | ||
| 179 | |||
| 180 | [HistoryLists\hlLibraryPath] | ||
| 181 | Count=1 | ||
| 182 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 183 | |||
| 184 | [HistoryLists\hlDebugSourcePath] | ||
| 185 | Count=1 | ||
| 186 | Item0=$(BCB)\source\vcl | ||
| 187 | |||
| 188 | [Debugging] | ||
| 189 | DebugSourceDirs= | ||
| 190 | |||
| 191 | [Parameters] | ||
| 192 | RunParams= | ||
| 193 | HostApplication= | ||
| 194 | |||
| 195 | !endif | ||
| 196 | |||
| 197 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 198 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 199 | $(LFLAGS) $(IFLAGS) + | ||
| 200 | $(ALLOBJ), + | ||
| 201 | $(PROJECT),, + | ||
| 202 | $(ALLLIB), + | ||
| 203 | $(DEFFILE), + | ||
| 204 | $(ALLRES) | ||
| 205 | ! | ||
| 206 | # --------------------------------------------------------------------------- | ||
| 207 | .pas.hpp: | ||
| 208 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 209 | |||
| 210 | .pas.obj: | ||
| 211 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 212 | |||
| 213 | .cpp.obj: | ||
| 214 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 215 | |||
| 216 | .c.obj: | ||
| 217 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 218 | |||
| 219 | .asm.obj: | ||
| 220 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 221 | |||
| 222 | .rc.res: | ||
| 223 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 224 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/d_zlib.cpp b/contrib/delphi2/d_zlib.cpp new file mode 100644 index 0000000..f5dea59 --- /dev/null +++ b/contrib/delphi2/d_zlib.cpp | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #include <condefs.h> | ||
| 2 | #pragma hdrstop | ||
| 3 | //--------------------------------------------------------------------------- | ||
| 4 | USEUNIT("adler32.c"); | ||
| 5 | USEUNIT("deflate.c"); | ||
| 6 | USEUNIT("infblock.c"); | ||
| 7 | USEUNIT("infcodes.c"); | ||
| 8 | USEUNIT("inffast.c"); | ||
| 9 | USEUNIT("inflate.c"); | ||
| 10 | USEUNIT("inftrees.c"); | ||
| 11 | USEUNIT("infutil.c"); | ||
| 12 | USEUNIT("trees.c"); | ||
| 13 | //--------------------------------------------------------------------------- | ||
| 14 | #define Library | ||
| 15 | |||
| 16 | // To add a file to the library use the Project menu 'Add to Project'. | ||
| 17 | |||
diff --git a/contrib/delphi2/readme.txt b/contrib/delphi2/readme.txt new file mode 100644 index 0000000..cbd3162 --- /dev/null +++ b/contrib/delphi2/readme.txt | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | These are files used to compile zlib under Borland C++ Builder 3. | ||
| 2 | |||
| 3 | zlib.bpg is the main project group that can be loaded in the BCB IDE and | ||
| 4 | loads all other *.bpr projects | ||
| 5 | |||
| 6 | zlib.bpr is a project used to create a static zlib.lib library with C calling | ||
| 7 | convention for functions. | ||
| 8 | |||
| 9 | zlib32.bpr creates a zlib32.dll dynamic link library with Windows standard | ||
| 10 | calling convention. | ||
| 11 | |||
| 12 | d_zlib.bpr creates a set of .obj files with register calling convention. | ||
| 13 | These files are used by zlib.pas to create a Delphi unit containing zlib. | ||
| 14 | The d_zlib.lib file generated isn't useful and can be deleted. | ||
| 15 | |||
| 16 | zlib.cpp, zlib32.cpp and d_zlib.cpp are used by the above projects. | ||
| 17 | |||
diff --git a/contrib/delphi2/zlib.bpg b/contrib/delphi2/zlib.bpg new file mode 100644 index 0000000..b6c9acd --- /dev/null +++ b/contrib/delphi2/zlib.bpg | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #------------------------------------------------------------------------------ | ||
| 2 | VERSION = BWS.01 | ||
| 3 | #------------------------------------------------------------------------------ | ||
| 4 | !ifndef ROOT | ||
| 5 | ROOT = $(MAKEDIR)\.. | ||
| 6 | !endif | ||
| 7 | #------------------------------------------------------------------------------ | ||
| 8 | MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** | ||
| 9 | DCC = $(ROOT)\bin\dcc32.exe $** | ||
| 10 | BRCC = $(ROOT)\bin\brcc32.exe $** | ||
| 11 | #------------------------------------------------------------------------------ | ||
| 12 | PROJECTS = zlib zlib32 d_zlib | ||
| 13 | #------------------------------------------------------------------------------ | ||
| 14 | default: $(PROJECTS) | ||
| 15 | #------------------------------------------------------------------------------ | ||
| 16 | |||
| 17 | zlib: zlib.bpr | ||
| 18 | $(MAKE) | ||
| 19 | |||
| 20 | zlib32: zlib32.bpr | ||
| 21 | $(MAKE) | ||
| 22 | |||
| 23 | d_zlib: d_zlib.bpr | ||
| 24 | $(MAKE) | ||
| 25 | |||
| 26 | |||
diff --git a/contrib/delphi2/zlib.bpr b/contrib/delphi2/zlib.bpr new file mode 100644 index 0000000..cf3945b --- /dev/null +++ b/contrib/delphi2/zlib.bpr | |||
| @@ -0,0 +1,225 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = zlib.lib | ||
| 17 | OBJFILES = zlib.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \ | ||
| 18 | infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \ | ||
| 19 | uncompr.obj zutil.obj | ||
| 20 | RESFILES = | ||
| 21 | RESDEPEN = $(RESFILES) | ||
| 22 | LIBFILES = | ||
| 23 | LIBRARIES = VCL35.lib | ||
| 24 | SPARELIBS = VCL35.lib | ||
| 25 | DEFFILE = | ||
| 26 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 27 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 28 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 29 | # --------------------------------------------------------------------------- | ||
| 30 | PATHCPP = .; | ||
| 31 | PATHASM = .; | ||
| 32 | PATHPAS = .; | ||
| 33 | PATHRC = .; | ||
| 34 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 35 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 36 | # --------------------------------------------------------------------------- | ||
| 37 | CFLAG1 = -O2 -Ve -d -k- -vi | ||
| 38 | CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm | ||
| 39 | CFLAG3 = -ff -5 | ||
| 40 | PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M | ||
| 41 | RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl | ||
| 42 | AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn | ||
| 43 | LFLAGS = | ||
| 44 | IFLAGS = -g -Gn | ||
| 45 | # --------------------------------------------------------------------------- | ||
| 46 | ALLOBJ = c0w32.obj $(OBJFILES) | ||
| 47 | ALLRES = $(RESFILES) | ||
| 48 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib | ||
| 49 | # --------------------------------------------------------------------------- | ||
| 50 | !!ifdef IDEOPTIONS | ||
| 51 | |||
| 52 | [Version Info] | ||
| 53 | IncludeVerInfo=0 | ||
| 54 | AutoIncBuild=0 | ||
| 55 | MajorVer=1 | ||
| 56 | MinorVer=0 | ||
| 57 | Release=0 | ||
| 58 | Build=0 | ||
| 59 | Debug=0 | ||
| 60 | PreRelease=0 | ||
| 61 | Special=0 | ||
| 62 | Private=0 | ||
| 63 | DLL=0 | ||
| 64 | Locale=1040 | ||
| 65 | CodePage=1252 | ||
| 66 | |||
| 67 | [Version Info Keys] | ||
| 68 | CompanyName= | ||
| 69 | FileDescription= | ||
| 70 | FileVersion=1.0.0.0 | ||
| 71 | InternalName= | ||
| 72 | LegalCopyright= | ||
| 73 | LegalTrademarks= | ||
| 74 | OriginalFilename= | ||
| 75 | ProductName= | ||
| 76 | ProductVersion=1.0.0.0 | ||
| 77 | Comments= | ||
| 78 | |||
| 79 | [HistoryLists\hlIncludePath] | ||
| 80 | Count=2 | ||
| 81 | Item0=$(BCB)\include | ||
| 82 | Item1=$(BCB)\include;$(BCB)\include\vcl | ||
| 83 | |||
| 84 | [HistoryLists\hlLibraryPath] | ||
| 85 | Count=1 | ||
| 86 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 87 | |||
| 88 | [HistoryLists\hlDebugSourcePath] | ||
| 89 | Count=1 | ||
| 90 | Item0=$(BCB)\source\vcl | ||
| 91 | |||
| 92 | [Debugging] | ||
| 93 | DebugSourceDirs= | ||
| 94 | |||
| 95 | [Parameters] | ||
| 96 | RunParams= | ||
| 97 | HostApplication= | ||
| 98 | |||
| 99 | !endif | ||
| 100 | |||
| 101 | --------------------------------------------------------------------------- | ||
| 102 | # MAKE SECTION | ||
| 103 | # --------------------------------------------------------------------------- | ||
| 104 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 105 | # the benefit of building from the command-line using the MAKE utility. | ||
| 106 | # --------------------------------------------------------------------------- | ||
| 107 | |||
| 108 | .autodepend | ||
| 109 | # --------------------------------------------------------------------------- | ||
| 110 | !if !$d(BCC32) | ||
| 111 | BCC32 = bcc32 | ||
| 112 | !endif | ||
| 113 | |||
| 114 | !if !$d(DCC32) | ||
| 115 | DCC32 = dcc32 | ||
| 116 | !endif | ||
| 117 | |||
| 118 | !if !$d(TASM32) | ||
| 119 | TASM32 = tasm32 | ||
| 120 | !endif | ||
| 121 | |||
| 122 | !if !$d(LINKER) | ||
| 123 | LINKER = TLib | ||
| 124 | !endif | ||
| 125 | |||
| 126 | !if !$d(BRCC32) | ||
| 127 | BRCC32 = brcc32 | ||
| 128 | !endif | ||
| 129 | # --------------------------------------------------------------------------- | ||
| 130 | !if $d(PATHCPP) | ||
| 131 | .PATH.CPP = $(PATHCPP) | ||
| 132 | .PATH.C = $(PATHCPP) | ||
| 133 | !endif | ||
| 134 | |||
| 135 | !if $d(PATHPAS) | ||
| 136 | .PATH.PAS = $(PATHPAS) | ||
| 137 | !endif | ||
| 138 | |||
| 139 | !if $d(PATHASM) | ||
| 140 | .PATH.ASM = $(PATHASM) | ||
| 141 | !endif | ||
| 142 | |||
| 143 | !if $d(PATHRC) | ||
| 144 | .PATH.RC = $(PATHRC) | ||
| 145 | !endif | ||
| 146 | # --------------------------------------------------------------------------- | ||
| 147 | !ifdef IDEOPTIONS | ||
| 148 | |||
| 149 | [Version Info] | ||
| 150 | IncludeVerInfo=0 | ||
| 151 | AutoIncBuild=0 | ||
| 152 | MajorVer=1 | ||
| 153 | MinorVer=0 | ||
| 154 | Release=0 | ||
| 155 | Build=0 | ||
| 156 | Debug=0 | ||
| 157 | PreRelease=0 | ||
| 158 | Special=0 | ||
| 159 | Private=0 | ||
| 160 | DLL=0 | ||
| 161 | Locale=1040 | ||
| 162 | CodePage=1252 | ||
| 163 | |||
| 164 | [Version Info Keys] | ||
| 165 | CompanyName= | ||
| 166 | FileDescription= | ||
| 167 | FileVersion=1.0.0.0 | ||
| 168 | InternalName= | ||
| 169 | LegalCopyright= | ||
| 170 | LegalTrademarks= | ||
| 171 | OriginalFilename= | ||
| 172 | ProductName= | ||
| 173 | ProductVersion=1.0.0.0 | ||
| 174 | Comments= | ||
| 175 | |||
| 176 | [HistoryLists\hlIncludePath] | ||
| 177 | Count=2 | ||
| 178 | Item0=$(BCB)\include;$(BCB)\include\vcl | ||
| 179 | Item1=$(BCB)\include | ||
| 180 | |||
| 181 | [HistoryLists\hlLibraryPath] | ||
| 182 | Count=1 | ||
| 183 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 184 | |||
| 185 | [HistoryLists\hlDebugSourcePath] | ||
| 186 | Count=1 | ||
| 187 | Item0=$(BCB)\source\vcl | ||
| 188 | |||
| 189 | [Debugging] | ||
| 190 | DebugSourceDirs= | ||
| 191 | |||
| 192 | [Parameters] | ||
| 193 | RunParams= | ||
| 194 | HostApplication= | ||
| 195 | |||
| 196 | !endif | ||
| 197 | |||
| 198 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 199 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 200 | $(LFLAGS) $(IFLAGS) + | ||
| 201 | $(ALLOBJ), + | ||
| 202 | $(PROJECT),, + | ||
| 203 | $(ALLLIB), + | ||
| 204 | $(DEFFILE), + | ||
| 205 | $(ALLRES) | ||
| 206 | ! | ||
| 207 | # --------------------------------------------------------------------------- | ||
| 208 | .pas.hpp: | ||
| 209 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 210 | |||
| 211 | .pas.obj: | ||
| 212 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 213 | |||
| 214 | .cpp.obj: | ||
| 215 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 216 | |||
| 217 | .c.obj: | ||
| 218 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 219 | |||
| 220 | .asm.obj: | ||
| 221 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 222 | |||
| 223 | .rc.res: | ||
| 224 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 225 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/zlib.cpp b/contrib/delphi2/zlib.cpp new file mode 100644 index 0000000..bf6953b --- /dev/null +++ b/contrib/delphi2/zlib.cpp | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include <condefs.h> | ||
| 2 | #pragma hdrstop | ||
| 3 | //--------------------------------------------------------------------------- | ||
| 4 | USEUNIT("adler32.c"); | ||
| 5 | USEUNIT("compress.c"); | ||
| 6 | USEUNIT("crc32.c"); | ||
| 7 | USEUNIT("deflate.c"); | ||
| 8 | USEUNIT("gzio.c"); | ||
| 9 | USEUNIT("infblock.c"); | ||
| 10 | USEUNIT("infcodes.c"); | ||
| 11 | USEUNIT("inffast.c"); | ||
| 12 | USEUNIT("inflate.c"); | ||
| 13 | USEUNIT("inftrees.c"); | ||
| 14 | USEUNIT("infutil.c"); | ||
| 15 | USEUNIT("trees.c"); | ||
| 16 | USEUNIT("uncompr.c"); | ||
| 17 | USEUNIT("zutil.c"); | ||
| 18 | //--------------------------------------------------------------------------- | ||
| 19 | #define Library | ||
| 20 | |||
| 21 | // To add a file to the library use the Project menu 'Add to Project'. | ||
| 22 | |||
diff --git a/contrib/delphi2/zlib.pas b/contrib/delphi2/zlib.pas new file mode 100644 index 0000000..10ae4ca --- /dev/null +++ b/contrib/delphi2/zlib.pas | |||
| @@ -0,0 +1,534 @@ | |||
| 1 | {*******************************************************} | ||
| 2 | { } | ||
| 3 | { Delphi Supplemental Components } | ||
| 4 | { ZLIB Data Compression Interface Unit } | ||
| 5 | { } | ||
| 6 | { Copyright (c) 1997 Borland International } | ||
| 7 | { } | ||
| 8 | {*******************************************************} | ||
| 9 | |||
| 10 | { Modified for zlib 1.1.3 by Davide Moretti <dave@rimini.com } | ||
| 11 | |||
| 12 | unit zlib; | ||
| 13 | |||
| 14 | interface | ||
| 15 | |||
| 16 | uses Sysutils, Classes; | ||
| 17 | |||
| 18 | type | ||
| 19 | TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; | ||
| 20 | TFree = procedure (AppData, Block: Pointer); | ||
| 21 | |||
| 22 | // Internal structure. Ignore. | ||
| 23 | TZStreamRec = packed record | ||
| 24 | next_in: PChar; // next input byte | ||
| 25 | avail_in: Integer; // number of bytes available at next_in | ||
| 26 | total_in: Integer; // total nb of input bytes read so far | ||
| 27 | |||
| 28 | next_out: PChar; // next output byte should be put here | ||
| 29 | avail_out: Integer; // remaining free space at next_out | ||
| 30 | total_out: Integer; // total nb of bytes output so far | ||
| 31 | |||
| 32 | msg: PChar; // last error message, NULL if no error | ||
| 33 | internal: Pointer; // not visible by applications | ||
| 34 | |||
| 35 | zalloc: TAlloc; // used to allocate the internal state | ||
| 36 | zfree: TFree; // used to free the internal state | ||
| 37 | AppData: Pointer; // private data object passed to zalloc and zfree | ||
| 38 | |||
| 39 | data_type: Integer; // best guess about the data type: ascii or binary | ||
| 40 | adler: Integer; // adler32 value of the uncompressed data | ||
| 41 | reserved: Integer; // reserved for future use | ||
| 42 | end; | ||
| 43 | |||
| 44 | // Abstract ancestor class | ||
| 45 | TCustomZlibStream = class(TStream) | ||
| 46 | private | ||
| 47 | FStrm: TStream; | ||
| 48 | FStrmPos: Integer; | ||
| 49 | FOnProgress: TNotifyEvent; | ||
| 50 | FZRec: TZStreamRec; | ||
| 51 | FBuffer: array [Word] of Char; | ||
| 52 | protected | ||
| 53 | procedure Progress(Sender: TObject); dynamic; | ||
| 54 | property OnProgress: TNotifyEvent read FOnProgress write FOnProgress; | ||
| 55 | constructor Create(Strm: TStream); | ||
| 56 | end; | ||
| 57 | |||
| 58 | { TCompressionStream compresses data on the fly as data is written to it, and | ||
| 59 | stores the compressed data to another stream. | ||
| 60 | |||
| 61 | TCompressionStream is write-only and strictly sequential. Reading from the | ||
| 62 | stream will raise an exception. Using Seek to move the stream pointer | ||
| 63 | will raise an exception. | ||
| 64 | |||
| 65 | Output data is cached internally, written to the output stream only when | ||
| 66 | the internal output buffer is full. All pending output data is flushed | ||
| 67 | when the stream is destroyed. | ||
| 68 | |||
| 69 | The Position property returns the number of uncompressed bytes of | ||
| 70 | data that have been written to the stream so far. | ||
| 71 | |||
| 72 | CompressionRate returns the on-the-fly percentage by which the original | ||
| 73 | data has been compressed: (1 - (CompressedBytes / UncompressedBytes)) * 100 | ||
| 74 | If raw data size = 100 and compressed data size = 25, the CompressionRate | ||
| 75 | is 75% | ||
| 76 | |||
| 77 | The OnProgress event is called each time the output buffer is filled and | ||
| 78 | written to the output stream. This is useful for updating a progress | ||
| 79 | indicator when you are writing a large chunk of data to the compression | ||
| 80 | stream in a single call.} | ||
| 81 | |||
| 82 | |||
| 83 | TCompressionLevel = (clNone, clFastest, clDefault, clMax); | ||
| 84 | |||
| 85 | TCompressionStream = class(TCustomZlibStream) | ||
| 86 | private | ||
| 87 | function GetCompressionRate: Single; | ||
| 88 | public | ||
| 89 | constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream); | ||
| 90 | destructor Destroy; override; | ||
| 91 | function Read(var Buffer; Count: Longint): Longint; override; | ||
| 92 | function Write(const Buffer; Count: Longint): Longint; override; | ||
| 93 | function Seek(Offset: Longint; Origin: Word): Longint; override; | ||
| 94 | property CompressionRate: Single read GetCompressionRate; | ||
| 95 | property OnProgress; | ||
| 96 | end; | ||
| 97 | |||
| 98 | { TDecompressionStream decompresses data on the fly as data is read from it. | ||
| 99 | |||
| 100 | Compressed data comes from a separate source stream. TDecompressionStream | ||
| 101 | is read-only and unidirectional; you can seek forward in the stream, but not | ||
| 102 | backwards. The special case of setting the stream position to zero is | ||
| 103 | allowed. Seeking forward decompresses data until the requested position in | ||
| 104 | the uncompressed data has been reached. Seeking backwards, seeking relative | ||
| 105 | to the end of the stream, requesting the size of the stream, and writing to | ||
| 106 | the stream will raise an exception. | ||
| 107 | |||
| 108 | The Position property returns the number of bytes of uncompressed data that | ||
| 109 | have been read from the stream so far. | ||
| 110 | |||
| 111 | The OnProgress event is called each time the internal input buffer of | ||
| 112 | compressed data is exhausted and the next block is read from the input stream. | ||
| 113 | This is useful for updating a progress indicator when you are reading a | ||
| 114 | large chunk of data from the decompression stream in a single call.} | ||
| 115 | |||
| 116 | TDecompressionStream = class(TCustomZlibStream) | ||
| 117 | public | ||
| 118 | constructor Create(Source: TStream); | ||
| 119 | destructor Destroy; override; | ||
| 120 | function Read(var Buffer; Count: Longint): Longint; override; | ||
| 121 | function Write(const Buffer; Count: Longint): Longint; override; | ||
| 122 | function Seek(Offset: Longint; Origin: Word): Longint; override; | ||
| 123 | property OnProgress; | ||
| 124 | end; | ||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | { CompressBuf compresses data, buffer to buffer, in one call. | ||
| 129 | In: InBuf = ptr to compressed data | ||
| 130 | InBytes = number of bytes in InBuf | ||
| 131 | Out: OutBuf = ptr to newly allocated buffer containing decompressed data | ||
| 132 | OutBytes = number of bytes in OutBuf } | ||
| 133 | procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 134 | out OutBuf: Pointer; out OutBytes: Integer); | ||
| 135 | |||
| 136 | |||
| 137 | { DecompressBuf decompresses data, buffer to buffer, in one call. | ||
| 138 | In: InBuf = ptr to compressed data | ||
| 139 | InBytes = number of bytes in InBuf | ||
| 140 | OutEstimate = zero, or est. size of the decompressed data | ||
| 141 | Out: OutBuf = ptr to newly allocated buffer containing decompressed data | ||
| 142 | OutBytes = number of bytes in OutBuf } | ||
| 143 | procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 144 | OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); | ||
| 145 | |||
| 146 | const | ||
| 147 | zlib_version = '1.1.3'; | ||
| 148 | |||
| 149 | type | ||
| 150 | EZlibError = class(Exception); | ||
| 151 | ECompressionError = class(EZlibError); | ||
| 152 | EDecompressionError = class(EZlibError); | ||
| 153 | |||
| 154 | function adler32(adler: Integer; buf: PChar; len: Integer): Integer; | ||
| 155 | |||
| 156 | implementation | ||
| 157 | |||
| 158 | const | ||
| 159 | Z_NO_FLUSH = 0; | ||
| 160 | Z_PARTIAL_FLUSH = 1; | ||
| 161 | Z_SYNC_FLUSH = 2; | ||
| 162 | Z_FULL_FLUSH = 3; | ||
| 163 | Z_FINISH = 4; | ||
| 164 | |||
| 165 | Z_OK = 0; | ||
| 166 | Z_STREAM_END = 1; | ||
| 167 | Z_NEED_DICT = 2; | ||
| 168 | Z_ERRNO = (-1); | ||
| 169 | Z_STREAM_ERROR = (-2); | ||
| 170 | Z_DATA_ERROR = (-3); | ||
| 171 | Z_MEM_ERROR = (-4); | ||
| 172 | Z_BUF_ERROR = (-5); | ||
| 173 | Z_VERSION_ERROR = (-6); | ||
| 174 | |||
| 175 | Z_NO_COMPRESSION = 0; | ||
| 176 | Z_BEST_SPEED = 1; | ||
| 177 | Z_BEST_COMPRESSION = 9; | ||
| 178 | Z_DEFAULT_COMPRESSION = (-1); | ||
| 179 | |||
| 180 | Z_FILTERED = 1; | ||
| 181 | Z_HUFFMAN_ONLY = 2; | ||
| 182 | Z_DEFAULT_STRATEGY = 0; | ||
| 183 | |||
| 184 | Z_BINARY = 0; | ||
| 185 | Z_ASCII = 1; | ||
| 186 | Z_UNKNOWN = 2; | ||
| 187 | |||
| 188 | Z_DEFLATED = 8; | ||
| 189 | |||
| 190 | _z_errmsg: array[0..9] of PChar = ( | ||
| 191 | 'need dictionary', // Z_NEED_DICT (2) | ||
| 192 | 'stream end', // Z_STREAM_END (1) | ||
| 193 | '', // Z_OK (0) | ||
| 194 | 'file error', // Z_ERRNO (-1) | ||
| 195 | 'stream error', // Z_STREAM_ERROR (-2) | ||
| 196 | 'data error', // Z_DATA_ERROR (-3) | ||
| 197 | 'insufficient memory', // Z_MEM_ERROR (-4) | ||
| 198 | 'buffer error', // Z_BUF_ERROR (-5) | ||
| 199 | 'incompatible version', // Z_VERSION_ERROR (-6) | ||
| 200 | '' | ||
| 201 | ); | ||
| 202 | |||
| 203 | {$L deflate.obj} | ||
| 204 | {$L inflate.obj} | ||
| 205 | {$L inftrees.obj} | ||
| 206 | {$L trees.obj} | ||
| 207 | {$L adler32.obj} | ||
| 208 | {$L infblock.obj} | ||
| 209 | {$L infcodes.obj} | ||
| 210 | {$L infutil.obj} | ||
| 211 | {$L inffast.obj} | ||
| 212 | |||
| 213 | procedure _tr_init; external; | ||
| 214 | procedure _tr_tally; external; | ||
| 215 | procedure _tr_flush_block; external; | ||
| 216 | procedure _tr_align; external; | ||
| 217 | procedure _tr_stored_block; external; | ||
| 218 | function adler32; external; | ||
| 219 | procedure inflate_blocks_new; external; | ||
| 220 | procedure inflate_blocks; external; | ||
| 221 | procedure inflate_blocks_reset; external; | ||
| 222 | procedure inflate_blocks_free; external; | ||
| 223 | procedure inflate_set_dictionary; external; | ||
| 224 | procedure inflate_trees_bits; external; | ||
| 225 | procedure inflate_trees_dynamic; external; | ||
| 226 | procedure inflate_trees_fixed; external; | ||
| 227 | procedure inflate_codes_new; external; | ||
| 228 | procedure inflate_codes; external; | ||
| 229 | procedure inflate_codes_free; external; | ||
| 230 | procedure _inflate_mask; external; | ||
| 231 | procedure inflate_flush; external; | ||
| 232 | procedure inflate_fast; external; | ||
| 233 | |||
| 234 | procedure _memset(P: Pointer; B: Byte; count: Integer);cdecl; | ||
| 235 | begin | ||
| 236 | FillChar(P^, count, B); | ||
| 237 | end; | ||
| 238 | |||
| 239 | procedure _memcpy(dest, source: Pointer; count: Integer);cdecl; | ||
| 240 | begin | ||
| 241 | Move(source^, dest^, count); | ||
| 242 | end; | ||
| 243 | |||
| 244 | |||
| 245 | |||
| 246 | // deflate compresses data | ||
| 247 | function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; | ||
| 248 | recsize: Integer): Integer; external; | ||
| 249 | function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; | ||
| 250 | function deflateEnd(var strm: TZStreamRec): Integer; external; | ||
| 251 | |||
| 252 | // inflate decompresses data | ||
| 253 | function inflateInit_(var strm: TZStreamRec; version: PChar; | ||
| 254 | recsize: Integer): Integer; external; | ||
| 255 | function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; | ||
| 256 | function inflateEnd(var strm: TZStreamRec): Integer; external; | ||
| 257 | function inflateReset(var strm: TZStreamRec): Integer; external; | ||
| 258 | |||
| 259 | |||
| 260 | function zcalloc(AppData: Pointer; Items, Size: Integer): Pointer; | ||
| 261 | begin | ||
| 262 | GetMem(Result, Items*Size); | ||
| 263 | end; | ||
| 264 | |||
| 265 | procedure zcfree(AppData, Block: Pointer); | ||
| 266 | begin | ||
| 267 | FreeMem(Block); | ||
| 268 | end; | ||
| 269 | |||
| 270 | function zlibCheck(code: Integer): Integer; | ||
| 271 | begin | ||
| 272 | Result := code; | ||
| 273 | if code < 0 then | ||
| 274 | raise EZlibError.Create('error'); //!! | ||
| 275 | end; | ||
| 276 | |||
| 277 | function CCheck(code: Integer): Integer; | ||
| 278 | begin | ||
| 279 | Result := code; | ||
| 280 | if code < 0 then | ||
| 281 | raise ECompressionError.Create('error'); //!! | ||
| 282 | end; | ||
| 283 | |||
| 284 | function DCheck(code: Integer): Integer; | ||
| 285 | begin | ||
| 286 | Result := code; | ||
| 287 | if code < 0 then | ||
| 288 | raise EDecompressionError.Create('error'); //!! | ||
| 289 | end; | ||
| 290 | |||
| 291 | procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 292 | out OutBuf: Pointer; out OutBytes: Integer); | ||
| 293 | var | ||
| 294 | strm: TZStreamRec; | ||
| 295 | P: Pointer; | ||
| 296 | begin | ||
| 297 | FillChar(strm, sizeof(strm), 0); | ||
| 298 | OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255; | ||
| 299 | GetMem(OutBuf, OutBytes); | ||
| 300 | try | ||
| 301 | strm.next_in := InBuf; | ||
| 302 | strm.avail_in := InBytes; | ||
| 303 | strm.next_out := OutBuf; | ||
| 304 | strm.avail_out := OutBytes; | ||
| 305 | CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm))); | ||
| 306 | try | ||
| 307 | while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do | ||
| 308 | begin | ||
| 309 | P := OutBuf; | ||
| 310 | Inc(OutBytes, 256); | ||
| 311 | ReallocMem(OutBuf, OutBytes); | ||
| 312 | strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); | ||
| 313 | strm.avail_out := 256; | ||
| 314 | end; | ||
| 315 | finally | ||
| 316 | CCheck(deflateEnd(strm)); | ||
| 317 | end; | ||
| 318 | ReallocMem(OutBuf, strm.total_out); | ||
| 319 | OutBytes := strm.total_out; | ||
| 320 | except | ||
| 321 | FreeMem(OutBuf); | ||
| 322 | raise | ||
| 323 | end; | ||
| 324 | end; | ||
| 325 | |||
| 326 | |||
| 327 | procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 328 | OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); | ||
| 329 | var | ||
| 330 | strm: TZStreamRec; | ||
| 331 | P: Pointer; | ||
| 332 | BufInc: Integer; | ||
| 333 | begin | ||
| 334 | FillChar(strm, sizeof(strm), 0); | ||
| 335 | BufInc := (InBytes + 255) and not 255; | ||
| 336 | if OutEstimate = 0 then | ||
| 337 | OutBytes := BufInc | ||
| 338 | else | ||
| 339 | OutBytes := OutEstimate; | ||
| 340 | GetMem(OutBuf, OutBytes); | ||
| 341 | try | ||
| 342 | strm.next_in := InBuf; | ||
| 343 | strm.avail_in := InBytes; | ||
| 344 | strm.next_out := OutBuf; | ||
| 345 | strm.avail_out := OutBytes; | ||
| 346 | DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); | ||
| 347 | try | ||
| 348 | while DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do | ||
| 349 | begin | ||
| 350 | P := OutBuf; | ||
| 351 | Inc(OutBytes, BufInc); | ||
| 352 | ReallocMem(OutBuf, OutBytes); | ||
| 353 | strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); | ||
| 354 | strm.avail_out := BufInc; | ||
| 355 | end; | ||
| 356 | finally | ||
| 357 | DCheck(inflateEnd(strm)); | ||
| 358 | end; | ||
| 359 | ReallocMem(OutBuf, strm.total_out); | ||
| 360 | OutBytes := strm.total_out; | ||
| 361 | except | ||
| 362 | FreeMem(OutBuf); | ||
| 363 | raise | ||
| 364 | end; | ||
| 365 | end; | ||
| 366 | |||
| 367 | |||
| 368 | // TCustomZlibStream | ||
| 369 | |||
| 370 | constructor TCustomZLibStream.Create(Strm: TStream); | ||
| 371 | begin | ||
| 372 | inherited Create; | ||
| 373 | FStrm := Strm; | ||
| 374 | FStrmPos := Strm.Position; | ||
| 375 | end; | ||
| 376 | |||
| 377 | procedure TCustomZLibStream.Progress(Sender: TObject); | ||
| 378 | begin | ||
| 379 | if Assigned(FOnProgress) then FOnProgress(Sender); | ||
| 380 | end; | ||
| 381 | |||
| 382 | |||
| 383 | // TCompressionStream | ||
| 384 | |||
| 385 | constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel; | ||
| 386 | Dest: TStream); | ||
| 387 | const | ||
| 388 | Levels: array [TCompressionLevel] of ShortInt = | ||
| 389 | (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION); | ||
| 390 | begin | ||
| 391 | inherited Create(Dest); | ||
| 392 | FZRec.next_out := FBuffer; | ||
| 393 | FZRec.avail_out := sizeof(FBuffer); | ||
| 394 | CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec))); | ||
| 395 | end; | ||
| 396 | |||
| 397 | destructor TCompressionStream.Destroy; | ||
| 398 | begin | ||
| 399 | FZRec.next_in := nil; | ||
| 400 | FZRec.avail_in := 0; | ||
| 401 | try | ||
| 402 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 403 | while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END) | ||
| 404 | and (FZRec.avail_out = 0) do | ||
| 405 | begin | ||
| 406 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); | ||
| 407 | FZRec.next_out := FBuffer; | ||
| 408 | FZRec.avail_out := sizeof(FBuffer); | ||
| 409 | end; | ||
| 410 | if FZRec.avail_out < sizeof(FBuffer) then | ||
| 411 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out); | ||
| 412 | finally | ||
| 413 | deflateEnd(FZRec); | ||
| 414 | end; | ||
| 415 | inherited Destroy; | ||
| 416 | end; | ||
| 417 | |||
| 418 | function TCompressionStream.Read(var Buffer; Count: Longint): Longint; | ||
| 419 | begin | ||
| 420 | raise ECompressionError.Create('Invalid stream operation'); | ||
| 421 | end; | ||
| 422 | |||
| 423 | function TCompressionStream.Write(const Buffer; Count: Longint): Longint; | ||
| 424 | begin | ||
| 425 | FZRec.next_in := @Buffer; | ||
| 426 | FZRec.avail_in := Count; | ||
| 427 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 428 | while (FZRec.avail_in > 0) do | ||
| 429 | begin | ||
| 430 | CCheck(deflate(FZRec, 0)); | ||
| 431 | if FZRec.avail_out = 0 then | ||
| 432 | begin | ||
| 433 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); | ||
| 434 | FZRec.next_out := FBuffer; | ||
| 435 | FZRec.avail_out := sizeof(FBuffer); | ||
| 436 | FStrmPos := FStrm.Position; | ||
| 437 | Progress(Self); | ||
| 438 | end; | ||
| 439 | end; | ||
| 440 | Result := Count; | ||
| 441 | end; | ||
| 442 | |||
| 443 | function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint; | ||
| 444 | begin | ||
| 445 | if (Offset = 0) and (Origin = soFromCurrent) then | ||
| 446 | Result := FZRec.total_in | ||
| 447 | else | ||
| 448 | raise ECompressionError.Create('Invalid stream operation'); | ||
| 449 | end; | ||
| 450 | |||
| 451 | function TCompressionStream.GetCompressionRate: Single; | ||
| 452 | begin | ||
| 453 | if FZRec.total_in = 0 then | ||
| 454 | Result := 0 | ||
| 455 | else | ||
| 456 | Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0; | ||
| 457 | end; | ||
| 458 | |||
| 459 | |||
| 460 | // TDecompressionStream | ||
| 461 | |||
| 462 | constructor TDecompressionStream.Create(Source: TStream); | ||
| 463 | begin | ||
| 464 | inherited Create(Source); | ||
| 465 | FZRec.next_in := FBuffer; | ||
| 466 | FZRec.avail_in := 0; | ||
| 467 | DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec))); | ||
| 468 | end; | ||
| 469 | |||
| 470 | destructor TDecompressionStream.Destroy; | ||
| 471 | begin | ||
| 472 | inflateEnd(FZRec); | ||
| 473 | inherited Destroy; | ||
| 474 | end; | ||
| 475 | |||
| 476 | function TDecompressionStream.Read(var Buffer; Count: Longint): Longint; | ||
| 477 | begin | ||
| 478 | FZRec.next_out := @Buffer; | ||
| 479 | FZRec.avail_out := Count; | ||
| 480 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 481 | while (FZRec.avail_out > 0) do | ||
| 482 | begin | ||
| 483 | if FZRec.avail_in = 0 then | ||
| 484 | begin | ||
| 485 | FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer)); | ||
| 486 | if FZRec.avail_in = 0 then | ||
| 487 | begin | ||
| 488 | Result := Count - FZRec.avail_out; | ||
| 489 | Exit; | ||
| 490 | end; | ||
| 491 | FZRec.next_in := FBuffer; | ||
| 492 | FStrmPos := FStrm.Position; | ||
| 493 | Progress(Self); | ||
| 494 | end; | ||
| 495 | DCheck(inflate(FZRec, 0)); | ||
| 496 | end; | ||
| 497 | Result := Count; | ||
| 498 | end; | ||
| 499 | |||
| 500 | function TDecompressionStream.Write(const Buffer; Count: Longint): Longint; | ||
| 501 | begin | ||
| 502 | raise EDecompressionError.Create('Invalid stream operation'); | ||
| 503 | end; | ||
| 504 | |||
| 505 | function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint; | ||
| 506 | var | ||
| 507 | I: Integer; | ||
| 508 | Buf: array [0..4095] of Char; | ||
| 509 | begin | ||
| 510 | if (Offset = 0) and (Origin = soFromBeginning) then | ||
| 511 | begin | ||
| 512 | DCheck(inflateReset(FZRec)); | ||
| 513 | FZRec.next_in := FBuffer; | ||
| 514 | FZRec.avail_in := 0; | ||
| 515 | FStrm.Position := 0; | ||
| 516 | FStrmPos := 0; | ||
| 517 | end | ||
| 518 | else if ( (Offset >= 0) and (Origin = soFromCurrent)) or | ||
| 519 | ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then | ||
| 520 | begin | ||
| 521 | if Origin = soFromBeginning then Dec(Offset, FZRec.total_out); | ||
| 522 | if Offset > 0 then | ||
| 523 | begin | ||
| 524 | for I := 1 to Offset div sizeof(Buf) do | ||
| 525 | ReadBuffer(Buf, sizeof(Buf)); | ||
| 526 | ReadBuffer(Buf, Offset mod sizeof(Buf)); | ||
| 527 | end; | ||
| 528 | end | ||
| 529 | else | ||
| 530 | raise EDecompressionError.Create('Invalid stream operation'); | ||
| 531 | Result := FZRec.total_out; | ||
| 532 | end; | ||
| 533 | |||
| 534 | end. | ||
diff --git a/contrib/delphi2/zlib32.bpr b/contrib/delphi2/zlib32.bpr new file mode 100644 index 0000000..cabcec4 --- /dev/null +++ b/contrib/delphi2/zlib32.bpr | |||
| @@ -0,0 +1,174 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = zlib32.dll | ||
| 17 | OBJFILES = zlib32.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \ | ||
| 18 | infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \ | ||
| 19 | uncompr.obj zutil.obj | ||
| 20 | RESFILES = | ||
| 21 | RESDEPEN = $(RESFILES) | ||
| 22 | LIBFILES = | ||
| 23 | LIBRARIES = | ||
| 24 | SPARELIBS = | ||
| 25 | DEFFILE = | ||
| 26 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 27 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 28 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 29 | # --------------------------------------------------------------------------- | ||
| 30 | PATHCPP = .; | ||
| 31 | PATHASM = .; | ||
| 32 | PATHPAS = .; | ||
| 33 | PATHRC = .; | ||
| 34 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 35 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 36 | # --------------------------------------------------------------------------- | ||
| 37 | CFLAG1 = -WD -O2 -Ve -d -k- -vi -c -tWD | ||
| 38 | CFLAG2 = -D_NO_VCL;ZLIB_DLL -I$(BCB)\include | ||
| 39 | CFLAG3 = -ff -5 | ||
| 40 | PFLAGS = -D_NO_VCL;ZLIB_DLL -U$(BCB)\lib;$(RELEASELIBPATH) -I$(BCB)\include -$I- -v \ | ||
| 41 | -JPHN -M | ||
| 42 | RFLAGS = -D_NO_VCL;ZLIB_DLL -i$(BCB)\include | ||
| 43 | AFLAGS = /i$(BCB)\include /d_NO_VCL /dZLIB_DLL /mx /w2 /zn | ||
| 44 | LFLAGS = -L$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpd -x -Gi | ||
| 45 | IFLAGS = -Gn -g | ||
| 46 | # --------------------------------------------------------------------------- | ||
| 47 | ALLOBJ = c0d32.obj $(OBJFILES) | ||
| 48 | ALLRES = $(RESFILES) | ||
| 49 | ALLLIB = $(LIBFILES) import32.lib cw32mt.lib | ||
| 50 | # --------------------------------------------------------------------------- | ||
| 51 | !ifdef IDEOPTIONS | ||
| 52 | |||
| 53 | [Version Info] | ||
| 54 | IncludeVerInfo=0 | ||
| 55 | AutoIncBuild=0 | ||
| 56 | MajorVer=1 | ||
| 57 | MinorVer=0 | ||
| 58 | Release=0 | ||
| 59 | Build=0 | ||
| 60 | Debug=0 | ||
| 61 | PreRelease=0 | ||
| 62 | Special=0 | ||
| 63 | Private=0 | ||
| 64 | DLL=1 | ||
| 65 | Locale=1040 | ||
| 66 | CodePage=1252 | ||
| 67 | |||
| 68 | [Version Info Keys] | ||
| 69 | CompanyName= | ||
| 70 | FileDescription=DLL (GUI) | ||
| 71 | FileVersion=1.0.0.0 | ||
| 72 | InternalName= | ||
| 73 | LegalCopyright= | ||
| 74 | LegalTrademarks= | ||
| 75 | OriginalFilename= | ||
| 76 | ProductName= | ||
| 77 | ProductVersion=1.0.0.0 | ||
| 78 | Comments= | ||
| 79 | |||
| 80 | [HistoryLists\hlIncludePath] | ||
| 81 | Count=1 | ||
| 82 | Item0=$(BCB)\include | ||
| 83 | |||
| 84 | [HistoryLists\hlLibraryPath] | ||
| 85 | Count=1 | ||
| 86 | Item0=$(BCB)\lib | ||
| 87 | |||
| 88 | [HistoryLists\hlConditionals] | ||
| 89 | Count=1 | ||
| 90 | Item0=_NO_VCL;ZLIB_DLL | ||
| 91 | |||
| 92 | [Debugging] | ||
| 93 | DebugSourceDirs= | ||
| 94 | |||
| 95 | [Parameters] | ||
| 96 | RunParams= | ||
| 97 | HostApplication= | ||
| 98 | |||
| 99 | !endif | ||
| 100 | |||
| 101 | # --------------------------------------------------------------------------- | ||
| 102 | # MAKE SECTION | ||
| 103 | # --------------------------------------------------------------------------- | ||
| 104 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 105 | # the benefit of building from the command-line using the MAKE utility. | ||
| 106 | # --------------------------------------------------------------------------- | ||
| 107 | |||
| 108 | .autodepend | ||
| 109 | # --------------------------------------------------------------------------- | ||
| 110 | !if !$d(BCC32) | ||
| 111 | BCC32 = bcc32 | ||
| 112 | !endif | ||
| 113 | |||
| 114 | !if !$d(DCC32) | ||
| 115 | DCC32 = dcc32 | ||
| 116 | !endif | ||
| 117 | |||
| 118 | !if !$d(TASM32) | ||
| 119 | TASM32 = tasm32 | ||
| 120 | !endif | ||
| 121 | |||
| 122 | !if !$d(LINKER) | ||
| 123 | LINKER = ilink32 | ||
| 124 | !endif | ||
| 125 | |||
| 126 | !if !$d(BRCC32) | ||
| 127 | BRCC32 = brcc32 | ||
| 128 | !endif | ||
| 129 | # --------------------------------------------------------------------------- | ||
| 130 | !if $d(PATHCPP) | ||
| 131 | .PATH.CPP = $(PATHCPP) | ||
| 132 | .PATH.C = $(PATHCPP) | ||
| 133 | !endif | ||
| 134 | |||
| 135 | !if $d(PATHPAS) | ||
| 136 | .PATH.PAS = $(PATHPAS) | ||
| 137 | !endif | ||
| 138 | |||
| 139 | !if $d(PATHASM) | ||
| 140 | .PATH.ASM = $(PATHASM) | ||
| 141 | !endif | ||
| 142 | |||
| 143 | !if $d(PATHRC) | ||
| 144 | .PATH.RC = $(PATHRC) | ||
| 145 | !endif | ||
| 146 | # --------------------------------------------------------------------------- | ||
| 147 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 148 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 149 | $(LFLAGS) $(IFLAGS) + | ||
| 150 | $(ALLOBJ), + | ||
| 151 | $(PROJECT),, + | ||
| 152 | $(ALLLIB), + | ||
| 153 | $(DEFFILE), + | ||
| 154 | $(ALLRES) | ||
| 155 | ! | ||
| 156 | # --------------------------------------------------------------------------- | ||
| 157 | .pas.hpp: | ||
| 158 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 159 | |||
| 160 | .pas.obj: | ||
| 161 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 162 | |||
| 163 | .cpp.obj: | ||
| 164 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 165 | |||
| 166 | .c.obj: | ||
| 167 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 168 | |||
| 169 | .asm.obj: | ||
| 170 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 171 | |||
| 172 | .rc.res: | ||
| 173 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 174 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/zlib32.cpp b/contrib/delphi2/zlib32.cpp new file mode 100644 index 0000000..7372f6b --- /dev/null +++ b/contrib/delphi2/zlib32.cpp | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | |||
| 2 | #include <windows.h> | ||
| 3 | #pragma hdrstop | ||
| 4 | #include <condefs.h> | ||
| 5 | |||
| 6 | |||
| 7 | //--------------------------------------------------------------------------- | ||
| 8 | // Important note about DLL memory management in a VCL DLL: | ||
| 9 | // | ||
| 10 | // | ||
| 11 | // | ||
| 12 | // If your DLL uses VCL and exports any functions that pass VCL String objects | ||
| 13 | // (or structs/classes containing nested Strings) as parameter or function | ||
| 14 | // results, you will need to build both your DLL project and any EXE projects | ||
| 15 | // that use your DLL with the dynamic RTL (the RTL DLL). This will change your | ||
| 16 | // DLL and its calling EXE's to use BORLNDMM.DLL as their memory manager. In | ||
| 17 | // these cases, the file BORLNDMM.DLL should be deployed along with your DLL | ||
| 18 | // and the RTL DLL (CP3240MT.DLL). To avoid the requiring BORLNDMM.DLL in | ||
| 19 | // these situations, pass string information using "char *" or ShortString | ||
| 20 | // parameters and then link with the static RTL. | ||
| 21 | // | ||
| 22 | //--------------------------------------------------------------------------- | ||
| 23 | USEUNIT("adler32.c"); | ||
| 24 | USEUNIT("compress.c"); | ||
| 25 | USEUNIT("crc32.c"); | ||
| 26 | USEUNIT("deflate.c"); | ||
| 27 | USEUNIT("gzio.c"); | ||
| 28 | USEUNIT("infblock.c"); | ||
| 29 | USEUNIT("infcodes.c"); | ||
| 30 | USEUNIT("inffast.c"); | ||
| 31 | USEUNIT("inflate.c"); | ||
| 32 | USEUNIT("inftrees.c"); | ||
| 33 | USEUNIT("infutil.c"); | ||
| 34 | USEUNIT("trees.c"); | ||
| 35 | USEUNIT("uncompr.c"); | ||
| 36 | USEUNIT("zutil.c"); | ||
| 37 | //--------------------------------------------------------------------------- | ||
| 38 | #pragma argsused | ||
| 39 | int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) | ||
| 40 | { | ||
| 41 | return 1; | ||
| 42 | } | ||
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 78a8473..ff71a47 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
| @@ -315,7 +315,7 @@ local uLong unzlocal_SearchCentralDir(fin) | |||
| 315 | if (fread(buf,(uInt)uReadSize,1,fin)!=1) | 315 | if (fread(buf,(uInt)uReadSize,1,fin)!=1) |
| 316 | break; | 316 | break; |
| 317 | 317 | ||
| 318 | for (i=0;i<(int)uReadSize-3;i++) | 318 | for (i=(int)uReadSize-3; (i--)>0;) |
| 319 | if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && | 319 | if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && |
| 320 | ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) | 320 | ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) |
| 321 | { | 321 | { |
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index ddb2334..0cae64a 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
| @@ -242,6 +242,8 @@ local int write_datablock(fout,ll) | |||
| 242 | Outputs a long in LSB order to the given file | 242 | Outputs a long in LSB order to the given file |
| 243 | nbByte == 1, 2 or 4 (byte, short or long) | 243 | nbByte == 1, 2 or 4 (byte, short or long) |
| 244 | */ | 244 | */ |
| 245 | |||
| 246 | local int ziplocal_putValue OF((FILE *file, uLong x, int nbByte)); | ||
| 245 | local int ziplocal_putValue (file, x, nbByte) | 247 | local int ziplocal_putValue (file, x, nbByte) |
| 246 | FILE *file; | 248 | FILE *file; |
| 247 | uLong x; | 249 | uLong x; |
| @@ -259,7 +261,7 @@ local int ziplocal_putValue (file, x, nbByte) | |||
| 259 | return ZIP_OK; | 261 | return ZIP_OK; |
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | 264 | local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte)); | |
| 263 | local void ziplocal_putValue_inmemory (dest, x, nbByte) | 265 | local void ziplocal_putValue_inmemory (dest, x, nbByte) |
| 264 | void* dest; | 266 | void* dest; |
| 265 | uLong x; | 267 | uLong x; |
| @@ -390,34 +392,34 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, | |||
| 390 | zi->ci.pos_local_header = ftell(zi->filezip); | 392 | zi->ci.pos_local_header = ftell(zi->filezip); |
| 391 | zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + | 393 | zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + |
| 392 | size_extrafield_global + size_comment; | 394 | size_extrafield_global + size_comment; |
| 393 | zi->ci.central_header = (char*)ALLOC(zi->ci.size_centralheader); | 395 | zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader); |
| 394 | 396 | ||
| 395 | ziplocal_putValue_inmemory(zi->ci.central_header,CENTRALHEADERMAGIC,4); | 397 | ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4); |
| 396 | /* version info */ | 398 | /* version info */ |
| 397 | ziplocal_putValue_inmemory(zi->ci.central_header+4,VERSIONMADEBY,2); | 399 | ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2); |
| 398 | ziplocal_putValue_inmemory(zi->ci.central_header+6,20,2); | 400 | ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2); |
| 399 | ziplocal_putValue_inmemory(zi->ci.central_header+8,zi->ci.flag,2); | 401 | ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2); |
| 400 | ziplocal_putValue_inmemory(zi->ci.central_header+10,zi->ci.method,2); | 402 | ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2); |
| 401 | ziplocal_putValue_inmemory(zi->ci.central_header+12,zi->ci.dosDate,4); | 403 | ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4); |
| 402 | ziplocal_putValue_inmemory(zi->ci.central_header+16,0,4); /*crc*/ | 404 | ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/ |
| 403 | ziplocal_putValue_inmemory(zi->ci.central_header+20,0,4); /*compr size*/ | 405 | ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/ |
| 404 | ziplocal_putValue_inmemory(zi->ci.central_header+24,0,4); /*uncompr size*/ | 406 | ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/ |
| 405 | ziplocal_putValue_inmemory(zi->ci.central_header+28,size_filename,2); | 407 | ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2); |
| 406 | ziplocal_putValue_inmemory(zi->ci.central_header+30,size_extrafield_global,2); | 408 | ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2); |
| 407 | ziplocal_putValue_inmemory(zi->ci.central_header+32,size_comment,2); | 409 | ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2); |
| 408 | ziplocal_putValue_inmemory(zi->ci.central_header+34,0,2); /*disk nm start*/ | 410 | ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/ |
| 409 | 411 | ||
| 410 | if (zipfi==NULL) | 412 | if (zipfi==NULL) |
| 411 | ziplocal_putValue_inmemory(zi->ci.central_header+36,0,2); | 413 | ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); |
| 412 | else | 414 | else |
| 413 | ziplocal_putValue_inmemory(zi->ci.central_header+36,zipfi->internal_fa,2); | 415 | ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); |
| 414 | 416 | ||
| 415 | if (zipfi==NULL) | 417 | if (zipfi==NULL) |
| 416 | ziplocal_putValue_inmemory(zi->ci.central_header+38,0,4); | 418 | ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); |
| 417 | else | 419 | else |
| 418 | ziplocal_putValue_inmemory(zi->ci.central_header+38,zipfi->external_fa,4); | 420 | ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); |
| 419 | 421 | ||
| 420 | ziplocal_putValue_inmemory(zi->ci.central_header+42,zi->ci.pos_local_header,4); | 422 | ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header,4); |
| 421 | 423 | ||
| 422 | for (i=0;i<size_filename;i++) | 424 | for (i=0;i<size_filename;i++) |
| 423 | *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i); | 425 | *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i); |
| @@ -433,25 +435,25 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, | |||
| 433 | return ZIP_INTERNALERROR; | 435 | return ZIP_INTERNALERROR; |
| 434 | 436 | ||
| 435 | /* write the local header */ | 437 | /* write the local header */ |
| 436 | err = ziplocal_putValue(zi->filezip,LOCALHEADERMAGIC,4); | 438 | err = ziplocal_putValue(zi->filezip,(uLong)LOCALHEADERMAGIC,4); |
| 437 | 439 | ||
| 438 | if (err==ZIP_OK) | 440 | if (err==ZIP_OK) |
| 439 | err = ziplocal_putValue(zi->filezip,20,2);/* version needed to extract */ | 441 | err = ziplocal_putValue(zi->filezip,(uLong)20,2);/* version needed to extract */ |
| 440 | if (err==ZIP_OK) | 442 | if (err==ZIP_OK) |
| 441 | err = ziplocal_putValue(zi->filezip,zi->ci.flag,2); | 443 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.flag,2); |
| 442 | 444 | ||
| 443 | if (err==ZIP_OK) | 445 | if (err==ZIP_OK) |
| 444 | err = ziplocal_putValue(zi->filezip,zi->ci.method,2); | 446 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.method,2); |
| 445 | 447 | ||
| 446 | if (err==ZIP_OK) | 448 | if (err==ZIP_OK) |
| 447 | err = ziplocal_putValue(zi->filezip,zi->ci.dosDate,4); | 449 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.dosDate,4); |
| 448 | 450 | ||
| 449 | if (err==ZIP_OK) | 451 | if (err==ZIP_OK) |
| 450 | err = ziplocal_putValue(zi->filezip,0,4); /* crc 32, unknown */ | 452 | err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* crc 32, unknown */ |
| 451 | if (err==ZIP_OK) | 453 | if (err==ZIP_OK) |
| 452 | err = ziplocal_putValue(zi->filezip,0,4); /* compressed size, unknown */ | 454 | err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* compressed size, unknown */ |
| 453 | if (err==ZIP_OK) | 455 | if (err==ZIP_OK) |
| 454 | err = ziplocal_putValue(zi->filezip,0,4); /* uncompressed size, unknown */ | 456 | err = ziplocal_putValue(zi->filezip,(uLong)0,4); /* uncompressed size, unknown */ |
| 455 | 457 | ||
| 456 | if (err==ZIP_OK) | 458 | if (err==ZIP_OK) |
| 457 | err = ziplocal_putValue(zi->filezip,(uLong)size_filename,2); | 459 | err = ziplocal_putValue(zi->filezip,(uLong)size_filename,2); |
| @@ -481,7 +483,7 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, | |||
| 481 | zi->ci.stream.opaque = (voidpf)0; | 483 | zi->ci.stream.opaque = (voidpf)0; |
| 482 | 484 | ||
| 483 | err = deflateInit2(&zi->ci.stream, level, | 485 | err = deflateInit2(&zi->ci.stream, level, |
| 484 | Z_DEFLATED, -MAX_WBITS, /*DEF_MEM_LEVEL*/8, 0); | 486 | Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, 0); |
| 485 | 487 | ||
| 486 | if (err==Z_OK) | 488 | if (err==Z_OK) |
| 487 | zi->ci.stream_initialised = 1; | 489 | zi->ci.stream_initialised = 1; |
| @@ -528,7 +530,7 @@ extern int ZEXPORT zipWriteInFileInZip (file, buf, len) | |||
| 528 | { | 530 | { |
| 529 | uLong uTotalOutBefore = zi->ci.stream.total_out; | 531 | uLong uTotalOutBefore = zi->ci.stream.total_out; |
| 530 | err=deflate(&zi->ci.stream, Z_NO_FLUSH); | 532 | err=deflate(&zi->ci.stream, Z_NO_FLUSH); |
| 531 | zi->ci.pos_in_buffered_data += zi->ci.stream.total_out - uTotalOutBefore ; | 533 | zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; |
| 532 | 534 | ||
| 533 | } | 535 | } |
| 534 | else | 536 | else |
| @@ -585,7 +587,7 @@ extern int ZEXPORT zipCloseFileInZip (file) | |||
| 585 | } | 587 | } |
| 586 | uTotalOutBefore = zi->ci.stream.total_out; | 588 | uTotalOutBefore = zi->ci.stream.total_out; |
| 587 | err=deflate(&zi->ci.stream, Z_FINISH); | 589 | err=deflate(&zi->ci.stream, Z_FINISH); |
| 588 | zi->ci.pos_in_buffered_data += zi->ci.stream.total_out - uTotalOutBefore ; | 590 | zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; |
| 589 | } | 591 | } |
| 590 | 592 | ||
| 591 | if (err==Z_STREAM_END) | 593 | if (err==Z_STREAM_END) |
| @@ -602,11 +604,11 @@ extern int ZEXPORT zipCloseFileInZip (file) | |||
| 602 | zi->ci.stream_initialised = 0; | 604 | zi->ci.stream_initialised = 0; |
| 603 | } | 605 | } |
| 604 | 606 | ||
| 605 | ziplocal_putValue_inmemory(zi->ci.central_header+16,zi->ci.crc32,4); /*crc*/ | 607 | ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)zi->ci.crc32,4); /*crc*/ |
| 606 | ziplocal_putValue_inmemory(zi->ci.central_header+20, | 608 | ziplocal_putValue_inmemory(zi->ci.central_header+20, |
| 607 | zi->ci.stream.total_out,4); /*compr size*/ | 609 | (uLong)zi->ci.stream.total_out,4); /*compr size*/ |
| 608 | ziplocal_putValue_inmemory(zi->ci.central_header+24, | 610 | ziplocal_putValue_inmemory(zi->ci.central_header+24, |
| 609 | zi->ci.stream.total_in,4); /*uncompr size*/ | 611 | (uLong)zi->ci.stream.total_in,4); /*uncompr size*/ |
| 610 | 612 | ||
| 611 | if (err==ZIP_OK) | 613 | if (err==ZIP_OK) |
| 612 | err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header, | 614 | err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header, |
| @@ -621,13 +623,13 @@ extern int ZEXPORT zipCloseFileInZip (file) | |||
| 621 | err = ZIP_ERRNO; | 623 | err = ZIP_ERRNO; |
| 622 | 624 | ||
| 623 | if (err==ZIP_OK) | 625 | if (err==ZIP_OK) |
| 624 | err = ziplocal_putValue(zi->filezip,zi->ci.crc32,4); /* crc 32, unknown */ | 626 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.crc32,4); /* crc 32, unknown */ |
| 625 | 627 | ||
| 626 | if (err==ZIP_OK) /* compressed size, unknown */ | 628 | if (err==ZIP_OK) /* compressed size, unknown */ |
| 627 | err = ziplocal_putValue(zi->filezip,zi->ci.stream.total_out,4); | 629 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_out,4); |
| 628 | 630 | ||
| 629 | if (err==ZIP_OK) /* uncompressed size, unknown */ | 631 | if (err==ZIP_OK) /* uncompressed size, unknown */ |
| 630 | err = ziplocal_putValue(zi->filezip,zi->ci.stream.total_in,4); | 632 | err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_in,4); |
| 631 | 633 | ||
| 632 | if (fseek(zi->filezip, | 634 | if (fseek(zi->filezip, |
| 633 | cur_pos_inzip,SEEK_SET)!=0) | 635 | cur_pos_inzip,SEEK_SET)!=0) |
| @@ -682,26 +684,26 @@ extern int ZEXPORT zipClose (file, global_comment) | |||
| 682 | free_datablock(zi->central_dir.first_block); | 684 | free_datablock(zi->central_dir.first_block); |
| 683 | 685 | ||
| 684 | if (err==ZIP_OK) /* Magic End */ | 686 | if (err==ZIP_OK) /* Magic End */ |
| 685 | err = ziplocal_putValue(zi->filezip,ENDHEADERMAGIC,4); | 687 | err = ziplocal_putValue(zi->filezip,(uLong)ENDHEADERMAGIC,4); |
| 686 | 688 | ||
| 687 | if (err==ZIP_OK) /* number of this disk */ | 689 | if (err==ZIP_OK) /* number of this disk */ |
| 688 | err = ziplocal_putValue(zi->filezip,0,2); | 690 | err = ziplocal_putValue(zi->filezip,(uLong)0,2); |
| 689 | 691 | ||
| 690 | if (err==ZIP_OK) /* number of the disk with the start of the central directory */ | 692 | if (err==ZIP_OK) /* number of the disk with the start of the central directory */ |
| 691 | err = ziplocal_putValue(zi->filezip,0,2); | 693 | err = ziplocal_putValue(zi->filezip,(uLong)0,2); |
| 692 | 694 | ||
| 693 | if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ | 695 | if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ |
| 694 | err = ziplocal_putValue(zi->filezip,zi->number_entry,2); | 696 | err = ziplocal_putValue(zi->filezip,(uLong)zi->number_entry,2); |
| 695 | 697 | ||
| 696 | if (err==ZIP_OK) /* total number of entries in the central dir */ | 698 | if (err==ZIP_OK) /* total number of entries in the central dir */ |
| 697 | err = ziplocal_putValue(zi->filezip,zi->number_entry,2); | 699 | err = ziplocal_putValue(zi->filezip,(uLong)zi->number_entry,2); |
| 698 | 700 | ||
| 699 | if (err==ZIP_OK) /* size of the central directory */ | 701 | if (err==ZIP_OK) /* size of the central directory */ |
| 700 | err = ziplocal_putValue(zi->filezip,size_centraldir,4); | 702 | err = ziplocal_putValue(zi->filezip,(uLong)size_centraldir,4); |
| 701 | 703 | ||
| 702 | if (err==ZIP_OK) /* offset of start of central directory with respect to the | 704 | if (err==ZIP_OK) /* offset of start of central directory with respect to the |
| 703 | starting disk number */ | 705 | starting disk number */ |
| 704 | err = ziplocal_putValue(zi->filezip,centraldir_pos_inzip ,4); | 706 | err = ziplocal_putValue(zi->filezip,(uLong)centraldir_pos_inzip ,4); |
| 705 | 707 | ||
| 706 | if (err==ZIP_OK) /* zipfile comment length */ | 708 | if (err==ZIP_OK) /* zipfile comment length */ |
| 707 | err = ziplocal_putValue(zi->filezip,(uLong)size_global_comment,2); | 709 | err = ziplocal_putValue(zi->filezip,(uLong)size_global_comment,2); |
diff --git a/contrib/untgz/untgz.c b/contrib/untgz/untgz.c index 6fa9a5d..4a431ff 100644 --- a/contrib/untgz/untgz.c +++ b/contrib/untgz/untgz.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | #include <time.h> | 11 | #include <time.h> |
| 12 | #include <utime.h> | ||
| 13 | #include <errno.h> | 12 | #include <errno.h> |
| 14 | #include <fcntl.h> | 13 | #include <fcntl.h> |
| 15 | #ifdef unix | 14 | #ifdef unix |
| @@ -21,6 +20,23 @@ | |||
| 21 | 20 | ||
| 22 | #include "zlib.h" | 21 | #include "zlib.h" |
| 23 | 22 | ||
| 23 | #ifdef WIN32 | ||
| 24 | # ifndef F_OK | ||
| 25 | # define F_OK (0) | ||
| 26 | # endif | ||
| 27 | # ifdef _MSC_VER | ||
| 28 | # define mkdir(dirname,mode) _mkdir(dirname) | ||
| 29 | # define strdup(str) _strdup(str) | ||
| 30 | # define unlink(fn) _unlink(fn) | ||
| 31 | # define access(path,mode) _access(path,mode) | ||
| 32 | # else | ||
| 33 | # define mkdir(dirname,mode) _mkdir(dirname) | ||
| 34 | # endif | ||
| 35 | #else | ||
| 36 | # include <utime.h> | ||
| 37 | #endif | ||
| 38 | |||
| 39 | |||
| 24 | /* Values used in typeflag field. */ | 40 | /* Values used in typeflag field. */ |
| 25 | 41 | ||
| 26 | #define REGTYPE '0' /* regular file */ | 42 | #define REGTYPE '0' /* regular file */ |
| @@ -83,7 +99,7 @@ char *prog; | |||
| 83 | 99 | ||
| 84 | /* This will give a benign warning */ | 100 | /* This will give a benign warning */ |
| 85 | 101 | ||
| 86 | static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", NULL }; | 102 | static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", ".tar", NULL }; |
| 87 | 103 | ||
| 88 | /* Return the real name of the TGZ archive */ | 104 | /* Return the real name of the TGZ archive */ |
| 89 | /* or NULL if it does not exist. */ | 105 | /* or NULL if it does not exist. */ |
| @@ -272,14 +288,6 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) | |||
| 272 | if (len < 0) | 288 | if (len < 0) |
| 273 | error (gzerror(in, &err)); | 289 | error (gzerror(in, &err)); |
| 274 | /* | 290 | /* |
| 275 | * if we met the end of the tar | ||
| 276 | * or the end-of-tar block, | ||
| 277 | * we are done | ||
| 278 | */ | ||
| 279 | if ((len == 0) || (buffer.header.name[0]== 0)) | ||
| 280 | break; | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Always expect complete blocks to process | 291 | * Always expect complete blocks to process |
| 284 | * the tar information. | 292 | * the tar information. |
| 285 | */ | 293 | */ |
| @@ -291,6 +299,13 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) | |||
| 291 | */ | 299 | */ |
| 292 | if (getheader == 1) | 300 | if (getheader == 1) |
| 293 | { | 301 | { |
| 302 | /* | ||
| 303 | * if we met the end of the tar | ||
| 304 | * or the end-of-tar block, | ||
| 305 | * we are done | ||
| 306 | */ | ||
| 307 | if ((len == 0) || (buffer.header.name[0]== 0)) break; | ||
| 308 | |||
| 294 | tartime = (time_t)getoct(buffer.header.mtime,12); | 309 | tartime = (time_t)getoct(buffer.header.mtime,12); |
| 295 | strcpy(fname,buffer.header.name); | 310 | strcpy(fname,buffer.header.name); |
| 296 | 311 | ||
| @@ -360,6 +375,34 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) | |||
| 360 | getheader = 1; | 375 | getheader = 1; |
| 361 | if ((action == TGZ_EXTRACT) && (outfile != NULL)) | 376 | if ((action == TGZ_EXTRACT) && (outfile != NULL)) |
| 362 | { | 377 | { |
| 378 | #ifdef WIN32 | ||
| 379 | HANDLE hFile; | ||
| 380 | FILETIME ftm,ftLocal; | ||
| 381 | SYSTEMTIME st; | ||
| 382 | struct tm localt; | ||
| 383 | |||
| 384 | fclose(outfile); | ||
| 385 | |||
| 386 | localt = *localtime(&tartime); | ||
| 387 | |||
| 388 | hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE, | ||
| 389 | 0, NULL, OPEN_EXISTING, 0, NULL); | ||
| 390 | |||
| 391 | st.wYear = (WORD)localt.tm_year+1900; | ||
| 392 | st.wMonth = (WORD)localt.tm_mon; | ||
| 393 | st.wDayOfWeek = (WORD)localt.tm_wday; | ||
| 394 | st.wDay = (WORD)localt.tm_mday; | ||
| 395 | st.wHour = (WORD)localt.tm_hour; | ||
| 396 | st.wMinute = (WORD)localt.tm_min; | ||
| 397 | st.wSecond = (WORD)localt.tm_sec; | ||
| 398 | st.wMilliseconds = 0; | ||
| 399 | SystemTimeToFileTime(&st,&ftLocal); | ||
| 400 | LocalFileTimeToFileTime(&ftLocal,&ftm); | ||
| 401 | SetFileTime(hFile,&ftm,NULL,&ftm); | ||
| 402 | CloseHandle(hFile); | ||
| 403 | |||
| 404 | outfile = NULL; | ||
| 405 | #else | ||
| 363 | struct utimbuf settime; | 406 | struct utimbuf settime; |
| 364 | 407 | ||
| 365 | settime.actime = settime.modtime = tartime; | 408 | settime.actime = settime.modtime = tartime; |
| @@ -367,6 +410,7 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) | |||
| 367 | fclose(outfile); | 410 | fclose(outfile); |
| 368 | outfile = NULL; | 411 | outfile = NULL; |
| 369 | utime(fname,&settime); | 412 | utime(fname,&settime); |
| 413 | #endif | ||
| 370 | } | 414 | } |
| 371 | } | 415 | } |
| 372 | } | 416 | } |
diff --git a/contrib/visual-basic.txt b/contrib/visual-basic.txt index 18aa084..10fb44b 100644 --- a/contrib/visual-basic.txt +++ b/contrib/visual-basic.txt | |||
| @@ -1,5 +1,17 @@ | |||
| 1 | See below some functions declarations for Visual Basic. | ||
| 2 | |||
| 3 | Frequently Asked Question: | ||
| 4 | |||
| 5 | Q: Each time I use the compress function I get the -5 error (not enough | ||
| 6 | room in the output buffer). | ||
| 7 | |||
| 8 | A: Make sure that the length of the compressed buffer is passed by | ||
| 9 | reference ("as any"), not by value ("as long"). Also check that | ||
| 10 | before the call of compress this length is equal to the total size of | ||
| 11 | the compressed buffer and not zero. | ||
| 12 | |||
| 13 | |||
| 1 | From: "Jon Caruana" <jon-net@usa.net> | 14 | From: "Jon Caruana" <jon-net@usa.net> |
| 2 | To: "Jean-loup Gailly" <gzip@prep.ai.mit.edu> | ||
| 3 | Subject: Re: How to port zlib declares to vb? | 15 | Subject: Re: How to port zlib declares to vb? |
| 4 | Date: Mon, 28 Oct 1996 18:33:03 -0600 | 16 | Date: Mon, 28 Oct 1996 18:33:03 -0600 |
| 5 | 17 | ||
| @@ -52,7 +52,7 @@ | |||
| 52 | #include "deflate.h" | 52 | #include "deflate.h" |
| 53 | 53 | ||
| 54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
| 55 | " deflate 1.1.2 Copyright 1995-1998 Jean-loup Gailly "; | 55 | " deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly "; |
| 56 | /* | 56 | /* |
| 57 | If you use the zlib library in a product, an acknowledgment is welcome | 57 | If you use the zlib library in a product, an acknowledgment is welcome |
| 58 | in the documentation of your product. If for some reason you cannot | 58 | in the documentation of your product. If for some reason you cannot |
| @@ -608,11 +608,13 @@ int ZEXPORT deflateCopy (dest, source) | |||
| 608 | deflate_state *ss; | 608 | deflate_state *ss; |
| 609 | ushf *overlay; | 609 | ushf *overlay; |
| 610 | 610 | ||
| 611 | ss = source->state; | ||
| 612 | 611 | ||
| 613 | if (source == Z_NULL || dest == Z_NULL || ss == Z_NULL) { | 612 | if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { |
| 614 | return Z_STREAM_ERROR; | 613 | return Z_STREAM_ERROR; |
| 615 | } | 614 | } |
| 615 | |||
| 616 | ss = source->state; | ||
| 617 | |||
| 616 | *dest = *source; | 618 | *dest = *source; |
| 617 | 619 | ||
| 618 | ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); | 620 | ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); |
| @@ -230,12 +230,12 @@ typedef struct internal_state { | |||
| 230 | 230 | ||
| 231 | ulg opt_len; /* bit length of current block with optimal trees */ | 231 | ulg opt_len; /* bit length of current block with optimal trees */ |
| 232 | ulg static_len; /* bit length of current block with static trees */ | 232 | ulg static_len; /* bit length of current block with static trees */ |
| 233 | ulg compressed_len; /* total bit length of compressed file */ | ||
| 234 | uInt matches; /* number of string matches in current block */ | 233 | uInt matches; /* number of string matches in current block */ |
| 235 | int last_eob_len; /* bit length of EOB code for last block */ | 234 | int last_eob_len; /* bit length of EOB code for last block */ |
| 236 | 235 | ||
| 237 | #ifdef DEBUG | 236 | #ifdef DEBUG |
| 238 | ulg bits_sent; /* bit length of the compressed data */ | 237 | ulg compressed_len; /* total bit length of compressed file mod 2^32 */ |
| 238 | ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ | ||
| 239 | #endif | 239 | #endif |
| 240 | 240 | ||
| 241 | ush bi_buf; | 241 | ush bi_buf; |
| @@ -268,7 +268,7 @@ typedef struct internal_state { | |||
| 268 | /* in trees.c */ | 268 | /* in trees.c */ |
| 269 | void _tr_init OF((deflate_state *s)); | 269 | void _tr_init OF((deflate_state *s)); |
| 270 | int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); | 270 | int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); |
| 271 | ulg _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, | 271 | void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, |
| 272 | int eof)); | 272 | int eof)); |
| 273 | void _tr_align OF((deflate_state *s)); | 273 | void _tr_align OF((deflate_state *s)); |
| 274 | void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, | 274 | void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, |
| @@ -15,6 +15,12 @@ | |||
| 15 | extern void exit OF((int)); | 15 | extern void exit OF((int)); |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | #if defined(VMS) || defined(RISCOS) | ||
| 19 | # define TESTFILE "foo-gz" | ||
| 20 | #else | ||
| 21 | # define TESTFILE "foo.gz" | ||
| 22 | #endif | ||
| 23 | |||
| 18 | #define CHECK_ERR(err, msg) { \ | 24 | #define CHECK_ERR(err, msg) { \ |
| 19 | if (err != Z_OK) { \ | 25 | if (err != Z_OK) { \ |
| 20 | fprintf(stderr, "%s error: %d\n", msg, err); \ | 26 | fprintf(stderr, "%s error: %d\n", msg, err); \ |
| @@ -79,8 +85,8 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) | |||
| 79 | * Test read/write of .gz files | 85 | * Test read/write of .gz files |
| 80 | */ | 86 | */ |
| 81 | void test_gzio(out, in, uncompr, uncomprLen) | 87 | void test_gzio(out, in, uncompr, uncomprLen) |
| 82 | const char *out; /* output file */ | 88 | const char *out; /* compressed output file */ |
| 83 | const char *in; /* input file */ | 89 | const char *in; /* compressed input file */ |
| 84 | Byte *uncompr; | 90 | Byte *uncompr; |
| 85 | int uncomprLen; | 91 | int uncomprLen; |
| 86 | { | 92 | { |
| @@ -528,8 +534,8 @@ int main(argc, argv) | |||
| 528 | } | 534 | } |
| 529 | test_compress(compr, comprLen, uncompr, uncomprLen); | 535 | test_compress(compr, comprLen, uncompr, uncomprLen); |
| 530 | 536 | ||
| 531 | test_gzio((argc > 1 ? argv[1] : "foo.gz"), | 537 | test_gzio((argc > 1 ? argv[1] : TESTFILE), |
| 532 | (argc > 2 ? argv[2] : "foo.gz"), | 538 | (argc > 2 ? argv[2] : TESTFILE), |
| 533 | uncompr, (int)uncomprLen); | 539 | uncompr, (int)uncomprLen); |
| 534 | 540 | ||
| 535 | test_deflate(compr, comprLen); | 541 | test_deflate(compr, comprLen); |
| @@ -414,10 +414,14 @@ int ZEXPORT gzread (file, buf, len) | |||
| 414 | s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); | 414 | s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); |
| 415 | start = s->stream.next_out; | 415 | start = s->stream.next_out; |
| 416 | 416 | ||
| 417 | if (getLong(s) != s->crc || getLong(s) != s->stream.total_out) { | 417 | if (getLong(s) != s->crc) { |
| 418 | s->z_err = Z_DATA_ERROR; | 418 | s->z_err = Z_DATA_ERROR; |
| 419 | } else { | 419 | } else { |
| 420 | /* Check for concatenated .gz files: */ | 420 | (void)getLong(s); |
| 421 | /* The uncompressed length returned by above getlong() may | ||
| 422 | * be different from s->stream.total_out) in case of | ||
| 423 | * concatenated .gz files. Check for such files: | ||
| 424 | */ | ||
| 421 | check_header(s); | 425 | check_header(s); |
| 422 | if (s->z_err == Z_OK) { | 426 | if (s->z_err == Z_OK) { |
| 423 | uLong total_in = s->stream.total_in; | 427 | uLong total_in = s->stream.total_in; |
| @@ -670,7 +674,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence) | |||
| 670 | return -1L; | 674 | return -1L; |
| 671 | #else | 675 | #else |
| 672 | if (whence == SEEK_SET) { | 676 | if (whence == SEEK_SET) { |
| 673 | offset -= s->stream.total_out; | 677 | offset -= s->stream.total_in; |
| 674 | } | 678 | } |
| 675 | if (offset < 0) return -1L; | 679 | if (offset < 0) return -1L; |
| 676 | 680 | ||
| @@ -745,6 +749,7 @@ int ZEXPORT gzrewind (file) | |||
| 745 | s->z_eof = 0; | 749 | s->z_eof = 0; |
| 746 | s->stream.avail_in = 0; | 750 | s->stream.avail_in = 0; |
| 747 | s->stream.next_in = s->inbuf; | 751 | s->stream.next_in = s->inbuf; |
| 752 | s->crc = crc32(0L, Z_NULL, 0); | ||
| 748 | 753 | ||
| 749 | if (s->startpos == 0) { /* not a compressed file */ | 754 | if (s->startpos == 0) { /* not a compressed file */ |
| 750 | rewind(s->file); | 755 | rewind(s->file); |
| @@ -793,7 +798,8 @@ local void putLong (file, x) | |||
| 793 | } | 798 | } |
| 794 | 799 | ||
| 795 | /* =========================================================================== | 800 | /* =========================================================================== |
| 796 | Reads a long in LSB order from the given gz_stream. Sets | 801 | Reads a long in LSB order from the given gz_stream. Sets z_err in case |
| 802 | of error. | ||
| 797 | */ | 803 | */ |
| 798 | local uLong getLong (s) | 804 | local uLong getLong (s) |
| 799 | gz_stream *s; | 805 | gz_stream *s; |
| @@ -345,13 +345,6 @@ int r; | |||
| 345 | s->mode = TYPE; | 345 | s->mode = TYPE; |
| 346 | break; | 346 | break; |
| 347 | } | 347 | } |
| 348 | if (k > 7) /* return unused byte, if any */ | ||
| 349 | { | ||
| 350 | Assert(k < 16, "inflate_codes grabbed too many bytes") | ||
| 351 | k -= 8; | ||
| 352 | n++; | ||
| 353 | p--; /* can always return one */ | ||
| 354 | } | ||
| 355 | s->mode = DRY; | 348 | s->mode = DRY; |
| 356 | case DRY: | 349 | case DRY: |
| 357 | FLUSH | 350 | FLUSH |
| @@ -221,6 +221,13 @@ int r; | |||
| 221 | c->mode = START; | 221 | c->mode = START; |
| 222 | break; | 222 | break; |
| 223 | case WASH: /* o: got eob, possibly more output */ | 223 | case WASH: /* o: got eob, possibly more output */ |
| 224 | if (k > 7) /* return unused byte, if any */ | ||
| 225 | { | ||
| 226 | Assert(k < 16, "inflate_codes grabbed too many bytes") | ||
| 227 | k -= 8; | ||
| 228 | n++; | ||
| 229 | p--; /* can always return one */ | ||
| 230 | } | ||
| 224 | FLUSH | 231 | FLUSH |
| 225 | if (s->read != s->write) | 232 | if (s->read != s->write) |
| 226 | LEAVE | 233 | LEAVE |
| @@ -10,116 +10,142 @@ | |||
| 10 | local uInt fixed_bl = 9; | 10 | local uInt fixed_bl = 9; |
| 11 | local uInt fixed_bd = 5; | 11 | local uInt fixed_bd = 5; |
| 12 | local inflate_huft fixed_tl[] = { | 12 | local inflate_huft fixed_tl[] = { |
| 13 | {{96,7},256}, {{0,8},80}, {{0,8},16}, {{84,8},115}, {{82,7},31}, | 13 | {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, |
| 14 | {{0,8},112}, {{0,8},48}, {{0,9},192}, {{80,7},10}, {{0,8},96}, | 14 | {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, |
| 15 | {{0,8},32}, {{0,9},160}, {{0,8},0}, {{0,8},128}, {{0,8},64}, | 15 | {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, |
| 16 | {{0,9},224}, {{80,7},6}, {{0,8},88}, {{0,8},24}, {{0,9},144}, | 16 | {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, |
| 17 | {{83,7},59}, {{0,8},120}, {{0,8},56}, {{0,9},208}, {{81,7},17}, | 17 | {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, |
| 18 | {{0,8},104}, {{0,8},40}, {{0,9},176}, {{0,8},8}, {{0,8},136}, | 18 | {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, |
| 19 | {{0,8},72}, {{0,9},240}, {{80,7},4}, {{0,8},84}, {{0,8},20}, | 19 | {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, |
| 20 | {{85,8},227}, {{83,7},43}, {{0,8},116}, {{0,8},52}, {{0,9},200}, | 20 | {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, |
| 21 | {{81,7},13}, {{0,8},100}, {{0,8},36}, {{0,9},168}, {{0,8},4}, | 21 | {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, |
| 22 | {{0,8},132}, {{0,8},68}, {{0,9},232}, {{80,7},8}, {{0,8},92}, | 22 | {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, |
| 23 | {{0,8},28}, {{0,9},152}, {{84,7},83}, {{0,8},124}, {{0,8},60}, | 23 | {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, |
| 24 | {{0,9},216}, {{82,7},23}, {{0,8},108}, {{0,8},44}, {{0,9},184}, | 24 | {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, |
| 25 | {{0,8},12}, {{0,8},140}, {{0,8},76}, {{0,9},248}, {{80,7},3}, | 25 | {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, |
| 26 | {{0,8},82}, {{0,8},18}, {{85,8},163}, {{83,7},35}, {{0,8},114}, | 26 | {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, |
| 27 | {{0,8},50}, {{0,9},196}, {{81,7},11}, {{0,8},98}, {{0,8},34}, | 27 | {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, |
| 28 | {{0,9},164}, {{0,8},2}, {{0,8},130}, {{0,8},66}, {{0,9},228}, | 28 | {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, |
| 29 | {{80,7},7}, {{0,8},90}, {{0,8},26}, {{0,9},148}, {{84,7},67}, | 29 | {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, |
| 30 | {{0,8},122}, {{0,8},58}, {{0,9},212}, {{82,7},19}, {{0,8},106}, | 30 | {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, |
| 31 | {{0,8},42}, {{0,9},180}, {{0,8},10}, {{0,8},138}, {{0,8},74}, | 31 | {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, |
| 32 | {{0,9},244}, {{80,7},5}, {{0,8},86}, {{0,8},22}, {{192,8},0}, | 32 | {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, |
| 33 | {{83,7},51}, {{0,8},118}, {{0,8},54}, {{0,9},204}, {{81,7},15}, | 33 | {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, |
| 34 | {{0,8},102}, {{0,8},38}, {{0,9},172}, {{0,8},6}, {{0,8},134}, | 34 | {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, |
| 35 | {{0,8},70}, {{0,9},236}, {{80,7},9}, {{0,8},94}, {{0,8},30}, | 35 | {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, |
| 36 | {{0,9},156}, {{84,7},99}, {{0,8},126}, {{0,8},62}, {{0,9},220}, | 36 | {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, |
| 37 | {{82,7},27}, {{0,8},110}, {{0,8},46}, {{0,9},188}, {{0,8},14}, | 37 | {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, |
| 38 | {{0,8},142}, {{0,8},78}, {{0,9},252}, {{96,7},256}, {{0,8},81}, | 38 | {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, |
| 39 | {{0,8},17}, {{85,8},131}, {{82,7},31}, {{0,8},113}, {{0,8},49}, | 39 | {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, |
| 40 | {{0,9},194}, {{80,7},10}, {{0,8},97}, {{0,8},33}, {{0,9},162}, | 40 | {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, |
| 41 | {{0,8},1}, {{0,8},129}, {{0,8},65}, {{0,9},226}, {{80,7},6}, | 41 | {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, |
| 42 | {{0,8},89}, {{0,8},25}, {{0,9},146}, {{83,7},59}, {{0,8},121}, | 42 | {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, |
| 43 | {{0,8},57}, {{0,9},210}, {{81,7},17}, {{0,8},105}, {{0,8},41}, | 43 | {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, |
| 44 | {{0,9},178}, {{0,8},9}, {{0,8},137}, {{0,8},73}, {{0,9},242}, | 44 | {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, |
| 45 | {{80,7},4}, {{0,8},85}, {{0,8},21}, {{80,8},258}, {{83,7},43}, | 45 | {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, |
| 46 | {{0,8},117}, {{0,8},53}, {{0,9},202}, {{81,7},13}, {{0,8},101}, | 46 | {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, |
| 47 | {{0,8},37}, {{0,9},170}, {{0,8},5}, {{0,8},133}, {{0,8},69}, | 47 | {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, |
| 48 | {{0,9},234}, {{80,7},8}, {{0,8},93}, {{0,8},29}, {{0,9},154}, | 48 | {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, |
| 49 | {{84,7},83}, {{0,8},125}, {{0,8},61}, {{0,9},218}, {{82,7},23}, | 49 | {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, |
| 50 | {{0,8},109}, {{0,8},45}, {{0,9},186}, {{0,8},13}, {{0,8},141}, | 50 | {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, |
| 51 | {{0,8},77}, {{0,9},250}, {{80,7},3}, {{0,8},83}, {{0,8},19}, | 51 | {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, |
| 52 | {{85,8},195}, {{83,7},35}, {{0,8},115}, {{0,8},51}, {{0,9},198}, | 52 | {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, |
| 53 | {{81,7},11}, {{0,8},99}, {{0,8},35}, {{0,9},166}, {{0,8},3}, | 53 | {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, |
| 54 | {{0,8},131}, {{0,8},67}, {{0,9},230}, {{80,7},7}, {{0,8},91}, | 54 | {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, |
| 55 | {{0,8},27}, {{0,9},150}, {{84,7},67}, {{0,8},123}, {{0,8},59}, | 55 | {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, |
| 56 | {{0,9},214}, {{82,7},19}, {{0,8},107}, {{0,8},43}, {{0,9},182}, | 56 | {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, |
| 57 | {{0,8},11}, {{0,8},139}, {{0,8},75}, {{0,9},246}, {{80,7},5}, | 57 | {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, |
| 58 | {{0,8},87}, {{0,8},23}, {{192,8},0}, {{83,7},51}, {{0,8},119}, | 58 | {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, |
| 59 | {{0,8},55}, {{0,9},206}, {{81,7},15}, {{0,8},103}, {{0,8},39}, | 59 | {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, |
| 60 | {{0,9},174}, {{0,8},7}, {{0,8},135}, {{0,8},71}, {{0,9},238}, | 60 | {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, |
| 61 | {{80,7},9}, {{0,8},95}, {{0,8},31}, {{0,9},158}, {{84,7},99}, | 61 | {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, |
| 62 | {{0,8},127}, {{0,8},63}, {{0,9},222}, {{82,7},27}, {{0,8},111}, | 62 | {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, |
| 63 | {{0,8},47}, {{0,9},190}, {{0,8},15}, {{0,8},143}, {{0,8},79}, | 63 | {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, |
| 64 | {{0,9},254}, {{96,7},256}, {{0,8},80}, {{0,8},16}, {{84,8},115}, | 64 | {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, |
| 65 | {{82,7},31}, {{0,8},112}, {{0,8},48}, {{0,9},193}, {{80,7},10}, | 65 | {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, |
| 66 | {{0,8},96}, {{0,8},32}, {{0,9},161}, {{0,8},0}, {{0,8},128}, | 66 | {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, |
| 67 | {{0,8},64}, {{0,9},225}, {{80,7},6}, {{0,8},88}, {{0,8},24}, | 67 | {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, |
| 68 | {{0,9},145}, {{83,7},59}, {{0,8},120}, {{0,8},56}, {{0,9},209}, | 68 | {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, |
| 69 | {{81,7},17}, {{0,8},104}, {{0,8},40}, {{0,9},177}, {{0,8},8}, | 69 | {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, |
| 70 | {{0,8},136}, {{0,8},72}, {{0,9},241}, {{80,7},4}, {{0,8},84}, | 70 | {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, |
| 71 | {{0,8},20}, {{85,8},227}, {{83,7},43}, {{0,8},116}, {{0,8},52}, | 71 | {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, |
| 72 | {{0,9},201}, {{81,7},13}, {{0,8},100}, {{0,8},36}, {{0,9},169}, | 72 | {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, |
| 73 | {{0,8},4}, {{0,8},132}, {{0,8},68}, {{0,9},233}, {{80,7},8}, | 73 | {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, |
| 74 | {{0,8},92}, {{0,8},28}, {{0,9},153}, {{84,7},83}, {{0,8},124}, | 74 | {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, |
| 75 | {{0,8},60}, {{0,9},217}, {{82,7},23}, {{0,8},108}, {{0,8},44}, | 75 | {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, |
| 76 | {{0,9},185}, {{0,8},12}, {{0,8},140}, {{0,8},76}, {{0,9},249}, | 76 | {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, |
| 77 | {{80,7},3}, {{0,8},82}, {{0,8},18}, {{85,8},163}, {{83,7},35}, | 77 | {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, |
| 78 | {{0,8},114}, {{0,8},50}, {{0,9},197}, {{81,7},11}, {{0,8},98}, | 78 | {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, |
| 79 | {{0,8},34}, {{0,9},165}, {{0,8},2}, {{0,8},130}, {{0,8},66}, | 79 | {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, |
| 80 | {{0,9},229}, {{80,7},7}, {{0,8},90}, {{0,8},26}, {{0,9},149}, | 80 | {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, |
| 81 | {{84,7},67}, {{0,8},122}, {{0,8},58}, {{0,9},213}, {{82,7},19}, | 81 | {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, |
| 82 | {{0,8},106}, {{0,8},42}, {{0,9},181}, {{0,8},10}, {{0,8},138}, | 82 | {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, |
| 83 | {{0,8},74}, {{0,9},245}, {{80,7},5}, {{0,8},86}, {{0,8},22}, | 83 | {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, |
| 84 | {{192,8},0}, {{83,7},51}, {{0,8},118}, {{0,8},54}, {{0,9},205}, | 84 | {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, |
| 85 | {{81,7},15}, {{0,8},102}, {{0,8},38}, {{0,9},173}, {{0,8},6}, | 85 | {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, |
| 86 | {{0,8},134}, {{0,8},70}, {{0,9},237}, {{80,7},9}, {{0,8},94}, | 86 | {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, |
| 87 | {{0,8},30}, {{0,9},157}, {{84,7},99}, {{0,8},126}, {{0,8},62}, | 87 | {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, |
| 88 | {{0,9},221}, {{82,7},27}, {{0,8},110}, {{0,8},46}, {{0,9},189}, | 88 | {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, |
| 89 | {{0,8},14}, {{0,8},142}, {{0,8},78}, {{0,9},253}, {{96,7},256}, | 89 | {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, |
| 90 | {{0,8},81}, {{0,8},17}, {{85,8},131}, {{82,7},31}, {{0,8},113}, | 90 | {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, |
| 91 | {{0,8},49}, {{0,9},195}, {{80,7},10}, {{0,8},97}, {{0,8},33}, | 91 | {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, |
| 92 | {{0,9},163}, {{0,8},1}, {{0,8},129}, {{0,8},65}, {{0,9},227}, | 92 | {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, |
| 93 | {{80,7},6}, {{0,8},89}, {{0,8},25}, {{0,9},147}, {{83,7},59}, | 93 | {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, |
| 94 | {{0,8},121}, {{0,8},57}, {{0,9},211}, {{81,7},17}, {{0,8},105}, | 94 | {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, |
| 95 | {{0,8},41}, {{0,9},179}, {{0,8},9}, {{0,8},137}, {{0,8},73}, | 95 | {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, |
| 96 | {{0,9},243}, {{80,7},4}, {{0,8},85}, {{0,8},21}, {{80,8},258}, | 96 | {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, |
| 97 | {{83,7},43}, {{0,8},117}, {{0,8},53}, {{0,9},203}, {{81,7},13}, | 97 | {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, |
| 98 | {{0,8},101}, {{0,8},37}, {{0,9},171}, {{0,8},5}, {{0,8},133}, | 98 | {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, |
| 99 | {{0,8},69}, {{0,9},235}, {{80,7},8}, {{0,8},93}, {{0,8},29}, | 99 | {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, |
| 100 | {{0,9},155}, {{84,7},83}, {{0,8},125}, {{0,8},61}, {{0,9},219}, | 100 | {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, |
| 101 | {{82,7},23}, {{0,8},109}, {{0,8},45}, {{0,9},187}, {{0,8},13}, | 101 | {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, |
| 102 | {{0,8},141}, {{0,8},77}, {{0,9},251}, {{80,7},3}, {{0,8},83}, | 102 | {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, |
| 103 | {{0,8},19}, {{85,8},195}, {{83,7},35}, {{0,8},115}, {{0,8},51}, | 103 | {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, |
| 104 | {{0,9},199}, {{81,7},11}, {{0,8},99}, {{0,8},35}, {{0,9},167}, | 104 | {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, |
| 105 | {{0,8},3}, {{0,8},131}, {{0,8},67}, {{0,9},231}, {{80,7},7}, | 105 | {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, |
| 106 | {{0,8},91}, {{0,8},27}, {{0,9},151}, {{84,7},67}, {{0,8},123}, | 106 | {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, |
| 107 | {{0,8},59}, {{0,9},215}, {{82,7},19}, {{0,8},107}, {{0,8},43}, | 107 | {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, |
| 108 | {{0,9},183}, {{0,8},11}, {{0,8},139}, {{0,8},75}, {{0,9},247}, | 108 | {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, |
| 109 | {{80,7},5}, {{0,8},87}, {{0,8},23}, {{192,8},0}, {{83,7},51}, | 109 | {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, |
| 110 | {{0,8},119}, {{0,8},55}, {{0,9},207}, {{81,7},15}, {{0,8},103}, | 110 | {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, |
| 111 | {{0,8},39}, {{0,9},175}, {{0,8},7}, {{0,8},135}, {{0,8},71}, | 111 | {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, |
| 112 | {{0,9},239}, {{80,7},9}, {{0,8},95}, {{0,8},31}, {{0,9},159}, | 112 | {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, |
| 113 | {{84,7},99}, {{0,8},127}, {{0,8},63}, {{0,9},223}, {{82,7},27}, | 113 | {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, |
| 114 | {{0,8},111}, {{0,8},47}, {{0,9},191}, {{0,8},15}, {{0,8},143}, | 114 | {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, |
| 115 | {{0,8},79}, {{0,9},255} | 115 | {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, |
| 116 | {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, | ||
| 117 | {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, | ||
| 118 | {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, | ||
| 119 | {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, | ||
| 120 | {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, | ||
| 121 | {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, | ||
| 122 | {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, | ||
| 123 | {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, | ||
| 124 | {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, | ||
| 125 | {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, | ||
| 126 | {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, | ||
| 127 | {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, | ||
| 128 | {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, | ||
| 129 | {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, | ||
| 130 | {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, | ||
| 131 | {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, | ||
| 132 | {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, | ||
| 133 | {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, | ||
| 134 | {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, | ||
| 135 | {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, | ||
| 136 | {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, | ||
| 137 | {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, | ||
| 138 | {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, | ||
| 139 | {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, | ||
| 140 | {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} | ||
| 116 | }; | 141 | }; |
| 117 | local inflate_huft fixed_td[] = { | 142 | local inflate_huft fixed_td[] = { |
| 118 | {{80,5},1}, {{87,5},257}, {{83,5},17}, {{91,5},4097}, {{81,5},5}, | 143 | {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, |
| 119 | {{89,5},1025}, {{85,5},65}, {{93,5},16385}, {{80,5},3}, {{88,5},513}, | 144 | {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, |
| 120 | {{84,5},33}, {{92,5},8193}, {{82,5},9}, {{90,5},2049}, {{86,5},129}, | 145 | {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, |
| 121 | {{192,5},24577}, {{80,5},2}, {{87,5},385}, {{83,5},25}, {{91,5},6145}, | 146 | {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, |
| 122 | {{81,5},7}, {{89,5},1537}, {{85,5},97}, {{93,5},24577}, {{80,5},4}, | 147 | {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, |
| 123 | {{88,5},769}, {{84,5},49}, {{92,5},12289}, {{82,5},13}, {{90,5},3073}, | 148 | {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, |
| 124 | {{86,5},193}, {{192,5},24577} | 149 | {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, |
| 150 | {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} | ||
| 125 | }; | 151 | }; |
| @@ -11,7 +11,7 @@ | |||
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | const char inflate_copyright[] = | 13 | const char inflate_copyright[] = |
| 14 | " inflate 1.1.2 Copyright 1995-1998 Mark Adler "; | 14 | " inflate 1.1.3 Copyright 1995-1998 Mark Adler "; |
| 15 | /* | 15 | /* |
| 16 | If you use the zlib library in a product, an acknowledgment is welcome | 16 | If you use the zlib library in a product, an acknowledgment is welcome |
| 17 | in the documentation of your product. If for some reason you cannot | 17 | in the documentation of your product. If for some reason you cannot |
| @@ -24,36 +24,6 @@ | |||
| 24 | #define exop word.what.Exop | 24 | #define exop word.what.Exop |
| 25 | #define bits word.what.Bits | 25 | #define bits word.what.Bits |
| 26 | 26 | ||
| 27 | /* showtree is only used for debugging purposes */ | ||
| 28 | void showtree(uInt b, inflate_huft *t, int d) | ||
| 29 | { | ||
| 30 | int i, e; | ||
| 31 | char p[2*d+1]; | ||
| 32 | |||
| 33 | for (i = 0; i < 2*d; i++) | ||
| 34 | p[i] = ' '; | ||
| 35 | p[i] = 0; | ||
| 36 | printf("%s[%d]\n", p, 1<<b); | ||
| 37 | for (i = 0; i < (1<<b); i++) | ||
| 38 | { | ||
| 39 | e = t[i].exop; | ||
| 40 | if (e == 0) /* simple code */ | ||
| 41 | printf("%s%d(%d): literal=%d\n", p, i, t[i].bits, t[i].base); | ||
| 42 | else if (e & 16) /* length */ | ||
| 43 | printf("%s%d(%d): length/distance=%d+(%d)\n", | ||
| 44 | p, i, t[i].bits, t[i].base, e & 15); | ||
| 45 | else if ((e & 64) == 0) /* next table */ | ||
| 46 | { | ||
| 47 | printf("%s%d(%d): *sub table*\n", p, i, t[i].bits); | ||
| 48 | showtree(e, t + t[i].base, d + 1); | ||
| 49 | } | ||
| 50 | else if (e & 32) /* end of block */ | ||
| 51 | printf("%s%d(%d): end of block\n", p, i, t[i].bits); | ||
| 52 | else /* bad code */ | ||
| 53 | printf("%s%d: bad code\n", p, i); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | /* generate initialization table for an inflate_huft structure array */ | 27 | /* generate initialization table for an inflate_huft structure array */ |
| 58 | void maketree(uInt b, inflate_huft *t) | 28 | void maketree(uInt b, inflate_huft *t) |
| 59 | { | 29 | { |
| @@ -68,9 +38,9 @@ void maketree(uInt b, inflate_huft *t) | |||
| 68 | fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); | 38 | fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); |
| 69 | exit(1); | 39 | exit(1); |
| 70 | } | 40 | } |
| 71 | if (i % 5 == 0) | 41 | if (i % 4 == 0) |
| 72 | printf("\n "); | 42 | printf("\n "); |
| 73 | printf(" {{%u,%u},%u}", t[i].exop, t[i].bits, t[i].base); | 43 | printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base); |
| 74 | if (++i == (1<<b)) | 44 | if (++i == (1<<b)) |
| 75 | break; | 45 | break; |
| 76 | putchar(','); | 46 | putchar(','); |
| @@ -95,10 +65,6 @@ void main(void) | |||
| 95 | fprintf(stderr, "inflate_trees_fixed error %d\n", r); | 65 | fprintf(stderr, "inflate_trees_fixed error %d\n", r); |
| 96 | return; | 66 | return; |
| 97 | } | 67 | } |
| 98 | /* puts("Literal/Length Tree:"); | ||
| 99 | showtree(bl, tl, 1); | ||
| 100 | puts("Distance Tree:"); | ||
| 101 | showtree(bd, td, 1); */ | ||
| 102 | puts("/* inffixed.h -- table for decoding fixed codes"); | 68 | puts("/* inffixed.h -- table for decoding fixed codes"); |
| 103 | puts(" * Generated automatically by the maketree.c program"); | 69 | puts(" * Generated automatically by the maketree.c program"); |
| 104 | puts(" */"); | 70 | puts(" */"); |
| @@ -48,6 +48,9 @@ | |||
| 48 | # define GZ_SUFFIX "-gz" | 48 | # define GZ_SUFFIX "-gz" |
| 49 | # define fileno(file) file->__file | 49 | # define fileno(file) file->__file |
| 50 | #endif | 50 | #endif |
| 51 | #if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os | ||
| 52 | # include <unix.h> /* for fileno */ | ||
| 53 | #endif | ||
| 51 | 54 | ||
| 52 | #ifndef WIN32 /* unlink already in stdio.h for WIN32 */ | 55 | #ifndef WIN32 /* unlink already in stdio.h for WIN32 */ |
| 53 | extern int unlink OF((const char *)); | 56 | extern int unlink OF((const char *)); |
diff --git a/msdos/Makefile.b32 b/msdos/Makefile.b32 index fc3ac68..f476da9 100644 --- a/msdos/Makefile.b32 +++ b/msdos/Makefile.b32 | |||
| @@ -33,13 +33,13 @@ OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | |||
| 33 | 33 | ||
| 34 | all: test | 34 | all: test |
| 35 | 35 | ||
| 36 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 36 | adler32.obj: adler32.c zlib.h zconf.h |
| 37 | $(CC) -c $(CFLAGS) $*.c | 37 | $(CC) -c $(CFLAGS) $*.c |
| 38 | 38 | ||
| 39 | compress.obj: compress.c zlib.h zconf.h | 39 | compress.obj: compress.c zlib.h zconf.h |
| 40 | $(CC) -c $(CFLAGS) $*.c | 40 | $(CC) -c $(CFLAGS) $*.c |
| 41 | 41 | ||
| 42 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 42 | crc32.obj: crc32.c zlib.h zconf.h |
| 43 | $(CC) -c $(CFLAGS) $*.c | 43 | $(CC) -c $(CFLAGS) $*.c |
| 44 | 44 | ||
| 45 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 45 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h |
diff --git a/msdos/Makefile.bor b/msdos/Makefile.bor index 2116563..f5651b4 100644 --- a/msdos/Makefile.bor +++ b/msdos/Makefile.bor | |||
| @@ -2,24 +2,40 @@ | |||
| 2 | # Borland C++ ************ UNTESTED *********** | 2 | # Borland C++ ************ UNTESTED *********** |
| 3 | 3 | ||
| 4 | # To use, do "make -fmakefile.bor" | 4 | # To use, do "make -fmakefile.bor" |
| 5 | # To compile in small model, set below: MODEL=-ms | 5 | # To compile in small model, set below: MODEL=s |
| 6 | 6 | ||
| 7 | # WARNING: the small model is supported but only for small values of | 7 | # WARNING: the small model is supported but only for small values of |
| 8 | # MAX_WBITS and MAX_MEM_LEVEL. For example: | 8 | # MAX_WBITS and MAX_MEM_LEVEL. For example: |
| 9 | # -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 | 9 | # -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 |
| 10 | # If you wish to reduce the memory requirements (default 256K for big | 10 | # If you wish to reduce the memory requirements (default 256K for big |
| 11 | # objects plus a few K), you can add to CFLAGS below: | 11 | # objects plus a few K), you can add to the LOC macro below: |
| 12 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | 12 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 |
| 13 | # See zconf.h for details about the memory requirements. | 13 | # See zconf.h for details about the memory requirements. |
| 14 | 14 | ||
| 15 | # ------------- Turbo C++, Borland C++ ------------- | 15 | # ------------- Turbo C++, Borland C++ ------------- |
| 16 | MODEL=-ml | 16 | |
| 17 | CFLAGS=-O2 -Z $(MODEL) | 17 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) |
| 18 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added | ||
| 19 | # to the declaration of LOC here: | ||
| 20 | LOC = $(LOCAL_ZLIB) | ||
| 21 | |||
| 22 | # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. | ||
| 23 | CPU_TYP = 0 | ||
| 24 | |||
| 25 | # Memory model: one of s, m, c, l (small, medium, compact, large) | ||
| 26 | MODEL=l | ||
| 27 | |||
| 18 | CC=bcc | 28 | CC=bcc |
| 19 | LD=bcc | ||
| 20 | LIB=tlib | ||
| 21 | # replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version | 29 | # replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version |
| 22 | LDFLAGS=$(MODEL) | 30 | LD=$(CC) |
| 31 | AR=tlib | ||
| 32 | |||
| 33 | # compiler flags | ||
| 34 | CFLAGS=-O2 -Z -m$(MODEL) $(LOC) | ||
| 35 | # replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 | ||
| 36 | |||
| 37 | LDFLAGS=-m$(MODEL) | ||
| 38 | |||
| 23 | O=.obj | 39 | O=.obj |
| 24 | 40 | ||
| 25 | # variables | 41 | # variables |
| @@ -32,69 +48,73 @@ OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \ | |||
| 32 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | 48 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ |
| 33 | infutil$(O)+inffast$(O) | 49 | infutil$(O)+inffast$(O) |
| 34 | 50 | ||
| 51 | ZLIB_H = zlib.h zconf.h | ||
| 52 | ZUTIL_H = zutil.h $(ZLIB_H) | ||
| 53 | |||
| 54 | ZLIB_LIB = zlib_$(MODEL).lib | ||
| 55 | |||
| 35 | all: test | 56 | all: test |
| 36 | 57 | ||
| 37 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 58 | # individual dependencies and action rules: |
| 59 | adler32.obj: adler32.c $(ZLIB_H) | ||
| 38 | $(CC) -c $(CFLAGS) $*.c | 60 | $(CC) -c $(CFLAGS) $*.c |
| 39 | 61 | ||
| 40 | compress.obj: compress.c zlib.h zconf.h | 62 | compress.obj: compress.c $(ZLIB_H) |
| 41 | $(CC) -c $(CFLAGS) $*.c | 63 | $(CC) -c $(CFLAGS) $*.c |
| 42 | 64 | ||
| 43 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 65 | crc32.obj: crc32.c $(ZLIB_H) |
| 44 | $(CC) -c $(CFLAGS) $*.c | 66 | $(CC) -c $(CFLAGS) $*.c |
| 45 | 67 | ||
| 46 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 68 | deflate.obj: deflate.c deflate.h $(ZUTIL_H) |
| 47 | $(CC) -c $(CFLAGS) $*.c | 69 | $(CC) -c $(CFLAGS) $*.c |
| 48 | 70 | ||
| 49 | gzio.obj: gzio.c zutil.h zlib.h zconf.h | 71 | gzio.obj: gzio.c $(ZUTIL_H) |
| 50 | $(CC) -c $(CFLAGS) $*.c | 72 | $(CC) -c $(CFLAGS) $*.c |
| 51 | 73 | ||
| 52 | infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\ | 74 | infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h |
| 53 | infcodes.h infutil.h | ||
| 54 | $(CC) -c $(CFLAGS) $*.c | 75 | $(CC) -c $(CFLAGS) $*.c |
| 55 | 76 | ||
| 56 | infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\ | 77 | infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h |
| 57 | infcodes.h inffast.h | ||
| 58 | $(CC) -c $(CFLAGS) $*.c | 78 | $(CC) -c $(CFLAGS) $*.c |
| 59 | 79 | ||
| 60 | inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h | 80 | inflate.obj: inflate.c $(ZUTIL_H) infblock.h |
| 61 | $(CC) -c $(CFLAGS) $*.c | 81 | $(CC) -c $(CFLAGS) $*.c |
| 62 | 82 | ||
| 63 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | 83 | inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h |
| 64 | $(CC) -c $(CFLAGS) $*.c | 84 | $(CC) -c $(CFLAGS) $*.c |
| 65 | 85 | ||
| 66 | infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h | 86 | infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h |
| 67 | $(CC) -c $(CFLAGS) $*.c | 87 | $(CC) -c $(CFLAGS) $*.c |
| 68 | 88 | ||
| 69 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h | 89 | inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h |
| 70 | $(CC) -c $(CFLAGS) $*.c | 90 | $(CC) -c $(CFLAGS) $*.c |
| 71 | 91 | ||
| 72 | trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h | 92 | trees.obj: trees.c deflate.h $(ZUTIL_H) |
| 73 | $(CC) -c $(CFLAGS) $*.c | 93 | $(CC) -c $(CFLAGS) $*.c |
| 74 | 94 | ||
| 75 | uncompr.obj: uncompr.c zlib.h zconf.h | 95 | uncompr.obj: uncompr.c $(ZLIB_H) |
| 76 | $(CC) -c $(CFLAGS) $*.c | 96 | $(CC) -c $(CFLAGS) $*.c |
| 77 | 97 | ||
| 78 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | 98 | zutil.obj: zutil.c $(ZUTIL_H) |
| 79 | $(CC) -c $(CFLAGS) $*.c | 99 | $(CC) -c $(CFLAGS) $*.c |
| 80 | 100 | ||
| 81 | example.obj: example.c zlib.h zconf.h | 101 | example.obj: example.c $(ZLIB_H) |
| 82 | $(CC) -c $(CFLAGS) $*.c | 102 | $(CC) -c $(CFLAGS) $*.c |
| 83 | 103 | ||
| 84 | minigzip.obj: minigzip.c zlib.h zconf.h | 104 | minigzip.obj: minigzip.c $(ZLIB_H) |
| 85 | $(CC) -c $(CFLAGS) $*.c | 105 | $(CC) -c $(CFLAGS) $*.c |
| 86 | 106 | ||
| 87 | # we must cut the command line to fit in the MS/DOS 128 byte limit: | 107 | # we must cut the command line to fit in the MS/DOS 128 byte limit: |
| 88 | zlib.lib: $(OBJ1) $(OBJ2) | 108 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) |
| 89 | del zlib.lib | 109 | del $(ZLIB_LIB) |
| 90 | $(LIB) zlib +$(OBJP1) | 110 | $(AR) $(ZLIB_LIB) +$(OBJP1) |
| 91 | $(LIB) zlib +$(OBJP2) | 111 | $(AR) $(ZLIB_LIB) +$(OBJP2) |
| 92 | 112 | ||
| 93 | example.exe: example.obj zlib.lib | 113 | example.exe: example.obj $(ZLIB_LIB) |
| 94 | $(LD) $(LDFLAGS) example.obj zlib.lib | 114 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) |
| 95 | 115 | ||
| 96 | minigzip.exe: minigzip.obj zlib.lib | 116 | minigzip.exe: minigzip.obj $(ZLIB_LIB) |
| 97 | $(LD) $(LDFLAGS) minigzip.obj zlib.lib | 117 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) |
| 98 | 118 | ||
| 99 | test: example.exe minigzip.exe | 119 | test: example.exe minigzip.exe |
| 100 | example | 120 | example |
diff --git a/msdos/Makefile.emx b/msdos/Makefile.emx new file mode 100644 index 0000000..0e5e5cc --- /dev/null +++ b/msdos/Makefile.emx | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98. | ||
| 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. | ||
| 3 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 4 | |||
| 5 | # To compile, or to compile and test, type: | ||
| 6 | # | ||
| 7 | # make -fmakefile.emx; make test -fmakefile.emx | ||
| 8 | # | ||
| 9 | |||
| 10 | CC=gcc | ||
| 11 | |||
| 12 | #CFLAGS=-MMD -O | ||
| 13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 14 | #CFLAGS=-MMD -g -DDEBUG | ||
| 15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 16 | -Wstrict-prototypes -Wmissing-prototypes | ||
| 17 | |||
| 18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . | ||
| 19 | CP=copy /Y | ||
| 20 | # If gnu install.exe is available, replace $(CP) with ginstall. | ||
| 21 | INSTALL=$(CP) | ||
| 22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: | ||
| 23 | RM=del | ||
| 24 | LDLIBS=-L. -lzlib | ||
| 25 | LD=$(CC) -s -o | ||
| 26 | LDSHARED=$(CC) | ||
| 27 | |||
| 28 | INCL=zlib.h zconf.h | ||
| 29 | LIBS=zlib.a | ||
| 30 | |||
| 31 | AR=ar rcs | ||
| 32 | |||
| 33 | prefix=/usr/local | ||
| 34 | exec_prefix = $(prefix) | ||
| 35 | |||
| 36 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 37 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | ||
| 38 | |||
| 39 | TEST_OBJS = example.o minigzip.o | ||
| 40 | |||
| 41 | all: example.exe minigzip.exe | ||
| 42 | |||
| 43 | test: all | ||
| 44 | ./example | ||
| 45 | echo hello world | .\minigzip | .\minigzip -d | ||
| 46 | |||
| 47 | %.o : %.c | ||
| 48 | $(CC) $(CFLAGS) -c $< -o $@ | ||
| 49 | |||
| 50 | zlib.a: $(OBJS) | ||
| 51 | $(AR) $@ $(OBJS) | ||
| 52 | |||
| 53 | %.exe : %.o $(LIBS) | ||
| 54 | $(LD) $@ $< $(LDLIBS) | ||
| 55 | |||
| 56 | |||
| 57 | .PHONY : clean | ||
| 58 | |||
| 59 | clean: | ||
| 60 | $(RM) *.d | ||
| 61 | $(RM) *.o | ||
| 62 | $(RM) *.exe | ||
| 63 | $(RM) zlib.a | ||
| 64 | $(RM) foo.gz | ||
| 65 | |||
| 66 | DEPS := $(wildcard *.d) | ||
| 67 | ifneq ($(DEPS),) | ||
| 68 | include $(DEPS) | ||
| 69 | endif | ||
diff --git a/msdos/Makefile.msc b/msdos/Makefile.msc index 1a6d663..562201d 100644 --- a/msdos/Makefile.msc +++ b/msdos/Makefile.msc | |||
| @@ -2,20 +2,36 @@ | |||
| 2 | # Microsoft C 5.1 or later | 2 | # Microsoft C 5.1 or later |
| 3 | 3 | ||
| 4 | # To use, do "make makefile.msc" | 4 | # To use, do "make makefile.msc" |
| 5 | # To compile in small model, set below: MODEL=-AS | 5 | # To compile in small model, set below: MODEL=S |
| 6 | 6 | ||
| 7 | # If you wish to reduce the memory requirements (default 256K for big | 7 | # If you wish to reduce the memory requirements (default 256K for big |
| 8 | # objects plus a few K), you can add to CFLAGS below: | 8 | # objects plus a few K), you can add to the LOC macro below: |
| 9 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | 9 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 |
| 10 | # See zconf.h for details about the memory requirements. | 10 | # See zconf.h for details about the memory requirements. |
| 11 | 11 | ||
| 12 | # ------------- Microsoft C 5.1 and later ------------- | 12 | # ------------- Microsoft C 5.1 and later ------------- |
| 13 | MODEL=-AL | 13 | |
| 14 | CFLAGS=-Oait -Gs -nologo -W3 $(MODEL) | 14 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) |
| 15 | #-Ox generates bad code with MSC 5.1 | 15 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added |
| 16 | # to the declaration of LOC here: | ||
| 17 | LOC = $(LOCAL_ZLIB) | ||
| 18 | |||
| 19 | # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. | ||
| 20 | CPU_TYP = 0 | ||
| 21 | |||
| 22 | # Memory model: one of S, M, C, L (small, medium, compact, large) | ||
| 23 | MODEL=L | ||
| 24 | |||
| 16 | CC=cl | 25 | CC=cl |
| 26 | CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) | ||
| 27 | #-Ox generates bad code with MSC 5.1 | ||
| 28 | LIB_CFLAGS=-Zl $(CFLAGS) | ||
| 29 | |||
| 17 | LD=link | 30 | LD=link |
| 18 | LDFLAGS=/e/st:0x1500/noe | 31 | LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode |
| 32 | # "/farcall/packcode" are only useful for `large code' memory models | ||
| 33 | # but should be a "no-op" for small code models. | ||
| 34 | |||
| 19 | O=.obj | 35 | O=.obj |
| 20 | 36 | ||
| 21 | # variables | 37 | # variables |
| @@ -28,69 +44,73 @@ OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \ | |||
| 28 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | 44 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ |
| 29 | infutil$(O)+inffast$(O) | 45 | infutil$(O)+inffast$(O) |
| 30 | 46 | ||
| 31 | all: zlib.lib example.exe minigzip.exe | 47 | ZLIB_H = zlib.h zconf.h |
| 48 | ZUTIL_H = zutil.h $(ZLIB_H) | ||
| 32 | 49 | ||
| 33 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 50 | ZLIB_LIB = zlib_$(MODEL).lib |
| 34 | $(CC) -c $(CFLAGS) $*.c | ||
| 35 | 51 | ||
| 36 | compress.obj: compress.c zlib.h zconf.h | 52 | all: $(ZLIB_LIB) example.exe minigzip.exe |
| 37 | $(CC) -c $(CFLAGS) $*.c | ||
| 38 | 53 | ||
| 39 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 54 | # individual dependencies and action rules: |
| 40 | $(CC) -c $(CFLAGS) $*.c | 55 | adler32.obj: adler32.c $(ZLIB_H) |
| 56 | $(CC) -c $(LIB_CFLAGS) $*.c | ||
| 41 | 57 | ||
| 42 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 58 | compress.obj: compress.c $(ZLIB_H) |
| 43 | $(CC) -c $(CFLAGS) $*.c | 59 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 44 | 60 | ||
| 45 | gzio.obj: gzio.c zutil.h zlib.h zconf.h | 61 | crc32.obj: crc32.c $(ZLIB_H) |
| 46 | $(CC) -c $(CFLAGS) $*.c | 62 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 47 | 63 | ||
| 48 | infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\ | 64 | deflate.obj: deflate.c deflate.h $(ZUTIL_H) |
| 49 | infcodes.h infutil.h | 65 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 50 | $(CC) -c $(CFLAGS) $*.c | ||
| 51 | 66 | ||
| 52 | infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\ | 67 | gzio.obj: gzio.c $(ZUTIL_H) |
| 53 | infcodes.h inffast.h | 68 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 54 | $(CC) -c $(CFLAGS) $*.c | ||
| 55 | 69 | ||
| 56 | inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h | 70 | infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h |
| 57 | $(CC) -c $(CFLAGS) $*.c | 71 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 58 | 72 | ||
| 59 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | 73 | infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h |
| 60 | $(CC) -c $(CFLAGS) $*.c | 74 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 61 | 75 | ||
| 62 | infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h | 76 | inflate.obj: inflate.c $(ZUTIL_H) infblock.h |
| 63 | $(CC) -c $(CFLAGS) $*.c | 77 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 64 | 78 | ||
| 65 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h | 79 | inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h |
| 66 | $(CC) -c $(CFLAGS) $*.c | 80 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 67 | 81 | ||
| 68 | trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h | 82 | infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h |
| 69 | $(CC) -c $(CFLAGS) $*.c | 83 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 70 | 84 | ||
| 71 | uncompr.obj: uncompr.c zlib.h zconf.h | 85 | inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h |
| 72 | $(CC) -c $(CFLAGS) $*.c | 86 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 73 | 87 | ||
| 74 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | 88 | trees.obj: trees.c deflate.h $(ZUTIL_H) |
| 75 | $(CC) -c $(CFLAGS) $*.c | 89 | $(CC) -c $(LIB_CFLAGS) $*.c |
| 90 | |||
| 91 | uncompr.obj: uncompr.c $(ZLIB_H) | ||
| 92 | $(CC) -c $(LIB_CFLAGS) $*.c | ||
| 93 | |||
| 94 | zutil.obj: zutil.c $(ZUTIL_H) | ||
| 95 | $(CC) -c $(LIB_CFLAGS) $*.c | ||
| 76 | 96 | ||
| 77 | example.obj: example.c zlib.h zconf.h | 97 | example.obj: example.c $(ZLIB_H) |
| 78 | $(CC) -c $(CFLAGS) $*.c | 98 | $(CC) -c $(CFLAGS) $*.c |
| 79 | 99 | ||
| 80 | minigzip.obj: minigzip.c zlib.h zconf.h | 100 | minigzip.obj: minigzip.c $(ZLIB_H) |
| 81 | $(CC) -c $(CFLAGS) $*.c | 101 | $(CC) -c $(CFLAGS) $*.c |
| 82 | 102 | ||
| 83 | # we must cut the command line to fit in the MS/DOS 128 byte limit: | 103 | # we must cut the command line to fit in the MS/DOS 128 byte limit: |
| 84 | zlib.lib: $(OBJ1) $(OBJ2) | 104 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) |
| 85 | if exist zlib.lib del zlib.lib | 105 | if exist $(ZLIB_LIB) del $(ZLIB_LIB) |
| 86 | lib zlib $(OBJ1); | 106 | lib $(ZLIB_LIB) $(OBJ1); |
| 87 | lib zlib $(OBJ2); | 107 | lib $(ZLIB_LIB) $(OBJ2); |
| 88 | 108 | ||
| 89 | example.exe: example.obj zlib.lib | 109 | example.exe: example.obj $(ZLIB_LIB) |
| 90 | $(LD) $(LDFLAGS) example.obj,,,zlib.lib; | 110 | $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); |
| 91 | 111 | ||
| 92 | minigzip.exe: minigzip.obj zlib.lib | 112 | minigzip.exe: minigzip.obj $(ZLIB_LIB) |
| 93 | $(LD) $(LDFLAGS) minigzip.obj,,,zlib.lib; | 113 | $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); |
| 94 | 114 | ||
| 95 | test: example.exe minigzip.exe | 115 | test: example.exe minigzip.exe |
| 96 | example | 116 | example |
diff --git a/msdos/Makefile.tc b/msdos/Makefile.tc index a46ce73..63e0550 100644 --- a/msdos/Makefile.tc +++ b/msdos/Makefile.tc | |||
| @@ -8,18 +8,18 @@ | |||
| 8 | # MAX_WBITS and MAX_MEM_LEVEL. For example: | 8 | # MAX_WBITS and MAX_MEM_LEVEL. For example: |
| 9 | # -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | 9 | # -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 |
| 10 | # If you wish to reduce the memory requirements (default 256K for big | 10 | # If you wish to reduce the memory requirements (default 256K for big |
| 11 | # objects plus a few K), you can add to CFLAGS below: | 11 | # objects plus a few K), you can add to CFLAGS below: |
| 12 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | 12 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 |
| 13 | # See zconf.h for details about the memory requirements. | 13 | # See zconf.h for details about the memory requirements. |
| 14 | 14 | ||
| 15 | # ------------- Turbo C 2.0 ------------- | 15 | # ------------- Turbo C 2.0 ------------- |
| 16 | MODEL=-ml | 16 | MODEL=l |
| 17 | # CFLAGS=-O2 -G -Z $(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | 17 | # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 |
| 18 | CFLAGS=-O2 -G -Z $(MODEL) | 18 | CFLAGS=-O2 -G -Z -m$(MODEL) |
| 19 | CC=tcc -I\tc\include | 19 | CC=tcc -I\tc\include |
| 20 | LD=tcc -L\tc\lib | 20 | LD=tcc -L\tc\lib |
| 21 | LIB=tlib | 21 | AR=tlib |
| 22 | LDFLAGS=$(MODEL) -f- | 22 | LDFLAGS=-m$(MODEL) -f- |
| 23 | O=.obj | 23 | O=.obj |
| 24 | 24 | ||
| 25 | # variables | 25 | # variables |
| @@ -32,69 +32,72 @@ OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \ | |||
| 32 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | 32 | OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ |
| 33 | infutil$(O)+inffast$(O) | 33 | infutil$(O)+inffast$(O) |
| 34 | 34 | ||
| 35 | ZLIB_H = zlib.h zconf.h | ||
| 36 | ZUTIL_H = zutil.h $(ZLIB_H) | ||
| 37 | |||
| 38 | ZLIB_LIB = zlib_$(MODEL).lib | ||
| 39 | |||
| 35 | all: test | 40 | all: test |
| 36 | 41 | ||
| 37 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 42 | adler32.obj: adler32.c $(ZLIB_H) |
| 38 | $(CC) -c $(CFLAGS) $*.c | 43 | $(CC) -c $(CFLAGS) $*.c |
| 39 | 44 | ||
| 40 | compress.obj: compress.c zlib.h zconf.h | 45 | compress.obj: compress.c $(ZLIB_H) |
| 41 | $(CC) -c $(CFLAGS) $*.c | 46 | $(CC) -c $(CFLAGS) $*.c |
| 42 | 47 | ||
| 43 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 48 | crc32.obj: crc32.c $(ZLIB_H) |
| 44 | $(CC) -c $(CFLAGS) $*.c | 49 | $(CC) -c $(CFLAGS) $*.c |
| 45 | 50 | ||
| 46 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 51 | deflate.obj: deflate.c deflate.h $(ZUTIL_H) |
| 47 | $(CC) -c $(CFLAGS) $*.c | 52 | $(CC) -c $(CFLAGS) $*.c |
| 48 | 53 | ||
| 49 | gzio.obj: gzio.c zutil.h zlib.h zconf.h | 54 | gzio.obj: gzio.c $(ZUTIL_H) |
| 50 | $(CC) -c $(CFLAGS) $*.c | 55 | $(CC) -c $(CFLAGS) $*.c |
| 51 | 56 | ||
| 52 | infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\ | 57 | infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h |
| 53 | infcodes.h infutil.h | ||
| 54 | $(CC) -c $(CFLAGS) $*.c | 58 | $(CC) -c $(CFLAGS) $*.c |
| 55 | 59 | ||
| 56 | infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\ | 60 | infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h |
| 57 | infcodes.h inffast.h | ||
| 58 | $(CC) -c $(CFLAGS) $*.c | 61 | $(CC) -c $(CFLAGS) $*.c |
| 59 | 62 | ||
| 60 | inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h | 63 | inflate.obj: inflate.c $(ZUTIL_H) infblock.h |
| 61 | $(CC) -c $(CFLAGS) $*.c | 64 | $(CC) -c $(CFLAGS) $*.c |
| 62 | 65 | ||
| 63 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | 66 | inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h |
| 64 | $(CC) -c $(CFLAGS) $*.c | 67 | $(CC) -c $(CFLAGS) $*.c |
| 65 | 68 | ||
| 66 | infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h | 69 | infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h |
| 67 | $(CC) -c $(CFLAGS) $*.c | 70 | $(CC) -c $(CFLAGS) $*.c |
| 68 | 71 | ||
| 69 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h | 72 | inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h |
| 70 | $(CC) -c $(CFLAGS) $*.c | 73 | $(CC) -c $(CFLAGS) $*.c |
| 71 | 74 | ||
| 72 | trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h | 75 | trees.obj: trees.c deflate.h $(ZUTIL_H) |
| 73 | $(CC) -c $(CFLAGS) $*.c | 76 | $(CC) -c $(CFLAGS) $*.c |
| 74 | 77 | ||
| 75 | uncompr.obj: uncompr.c zlib.h zconf.h | 78 | uncompr.obj: uncompr.c $(ZLIB_H) |
| 76 | $(CC) -c $(CFLAGS) $*.c | 79 | $(CC) -c $(CFLAGS) $*.c |
| 77 | 80 | ||
| 78 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | 81 | zutil.obj: zutil.c $(ZUTIL_H) |
| 79 | $(CC) -c $(CFLAGS) $*.c | 82 | $(CC) -c $(CFLAGS) $*.c |
| 80 | 83 | ||
| 81 | example.obj: example.c zlib.h zconf.h | 84 | example.obj: example.c $(ZLIB_H) |
| 82 | $(CC) -c $(CFLAGS) $*.c | 85 | $(CC) -c $(CFLAGS) $*.c |
| 83 | 86 | ||
| 84 | minigzip.obj: minigzip.c zlib.h zconf.h | 87 | minigzip.obj: minigzip.c $(ZLIB_H) |
| 85 | $(CC) -c $(CFLAGS) $*.c | 88 | $(CC) -c $(CFLAGS) $*.c |
| 86 | 89 | ||
| 87 | # we must cut the command line to fit in the MS/DOS 128 byte limit: | 90 | # we must cut the command line to fit in the MS/DOS 128 byte limit: |
| 88 | zlib.lib: $(OBJ1) $(OBJ2) | 91 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) |
| 89 | del zlib.lib | 92 | del $(ZLIB_LIB) |
| 90 | $(LIB) zlib +$(OBJP1) | 93 | $(AR) $(ZLIB_LIB) +$(OBJP1) |
| 91 | $(LIB) zlib +$(OBJP2) | 94 | $(AR) $(ZLIB_LIB) +$(OBJP2) |
| 92 | 95 | ||
| 93 | example.exe: example.obj zlib.lib | 96 | example.exe: example.obj $(ZLIB_LIB) |
| 94 | $(LD) $(LDFLAGS) -eexample.exe example.obj zlib.lib | 97 | $(LD) $(LDFLAGS) -eexample.exe example.obj $(ZLIB_LIB) |
| 95 | 98 | ||
| 96 | minigzip.exe: minigzip.obj zlib.lib | 99 | minigzip.exe: minigzip.obj $(ZLIB_LIB) |
| 97 | $(LD) $(LDFLAGS) -eminigzip.exe minigzip.obj zlib.lib | 100 | $(LD) $(LDFLAGS) -eminigzip.exe minigzip.obj $(ZLIB_LIB) |
| 98 | 101 | ||
| 99 | test: example.exe minigzip.exe | 102 | test: example.exe minigzip.exe |
| 100 | example | 103 | example |
diff --git a/msdos/Makefile.w32 b/msdos/Makefile.w32 index d513c81..0a05fa9 100644 --- a/msdos/Makefile.w32 +++ b/msdos/Makefile.w32 | |||
| @@ -28,13 +28,13 @@ OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | |||
| 28 | 28 | ||
| 29 | all: zlib.lib example.exe minigzip.exe | 29 | all: zlib.lib example.exe minigzip.exe |
| 30 | 30 | ||
| 31 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 31 | adler32.obj: adler32.c zlib.h zconf.h |
| 32 | $(CC) -c $(CFLAGS) $*.c | 32 | $(CC) -c $(CFLAGS) $*.c |
| 33 | 33 | ||
| 34 | compress.obj: compress.c zlib.h zconf.h | 34 | compress.obj: compress.c zlib.h zconf.h |
| 35 | $(CC) -c $(CFLAGS) $*.c | 35 | $(CC) -c $(CFLAGS) $*.c |
| 36 | 36 | ||
| 37 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 37 | crc32.obj: crc32.c zlib.h zconf.h |
| 38 | $(CC) -c $(CFLAGS) $*.c | 38 | $(CC) -c $(CFLAGS) $*.c |
| 39 | 39 | ||
| 40 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 40 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h |
diff --git a/msdos/Makefile.wat b/msdos/Makefile.wat index 2a3b629..44bf860 100644 --- a/msdos/Makefile.wat +++ b/msdos/Makefile.wat | |||
| @@ -30,13 +30,13 @@ OBJP3=infutil$(O)+inffast$(O) | |||
| 30 | 30 | ||
| 31 | all: test | 31 | all: test |
| 32 | 32 | ||
| 33 | adler32.obj: adler32.c zutil.h zlib.h zconf.h | 33 | adler32.obj: adler32.c zlib.h zconf.h |
| 34 | $(CC) $(CFLAGS) $*.c | 34 | $(CC) $(CFLAGS) $*.c |
| 35 | 35 | ||
| 36 | compress.obj: compress.c zlib.h zconf.h | 36 | compress.obj: compress.c zlib.h zconf.h |
| 37 | $(CC) $(CFLAGS) $*.c | 37 | $(CC) $(CFLAGS) $*.c |
| 38 | 38 | ||
| 39 | crc32.obj: crc32.c zutil.h zlib.h zconf.h | 39 | crc32.obj: crc32.c zlib.h zconf.h |
| 40 | $(CC) $(CFLAGS) $*.c | 40 | $(CC) $(CFLAGS) $*.c |
| 41 | 41 | ||
| 42 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 42 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h |
diff --git a/msdos/zlib.def b/msdos/zlib.def index e4edaad..6c04412 100644 --- a/msdos/zlib.def +++ b/msdos/zlib.def | |||
| @@ -8,7 +8,7 @@ SUBSYSTEM WINDOWS | |||
| 8 | 8 | ||
| 9 | STUB 'WINSTUB.EXE' | 9 | STUB 'WINSTUB.EXE' |
| 10 | 10 | ||
| 11 | VERSION 1.11 | 11 | VERSION 1.13 |
| 12 | 12 | ||
| 13 | CODE EXECUTE READ | 13 | CODE EXECUTE READ |
| 14 | 14 | ||
diff --git a/msdos/zlib.rc b/msdos/zlib.rc index 0a38186..556d4ff 100644 --- a/msdos/zlib.rc +++ b/msdos/zlib.rc | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | #define IDR_VERSION1 1 | 3 | #define IDR_VERSION1 1 |
| 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE | 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE |
| 5 | FILEVERSION 1,1,2,0 | 5 | FILEVERSION 1,1,3,0 |
| 6 | PRODUCTVERSION 1,1,2,0 | 6 | PRODUCTVERSION 1,1,3,0 |
| 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
| 8 | FILEFLAGS 0 | 8 | FILEFLAGS 0 |
| 9 | FILEOS VOS_DOS_WINDOWS32 | 9 | FILEOS VOS_DOS_WINDOWS32 |
| @@ -17,7 +17,7 @@ BEGIN | |||
| 17 | 17 | ||
| 18 | BEGIN | 18 | BEGIN |
| 19 | VALUE "FileDescription", "zlib data compression library\0" | 19 | VALUE "FileDescription", "zlib data compression library\0" |
| 20 | VALUE "FileVersion", "1.1.2\0" | 20 | VALUE "FileVersion", "1.1.3\0" |
| 21 | VALUE "InternalName", "zlib\0" | 21 | VALUE "InternalName", "zlib\0" |
| 22 | VALUE "OriginalFilename", "zlib.dll\0" | 22 | VALUE "OriginalFilename", "zlib.dll\0" |
| 23 | VALUE "ProductName", "ZLib.DLL\0" | 23 | VALUE "ProductName", "ZLib.DLL\0" |
diff --git a/nt/Makefile.emx b/nt/Makefile.emx new file mode 100644 index 0000000..2d475b1 --- /dev/null +++ b/nt/Makefile.emx | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | # Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98. | ||
| 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. | ||
| 3 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 4 | |||
| 5 | # To compile, or to compile and test, type: | ||
| 6 | # | ||
| 7 | # make -fmakefile.emx; make test -fmakefile.emx | ||
| 8 | # | ||
| 9 | |||
| 10 | CC=gcc -Zwin32 | ||
| 11 | |||
| 12 | #CFLAGS=-MMD -O | ||
| 13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 14 | #CFLAGS=-MMD -g -DDEBUG | ||
| 15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 16 | -Wstrict-prototypes -Wmissing-prototypes | ||
| 17 | |||
| 18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . | ||
| 19 | CP=copy /Y | ||
| 20 | # If gnu install.exe is available, replace $(CP) with ginstall. | ||
| 21 | INSTALL=$(CP) | ||
| 22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: | ||
| 23 | RM=del | ||
| 24 | LDLIBS=-L. -lzlib | ||
| 25 | LD=$(CC) -s -o | ||
| 26 | LDSHARED=$(CC) | ||
| 27 | |||
| 28 | INCL=zlib.h zconf.h | ||
| 29 | LIBS=zlib.a | ||
| 30 | |||
| 31 | AR=ar rcs | ||
| 32 | |||
| 33 | prefix=/usr/local | ||
| 34 | exec_prefix = $(prefix) | ||
| 35 | |||
| 36 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 37 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | ||
| 38 | |||
| 39 | TEST_OBJS = example.o minigzip.o | ||
| 40 | |||
| 41 | all: example.exe minigzip.exe | ||
| 42 | |||
| 43 | test: all | ||
| 44 | ./example | ||
| 45 | echo hello world | .\minigzip | .\minigzip -d | ||
| 46 | |||
| 47 | %.o : %.c | ||
| 48 | $(CC) $(CFLAGS) -c $< -o $@ | ||
| 49 | |||
| 50 | zlib.a: $(OBJS) | ||
| 51 | $(AR) $@ $(OBJS) | ||
| 52 | |||
| 53 | %.exe : %.o $(LIBS) | ||
| 54 | $(LD) $@ $< $(LDLIBS) | ||
| 55 | |||
| 56 | |||
| 57 | .PHONY : clean | ||
| 58 | |||
| 59 | clean: | ||
| 60 | $(RM) *.d | ||
| 61 | $(RM) *.o | ||
| 62 | $(RM) *.exe | ||
| 63 | $(RM) zlib.a | ||
| 64 | $(RM) foo.gz | ||
| 65 | |||
| 66 | DEPS := $(wildcard *.d) | ||
| 67 | ifneq ($(DEPS),) | ||
| 68 | include $(DEPS) | ||
| 69 | endif | ||
| 70 | # Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98. | ||
| 71 | # Copyright (C) 1995-1998 Jean-loup Gailly. | ||
| 72 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 73 | |||
| 74 | # To compile, or to compile and test, type: | ||
| 75 | # | ||
| 76 | # make -fmakefile.emx; make test -fmakefile.emx | ||
| 77 | # | ||
| 78 | |||
| 79 | CC=gcc | ||
| 80 | |||
| 81 | #CFLAGS=-MMD -O | ||
| 82 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 83 | #CFLAGS=-MMD -g -DDEBUG | ||
| 84 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 85 | -Wstrict-prototypes -Wmissing-prototypes | ||
| 86 | |||
| 87 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . | ||
| 88 | CP=copy /Y | ||
| 89 | # If gnu install.exe is available, replace $(CP) with ginstall. | ||
| 90 | INSTALL=$(CP) | ||
| 91 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: | ||
| 92 | RM=del | ||
| 93 | LDLIBS=-L. -lzlib | ||
| 94 | LD=$(CC) -s -o | ||
| 95 | LDSHARED=$(CC) | ||
| 96 | |||
| 97 | INCL=zlib.h zconf.h | ||
| 98 | LIBS=zlib.a | ||
| 99 | |||
| 100 | AR=ar rcs | ||
| 101 | |||
| 102 | prefix=/usr/local | ||
| 103 | exec_prefix = $(prefix) | ||
| 104 | |||
| 105 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 106 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | ||
| 107 | |||
| 108 | TEST_OBJS = example.o minigzip.o | ||
| 109 | |||
| 110 | all: example.exe minigzip.exe | ||
| 111 | |||
| 112 | test: all | ||
| 113 | ./example | ||
| 114 | echo hello world | .\minigzip | .\minigzip -d | ||
| 115 | |||
| 116 | %.o : %.c | ||
| 117 | $(CC) $(CFLAGS) -c $< -o $@ | ||
| 118 | |||
| 119 | zlib.a: $(OBJS) | ||
| 120 | $(AR) $@ $(OBJS) | ||
| 121 | |||
| 122 | %.exe : %.o $(LIBS) | ||
| 123 | $(LD) $@ $< $(LDLIBS) | ||
| 124 | |||
| 125 | |||
| 126 | .PHONY : clean | ||
| 127 | |||
| 128 | clean: | ||
| 129 | $(RM) *.d | ||
| 130 | $(RM) *.o | ||
| 131 | $(RM) *.exe | ||
| 132 | $(RM) zlib.a | ||
| 133 | $(RM) foo.gz | ||
| 134 | |||
| 135 | DEPS := $(wildcard *.d) | ||
| 136 | ifneq ($(DEPS),) | ||
| 137 | include $(DEPS) | ||
| 138 | endif | ||
diff --git a/nt/Makefile.gcc b/nt/Makefile.gcc new file mode 100644 index 0000000..cdd652f --- /dev/null +++ b/nt/Makefile.gcc | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | # Makefile for zlib. Modified for mingw32 by C. Spieler, 6/16/98. | ||
| 2 | # (This Makefile is directly derived from Makefile.dj2) | ||
| 3 | # Copyright (C) 1995-1998 Jean-loup Gailly. | ||
| 4 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 5 | |||
| 6 | # To compile, or to compile and test, type: | ||
| 7 | # | ||
| 8 | # make -fmakefile.gcc; make test -fmakefile.gcc | ||
| 9 | # | ||
| 10 | # To install libz.a, zconf.h and zlib.h in the mingw32 directories, type: | ||
| 11 | # | ||
| 12 | # make install -fmakefile.gcc | ||
| 13 | # | ||
| 14 | |||
| 15 | CC=gcc | ||
| 16 | |||
| 17 | #CFLAGS=-MMD -O | ||
| 18 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 19 | #CFLAGS=-MMD -g -DDEBUG | ||
| 20 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 21 | -Wstrict-prototypes -Wmissing-prototypes | ||
| 22 | |||
| 23 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . | ||
| 24 | CP=copy /Y | ||
| 25 | # If gnu install.exe is available, replace $(CP) with ginstall. | ||
| 26 | INSTALL=$(CP) | ||
| 27 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: | ||
| 28 | RM=del | ||
| 29 | LDLIBS=-L. -lz | ||
| 30 | LD=$(CC) -s -o | ||
| 31 | LDSHARED=$(CC) | ||
| 32 | |||
| 33 | INCL=zlib.h zconf.h | ||
| 34 | LIBS=libz.a | ||
| 35 | |||
| 36 | AR=ar rcs | ||
| 37 | |||
| 38 | prefix=/usr/local | ||
| 39 | exec_prefix = $(prefix) | ||
| 40 | |||
| 41 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 42 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | ||
| 43 | |||
| 44 | TEST_OBJS = example.o minigzip.o | ||
| 45 | |||
| 46 | all: example.exe minigzip.exe | ||
| 47 | |||
| 48 | test: all | ||
| 49 | ./example | ||
| 50 | echo hello world | .\minigzip | .\minigzip -d | ||
| 51 | |||
| 52 | %.o : %.c | ||
| 53 | $(CC) $(CFLAGS) -c $< -o $@ | ||
| 54 | |||
| 55 | libz.a: $(OBJS) | ||
| 56 | $(AR) $@ $(OBJS) | ||
| 57 | |||
| 58 | %.exe : %.o $(LIBS) | ||
| 59 | $(LD) $@ $< $(LDLIBS) | ||
| 60 | |||
| 61 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . | ||
| 62 | |||
| 63 | .PHONY : uninstall clean | ||
| 64 | |||
| 65 | install: $(INCL) $(LIBS) | ||
| 66 | -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) | ||
| 67 | -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) | ||
| 68 | $(INSTALL) zlib.h $(INCLUDE_PATH) | ||
| 69 | $(INSTALL) zconf.h $(INCLUDE_PATH) | ||
| 70 | $(INSTALL) libz.a $(LIBRARY_PATH) | ||
| 71 | |||
| 72 | uninstall: | ||
| 73 | $(RM) $(INCLUDE_PATH)\zlib.h | ||
| 74 | $(RM) $(INCLUDE_PATH)\zconf.h | ||
| 75 | $(RM) $(LIBRARY_PATH)\libz.a | ||
| 76 | |||
| 77 | clean: | ||
| 78 | $(RM) *.d | ||
| 79 | $(RM) *.o | ||
| 80 | $(RM) *.exe | ||
| 81 | $(RM) libz.a | ||
| 82 | $(RM) foo.gz | ||
| 83 | |||
| 84 | DEPS := $(wildcard *.d) | ||
| 85 | ifneq ($(DEPS),) | ||
| 86 | include $(DEPS) | ||
| 87 | endif | ||
diff --git a/os2/Makefile.os2 b/os2/Makefile.os2 new file mode 100644 index 0000000..4f56947 --- /dev/null +++ b/os2/Makefile.os2 | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | # Makefile for zlib under OS/2 using GCC (PGCC) | ||
| 2 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 3 | |||
| 4 | # To compile and test, type: | ||
| 5 | # cp Makefile.os2 .. | ||
| 6 | # cd .. | ||
| 7 | # make -f Makefile.os2 test | ||
| 8 | |||
| 9 | # This makefile will build a static library z.lib, a shared library | ||
| 10 | # z.dll and a import library zdll.lib. You can use either z.lib or | ||
| 11 | # zdll.lib by specifying either -lz or -lzdll on gcc's command line | ||
| 12 | |||
| 13 | CC=gcc -Zomf -s | ||
| 14 | |||
| 15 | CFLAGS=-O6 -Wall | ||
| 16 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 17 | #CFLAGS=-g -DDEBUG | ||
| 18 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 19 | # -Wstrict-prototypes -Wmissing-prototypes | ||
| 20 | |||
| 21 | #################### BUG WARNING: ##################### | ||
| 22 | ## infcodes.c hits a bug in pgcc-1.0, so you have to use either | ||
| 23 | ## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem) | ||
| 24 | ## This bug is reportedly fixed in pgcc >1.0, but this was not tested | ||
| 25 | CFLAGS+=-fno-force-mem | ||
| 26 | |||
| 27 | LDFLAGS=-s -L. -lzdll -Zcrtdll | ||
| 28 | LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll | ||
| 29 | |||
| 30 | VER=1.1.0 | ||
| 31 | ZLIB=z.lib | ||
| 32 | SHAREDLIB=z.dll | ||
| 33 | SHAREDLIBIMP=zdll.lib | ||
| 34 | LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP) | ||
| 35 | |||
| 36 | AR=emxomfar cr | ||
| 37 | IMPLIB=emximp | ||
| 38 | RANLIB=echo | ||
| 39 | TAR=tar | ||
| 40 | SHELL=bash | ||
| 41 | |||
| 42 | prefix=/usr/local | ||
| 43 | exec_prefix = $(prefix) | ||
| 44 | |||
| 45 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 46 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | ||
| 47 | |||
| 48 | TEST_OBJS = example.o minigzip.o | ||
| 49 | |||
| 50 | DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ | ||
| 51 | algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ | ||
| 52 | nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ | ||
| 53 | contrib/asm386/*.asm contrib/asm386/*.c \ | ||
| 54 | contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ | ||
| 55 | contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ | ||
| 56 | contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 | ||
| 57 | |||
| 58 | all: example.exe minigzip.exe | ||
| 59 | |||
| 60 | test: all | ||
| 61 | @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||
| 62 | echo hello world | ./minigzip | ./minigzip -d || \ | ||
| 63 | echo ' *** minigzip test FAILED ***' ; \ | ||
| 64 | if ./example; then \ | ||
| 65 | echo ' *** zlib test OK ***'; \ | ||
| 66 | else \ | ||
| 67 | echo ' *** zlib test FAILED ***'; \ | ||
| 68 | fi | ||
| 69 | |||
| 70 | $(ZLIB): $(OBJS) | ||
| 71 | $(AR) $@ $(OBJS) | ||
| 72 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | ||
| 73 | |||
| 74 | $(SHAREDLIB): $(OBJS) os2/z.def | ||
| 75 | $(LDSHARED) -o $@ $^ | ||
| 76 | |||
| 77 | $(SHAREDLIBIMP): os2/z.def | ||
| 78 | $(IMPLIB) -o $@ $^ | ||
| 79 | |||
| 80 | example.exe: example.o $(LIBS) | ||
| 81 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) | ||
| 82 | |||
| 83 | minigzip.exe: minigzip.o $(LIBS) | ||
| 84 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | ||
| 85 | |||
| 86 | clean: | ||
| 87 | rm -f *.o *~ example minigzip libz.a libz.so* foo.gz | ||
| 88 | |||
| 89 | distclean: clean | ||
| 90 | |||
| 91 | zip: | ||
| 92 | mv Makefile Makefile~; cp -p Makefile.in Makefile | ||
| 93 | rm -f test.c ztest*.c | ||
| 94 | v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ | ||
| 95 | zip -ul9 zlib$$v $(DISTFILES) | ||
| 96 | mv Makefile~ Makefile | ||
| 97 | |||
| 98 | dist: | ||
| 99 | mv Makefile Makefile~; cp -p Makefile.in Makefile | ||
| 100 | rm -f test.c ztest*.c | ||
| 101 | d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ | ||
| 102 | rm -f $$d.tar.gz; \ | ||
| 103 | if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ | ||
| 104 | files=""; \ | ||
| 105 | for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ | ||
| 106 | cd ..; \ | ||
| 107 | GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ | ||
| 108 | if test ! -d $$d; then rm -f $$d; fi | ||
| 109 | mv Makefile~ Makefile | ||
| 110 | |||
| 111 | tags: | ||
| 112 | etags *.[ch] | ||
| 113 | |||
| 114 | depend: | ||
| 115 | makedepend -- $(CFLAGS) -- *.[ch] | ||
| 116 | |||
| 117 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 118 | |||
| 119 | adler32.o: zlib.h zconf.h | ||
| 120 | compress.o: zlib.h zconf.h | ||
| 121 | crc32.o: zlib.h zconf.h | ||
| 122 | deflate.o: deflate.h zutil.h zlib.h zconf.h | ||
| 123 | example.o: zlib.h zconf.h | ||
| 124 | gzio.o: zutil.h zlib.h zconf.h | ||
| 125 | infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h | ||
| 126 | infcodes.o: zutil.h zlib.h zconf.h | ||
| 127 | infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h | ||
| 128 | inffast.o: zutil.h zlib.h zconf.h inftrees.h | ||
| 129 | inffast.o: infblock.h infcodes.h infutil.h inffast.h | ||
| 130 | inflate.o: zutil.h zlib.h zconf.h infblock.h | ||
| 131 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h | ||
| 132 | infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h | ||
| 133 | minigzip.o: zlib.h zconf.h | ||
| 134 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | ||
| 135 | uncompr.o: zlib.h zconf.h | ||
| 136 | zutil.o: zutil.h zlib.h zconf.h | ||
diff --git a/os2/zlib.def b/os2/zlib.def new file mode 100644 index 0000000..4c753f1 --- /dev/null +++ b/os2/zlib.def | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | ; | ||
| 2 | ; Slightly modified version of ../nt/zlib.dnt :-) | ||
| 3 | ; | ||
| 4 | |||
| 5 | LIBRARY Z | ||
| 6 | DESCRIPTION "Zlib compression library for OS/2" | ||
| 7 | CODE PRELOAD MOVEABLE DISCARDABLE | ||
| 8 | DATA PRELOAD MOVEABLE MULTIPLE | ||
| 9 | |||
| 10 | EXPORTS | ||
| 11 | adler32 | ||
| 12 | compress | ||
| 13 | crc32 | ||
| 14 | deflate | ||
| 15 | deflateCopy | ||
| 16 | deflateEnd | ||
| 17 | deflateInit2_ | ||
| 18 | deflateInit_ | ||
| 19 | deflateParams | ||
| 20 | deflateReset | ||
| 21 | deflateSetDictionary | ||
| 22 | gzclose | ||
| 23 | gzdopen | ||
| 24 | gzerror | ||
| 25 | gzflush | ||
| 26 | gzopen | ||
| 27 | gzread | ||
| 28 | gzwrite | ||
| 29 | inflate | ||
| 30 | inflateEnd | ||
| 31 | inflateInit2_ | ||
| 32 | inflateInit_ | ||
| 33 | inflateReset | ||
| 34 | inflateSetDictionary | ||
| 35 | inflateSync | ||
| 36 | uncompress | ||
| 37 | zlibVersion | ||
| 38 | gzprintf | ||
| 39 | gzputc | ||
| 40 | gzgetc | ||
| 41 | gzseek | ||
| 42 | gzrewind | ||
| 43 | gztell | ||
| 44 | gzeof | ||
| 45 | gzsetparams | ||
| 46 | zError | ||
| 47 | inflateSyncPoint | ||
| 48 | get_crc_table | ||
| 49 | compress2 | ||
| 50 | gzputs | ||
| 51 | gzgets | ||
| @@ -250,6 +250,13 @@ local void tr_static_init() | |||
| 250 | 250 | ||
| 251 | if (static_init_done) return; | 251 | if (static_init_done) return; |
| 252 | 252 | ||
| 253 | /* For some embedded targets, global variables are not initialized: */ | ||
| 254 | static_l_desc.static_tree = static_ltree; | ||
| 255 | static_l_desc.extra_bits = extra_lbits; | ||
| 256 | static_d_desc.static_tree = static_dtree; | ||
| 257 | static_d_desc.extra_bits = extra_dbits; | ||
| 258 | static_bl_desc.extra_bits = extra_blbits; | ||
| 259 | |||
| 253 | /* Initialize the mapping length (0..255) -> length code (0..28) */ | 260 | /* Initialize the mapping length (0..255) -> length code (0..28) */ |
| 254 | length = 0; | 261 | length = 0; |
| 255 | for (code = 0; code < LENGTH_CODES-1; code++) { | 262 | for (code = 0; code < LENGTH_CODES-1; code++) { |
| @@ -378,8 +385,6 @@ void _tr_init(s) | |||
| 378 | { | 385 | { |
| 379 | tr_static_init(); | 386 | tr_static_init(); |
| 380 | 387 | ||
| 381 | s->compressed_len = 0L; | ||
| 382 | |||
| 383 | s->l_desc.dyn_tree = s->dyn_ltree; | 388 | s->l_desc.dyn_tree = s->dyn_ltree; |
| 384 | s->l_desc.stat_desc = &static_l_desc; | 389 | s->l_desc.stat_desc = &static_l_desc; |
| 385 | 390 | ||
| @@ -393,6 +398,7 @@ void _tr_init(s) | |||
| 393 | s->bi_valid = 0; | 398 | s->bi_valid = 0; |
| 394 | s->last_eob_len = 8; /* enough lookahead for inflate */ | 399 | s->last_eob_len = 8; /* enough lookahead for inflate */ |
| 395 | #ifdef DEBUG | 400 | #ifdef DEBUG |
| 401 | s->compressed_len = 0L; | ||
| 396 | s->bits_sent = 0L; | 402 | s->bits_sent = 0L; |
| 397 | #endif | 403 | #endif |
| 398 | 404 | ||
| @@ -865,9 +871,10 @@ void _tr_stored_block(s, buf, stored_len, eof) | |||
| 865 | int eof; /* true if this is the last block for a file */ | 871 | int eof; /* true if this is the last block for a file */ |
| 866 | { | 872 | { |
| 867 | send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ | 873 | send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ |
| 874 | #ifdef DEBUG | ||
| 868 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; | 875 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; |
| 869 | s->compressed_len += (stored_len + 4) << 3; | 876 | s->compressed_len += (stored_len + 4) << 3; |
| 870 | 877 | #endif | |
| 871 | copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ | 878 | copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ |
| 872 | } | 879 | } |
| 873 | 880 | ||
| @@ -887,7 +894,9 @@ void _tr_align(s) | |||
| 887 | { | 894 | { |
| 888 | send_bits(s, STATIC_TREES<<1, 3); | 895 | send_bits(s, STATIC_TREES<<1, 3); |
| 889 | send_code(s, END_BLOCK, static_ltree); | 896 | send_code(s, END_BLOCK, static_ltree); |
| 897 | #ifdef DEBUG | ||
| 890 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ | 898 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ |
| 899 | #endif | ||
| 891 | bi_flush(s); | 900 | bi_flush(s); |
| 892 | /* Of the 10 bits for the empty block, we have already sent | 901 | /* Of the 10 bits for the empty block, we have already sent |
| 893 | * (10 - bi_valid) bits. The lookahead for the last real code (before | 902 | * (10 - bi_valid) bits. The lookahead for the last real code (before |
| @@ -897,7 +906,9 @@ void _tr_align(s) | |||
| 897 | if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { | 906 | if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { |
| 898 | send_bits(s, STATIC_TREES<<1, 3); | 907 | send_bits(s, STATIC_TREES<<1, 3); |
| 899 | send_code(s, END_BLOCK, static_ltree); | 908 | send_code(s, END_BLOCK, static_ltree); |
| 909 | #ifdef DEBUG | ||
| 900 | s->compressed_len += 10L; | 910 | s->compressed_len += 10L; |
| 911 | #endif | ||
| 901 | bi_flush(s); | 912 | bi_flush(s); |
| 902 | } | 913 | } |
| 903 | s->last_eob_len = 7; | 914 | s->last_eob_len = 7; |
| @@ -905,10 +916,9 @@ void _tr_align(s) | |||
| 905 | 916 | ||
| 906 | /* =========================================================================== | 917 | /* =========================================================================== |
| 907 | * Determine the best encoding for the current block: dynamic trees, static | 918 | * Determine the best encoding for the current block: dynamic trees, static |
| 908 | * trees or store, and output the encoded block to the zip file. This function | 919 | * trees or store, and output the encoded block to the zip file. |
| 909 | * returns the total compressed length for the file so far. | ||
| 910 | */ | 920 | */ |
| 911 | ulg _tr_flush_block(s, buf, stored_len, eof) | 921 | void _tr_flush_block(s, buf, stored_len, eof) |
| 912 | deflate_state *s; | 922 | deflate_state *s; |
| 913 | charf *buf; /* input block, or NULL if too old */ | 923 | charf *buf; /* input block, or NULL if too old */ |
| 914 | ulg stored_len; /* length of input block */ | 924 | ulg stored_len; /* length of input block */ |
| @@ -955,25 +965,6 @@ ulg _tr_flush_block(s, buf, stored_len, eof) | |||
| 955 | opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ | 965 | opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ |
| 956 | } | 966 | } |
| 957 | 967 | ||
| 958 | /* If compression failed and this is the first and last block, | ||
| 959 | * and if the .zip file can be seeked (to rewrite the local header), | ||
| 960 | * the whole file is transformed into a stored file: | ||
| 961 | */ | ||
| 962 | #ifdef STORED_FILE_OK | ||
| 963 | # ifdef FORCE_STORED_FILE | ||
| 964 | if (eof && s->compressed_len == 0L) { /* force stored file */ | ||
| 965 | # else | ||
| 966 | if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) { | ||
| 967 | # endif | ||
| 968 | /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ | ||
| 969 | if (buf == (charf*)0) error ("block vanished"); | ||
| 970 | |||
| 971 | copy_block(buf, (unsigned)stored_len, 0); /* without header */ | ||
| 972 | s->compressed_len = stored_len << 3; | ||
| 973 | s->method = STORED; | ||
| 974 | } else | ||
| 975 | #endif /* STORED_FILE_OK */ | ||
| 976 | |||
| 977 | #ifdef FORCE_STORED | 968 | #ifdef FORCE_STORED |
| 978 | if (buf != (char*)0) { /* force stored block */ | 969 | if (buf != (char*)0) { /* force stored block */ |
| 979 | #else | 970 | #else |
| @@ -995,25 +986,32 @@ ulg _tr_flush_block(s, buf, stored_len, eof) | |||
| 995 | #endif | 986 | #endif |
| 996 | send_bits(s, (STATIC_TREES<<1)+eof, 3); | 987 | send_bits(s, (STATIC_TREES<<1)+eof, 3); |
| 997 | compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); | 988 | compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); |
| 989 | #ifdef DEBUG | ||
| 998 | s->compressed_len += 3 + s->static_len; | 990 | s->compressed_len += 3 + s->static_len; |
| 991 | #endif | ||
| 999 | } else { | 992 | } else { |
| 1000 | send_bits(s, (DYN_TREES<<1)+eof, 3); | 993 | send_bits(s, (DYN_TREES<<1)+eof, 3); |
| 1001 | send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, | 994 | send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, |
| 1002 | max_blindex+1); | 995 | max_blindex+1); |
| 1003 | compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); | 996 | compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); |
| 997 | #ifdef DEBUG | ||
| 1004 | s->compressed_len += 3 + s->opt_len; | 998 | s->compressed_len += 3 + s->opt_len; |
| 999 | #endif | ||
| 1005 | } | 1000 | } |
| 1006 | Assert (s->compressed_len == s->bits_sent, "bad compressed size"); | 1001 | Assert (s->compressed_len == s->bits_sent, "bad compressed size"); |
| 1002 | /* The above check is made mod 2^32, for files larger than 512 MB | ||
| 1003 | * and uLong implemented on 32 bits. | ||
| 1004 | */ | ||
| 1007 | init_block(s); | 1005 | init_block(s); |
| 1008 | 1006 | ||
| 1009 | if (eof) { | 1007 | if (eof) { |
| 1010 | bi_windup(s); | 1008 | bi_windup(s); |
| 1009 | #ifdef DEBUG | ||
| 1011 | s->compressed_len += 7; /* align on byte boundary */ | 1010 | s->compressed_len += 7; /* align on byte boundary */ |
| 1011 | #endif | ||
| 1012 | } | 1012 | } |
| 1013 | Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, | 1013 | Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, |
| 1014 | s->compressed_len-7*eof)); | 1014 | s->compressed_len-7*eof)); |
| 1015 | |||
| 1016 | return s->compressed_len >> 3; | ||
| 1017 | } | 1015 | } |
| 1018 | 1016 | ||
| 1019 | /* =========================================================================== | 1017 | /* =========================================================================== |
| @@ -91,8 +91,8 @@ | |||
| 91 | # define NO_DUMMY_DECL | 91 | # define NO_DUMMY_DECL |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | /* Borland C incorrectly complains about missing returns: */ | 94 | /* Old Borland C incorrectly complains about missing returns: */ |
| 95 | #if defined(__BORLANDC__) | 95 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) |
| 96 | # define NEED_DUMMY_RETURN | 96 | # define NEED_DUMMY_RETURN |
| 97 | #endif | 97 | #endif |
| 98 | 98 | ||
| @@ -148,7 +148,7 @@ | |||
| 148 | /* MSC small or medium model */ | 148 | /* MSC small or medium model */ |
| 149 | # define SMALL_MEDIUM | 149 | # define SMALL_MEDIUM |
| 150 | # ifdef _MSC_VER | 150 | # ifdef _MSC_VER |
| 151 | # define FAR __far | 151 | # define FAR _far |
| 152 | # else | 152 | # else |
| 153 | # define FAR far | 153 | # define FAR far |
| 154 | # endif | 154 | # endif |
| @@ -156,42 +156,68 @@ | |||
| 156 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) | 156 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) |
| 157 | # ifndef __32BIT__ | 157 | # ifndef __32BIT__ |
| 158 | # define SMALL_MEDIUM | 158 | # define SMALL_MEDIUM |
| 159 | # define FAR __far | 159 | # define FAR _far |
| 160 | # endif | 160 | # endif |
| 161 | #endif | 161 | #endif |
| 162 | 162 | ||
| 163 | /* Compile with -DZLIB_DLL for Windows DLL support */ | 163 | /* Compile with -DZLIB_DLL for Windows DLL support */ |
| 164 | #if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) | 164 | #if defined(ZLIB_DLL) |
| 165 | # ifdef FAR | 165 | # if defined(_WINDOWS) || defined(WINDOWS) |
| 166 | # undef FAR | 166 | # ifdef FAR |
| 167 | # undef FAR | ||
| 168 | # endif | ||
| 169 | # include <windows.h> | ||
| 170 | # define ZEXPORT WINAPI | ||
| 171 | # ifdef WIN32 | ||
| 172 | # define ZEXPORTVA WINAPIV | ||
| 173 | # else | ||
| 174 | # define ZEXPORTVA FAR _cdecl _export | ||
| 175 | # endif | ||
| 167 | # endif | 176 | # endif |
| 168 | # include <windows.h> | 177 | # if defined (__BORLANDC__) |
| 169 | # define ZEXPORT WINAPI | 178 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) |
| 170 | # ifdef WIN32 | 179 | # include <windows.h> |
| 171 | # define ZEXPORTVA WINAPIV | 180 | # define ZEXPORT __declspec(dllexport) WINAPI |
| 181 | # define ZEXPORTRVA __declspec(dllexport) WINAPIV | ||
| 182 | # else | ||
| 183 | # if defined (_Windows) && defined (__DLL__) | ||
| 184 | # define ZEXPORT _export | ||
| 185 | # define ZEXPORTVA _export | ||
| 186 | # endif | ||
| 187 | # endif | ||
| 188 | # endif | ||
| 189 | #endif | ||
| 190 | |||
| 191 | #if defined (__BEOS__) | ||
| 192 | # if defined (ZLIB_DLL) | ||
| 193 | # define ZEXTERN extern __declspec(dllexport) | ||
| 172 | # else | 194 | # else |
| 173 | # define ZEXPORTVA FAR _cdecl _export | 195 | # define ZEXTERN extern __declspec(dllimport) |
| 174 | # endif | 196 | # endif |
| 175 | #else | 197 | #endif |
| 176 | # if defined (__BORLANDC__) && defined (_Windows) && defined (__DLL__) | 198 | |
| 177 | # define ZEXPORT _export | 199 | #ifndef ZEXPORT |
| 178 | # define ZEXPORTVA _export | 200 | # define ZEXPORT |
| 179 | # else | 201 | #endif |
| 180 | # define ZEXPORT | 202 | #ifndef ZEXPORTVA |
| 181 | # define ZEXPORTVA | 203 | # define ZEXPORTVA |
| 182 | # endif | 204 | #endif |
| 205 | #ifndef ZEXTERN | ||
| 206 | # define ZEXTERN extern | ||
| 183 | #endif | 207 | #endif |
| 184 | 208 | ||
| 185 | #ifndef FAR | 209 | #ifndef FAR |
| 186 | # define FAR | 210 | # define FAR |
| 187 | #endif | 211 | #endif |
| 188 | 212 | ||
| 213 | #if !defined(MACOS) && !defined(TARGET_OS_MAC) | ||
| 189 | typedef unsigned char Byte; /* 8 bits */ | 214 | typedef unsigned char Byte; /* 8 bits */ |
| 215 | #endif | ||
| 190 | typedef unsigned int uInt; /* 16 bits or more */ | 216 | typedef unsigned int uInt; /* 16 bits or more */ |
| 191 | typedef unsigned long uLong; /* 32 bits or more */ | 217 | typedef unsigned long uLong; /* 32 bits or more */ |
| 192 | 218 | ||
| 193 | #if defined(__BORLANDC__) && defined(SMALL_MEDIUM) | 219 | #ifdef SMALL_MEDIUM |
| 194 | /* Borland C/C++ ignores FAR inside typedef */ | 220 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ |
| 195 | # define Bytef Byte FAR | 221 | # define Bytef Byte FAR |
| 196 | #else | 222 | #else |
| 197 | typedef Byte FAR Bytef; | 223 | typedef Byte FAR Bytef; |
| @@ -217,6 +243,7 @@ typedef uLong FAR uLongf; | |||
| 217 | #ifndef SEEK_SET | 243 | #ifndef SEEK_SET |
| 218 | # define SEEK_SET 0 /* Seek from beginning of file. */ | 244 | # define SEEK_SET 0 /* Seek from beginning of file. */ |
| 219 | # define SEEK_CUR 1 /* Seek from current position. */ | 245 | # define SEEK_CUR 1 /* Seek from current position. */ |
| 246 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
| 220 | #endif | 247 | #endif |
| 221 | #ifndef z_off_t | 248 | #ifndef z_off_t |
| 222 | # define z_off_t long | 249 | # define z_off_t long |
| @@ -1,4 +1,4 @@ | |||
| 1 | .TH ZLIB 3 "19 March 1998" | 1 | .TH ZLIB 3 "9 July 1998" |
| 2 | .SH NAME | 2 | .SH NAME |
| 3 | zlib \- compression/decompression library | 3 | zlib \- compression/decompression library |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| @@ -81,7 +81,7 @@ These documents are also available in other formats from: | |||
| 81 | .IP | 81 | .IP |
| 82 | ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html | 82 | ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html |
| 83 | .SH AUTHORS | 83 | .SH AUTHORS |
| 84 | Version 1.1.2 | 84 | Version 1.1.3 |
| 85 | Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org) | 85 | Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org) |
| 86 | and Mark Adler (madler@alumni.caltech.edu). | 86 | and Mark Adler (madler@alumni.caltech.edu). |
| 87 | .LP | 87 | .LP |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library |
| 2 | version 1.1.2, March 19th, 1998 | 2 | version 1.1.3, July 9th, 1998 |
| 3 | 3 | ||
| 4 | Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler |
| 5 | 5 | ||
| @@ -37,7 +37,7 @@ | |||
| 37 | extern "C" { | 37 | extern "C" { |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #define ZLIB_VERSION "1.1.2" | 40 | #define ZLIB_VERSION "1.1.3" |
| 41 | 41 | ||
| 42 | /* | 42 | /* |
| 43 | The 'zlib' compression library provides in-memory compression and | 43 | The 'zlib' compression library provides in-memory compression and |
| @@ -168,7 +168,7 @@ typedef z_stream FAR *z_streamp; | |||
| 168 | 168 | ||
| 169 | /* basic functions */ | 169 | /* basic functions */ |
| 170 | 170 | ||
| 171 | extern const char * ZEXPORT zlibVersion OF((void)); | 171 | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); |
| 172 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | 172 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. |
| 173 | If the first character differs, the library code actually used is | 173 | If the first character differs, the library code actually used is |
| 174 | not compatible with the zlib.h header file used by the application. | 174 | not compatible with the zlib.h header file used by the application. |
| @@ -176,7 +176,7 @@ extern const char * ZEXPORT zlibVersion OF((void)); | |||
| 176 | */ | 176 | */ |
| 177 | 177 | ||
| 178 | /* | 178 | /* |
| 179 | extern int ZEXPORT deflateInit OF((z_streamp strm, int level)); | 179 | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); |
| 180 | 180 | ||
| 181 | Initializes the internal stream state for compression. The fields | 181 | Initializes the internal stream state for compression. The fields |
| 182 | zalloc, zfree and opaque must be initialized before by the caller. | 182 | zalloc, zfree and opaque must be initialized before by the caller. |
| @@ -198,7 +198,7 @@ extern int ZEXPORT deflateInit OF((z_streamp strm, int level)); | |||
| 198 | */ | 198 | */ |
| 199 | 199 | ||
| 200 | 200 | ||
| 201 | extern int ZEXPORT deflate OF((z_streamp strm, int flush)); | 201 | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); |
| 202 | /* | 202 | /* |
| 203 | deflate compresses as much data as possible, and stops when the input | 203 | deflate compresses as much data as possible, and stops when the input |
| 204 | buffer becomes empty or the output buffer becomes full. It may introduce some | 204 | buffer becomes empty or the output buffer becomes full. It may introduce some |
| @@ -271,11 +271,12 @@ extern int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
| 271 | processed or more output produced), Z_STREAM_END if all input has been | 271 | processed or more output produced), Z_STREAM_END if all input has been |
| 272 | consumed and all output has been produced (only when flush is set to | 272 | consumed and all output has been produced (only when flush is set to |
| 273 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example | 273 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example |
| 274 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. | 274 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible |
| 275 | (for example avail_in or avail_out was zero). | ||
| 275 | */ | 276 | */ |
| 276 | 277 | ||
| 277 | 278 | ||
| 278 | extern int ZEXPORT deflateEnd OF((z_streamp strm)); | 279 | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); |
| 279 | /* | 280 | /* |
| 280 | All dynamically allocated data structures for this stream are freed. | 281 | All dynamically allocated data structures for this stream are freed. |
| 281 | This function discards any unprocessed input and does not flush any | 282 | This function discards any unprocessed input and does not flush any |
| @@ -290,7 +291,7 @@ extern int ZEXPORT deflateEnd OF((z_streamp strm)); | |||
| 290 | 291 | ||
| 291 | 292 | ||
| 292 | /* | 293 | /* |
| 293 | extern int ZEXPORT inflateInit OF((z_streamp strm)); | 294 | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); |
| 294 | 295 | ||
| 295 | Initializes the internal stream state for decompression. The fields | 296 | Initializes the internal stream state for decompression. The fields |
| 296 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by | 297 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by |
| @@ -310,7 +311,7 @@ extern int ZEXPORT inflateInit OF((z_streamp strm)); | |||
| 310 | */ | 311 | */ |
| 311 | 312 | ||
| 312 | 313 | ||
| 313 | extern int ZEXPORT inflate OF((z_streamp strm, int flush)); | 314 | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); |
| 314 | /* | 315 | /* |
| 315 | inflate decompresses as much data as possible, and stops when the input | 316 | inflate decompresses as much data as possible, and stops when the input |
| 316 | buffer becomes empty or the output buffer becomes full. It may some | 317 | buffer becomes empty or the output buffer becomes full. It may some |
| @@ -379,7 +380,7 @@ extern int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
| 379 | */ | 380 | */ |
| 380 | 381 | ||
| 381 | 382 | ||
| 382 | extern int ZEXPORT inflateEnd OF((z_streamp strm)); | 383 | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); |
| 383 | /* | 384 | /* |
| 384 | All dynamically allocated data structures for this stream are freed. | 385 | All dynamically allocated data structures for this stream are freed. |
| 385 | This function discards any unprocessed input and does not flush any | 386 | This function discards any unprocessed input and does not flush any |
| @@ -397,12 +398,12 @@ extern int ZEXPORT inflateEnd OF((z_streamp strm)); | |||
| 397 | */ | 398 | */ |
| 398 | 399 | ||
| 399 | /* | 400 | /* |
| 400 | extern int ZEXPORT deflateInit2 OF((z_streamp strm, | 401 | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, |
| 401 | int level, | 402 | int level, |
| 402 | int method, | 403 | int method, |
| 403 | int windowBits, | 404 | int windowBits, |
| 404 | int memLevel, | 405 | int memLevel, |
| 405 | int strategy)); | 406 | int strategy)); |
| 406 | 407 | ||
| 407 | This is another version of deflateInit with more compression options. The | 408 | This is another version of deflateInit with more compression options. The |
| 408 | fields next_in, zalloc, zfree and opaque must be initialized before by | 409 | fields next_in, zalloc, zfree and opaque must be initialized before by |
| @@ -440,14 +441,14 @@ extern int ZEXPORT deflateInit2 OF((z_streamp strm, | |||
| 440 | not perform any compression: this will be done by deflate(). | 441 | not perform any compression: this will be done by deflate(). |
| 441 | */ | 442 | */ |
| 442 | 443 | ||
| 443 | extern int ZEXPORT deflateSetDictionary OF((z_streamp strm, | 444 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
| 444 | const Bytef *dictionary, | 445 | const Bytef *dictionary, |
| 445 | uInt dictLength)); | 446 | uInt dictLength)); |
| 446 | /* | 447 | /* |
| 447 | Initializes the compression dictionary from the given byte sequence | 448 | Initializes the compression dictionary from the given byte sequence |
| 448 | without producing any compressed output. This function must be called | 449 | without producing any compressed output. This function must be called |
| 449 | immediately after deflateInit or deflateInit2, before any call of | 450 | immediately after deflateInit, deflateInit2 or deflateReset, before any |
| 450 | deflate. The compressor and decompressor must use exactly the same | 451 | call of deflate. The compressor and decompressor must use exactly the same |
| 451 | dictionary (see inflateSetDictionary). | 452 | dictionary (see inflateSetDictionary). |
| 452 | 453 | ||
| 453 | The dictionary should consist of strings (byte sequences) that are likely | 454 | The dictionary should consist of strings (byte sequences) that are likely |
| @@ -476,8 +477,8 @@ extern int ZEXPORT deflateSetDictionary OF((z_streamp strm, | |||
| 476 | perform any compression: this will be done by deflate(). | 477 | perform any compression: this will be done by deflate(). |
| 477 | */ | 478 | */ |
| 478 | 479 | ||
| 479 | extern int ZEXPORT deflateCopy OF((z_streamp dest, | 480 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, |
| 480 | z_streamp source)); | 481 | z_streamp source)); |
| 481 | /* | 482 | /* |
| 482 | Sets the destination stream as a complete copy of the source stream. | 483 | Sets the destination stream as a complete copy of the source stream. |
| 483 | 484 | ||
| @@ -494,7 +495,7 @@ extern int ZEXPORT deflateCopy OF((z_streamp dest, | |||
| 494 | destination. | 495 | destination. |
| 495 | */ | 496 | */ |
| 496 | 497 | ||
| 497 | extern int ZEXPORT deflateReset OF((z_streamp strm)); | 498 | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); |
| 498 | /* | 499 | /* |
| 499 | This function is equivalent to deflateEnd followed by deflateInit, | 500 | This function is equivalent to deflateEnd followed by deflateInit, |
| 500 | but does not free and reallocate all the internal compression state. | 501 | but does not free and reallocate all the internal compression state. |
| @@ -505,7 +506,9 @@ extern int ZEXPORT deflateReset OF((z_streamp strm)); | |||
| 505 | stream state was inconsistent (such as zalloc or state being NULL). | 506 | stream state was inconsistent (such as zalloc or state being NULL). |
| 506 | */ | 507 | */ |
| 507 | 508 | ||
| 508 | extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); | 509 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, |
| 510 | int level, | ||
| 511 | int strategy)); | ||
| 509 | /* | 512 | /* |
| 510 | Dynamically update the compression level and compression strategy. The | 513 | Dynamically update the compression level and compression strategy. The |
| 511 | interpretation of level and strategy is as in deflateInit2. This can be | 514 | interpretation of level and strategy is as in deflateInit2. This can be |
| @@ -525,8 +528,8 @@ extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); | |||
| 525 | */ | 528 | */ |
| 526 | 529 | ||
| 527 | /* | 530 | /* |
| 528 | extern int ZEXPORT inflateInit2 OF((z_streamp strm, | 531 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, |
| 529 | int windowBits)); | 532 | int windowBits)); |
| 530 | 533 | ||
| 531 | This is another version of inflateInit with an extra parameter. The | 534 | This is another version of inflateInit with an extra parameter. The |
| 532 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized | 535 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized |
| @@ -547,9 +550,9 @@ extern int ZEXPORT inflateInit2 OF((z_streamp strm, | |||
| 547 | modified, but next_out and avail_out are unchanged.) | 550 | modified, but next_out and avail_out are unchanged.) |
| 548 | */ | 551 | */ |
| 549 | 552 | ||
| 550 | extern int ZEXPORT inflateSetDictionary OF((z_streamp strm, | 553 | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, |
| 551 | const Bytef *dictionary, | 554 | const Bytef *dictionary, |
| 552 | uInt dictLength)); | 555 | uInt dictLength)); |
| 553 | /* | 556 | /* |
| 554 | Initializes the decompression dictionary from the given uncompressed byte | 557 | Initializes the decompression dictionary from the given uncompressed byte |
| 555 | sequence. This function must be called immediately after a call of inflate | 558 | sequence. This function must be called immediately after a call of inflate |
| @@ -566,7 +569,7 @@ extern int ZEXPORT inflateSetDictionary OF((z_streamp strm, | |||
| 566 | inflate(). | 569 | inflate(). |
| 567 | */ | 570 | */ |
| 568 | 571 | ||
| 569 | extern int ZEXPORT inflateSync OF((z_streamp strm)); | 572 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); |
| 570 | /* | 573 | /* |
| 571 | Skips invalid compressed data until a full flush point (see above the | 574 | Skips invalid compressed data until a full flush point (see above the |
| 572 | description of deflate with Z_FULL_FLUSH) can be found, or until all | 575 | description of deflate with Z_FULL_FLUSH) can be found, or until all |
| @@ -581,7 +584,7 @@ extern int ZEXPORT inflateSync OF((z_streamp strm)); | |||
| 581 | until success or end of the input data. | 584 | until success or end of the input data. |
| 582 | */ | 585 | */ |
| 583 | 586 | ||
| 584 | extern int ZEXPORT inflateReset OF((z_streamp strm)); | 587 | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); |
| 585 | /* | 588 | /* |
| 586 | This function is equivalent to inflateEnd followed by inflateInit, | 589 | This function is equivalent to inflateEnd followed by inflateInit, |
| 587 | but does not free and reallocate all the internal decompression state. | 590 | but does not free and reallocate all the internal decompression state. |
| @@ -602,8 +605,8 @@ extern int ZEXPORT inflateReset OF((z_streamp strm)); | |||
| 602 | utility functions can easily be modified if you need special options. | 605 | utility functions can easily be modified if you need special options. |
| 603 | */ | 606 | */ |
| 604 | 607 | ||
| 605 | extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | 608 | ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, |
| 606 | const Bytef *source, uLong sourceLen)); | 609 | const Bytef *source, uLong sourceLen)); |
| 607 | /* | 610 | /* |
| 608 | Compresses the source buffer into the destination buffer. sourceLen is | 611 | Compresses the source buffer into the destination buffer. sourceLen is |
| 609 | the byte length of the source buffer. Upon entry, destLen is the total | 612 | the byte length of the source buffer. Upon entry, destLen is the total |
| @@ -617,9 +620,9 @@ extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | |||
| 617 | buffer. | 620 | buffer. |
| 618 | */ | 621 | */ |
| 619 | 622 | ||
| 620 | extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | 623 | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, |
| 621 | const Bytef *source, uLong sourceLen, | 624 | const Bytef *source, uLong sourceLen, |
| 622 | int level)); | 625 | int level)); |
| 623 | /* | 626 | /* |
| 624 | Compresses the source buffer into the destination buffer. The level | 627 | Compresses the source buffer into the destination buffer. The level |
| 625 | parameter has the same meaning as in deflateInit. sourceLen is the byte | 628 | parameter has the same meaning as in deflateInit. sourceLen is the byte |
| @@ -632,8 +635,8 @@ extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | |||
| 632 | Z_STREAM_ERROR if the level parameter is invalid. | 635 | Z_STREAM_ERROR if the level parameter is invalid. |
| 633 | */ | 636 | */ |
| 634 | 637 | ||
| 635 | extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | 638 | ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, |
| 636 | const Bytef *source, uLong sourceLen)); | 639 | const Bytef *source, uLong sourceLen)); |
| 637 | /* | 640 | /* |
| 638 | Decompresses the source buffer into the destination buffer. sourceLen is | 641 | Decompresses the source buffer into the destination buffer. sourceLen is |
| 639 | the byte length of the source buffer. Upon entry, destLen is the total | 642 | the byte length of the source buffer. Upon entry, destLen is the total |
| @@ -653,7 +656,7 @@ extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | |||
| 653 | 656 | ||
| 654 | typedef voidp gzFile; | 657 | typedef voidp gzFile; |
| 655 | 658 | ||
| 656 | extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | 659 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
| 657 | /* | 660 | /* |
| 658 | Opens a gzip (.gz) file for reading or writing. The mode parameter | 661 | Opens a gzip (.gz) file for reading or writing. The mode parameter |
| 659 | is as in fopen ("rb" or "wb") but can also include a compression level | 662 | is as in fopen ("rb" or "wb") but can also include a compression level |
| @@ -669,7 +672,7 @@ extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | |||
| 669 | can be checked to distinguish the two cases (if errno is zero, the | 672 | can be checked to distinguish the two cases (if errno is zero, the |
| 670 | zlib error is Z_MEM_ERROR). */ | 673 | zlib error is Z_MEM_ERROR). */ |
| 671 | 674 | ||
| 672 | extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | 675 | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); |
| 673 | /* | 676 | /* |
| 674 | gzdopen() associates a gzFile with the file descriptor fd. File | 677 | gzdopen() associates a gzFile with the file descriptor fd. File |
| 675 | descriptors are obtained from calls like open, dup, creat, pipe or | 678 | descriptors are obtained from calls like open, dup, creat, pipe or |
| @@ -682,7 +685,7 @@ extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | |||
| 682 | the (de)compression state. | 685 | the (de)compression state. |
| 683 | */ | 686 | */ |
| 684 | 687 | ||
| 685 | extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | 688 | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); |
| 686 | /* | 689 | /* |
| 687 | Dynamically update the compression level or strategy. See the description | 690 | Dynamically update the compression level or strategy. See the description |
| 688 | of deflateInit2 for the meaning of these parameters. | 691 | of deflateInit2 for the meaning of these parameters. |
| @@ -690,7 +693,7 @@ extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | |||
| 690 | opened for writing. | 693 | opened for writing. |
| 691 | */ | 694 | */ |
| 692 | 695 | ||
| 693 | extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | 696 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
| 694 | /* | 697 | /* |
| 695 | Reads the given number of uncompressed bytes from the compressed file. | 698 | Reads the given number of uncompressed bytes from the compressed file. |
| 696 | If the input file was not in gzip format, gzread copies the given number | 699 | If the input file was not in gzip format, gzread copies the given number |
| @@ -698,28 +701,29 @@ extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | |||
| 698 | gzread returns the number of uncompressed bytes actually read (0 for | 701 | gzread returns the number of uncompressed bytes actually read (0 for |
| 699 | end of file, -1 for error). */ | 702 | end of file, -1 for error). */ |
| 700 | 703 | ||
| 701 | extern int ZEXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len)); | 704 | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, |
| 705 | const voidp buf, unsigned len)); | ||
| 702 | /* | 706 | /* |
| 703 | Writes the given number of uncompressed bytes into the compressed file. | 707 | Writes the given number of uncompressed bytes into the compressed file. |
| 704 | gzwrite returns the number of uncompressed bytes actually written | 708 | gzwrite returns the number of uncompressed bytes actually written |
| 705 | (0 in case of error). | 709 | (0 in case of error). |
| 706 | */ | 710 | */ |
| 707 | 711 | ||
| 708 | extern int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); | 712 | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); |
| 709 | /* | 713 | /* |
| 710 | Converts, formats, and writes the args to the compressed file under | 714 | Converts, formats, and writes the args to the compressed file under |
| 711 | control of the format string, as in fprintf. gzprintf returns the number of | 715 | control of the format string, as in fprintf. gzprintf returns the number of |
| 712 | uncompressed bytes actually written (0 in case of error). | 716 | uncompressed bytes actually written (0 in case of error). |
| 713 | */ | 717 | */ |
| 714 | 718 | ||
| 715 | extern int ZEXPORT gzputs OF((gzFile file, const char *s)); | 719 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); |
| 716 | /* | 720 | /* |
| 717 | Writes the given null-terminated string to the compressed file, excluding | 721 | Writes the given null-terminated string to the compressed file, excluding |
| 718 | the terminating null character. | 722 | the terminating null character. |
| 719 | gzputs returns the number of characters written, or -1 in case of error. | 723 | gzputs returns the number of characters written, or -1 in case of error. |
| 720 | */ | 724 | */ |
| 721 | 725 | ||
| 722 | extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | 726 | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); |
| 723 | /* | 727 | /* |
| 724 | Reads bytes from the compressed file until len-1 characters are read, or | 728 | Reads bytes from the compressed file until len-1 characters are read, or |
| 725 | a newline character is read and transferred to buf, or an end-of-file | 729 | a newline character is read and transferred to buf, or an end-of-file |
| @@ -728,19 +732,19 @@ extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | |||
| 728 | gzgets returns buf, or Z_NULL in case of error. | 732 | gzgets returns buf, or Z_NULL in case of error. |
| 729 | */ | 733 | */ |
| 730 | 734 | ||
| 731 | extern int ZEXPORT gzputc OF((gzFile file, int c)); | 735 | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); |
| 732 | /* | 736 | /* |
| 733 | Writes c, converted to an unsigned char, into the compressed file. | 737 | Writes c, converted to an unsigned char, into the compressed file. |
| 734 | gzputc returns the value that was written, or -1 in case of error. | 738 | gzputc returns the value that was written, or -1 in case of error. |
| 735 | */ | 739 | */ |
| 736 | 740 | ||
| 737 | extern int ZEXPORT gzgetc OF((gzFile file)); | 741 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); |
| 738 | /* | 742 | /* |
| 739 | Reads one byte from the compressed file. gzgetc returns this byte | 743 | Reads one byte from the compressed file. gzgetc returns this byte |
| 740 | or -1 in case of end of file or error. | 744 | or -1 in case of end of file or error. |
| 741 | */ | 745 | */ |
| 742 | 746 | ||
| 743 | extern int ZEXPORT gzflush OF((gzFile file, int flush)); | 747 | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); |
| 744 | /* | 748 | /* |
| 745 | Flushes all pending output into the compressed file. The parameter | 749 | Flushes all pending output into the compressed file. The parameter |
| 746 | flush is as in the deflate() function. The return value is the zlib | 750 | flush is as in the deflate() function. The return value is the zlib |
| @@ -750,10 +754,11 @@ extern int ZEXPORT gzflush OF((gzFile file, int flush)); | |||
| 750 | degrade compression. | 754 | degrade compression. |
| 751 | */ | 755 | */ |
| 752 | 756 | ||
| 753 | extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); | 757 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, |
| 758 | z_off_t offset, int whence)); | ||
| 754 | /* | 759 | /* |
| 755 | Sets the starting position for the next gzread or gzwrite on the given | 760 | Sets the starting position for the next gzread or gzwrite on the |
| 756 | compressed file. The offset represents a number of bytes in the | 761 | given compressed file. The offset represents a number of bytes in the |
| 757 | uncompressed data stream. The whence parameter is defined as in lseek(2); | 762 | uncompressed data stream. The whence parameter is defined as in lseek(2); |
| 758 | the value SEEK_END is not supported. | 763 | the value SEEK_END is not supported. |
| 759 | If the file is opened for reading, this function is emulated but can be | 764 | If the file is opened for reading, this function is emulated but can be |
| @@ -767,14 +772,14 @@ extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); | |||
| 767 | would be before the current position. | 772 | would be before the current position. |
| 768 | */ | 773 | */ |
| 769 | 774 | ||
| 770 | extern int ZEXPORT gzrewind OF((gzFile file)); | 775 | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); |
| 771 | /* | 776 | /* |
| 772 | Rewinds the given file. This function is supported only for reading. | 777 | Rewinds the given file. This function is supported only for reading. |
| 773 | 778 | ||
| 774 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | 779 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) |
| 775 | */ | 780 | */ |
| 776 | 781 | ||
| 777 | extern z_off_t ZEXPORT gztell OF((gzFile file)); | 782 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); |
| 778 | /* | 783 | /* |
| 779 | Returns the starting position for the next gzread or gzwrite on the | 784 | Returns the starting position for the next gzread or gzwrite on the |
| 780 | given compressed file. This position represents a number of bytes in the | 785 | given compressed file. This position represents a number of bytes in the |
| @@ -783,20 +788,20 @@ extern z_off_t ZEXPORT gztell OF((gzFile file)); | |||
| 783 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) | 788 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) |
| 784 | */ | 789 | */ |
| 785 | 790 | ||
| 786 | extern int ZEXPORT gzeof OF((gzFile file)); | 791 | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); |
| 787 | /* | 792 | /* |
| 788 | Returns 1 when EOF has previously been detected reading the given | 793 | Returns 1 when EOF has previously been detected reading the given |
| 789 | input stream, otherwise zero. | 794 | input stream, otherwise zero. |
| 790 | */ | 795 | */ |
| 791 | 796 | ||
| 792 | extern int ZEXPORT gzclose OF((gzFile file)); | 797 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); |
| 793 | /* | 798 | /* |
| 794 | Flushes all pending output if necessary, closes the compressed file | 799 | Flushes all pending output if necessary, closes the compressed file |
| 795 | and deallocates all the (de)compression state. The return value is the zlib | 800 | and deallocates all the (de)compression state. The return value is the zlib |
| 796 | error number (see function gzerror below). | 801 | error number (see function gzerror below). |
| 797 | */ | 802 | */ |
| 798 | 803 | ||
| 799 | extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | 804 | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); |
| 800 | /* | 805 | /* |
| 801 | Returns the error message for the last error which occurred on the | 806 | Returns the error message for the last error which occurred on the |
| 802 | given compressed file. errnum is set to zlib error number. If an | 807 | given compressed file. errnum is set to zlib error number. If an |
| @@ -813,7 +818,7 @@ extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | |||
| 813 | compression library. | 818 | compression library. |
| 814 | */ | 819 | */ |
| 815 | 820 | ||
| 816 | extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | 821 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); |
| 817 | 822 | ||
| 818 | /* | 823 | /* |
| 819 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | 824 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and |
| @@ -830,7 +835,7 @@ extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | |||
| 830 | if (adler != original_adler) error(); | 835 | if (adler != original_adler) error(); |
| 831 | */ | 836 | */ |
| 832 | 837 | ||
| 833 | extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | 838 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
| 834 | /* | 839 | /* |
| 835 | Update a running crc with the bytes buf[0..len-1] and return the updated | 840 | Update a running crc with the bytes buf[0..len-1] and return the updated |
| 836 | crc. If buf is NULL, this function returns the required initial value | 841 | crc. If buf is NULL, this function returns the required initial value |
| @@ -852,16 +857,16 @@ extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | |||
| 852 | /* deflateInit and inflateInit are macros to allow checking the zlib version | 857 | /* deflateInit and inflateInit are macros to allow checking the zlib version |
| 853 | * and the compiler's view of z_stream: | 858 | * and the compiler's view of z_stream: |
| 854 | */ | 859 | */ |
| 855 | extern int ZEXPORT deflateInit_ OF((z_streamp strm, int level, | 860 | ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, |
| 856 | const char *version, int stream_size)); | ||
| 857 | extern int ZEXPORT inflateInit_ OF((z_streamp strm, | ||
| 858 | const char *version, int stream_size)); | ||
| 859 | extern int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | ||
| 860 | int windowBits, int memLevel, | ||
| 861 | int strategy, const char *version, | ||
| 862 | int stream_size)); | ||
| 863 | extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | ||
| 864 | const char *version, int stream_size)); | 861 | const char *version, int stream_size)); |
| 862 | ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, | ||
| 863 | const char *version, int stream_size)); | ||
| 864 | ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | ||
| 865 | int windowBits, int memLevel, | ||
| 866 | int strategy, const char *version, | ||
| 867 | int stream_size)); | ||
| 868 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | ||
| 869 | const char *version, int stream_size)); | ||
| 865 | #define deflateInit(strm, level) \ | 870 | #define deflateInit(strm, level) \ |
| 866 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | 871 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) |
| 867 | #define inflateInit(strm) \ | 872 | #define inflateInit(strm) \ |
| @@ -877,9 +882,9 @@ extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | |||
| 877 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | 882 | struct internal_state {int dummy;}; /* hack for buggy compilers */ |
| 878 | #endif | 883 | #endif |
| 879 | 884 | ||
| 880 | extern const char * ZEXPORT zError OF((int err)); | 885 | ZEXTERN const char * ZEXPORT zError OF((int err)); |
| 881 | extern int ZEXPORT inflateSyncPoint OF((z_streamp z)); | 886 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); |
| 882 | extern const uLongf * ZEXPORT get_crc_table OF((void)); | 887 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
| 883 | 888 | ||
| 884 | #ifdef __cplusplus | 889 | #ifdef __cplusplus |
| 885 | } | 890 | } |
| @@ -60,7 +60,7 @@ const char * ZEXPORT zError(err) | |||
| 60 | 60 | ||
| 61 | void zmemcpy(dest, source, len) | 61 | void zmemcpy(dest, source, len) |
| 62 | Bytef* dest; | 62 | Bytef* dest; |
| 63 | Bytef* source; | 63 | const Bytef* source; |
| 64 | uInt len; | 64 | uInt len; |
| 65 | { | 65 | { |
| 66 | if (len == 0) return; | 66 | if (len == 0) return; |
| @@ -70,8 +70,8 @@ void zmemcpy(dest, source, len) | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | int zmemcmp(s1, s2, len) | 72 | int zmemcmp(s1, s2, len) |
| 73 | Bytef* s1; | 73 | const Bytef* s1; |
| 74 | Bytef* s2; | 74 | const Bytef* s2; |
| 75 | uInt len; | 75 | uInt len; |
| 76 | { | 76 | { |
| 77 | uInt j; | 77 | uInt j; |
| @@ -178,7 +178,7 @@ void zcfree (voidpf opaque, voidpf ptr) | |||
| 178 | 178 | ||
| 179 | # define MY_ZCALLOC | 179 | # define MY_ZCALLOC |
| 180 | 180 | ||
| 181 | #if (!defined(_MSC_VER) || (_MSC_VER < 600)) | 181 | #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) |
| 182 | # define _halloc halloc | 182 | # define _halloc halloc |
| 183 | # define _hfree hfree | 183 | # define _hfree hfree |
| 184 | #endif | 184 | #endif |
| @@ -75,7 +75,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
| 75 | 75 | ||
| 76 | #ifdef MSDOS | 76 | #ifdef MSDOS |
| 77 | # define OS_CODE 0x00 | 77 | # define OS_CODE 0x00 |
| 78 | # ifdef __TURBOC__ | 78 | # if defined(__TURBOC__) || defined(__BORLANDC__) |
| 79 | # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) | 79 | # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) |
| 80 | /* Allow compilation with ANSI keywords only enabled */ | 80 | /* Allow compilation with ANSI keywords only enabled */ |
| 81 | void _Cdecl farfree( void *block ); | 81 | void _Cdecl farfree( void *block ); |
| @@ -112,13 +112,12 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
| 112 | 112 | ||
| 113 | #if defined(MACOS) || defined(TARGET_OS_MAC) | 113 | #if defined(MACOS) || defined(TARGET_OS_MAC) |
| 114 | # define OS_CODE 0x07 | 114 | # define OS_CODE 0x07 |
| 115 | # ifndef fdopen | 115 | # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os |
| 116 | # define fdopen(fd,mode) NULL /* No fdopen() */ | 116 | # include <unix.h> /* for fdopen */ |
| 117 | # endif | 117 | # else |
| 118 | #endif | 118 | # ifndef fdopen |
| 119 | #if defined(__MWERKS__) && !defined(fdopen) | 119 | # define fdopen(fd,mode) NULL /* No fdopen() */ |
| 120 | # if __dest_os != __be_os && __dest_os != __win32_os | 120 | # endif |
| 121 | # define fdopen(fd,mode) NULL | ||
| 122 | # endif | 121 | # endif |
| 123 | #endif | 122 | #endif |
| 124 | 123 | ||
| @@ -134,7 +133,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
| 134 | # define fdopen(fd,mode) NULL /* No fdopen() */ | 133 | # define fdopen(fd,mode) NULL /* No fdopen() */ |
| 135 | #endif | 134 | #endif |
| 136 | 135 | ||
| 137 | #if (defined(_MSC_VER) && (_MSC_VER >= 600)) | 136 | #if (defined(_MSC_VER) && (_MSC_VER > 600)) |
| 138 | # define fdopen(fd,type) _fdopen(fd,type) | 137 | # define fdopen(fd,type) _fdopen(fd,type) |
| 139 | #endif | 138 | #endif |
| 140 | 139 | ||
| @@ -182,8 +181,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
| 182 | # define zmemzero(dest, len) memset(dest, 0, len) | 181 | # define zmemzero(dest, len) memset(dest, 0, len) |
| 183 | # endif | 182 | # endif |
| 184 | #else | 183 | #else |
| 185 | extern void zmemcpy OF((Bytef* dest, Bytef* source, uInt len)); | 184 | extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); |
| 186 | extern int zmemcmp OF((Bytef* s1, Bytef* s2, uInt len)); | 185 | extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); |
| 187 | extern void zmemzero OF((Bytef* dest, uInt len)); | 186 | extern void zmemzero OF((Bytef* dest, uInt len)); |
| 188 | #endif | 187 | #endif |
| 189 | 188 | ||
