Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 8e34b3a802 | ||
|   | 13a294f044 | 
							
								
								
									
										68
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								ChangeLog
									
									
									
									
									
								
							| @@ -1,5 +1,63 @@ | ||||
|  | ||||
| 		ChangeLog file for zlib | ||||
|                 ChangeLog file for zlib | ||||
| Changes in 1.2.0.2 (13 July 2003) | ||||
| - Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons | ||||
| - Attempt to avoid warnings in crc32.c for pointer-int conversion | ||||
| - Add AIX to configure, remove aix directory [Bakker] | ||||
| - Add some casts to minigzip.c | ||||
| - Improve checking after insecure sprintf() or vsprintf() calls | ||||
| - Remove #elif's from crc32.c | ||||
| - Change leave label to inf_leave in inflate.c and infback.c to avoid | ||||
|   library conflicts | ||||
| - Remove inflate gzip decoding by default--only enable gzip decoding by | ||||
|   special request for stricter backward compatibility | ||||
| - Add zlibCompileFlags() function to return compilation information | ||||
| - More typecasting in deflate.c to avoid warnings | ||||
| - Remove leading underscore from _Capital #defines [Truta] | ||||
| - Fix configure to link shared library when testing | ||||
| - Add some Windows CE target adjustments [Mai] | ||||
| - Remove #define ZLIB_DLL in zconf.h [Vollant] | ||||
| - Add zlib.3 [Rodgers] | ||||
| - Update RFC URL in deflate.c and algorithm.txt [Mai] | ||||
| - Add zlib_dll_FAQ.txt to contrib [Truta] | ||||
| - Add UL to some constants [Truta] | ||||
| - Update minizip and vstudio [Vollant] | ||||
| - Remove vestigial NEED_DUMMY_RETURN from zconf.in.h | ||||
| - Expand use of NO_DUMMY_DECL to avoid all dummy structures | ||||
| - Added iostream3 to contrib [Schwardt] | ||||
| - Replace rewind() with fseek() for WinCE [Truta] | ||||
| - Improve setting of zlib format compression level flags | ||||
|     - Report 0 for huffman and rle strategies and for level == 0 or 1 | ||||
|     - Report 2 only for level == 6 | ||||
| - Only deal with 64K limit when necessary at compile time [Truta] | ||||
| - Allow TOO_FAR check to be turned off at compile time [Truta] | ||||
| - Added gzclearerr() function [Souza] | ||||
| - Added gzungetc() function | ||||
|  | ||||
| Changes in 1.2.0.1 (17 March 2003) | ||||
| - Add Z_RLE strategy for run-length encoding [Truta] | ||||
|     - When Z_RLE requested, restrict matches to distance one | ||||
|     - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE | ||||
| - Correct FASTEST compilation to allow level == 0 | ||||
| - Clean up what gets compiled for FASTEST | ||||
| - Incorporate changes to zconf.in.h [Vollant] | ||||
|     - Refine detection of Turbo C need for dummy returns | ||||
|     - Refine ZLIB_DLL compilation | ||||
|     - Include additional header file on VMS for off_t typedef | ||||
| - Try to use _vsnprintf where it supplants vsprintf [Vollant] | ||||
| - Add some casts in inffast.c | ||||
| - Enchance comments in zlib.h on what happens if gzprintf() tries to | ||||
|   write more than 4095 bytes before compression | ||||
| - Remove unused state from inflateBackEnd() | ||||
| - Remove exit(0) from minigzip.c, example.c | ||||
| - Get rid of all those darn tabs | ||||
| - Add "check" target to Makefile.in that does the same thing as "test" | ||||
| - Add "mostlyclean" and "maintainer-clean" targets to Makefile.in | ||||
| - Update contrib/inflate86 [Anderson] | ||||
| - Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] | ||||
| - Add msdos and win32 directories with makefiles [Truta] | ||||
| - More additions and improvements to the FAQ | ||||
|  | ||||
| Changes in 1.2.0 (9 March 2003) | ||||
| - New and improved inflate code | ||||
|     - About 20% faster | ||||
| @@ -236,13 +294,13 @@ Changes in 1.0.6 (19 Jan 1998) | ||||
| - added Makefile.nt (thanks to Stephen Williams) | ||||
| - added the unsupported "contrib" directory: | ||||
|    contrib/asm386/ by Gilles Vollant <info@winimage.com> | ||||
| 	386 asm code replacing longest_match(). | ||||
|         386 asm code replacing longest_match(). | ||||
|    contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> | ||||
|         A C++ I/O streams interface to the zlib gz* functions | ||||
|    contrib/iostream2/  by Tyge L<>vset <Tyge.Lovset@cmr.no> | ||||
| 	Another C++ I/O streams interface | ||||
|         Another C++ I/O streams interface | ||||
|    contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag@tid.es> | ||||
| 	A very simple tar.gz file extractor using zlib | ||||
|         A very simple tar.gz file extractor using zlib | ||||
|    contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl> | ||||
|         How to use compress(), uncompress() and the gz* functions from VB. | ||||
| - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression | ||||
| @@ -269,7 +327,7 @@ Changes in 1.0.6 (19 Jan 1998) | ||||
| - add NEED_DUMMY_RETURN for Borland | ||||
| - use variable z_verbose for tracing in debug mode (L. Peter Deutsch). | ||||
| - allow compilation with CC | ||||
| - defined STDC for OS/2 (David Charlap)	 | ||||
| - defined STDC for OS/2 (David Charlap) | ||||
| - limit external names to 8 chars for MVS (Thomas Lund) | ||||
| - in minigzip.c, use static buffers only for 16-bit systems | ||||
| - fix suffix check for "minigzip -d foo.gz" | ||||
|   | ||||
							
								
								
									
										106
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										106
									
								
								FAQ
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
|  | ||||
| 		Frequently Asked Questions about zlib | ||||
|                 Frequently Asked Questions about zlib | ||||
|  | ||||
|  | ||||
| If your question is not there, please check the zlib home page  | ||||
| @@ -90,13 +90,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
|     ./configure -s | ||||
|     make | ||||
|  | ||||
| 14. Why does "make test" fail on Mac OS X? | ||||
| 14. How do I install a shared zlib library on Unix? | ||||
|  | ||||
|     Mac OS X already includes zlib as a shared library, and so -lz links the | ||||
|     shared library instead of the one that the "make" compiled. The two are | ||||
|     incompatible due to different compile-time options. Simply change the -lz | ||||
|     in the Makefile to libz.a, and it will use the compiled library instead | ||||
|     of the shared one and the "make test" will succeed. | ||||
|     make install | ||||
|  | ||||
|     However, many flavors of Unix come with a shared zlib already installed. | ||||
|     Before going to the trouble of compiling a shared version of zlib and | ||||
|     trying to install it, you may want to check if it's already there! If you | ||||
|     can #include <zlib.h>, it's there. The -lz option will probably link to it. | ||||
|  | ||||
| 15. I have a question about OttoPDF | ||||
|  | ||||
| @@ -108,8 +109,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
|     The compress and deflate functions produce data in the zlib format, which | ||||
|     is different and incompatible with the gzip format. The gz* functions in | ||||
|     zlib on the other hand use the gzip format. Both the zlib and gzip | ||||
|     formats use the same compressed data format, but have different headers | ||||
|     and trailers. | ||||
|     formats use the same compressed data format internally, but have different | ||||
|     headers and trailers around the compressed data. | ||||
|  | ||||
| 17. Ok, so why are there two different formats? | ||||
|  | ||||
| @@ -127,12 +128,13 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
| 19. Is zlib thread-safe? | ||||
|  | ||||
|     Yes. However any library routines that zlib uses and any application- | ||||
|     provided memory allocation routines must also be thread-safe. Of course, | ||||
|     you should only operate on any given zlib or gzip stream from a single | ||||
|     thread. zlib's gz* functions use stdio library routines, and most of | ||||
|     zlib's functions use the library memory allocation routines by default. | ||||
|     zlib's Init functions allow for the application to provide custom memory | ||||
|     allocation routines. | ||||
|     provided memory allocation routines must also be thread-safe. zlib's gz* | ||||
|     functions use stdio library routines, and most of zlib's functions use the | ||||
|     library memory allocation routines by default. zlib's Init functions allow | ||||
|     for the application to provide custom memory allocation routines. | ||||
|  | ||||
|     Of course, you should only operate on any given zlib or gzip stream from a | ||||
|     single thread at a time. | ||||
|  | ||||
| 20. Can I use zlib in my commercial application? | ||||
|  | ||||
| @@ -142,24 +144,44 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
|  | ||||
|     No. Please read the license in zlib.h. | ||||
|  | ||||
| 22. Will zlib work on a big-endian or little-endian architecture, and can I | ||||
| 22. The license says that altered source versions must be "plainly marked". So | ||||
|     what exactly do I need to do to meet that requirement? | ||||
|  | ||||
|     You need to append something the ZLIB_VERSION string in zlib.h. For | ||||
|     example, if the version of the base zlib you are altering is "1.2.3", then | ||||
|     you could change the string to "1.2.3-fred-mods-v3". You should not change | ||||
|     it to "1.2.4" or "1.2.3.1" since the zlib authors would like to reserve | ||||
|     those forms of the version for their own use. | ||||
|  | ||||
|     For altered source distributions, you should also note the origin and | ||||
|     nature of the changes in zlib.h, as well as in ChangeLog and README, along | ||||
|     with the dates of the alterations. The origin should include at least your | ||||
|     name (or your company's name), and an email address to contact for help or | ||||
|     issues with the library. | ||||
|  | ||||
|     Note that distributing a compiled zlib library along with zlib.h and | ||||
|     zconf.h is also a source distribution, and so you should change | ||||
|     ZLIB_VERSION and note the origin and nature of the changes in zlib.h as you | ||||
|     would for a full source distribution. | ||||
|  | ||||
| 23. Will zlib work on a big-endian or little-endian architecture, and can I | ||||
|     exchange compressed data between them? | ||||
|  | ||||
|     Yes and yes. | ||||
|  | ||||
| 23. Will zlib work on a 64-bit machine? | ||||
| 24. Will zlib work on a 64-bit machine? | ||||
|  | ||||
|     It should. It has been tested on 64-bit machines, and has no dependence | ||||
|     on any data types being limited to 32-bits in length. If you have any | ||||
|     difficulties, please provide a complete problem report to zlib@gzip.org | ||||
|  | ||||
| 24. Will zlib decompress data from the PKWare Data Compression Library? | ||||
| 25. Will zlib decompress data from the PKWare Data Compression Library? | ||||
|  | ||||
|     No. The PKWare DCL uses a completely different compressed data format | ||||
|     than does PKZIP and zlib. However, you can look in zlib's contrib/blast | ||||
|     directory for a possible solution to your problem. | ||||
|  | ||||
| 25. Can I access data randomly in a compressed stream? | ||||
| 26. Can I access data randomly in a compressed stream? | ||||
|  | ||||
|     No, not without some preparation. If when compressing you periodically | ||||
|     use Z_FULL_FLUSH, carefully write all the pending data at those points, | ||||
| @@ -167,76 +189,84 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
|     at those points. You have to be careful to not use Z_FULL_FLUSH too | ||||
|     often, since it can significantly degrade compression. | ||||
|  | ||||
| 26. Does zlib work on MVS, OS/390, CICS, etc.? | ||||
| 27. Does zlib work on MVS, OS/390, CICS, etc.? | ||||
|  | ||||
|     We don't know for sure. We have heard occasional reports of success on | ||||
|     these systems. If you do use it on one of these, please provide us with | ||||
|     a report, instructions, and patches that we can reference when we get | ||||
|     these questions. Thanks. | ||||
|  | ||||
| 27. Is there some simpler, easier to read version of inflate I can look at | ||||
| 28. Is there some simpler, easier to read version of inflate I can look at | ||||
|     to understand the deflate format? | ||||
|  | ||||
|     First off, you should read RFC 1951. Second, yes. Look in zlib's | ||||
|     contrib/puff directory. | ||||
|  | ||||
| 28. Does zlib infringe on any patents? | ||||
| 29. Does zlib infringe on any patents? | ||||
|  | ||||
|     As far as we know, no. In fact, that was originally the whole point behind | ||||
|     zlib. Look here for some more information: | ||||
|  | ||||
|     http://www.gzip.org/#faq11 | ||||
|  | ||||
| 29. Can zlib work with greater than 4 GB of data? | ||||
| 30. Can zlib work with greater than 4 GB of data? | ||||
|  | ||||
|     Yes. inflate() and deflate() will process any amount of data correctly. | ||||
|     However the strm.total_in and strm_total_out counters may be limited to | ||||
|     4 GB. The user can easily set up their own counters updated after each | ||||
|     4 GB. The application can easily set up its own counters updated after each | ||||
|     call of inflate() or deflate() to count beyond 4 GB. compress() and | ||||
|     uncompress() may be limited to 4 GB, since they operate in a single | ||||
|     call using unsigned long lengths. gzseek() may be limited to 4 GB | ||||
|     uncompress() may be limited to 4 GB, since they operate in a single call | ||||
|     using unsigned long lengths. gzseek() and gztell() may be limited to 4 GB | ||||
|     depending on how zlib is compiled. | ||||
|  | ||||
| 30. Does zlib have any security vulnerabilities? | ||||
| 31. Does zlib have any security vulnerabilities? | ||||
|  | ||||
|     The only one that we are aware of is potentially in gzprintf(). If zlib | ||||
|     is compiled to use sprintf() or vsprintf(), then there is no protection | ||||
|     against a buffer overflow of a 4K string space, other than the caller of | ||||
|     gzprintf() assuring that the output will not exceed 4K. On the other | ||||
|     hand, if zlib is compiled to use snprintf() or vsnprintf(), then there is | ||||
|     no vulnerability. | ||||
|     hand, if zlib is compiled to use snprintf() or vsnprintf(), which should | ||||
|     normally be the case, then there is no vulnerability. The ./configure | ||||
|     script will display warnings if an insecure variation of sprintf() will | ||||
|     be used by gzprintf(). Also the zlibCompileFlags() functions will return | ||||
|     information on what variant of sprintf() is used by gzprintf(). | ||||
|  | ||||
|     If you don't have snprintf() or vsnprintf() and would like one, you can | ||||
|     find a portable implementation here: | ||||
|  | ||||
|         http://www.ijs.si/software/snprintf/ | ||||
|  | ||||
|     Note that you should be using the most recent version of zlib. Versions | ||||
|     1.1.3 and before were subject to a double-free vulnerability. | ||||
|  | ||||
| 31. Is there a Java version of zlib? | ||||
| 32. Is there a Java version of zlib? | ||||
|  | ||||
|     Probably what you want is to use zlib in Java. zlib is already included | ||||
|     as part of the Java SDK in the java.util.zip class. If you really want | ||||
|     a version of zlib written in the Java language, look on the zlib home | ||||
|     page for links: http://www.zlib.org/ | ||||
|  | ||||
| 32. I get this or that compiler or source-code scanner warning. Can't you guys | ||||
|     write proper code? | ||||
| 33. I get this or that compiler or source-code scanner warning when I crank it | ||||
|     up to maximally-pendantic. Can't you guys write proper code? | ||||
|  | ||||
|     Many years ago, we gave up attempting to avoid warnings on every compiler | ||||
|     in the universe. It just got to be a waste of time, and some compilers | ||||
|     were downright silly. So now, we simply make sure that the code always | ||||
|     works. | ||||
|  | ||||
| 33. Will zlib read the (insert any ancient or arcane format here) compressed | ||||
| 34. Will zlib read the (insert any ancient or arcane format here) compressed | ||||
|     data format? | ||||
|  | ||||
|     Probably not. Look in the comp.compression FAQ for pointers to various | ||||
|     formats and associated software. | ||||
|  | ||||
| 34. How can I encrypt/decrypt zip files with zlib? | ||||
| 35. How can I encrypt/decrypt zip files with zlib? | ||||
|  | ||||
|     zlib doesn't support encryption. PKZIP encryption is very weak and can be | ||||
|     broken with freely available programs. To get strong encryption, use gpg | ||||
|     which already includes zlib compression. | ||||
|  | ||||
| 35. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? | ||||
| 36. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? | ||||
|  | ||||
|     "gzip" is the gzip format, and "deflate" is the zlib format. They should | ||||
|     probably have called the second one "zlib" instead to avoid confusion | ||||
| @@ -250,14 +280,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | ||||
|     for), using the "gzip" transfer encoding is probably more reliable due to | ||||
|     an unfortunate choice of name on the part of the HTTP 1.1 authors. | ||||
|  | ||||
| 36. Does zlib support the new "Deflate64" format introduced by PKWare? | ||||
| 37. Does zlib support the new "Deflate64" format introduced by PKWare? | ||||
|  | ||||
|     No. PKWare has apparently decided to keep that format proprietary, since | ||||
|     they have not documented it as they have previous compression formats. | ||||
|     In any case, the compression improvements are so modest compared to other | ||||
|     more modern approaches, that it's not worth the effort to implement. | ||||
|  | ||||
| 37. Can you please sign these lengthy legal documents and fax them back to us | ||||
| 38. Can you please sign these lengthy legal documents and fax them back to us | ||||
|     so that we can use your software in our product? | ||||
|  | ||||
|     No. | ||||
|     No. Go away. | ||||
|   | ||||
							
								
								
									
										34
									
								
								INDEX
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								INDEX
									
									
									
									
									
								
							| @@ -1,22 +1,24 @@ | ||||
| ChangeLog		history of changes | ||||
| FAQ			Frequently Asked Questions about zlib | ||||
| INDEX			this file | ||||
| Makefile		makefile for Unix (generated by configure) | ||||
| Makefile.in		makefile for Unix (template for configure) | ||||
| README			guess what | ||||
| algorithm.txt		description of the (de)compression algorithm | ||||
| configure		configure script for Unix | ||||
| zconf.in.h		template for zconf.h (used by configure) | ||||
| ChangeLog       history of changes | ||||
| FAQ             Frequently Asked Questions about zlib | ||||
| INDEX           this file | ||||
| Makefile        makefile for Unix (generated by configure) | ||||
| Makefile.in     makefile for Unix (template for configure) | ||||
| README          guess what | ||||
| algorithm.txt   description of the (de)compression algorithm | ||||
| configure       configure script for Unix | ||||
| zconf.in.h      template for zconf.h (used by configure) | ||||
|  | ||||
| aix/			instructions for building an AIX shared library | ||||
| old/			makefiles for various architectures and zlib documentation | ||||
| 			that has not yet been updated for zlib 1.2.x | ||||
| aix/            instructions for building an AIX shared library | ||||
| msdos/		makefiles for MSDOS | ||||
| old/            makefiles for various architectures and zlib documentation | ||||
|                 files that have not yet been updated for zlib 1.2.x | ||||
| win32/		makefiles for Windows | ||||
|  | ||||
| 		zlib public header files (must be kept): | ||||
|                 zlib public header files (must be kept): | ||||
| zconf.h | ||||
| zlib.h | ||||
|  | ||||
| 		private source files used to build the zlib library: | ||||
|                 private source files used to build the zlib library: | ||||
| adler32.c | ||||
| compress.c | ||||
| crc32.c | ||||
| @@ -38,9 +40,9 @@ uncompr.c | ||||
| zutil.c | ||||
| zutil.h | ||||
|  | ||||
| 		source files for sample programs: | ||||
|                 source files for sample programs: | ||||
| example.c | ||||
| minigzip.c | ||||
|  | ||||
| 		unsupported contribution by third parties | ||||
|                 unsupported contribution by third parties | ||||
| See contrib/README.contrib | ||||
|   | ||||
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							| @@ -24,7 +24,7 @@ LDFLAGS=libz.a | ||||
| LDSHARED=$(CC) | ||||
| CPP=$(CC) -E | ||||
|  | ||||
| VER=1.2.0 | ||||
| VER=1.2.0.2 | ||||
| LIBS=libz.a | ||||
| SHAREDLIB=libz.so | ||||
|  | ||||
| @@ -61,6 +61,7 @@ DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ | ||||
|  | ||||
| all: example minigzip | ||||
|  | ||||
| check: test | ||||
| test: all | ||||
| 	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||||
| 	echo hello world | ./minigzip | ./minigzip -d || \ | ||||
| @@ -123,10 +124,12 @@ uninstall: | ||||
| 	  rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ | ||||
| 	fi | ||||
|  | ||||
| mostlyclean: clean | ||||
| clean: | ||||
| 	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ | ||||
| 	   _match.s maketree | ||||
|  | ||||
| maintainer-clean: distclean | ||||
| distclean:	clean | ||||
| 	cp -p Makefile.in Makefile | ||||
| 	cp -p zconf.in.h zconf.h | ||||
|   | ||||
| @@ -24,7 +24,7 @@ LDFLAGS=libz.a | ||||
| LDSHARED=$(CC) | ||||
| CPP=$(CC) -E | ||||
|  | ||||
| VER=1.2.0 | ||||
| VER=1.2.0.2 | ||||
| LIBS=libz.a | ||||
| SHAREDLIB=libz.so | ||||
|  | ||||
| @@ -61,6 +61,7 @@ DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ | ||||
|  | ||||
| all: example minigzip | ||||
|  | ||||
| check: test | ||||
| test: all | ||||
| 	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||||
| 	echo hello world | ./minigzip | ./minigzip -d || \ | ||||
| @@ -123,10 +124,12 @@ uninstall: | ||||
| 	  rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ | ||||
| 	fi | ||||
|  | ||||
| mostlyclean: clean | ||||
| clean: | ||||
| 	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ | ||||
| 	   _match.s maketree | ||||
|  | ||||
| maintainer-clean: distclean | ||||
| distclean:	clean | ||||
| 	cp -p Makefile.in Makefile | ||||
| 	cp -p zconf.in.h zconf.h | ||||
|   | ||||
							
								
								
									
										112
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								README
									
									
									
									
									
								
							| @@ -1,38 +1,40 @@ | ||||
| zlib 1.2.0 is a general purpose data compression library.  All the code | ||||
| is thread safe.  The data format used by the zlib library | ||||
| is described by RFCs (Request for Comments) 1950 to 1952 in the files  | ||||
| http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate | ||||
| format) and rfc1952.txt (gzip format). These documents are also available in | ||||
| other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html | ||||
| ZLIB DATA COMPRESSION LIBRARY | ||||
|  | ||||
| zlib 1.2.0.2 is a general purpose data compression library.  All the code is | ||||
| thread safe.  The data format used by the zlib library is described by RFCs | ||||
| (Request for Comments) 1950 to 1952 in the files | ||||
| http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) | ||||
| and rfc1952.txt (gzip format). These documents are also available in other | ||||
| formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html | ||||
|  | ||||
| All functions of the compression library are documented in the file zlib.h | ||||
| (volunteer to write man pages welcome, contact jloup@gzip.org). A usage | ||||
| example of the library is given in the file example.c which also tests that | ||||
| the library is working correctly. Another example is given in the file | ||||
| minigzip.c. The compression library itself is composed of all source files | ||||
| except example.c and minigzip.c. | ||||
| (volunteer to write man pages welcome, contact jloup@gzip.org). A usage example | ||||
| of the library is given in the file example.c which also tests that the library | ||||
| is working correctly. Another example is given in the file minigzip.c. The | ||||
| compression library itself is composed of all source files except example.c and | ||||
| minigzip.c. | ||||
|  | ||||
| To compile all files and run the test program, follow the instructions | ||||
| given at the top of Makefile. In short "make test; make install" | ||||
| should work for most machines. For Unix: "./configure; make test; make install" | ||||
| For MSDOS, use one of the special makefiles such as Makefile.msc. | ||||
| For VMS, use Make_vms.com or descrip.mms. | ||||
| To compile all files and run the test program, follow the instructions given at | ||||
| the top of Makefile. In short "make test; make install" should work for most | ||||
| machines. For Unix: "./configure; make test; make install" For MSDOS, use one | ||||
| of the special makefiles such as Makefile.msc. For VMS, use Make_vms.com or | ||||
| descrip.mms. | ||||
|  | ||||
| Questions about zlib should be sent to <zlib@gzip.org>, or to | ||||
| Gilles Vollant <info@winimage.com> for the Windows DLL version. | ||||
| The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/ | ||||
| Before reporting a problem, please check this site to verify that | ||||
| you have the latest version of zlib; otherwise get the latest version and | ||||
| check whether the problem still exists or not. | ||||
| Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant | ||||
| <info@winimage.com> for the Windows DLL version. The zlib home page is | ||||
| http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, | ||||
| please check this site to verify that you have the latest version of zlib; | ||||
| otherwise get the latest version and check whether the problem still exists or | ||||
| not. | ||||
|  | ||||
| PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html | ||||
| before asking for help. | ||||
| PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking | ||||
| for help. | ||||
|  | ||||
| Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 | ||||
| issue of  Dr. Dobb's Journal; a copy of the article is available in | ||||
| http://dogma.net/markn/articles/zlibtool/zlibtool.htm | ||||
|  | ||||
| The changes made in version 1.2.0 are documented in the file ChangeLog. | ||||
| The changes made in version 1.2.0.2 are documented in the file ChangeLog. | ||||
|  | ||||
| Unsupported third party contributions are provided in directory "contrib". | ||||
|  | ||||
| @@ -40,56 +42,56 @@ A Java implementation of zlib is available in the Java Development Kit | ||||
| http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html | ||||
| See the zlib home page http://www.zlib.org for details. | ||||
|  | ||||
| A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> | ||||
| is in the CPAN (Comprehensive Perl Archive Network) sites | ||||
| A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the | ||||
| CPAN (Comprehensive Perl Archive Network) sites | ||||
| http://www.cpan.org/modules/by-module/Compress/ | ||||
|  | ||||
| A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> | ||||
| is available in Python 1.5 and later versions, see | ||||
| A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> is | ||||
| available in Python 1.5 and later versions, see | ||||
| http://www.python.org/doc/lib/module-zlib.html | ||||
|  | ||||
| A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> | ||||
| is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html | ||||
| A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is | ||||
| availlable at http://www.westend.com/~kupries/doc/trf/man/man.html | ||||
|  | ||||
| An experimental package to read and write files in .zip format, | ||||
| written on top of zlib by Gilles Vollant <info@winimage.com>, is | ||||
| available at http://www.winimage.com/zLibDll/unzip.html | ||||
| and also in the contrib/minizip directory of zlib. | ||||
| An experimental package to read and write files in .zip format, written on top | ||||
| of zlib by Gilles Vollant <info@winimage.com>, is available at | ||||
| http://www.winimage.com/zLibDll/unzip.html and also in the contrib/minizip | ||||
| directory of zlib. | ||||
|  | ||||
|  | ||||
| Notes for some targets: | ||||
|  | ||||
| - To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc | ||||
|   and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL | ||||
|   The zlib DLL support was initially done by Alessandro Iacopetti and is | ||||
|   now maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL | ||||
|   home page at http://www.winimage.com/zLibDll | ||||
|   and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL The | ||||
|   zlib DLL support was initially done by Alessandro Iacopetti and is now | ||||
|   maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL home | ||||
|   page at http://www.winimage.com/zLibDll | ||||
|  | ||||
|   From Visual Basic, you can call the DLL functions which do not take | ||||
|   a structure as argument: compress, uncompress and all gz* functions. | ||||
|   See contrib/visual-basic.txt for more information, or get | ||||
|   From Visual Basic, you can call the DLL functions which do not take a | ||||
|   structure as argument: compress, uncompress and all gz* functions. See | ||||
|   contrib/visual-basic.txt for more information, or get | ||||
|   http://www.tcfb.com/dowseware/cmp-z-it.zip | ||||
|  | ||||
| - For 64-bit Irix, deflate.c must be compiled without any optimization. | ||||
|   With -O, one libpng test fails. The test works in 32 bit mode (with | ||||
|   the -n32 compiler flag). The compiler bug has been reported to SGI. | ||||
| - For 64-bit Irix, deflate.c must be compiled without any optimization. With | ||||
|   -O, one libpng test fails. The test works in 32 bit mode (with the -n32 | ||||
|   compiler flag). The compiler bug has been reported to SGI. | ||||
|  | ||||
| - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1    | ||||
|   it works when compiled with cc. | ||||
| - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works | ||||
|   when compiled with cc. | ||||
|  | ||||
| - on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 | ||||
|   is necessary to get gzprintf working correctly. This is done by configure. | ||||
| - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is | ||||
|   necessary to get gzprintf working correctly. This is done by configure. | ||||
|  | ||||
| - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works | ||||
|   with other compilers. Use "make test" to check your compiler. | ||||
| - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with | ||||
|   other compilers. Use "make test" to check your compiler. | ||||
|  | ||||
| - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. | ||||
|  | ||||
| - For Turbo C the small model is supported only with reduced performance to | ||||
|   avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
|  | ||||
| - For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html | ||||
|   Per Harald Myrvang <perm@stud.cs.uit.no> | ||||
| - For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html Per | ||||
|   Harald Myrvang <perm@stud.cs.uit.no> | ||||
|  | ||||
|  | ||||
| Acknowledgments: | ||||
| @@ -129,4 +131,6 @@ entirely written by Jean-loup Gailly and Mark Adler; it does not | ||||
| include third-party code. | ||||
|  | ||||
| If you redistribute modified sources, we would appreciate that you include | ||||
| in the file ChangeLog history information documenting your changes. | ||||
| in the file ChangeLog history information documenting your changes. Please | ||||
| read the FAQ for more information on the distribution of modified source | ||||
| versions. | ||||
|   | ||||
| @@ -5,6 +5,7 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #define ZLIB_INTERNAL | ||||
| #include "zlib.h" | ||||
|  | ||||
| #define BASE 65521L /* largest prime smaller than 65536 */ | ||||
| @@ -34,12 +35,12 @@ uLong ZEXPORT adler32(adler, buf, len) | ||||
|         len -= k; | ||||
|         while (k >= 16) { | ||||
|             DO16(buf); | ||||
| 	    buf += 16; | ||||
|             buf += 16; | ||||
|             k -= 16; | ||||
|         } | ||||
|         if (k != 0) do { | ||||
|             s1 += *buf++; | ||||
| 	    s2 += s1; | ||||
|             s2 += s1; | ||||
|         } while (--k); | ||||
|         s1 %= BASE; | ||||
|         s2 %= BASE; | ||||
|   | ||||
| @@ -1,9 +0,0 @@ | ||||
| To make a shared library: | ||||
|  | ||||
| 1. Compile a static library | ||||
| 2. Use mkexps on that to create libz.exp | ||||
| 3. Apply the configure.diff patch to configure | ||||
| 4. Run the new configure to make a new Makefile | ||||
| 5. Use the new Makefile to make the shared library | ||||
|  | ||||
| Courtesy of dbakker@arrayasolutions.com | ||||
| @@ -1,57 +0,0 @@ | ||||
| *** ../orig/zlib-1.1.4/configure	Wed Jul  8 14:19:35 1998 | ||||
| --- configure	Sun Feb  9 11:11:19 2003 | ||||
| *************** | ||||
| *** 18,23 **** | ||||
| --- 18,24 ---- | ||||
|   # If you have problems, try without defining CC and CFLAGS before reporting | ||||
|   # an error. | ||||
|    | ||||
| + LDFLAGS="-L. -lz" | ||||
|   LIBS=libz.a | ||||
|   SHAREDLIB=libz.so | ||||
|   VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | ||||
| *************** | ||||
| *** 116,121 **** | ||||
| --- 117,128 ---- | ||||
|   	     SFLAGS=${CFLAGS-"-Kconform_pic -O"} | ||||
|   	     CFLAGS=${CFLAGS-"-O"} | ||||
|   	     LDSHARED=${LDSHARED-"cc -G"};; | ||||
| +   AIX*)      | ||||
| + 	     SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||||
| + 	     CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||||
| + 	     LDTESTSHARED=${LDSHARED-"cc -G"} | ||||
| + 	     LDSHAREDFLAGS="-L. libz.so" | ||||
| + 	     LDSHARED=${LDSHARED-"cc -G"};; | ||||
|     # send working options for other systems to support@gzip.org | ||||
|     *)         SFLAGS=${CFLAGS-"-O"} | ||||
|   	     CFLAGS=${CFLAGS-"-O"} | ||||
| *************** | ||||
| *** 127,135 **** | ||||
|     echo Checking for shared library support... | ||||
|     # we must test in two steps (cc then ld), required at least on SunOS 4.x | ||||
|     if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && | ||||
| !      test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then | ||||
|       CFLAGS="$SFLAGS" | ||||
|       LIBS="$SHAREDLIB.$VER" | ||||
|       echo Building shared library $SHAREDLIB.$VER with $CC. | ||||
|     elif test -z "$old_cc" -a -z "$old_cflags"; then | ||||
|       echo No shared library suppport. | ||||
| --- 134,143 ---- | ||||
|     echo Checking for shared library support... | ||||
|     # we must test in two steps (cc then ld), required at least on SunOS 4.x | ||||
|     if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && | ||||
| !      test "`($LDTESTSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then | ||||
|       CFLAGS="$SFLAGS" | ||||
|       LIBS="$SHAREDLIB.$VER" | ||||
| + 	LDFLAGS="$LDSHAREDFLAGS" | ||||
|       echo Building shared library $SHAREDLIB.$VER with $CC. | ||||
|     elif test -z "$old_cc" -a -z "$old_cflags"; then | ||||
|       echo No shared library suppport. | ||||
| *************** | ||||
| *** 209,212 **** | ||||
| --- 217,221 ---- | ||||
|   /^exec_prefix *=/s%=.*%=$exec_prefix% | ||||
|   /^libdir *=/s%=.*%=$libdir% | ||||
|   /^includedir *=/s%=.*%=$includedir% | ||||
| + /^LDFLAGS *=/s%=.*%=$LDFLAGS% | ||||
|   " > Makefile | ||||
							
								
								
									
										37
									
								
								aix/mkexps
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								aix/mkexps
									
									
									
									
									
								
							| @@ -1,37 +0,0 @@ | ||||
| #!/bin/ksh | ||||
| # | ||||
| # mkexps - make export list | ||||
| # This program creates an export list by combining all the "." and normal names | ||||
| # into one list. | ||||
| # | ||||
| if [[ "$#" -ne 1 ]] | ||||
| then | ||||
|     print "Usage: mkexps ArchiveFile" | ||||
|     exit -2 | ||||
| fi | ||||
| if [[ ! -f $1 ]] | ||||
| then | ||||
|     print "mkexps: Cannot open file \"$1\"" | ||||
|     exit -1 | ||||
| fi | ||||
|  | ||||
| dump -g $1 | awk ' | ||||
| BEGIN { | ||||
|         top = 1 | ||||
| } | ||||
| /^[ ]*[0-9][0-9]*/ { | ||||
|     if ( (n = index( $2, "." )) > 0 ) { | ||||
|         export_array[ top++ ] = substr( $2, n+1, length( $2 )) | ||||
|     } | ||||
|     else { | ||||
| 	export_array[ top++ ] = $2 | ||||
|     } | ||||
| } | ||||
|  | ||||
| END { | ||||
|     for ( i = 1; i < top; i++ ) | ||||
|     { | ||||
| 	print export_array[ i ] | ||||
|     } | ||||
|  | ||||
| }' | sort | uniq | ||||
| @@ -206,4 +206,4 @@ Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, | ||||
| pp. 337-343. | ||||
|  | ||||
| ``DEFLATE Compressed Data Format Specification'' available in | ||||
| ftp://ds.internic.net/rfc/rfc1951.txt | ||||
| http://www.ietf.org/rfc/rfc1951.txt | ||||
|   | ||||
| @@ -5,6 +5,7 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #define ZLIB_INTERNAL | ||||
| #include "zlib.h" | ||||
|  | ||||
| /* =========================================================================== | ||||
|   | ||||
							
								
								
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -19,6 +19,7 @@ | ||||
| # an error. | ||||
|  | ||||
| LIBS=libz.a | ||||
| LDFLAGS="-L. ${LIBS}" | ||||
| SHAREDLIB=libz.so | ||||
| VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | ||||
| AR=${AR-"ar rc"} | ||||
| @@ -53,6 +54,10 @@ case "$1" in | ||||
|     esac | ||||
| done | ||||
|  | ||||
| if [ $shared -eq 1 ]; then | ||||
|   LDFLAGS="-L. ${SHAREDLIB}" | ||||
| fi | ||||
|  | ||||
| test=ztest$$ | ||||
| cat > $test.c <<EOF | ||||
| extern int getchar(); | ||||
| @@ -123,6 +128,10 @@ else | ||||
| 	     SFLAGS=${CFLAGS-"-KPIC -O"} | ||||
| 	     CFLAGS=${CFLAGS-"-O"} | ||||
| 	     LDSHARED=${LDSHARED-"cc -G"};; | ||||
|   AIX*)  # Courtesy of dbakker@arrayasolutions.com | ||||
| 	     SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||||
| 	     CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} | ||||
| 	     LDSHARED=${LDSHARED-"xlc -G"};; | ||||
|   # send working options for other systems to support@gzip.org | ||||
|   *)         SFLAGS=${CFLAGS-"-O"} | ||||
| 	     CFLAGS=${CFLAGS-"-O"} | ||||
| @@ -422,4 +431,5 @@ sed < Makefile.in " | ||||
| /^exec_prefix *=/s%=.*%=$exec_prefix% | ||||
| /^libdir *=/s%=.*%=$libdir% | ||||
| /^includedir *=/s%=.*%=$includedir% | ||||
| /^LDFLAGS *=/s%=.*%=$LDFLAGS% | ||||
| " > Makefile | ||||
|   | ||||
| @@ -12,7 +12,7 @@ asm586/ and asm686/    by Brian Raiter <breadbox@muppetlabs.com> | ||||
|         See http://www.muppetlabs.com/~breadbox/software/assembly.html | ||||
|  | ||||
| blast/      by Mark Adler <madler@alumni.caltech.edu> | ||||
| 	Decompressor for output of PKWare Data Compression Library | ||||
| 	Decompressor for output of PKWare Data Compression Library (DCL) | ||||
|  | ||||
| delphi/     by Bob Dellaca <bobdl@xtra.co.nz> | ||||
| 	Support for Delphi | ||||
| @@ -33,8 +33,15 @@ iostream/   by Kevin Ruland <kevin@rodin.wustl.edu> | ||||
| iostream2/  by Tyge L<>vset <Tyge.Lovset@cmr.no> | ||||
| 	Another C++ I/O streams interface | ||||
|  | ||||
| testzlib/    by Gilles Vollant <info@winimage.com> | ||||
| 	Example of the use of zlib | ||||
|  | ||||
| untgz/      by "Pedro A. Aranda Guti\irrez" <paag@tid.es> | ||||
| 	A very simple tar.gz file extractor using zlib | ||||
|  | ||||
| visual-basic.txt by Carlos Rios <c_rios@sonda.cl> | ||||
|         How to use compress(), uncompress() and the gz* functions from VB. | ||||
|  | ||||
| vstudio/    by Gilles Vollant <info@winimage.com> | ||||
| 	Building zlib DLL with Visual Studio .NET | ||||
| 	Includes x86 inffast.asm for MASM | ||||
|   | ||||
							
								
								
									
										783
									
								
								contrib/inflate86/inffas86.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										783
									
								
								contrib/inflate86/inffas86.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,783 @@ | ||||
| /* inffas86.c is a hand tuned assembler version of | ||||
|  * | ||||
|  * inffast.c -- fast decoding | ||||
|  * Copyright (C) 1995-2003 Mark Adler | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  * | ||||
|  * Copyright (C) 2003 Chris Anderson <christop@charm.net> | ||||
|  * Please use the copyright conditions above. | ||||
|  * | ||||
|  * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from | ||||
|  * the gcc -S output of zlib-1.2.0/inffast.c.  Zlib-1.2.0 is in beta release at | ||||
|  * the moment.  I have successfully compiled and tested this code with gcc2.96, | ||||
|  * gcc3.2, icc5.0, msvc6.0.  It is very close to the speed of inffast.S | ||||
|  * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX | ||||
|  * enabled.  I will attempt to merge the MMX code into this version.  Newer | ||||
|  * versions of this and inffast.S can be found at | ||||
|  * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ | ||||
|  */ | ||||
|  | ||||
| #include "zutil.h" | ||||
| #include "inftrees.h" | ||||
| #include "inflate.h" | ||||
| #include "inffast.h" | ||||
|  | ||||
| /* Mark Adler's comments from inffast.c: */ | ||||
|  | ||||
| /* | ||||
|    Decode literal, length, and distance codes and write out the resulting | ||||
|    literal and match bytes until either not enough input or output is | ||||
|    available, an end-of-block is encountered, or a data error is encountered. | ||||
|    When large enough input and output buffers are supplied to inflate(), for | ||||
|    example, a 16K input buffer and a 64K output buffer, more than 95% of the | ||||
|    inflate execution time is spent in this routine. | ||||
|  | ||||
|    Entry assumptions: | ||||
|  | ||||
|         state->mode == LEN | ||||
|         strm->avail_in >= 6 | ||||
|         strm->avail_out >= 258 | ||||
|         start >= strm->avail_out | ||||
|         state->bits < 8 | ||||
|  | ||||
|    On return, state->mode is one of: | ||||
|  | ||||
|         LEN -- ran out of enough output space or enough available input | ||||
|         TYPE -- reached end of block code, inflate() to interpret next block | ||||
|         BAD -- error in block data | ||||
|  | ||||
|    Notes: | ||||
|  | ||||
|     - The maximum input bits used by a length/distance pair is 15 bits for the | ||||
|       length code, 5 bits for the length extra, 15 bits for the distance code, | ||||
|       and 13 bits for the distance extra.  This totals 48 bits, or six bytes. | ||||
|       Therefore if strm->avail_in >= 6, then there is enough input to avoid | ||||
|       checking for available input while decoding. | ||||
|  | ||||
|     - The maximum bytes that a single length/distance pair can output is 258 | ||||
|       bytes, which is the maximum length that can be coded.  inflate_fast() | ||||
|       requires strm->avail_out >= 258 for each loop to avoid checking for | ||||
|       output space. | ||||
|  */ | ||||
| void inflate_fast(strm, start) | ||||
| z_streamp strm; | ||||
| unsigned start;         /* inflate()'s starting value for strm->avail_out */ | ||||
| { | ||||
|     struct inflate_state FAR *state; | ||||
|     struct inffast_ar { | ||||
|       void *esp;                  /* esp save */ | ||||
|       unsigned char FAR *in;      /* local strm->next_in */ | ||||
|       unsigned char FAR *last;    /* while in < last, enough input available */ | ||||
|       unsigned char FAR *out;     /* local strm->next_out */ | ||||
|       unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */ | ||||
|       unsigned char FAR *end;     /* while out < end, enough space available */ | ||||
|       unsigned wsize;             /* window size or zero if not using window */ | ||||
|       unsigned write;             /* window write index */ | ||||
|       unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */ | ||||
|       unsigned long hold;         /* local strm->hold */ | ||||
|       unsigned bits;              /* local strm->bits */ | ||||
|       code const FAR *lcode;      /* local strm->lencode */ | ||||
|       code const FAR *dcode;      /* local strm->distcode */ | ||||
|       unsigned lmask;             /* mask for first level of length codes */ | ||||
|       unsigned dmask;             /* mask for first level of distance codes */ | ||||
|       unsigned len;               /* match length, unused bytes */ | ||||
|       unsigned dist;              /* match distance */ | ||||
|       unsigned status;            /* this is set when state changes */ | ||||
|     } ar; | ||||
|  | ||||
|     /* copy state to local variables */ | ||||
|     state = (struct inflate_state FAR *)strm->state; | ||||
|     ar.in = strm->next_in; | ||||
|     ar.last = ar.in + (strm->avail_in - 5); | ||||
|     ar.out = strm->next_out; | ||||
|     ar.beg = ar.out - (start - strm->avail_out); | ||||
|     ar.end = ar.out + (strm->avail_out - 257); | ||||
|     ar.wsize = state->wsize; | ||||
|     ar.write = state->write; | ||||
|     ar.window = state->window; | ||||
|     ar.hold = state->hold; | ||||
|     ar.bits = state->bits; | ||||
|     ar.lcode = state->lencode; | ||||
|     ar.dcode = state->distcode; | ||||
|     ar.lmask = (1U << state->lenbits) - 1; | ||||
|     ar.dmask = (1U << state->distbits) - 1; | ||||
|  | ||||
|     /* decode literals and length/distances until end-of-block or not enough | ||||
|        input data or output space */ | ||||
|  | ||||
|     /* align in on 2 byte boundary */ | ||||
|     if (((unsigned long)(void *)ar.in & 0x1) != 0) { | ||||
|         ar.hold += (unsigned long)*ar.in++ << ar.bits; | ||||
|         ar.bits += 8; | ||||
|     } | ||||
|  | ||||
| #if defined( __GNUC__ ) || defined( __ICC ) | ||||
|     __asm__ __volatile__ ( | ||||
| "        leal    %0, %%eax\n" | ||||
| "        pushf\n" | ||||
| "        pushl   %%ebp\n" | ||||
| "        movl    %%esp, (%%eax)\n" | ||||
| "        movl    %%eax, %%esp\n" | ||||
| "        movl    4(%%esp), %%esi\n"       /* esi = in */ | ||||
| "        movl    12(%%esp), %%edi\n"      /* edi = out */ | ||||
| "        movl    36(%%esp), %%edx\n"      /* edx = hold */ | ||||
| "        movl    40(%%esp), %%ebx\n"      /* ebx = bits */ | ||||
| "        movl    44(%%esp), %%ebp\n"      /* ebp = lcode */ | ||||
|  | ||||
| "        cld\n" | ||||
| "        jmp     .L_do_loop\n" | ||||
|  | ||||
| ".L_while_test:\n" | ||||
| "        cmpl    %%edi, 20(%%esp)\n" | ||||
| "        jbe     .L_break_loop\n" | ||||
| "        cmpl    %%esi, 8(%%esp)\n" | ||||
| "        jbe     .L_break_loop\n" | ||||
|  | ||||
| ".L_do_loop:\n" | ||||
| "        cmpb    $15, %%bl\n" | ||||
| "        ja      .L_get_length_code\n"    /* if (15 < bits) */ | ||||
|  | ||||
| "        xorl    %%eax, %%eax\n" | ||||
| "        lodsw\n"                         /* al = *(ushort *)in++ */ | ||||
| "        movb    %%bl, %%cl\n"            /* cl = bits, needs it for shifting */ | ||||
| "        addb    $16, %%bl\n"             /* bits += 16 */ | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        orl     %%eax, %%edx\n"        /* hold |= *((ushort *)in)++ << bits */ | ||||
|  | ||||
| ".L_get_length_code:\n" | ||||
| "        movl    52(%%esp), %%eax\n"      /* eax = lmask */ | ||||
| "        andl    %%edx, %%eax\n"          /* eax &= hold */ | ||||
| "        movl    (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */ | ||||
|  | ||||
| ".L_dolen:\n" | ||||
| "        movb    %%ah, %%cl\n"            /* cl = this.bits */ | ||||
| "        subb    %%ah, %%bl\n"            /* bits -= this.bits */ | ||||
| "        shrl    %%cl, %%edx\n"           /* hold >>= this.bits */ | ||||
|  | ||||
| "        testb   %%al, %%al\n" | ||||
| "        jnz     .L_test_for_length_base\n" /* if (op != 0) 45.7% */ | ||||
|  | ||||
| "        shrl    $16, %%eax\n"            /* output this.val char */ | ||||
| "        stosb\n" | ||||
| "        jmp     .L_while_test\n" | ||||
|  | ||||
| ".L_test_for_length_base:\n" | ||||
| "        movl    %%eax, %%ecx\n"          /* len = this */ | ||||
| "        shrl    $16, %%ecx\n"            /* len = this.val */ | ||||
| "        movl    %%ecx, 60(%%esp)\n"      /* len = this */ | ||||
| "        movb    %%al, %%cl\n" | ||||
|  | ||||
| "        testb   $16, %%al\n" | ||||
| "        jz      .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ | ||||
| "        andb    $15, %%cl\n"             /* op &= 15 */ | ||||
| "        jz      .L_decode_distance\n"    /* if (!op) */ | ||||
| "        cmpb    %%cl, %%bl\n" | ||||
| "        jae     .L_add_bits_to_len\n"    /* if (op <= bits) */ | ||||
|  | ||||
| "        movb    %%cl, %%ch\n"            /* stash op in ch, freeing cl */ | ||||
| "        xorl    %%eax, %%eax\n" | ||||
| "        lodsw\n"                         /* al = *(ushort *)in++ */ | ||||
| "        movb    %%bl, %%cl\n"            /* cl = bits, needs it for shifting */ | ||||
| "        addb    $16, %%bl\n"             /* bits += 16 */ | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        orl     %%eax, %%edx\n"         /* hold |= *((ushort *)in)++ << bits */ | ||||
| "        movb    %%ch, %%cl\n"            /* move op back to ecx */ | ||||
|  | ||||
| ".L_add_bits_to_len:\n" | ||||
| "        movl    $1, %%eax\n" | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        decl    %%eax\n" | ||||
| "        subb    %%cl, %%bl\n" | ||||
| "        andl    %%edx, %%eax\n"          /* eax &= hold */ | ||||
| "        shrl    %%cl, %%edx\n" | ||||
| "        addl    %%eax, 60(%%esp)\n"      /* len += hold & mask[op] */ | ||||
|  | ||||
| ".L_decode_distance:\n" | ||||
| "        cmpb    $15, %%bl\n" | ||||
| "        ja      .L_get_distance_code\n"  /* if (15 < bits) */ | ||||
|  | ||||
| "        xorl    %%eax, %%eax\n" | ||||
| "        lodsw\n"                         /* al = *(ushort *)in++ */ | ||||
| "        movb    %%bl, %%cl\n"            /* cl = bits, needs it for shifting */ | ||||
| "        addb    $16, %%bl\n"             /* bits += 16 */ | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        orl     %%eax, %%edx\n"         /* hold |= *((ushort *)in)++ << bits */ | ||||
|  | ||||
| ".L_get_distance_code:\n" | ||||
| "        movl    56(%%esp), %%eax\n"      /* eax = dmask */ | ||||
| "        movl    48(%%esp), %%ecx\n"      /* ecx = dcode */ | ||||
| "        andl    %%edx, %%eax\n"          /* eax &= hold */ | ||||
| "        movl    (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */ | ||||
|  | ||||
| ".L_dodist:\n" | ||||
| "        movl    %%eax, %%ebp\n"          /* dist = this */ | ||||
| "        shrl    $16, %%ebp\n"            /* dist = this.val */ | ||||
| "        movb    %%ah, %%cl\n" | ||||
| "        subb    %%ah, %%bl\n"            /* bits -= this.bits */ | ||||
| "        shrl    %%cl, %%edx\n"           /* hold >>= this.bits */ | ||||
| "        movb    %%al, %%cl\n"            /* cl = this.op */ | ||||
|  | ||||
| "        testb   $16, %%al\n"             /* if ((op & 16) == 0) */ | ||||
| "        jz      .L_test_for_second_level_dist\n" | ||||
| "        andb    $15, %%cl\n"             /* op &= 15 */ | ||||
| "        jz      .L_check_dist_one\n" | ||||
| "        cmpb    %%cl, %%bl\n" | ||||
| "        jae     .L_add_bits_to_dist\n"   /* if (op <= bits) 97.6% */ | ||||
|  | ||||
| "        movb    %%cl, %%ch\n"            /* stash op in ch, freeing cl */ | ||||
| "        xorl    %%eax, %%eax\n" | ||||
| "        lodsw\n"                         /* al = *(ushort *)in++ */ | ||||
| "        movb    %%bl, %%cl\n"            /* cl = bits, needs it for shifting */ | ||||
| "        addb    $16, %%bl\n"             /* bits += 16 */ | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        orl     %%eax, %%edx\n"        /* hold |= *((ushort *)in)++ << bits */ | ||||
| "        movb    %%ch, %%cl\n"            /* move op back to ecx */ | ||||
|  | ||||
| ".L_add_bits_to_dist:\n" | ||||
| "        movl    $1, %%eax\n" | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        decl    %%eax\n"                 /* (1 << op) - 1 */ | ||||
| "        subb    %%cl, %%bl\n" | ||||
| "        andl    %%edx, %%eax\n"          /* eax &= hold */ | ||||
| "        shrl    %%cl, %%edx\n" | ||||
| "        addl    %%eax, %%ebp\n"          /* dist += hold & ((1 << op) - 1) */ | ||||
|  | ||||
| ".L_check_window:\n" | ||||
| "        movl    %%esi, 4(%%esp)\n"       /* save in so from can use it's reg */ | ||||
| "        movl    %%edi, %%eax\n" | ||||
| "        subl    16(%%esp), %%eax\n"      /* nbytes = out - beg */ | ||||
|  | ||||
| "        cmpl    %%ebp, %%eax\n" | ||||
| "        jb      .L_clip_window\n"        /* if (dist > nbytes) 4.2% */ | ||||
|  | ||||
| "        movl    60(%%esp), %%ecx\n" | ||||
| "        movl    %%edi, %%esi\n" | ||||
| "        subl    %%ebp, %%esi\n"          /* from = out - dist */ | ||||
|  | ||||
| "        subl    $3, %%ecx\n"             /* copy from to out */ | ||||
| "        movb    (%%esi), %%al\n" | ||||
| "        movb    %%al, (%%edi)\n" | ||||
| "        movb    1(%%esi), %%al\n" | ||||
| "        movb    2(%%esi), %%ah\n" | ||||
| "        addl    $3, %%esi\n" | ||||
| "        movb    %%al, 1(%%edi)\n" | ||||
| "        movb    %%ah, 2(%%edi)\n" | ||||
| "        addl    $3, %%edi\n" | ||||
| "        rep     movsb\n" | ||||
|  | ||||
| "        movl    4(%%esp), %%esi\n"      /* move in back to %esi, toss from */ | ||||
| "        movl    44(%%esp), %%ebp\n"     /* ebp = lcode */ | ||||
| "        jmp     .L_while_test\n" | ||||
|  | ||||
| ".L_check_dist_one:\n" | ||||
| "        cmpl    $1, %%ebp\n"            /* if dist 1, is a memset */ | ||||
| "        jne     .L_check_window\n" | ||||
| "        cmpl    %%edi, 16(%%esp)\n" | ||||
| "        je      .L_check_window\n" | ||||
|  | ||||
| "        decl    %%edi\n" | ||||
| "        movl    60(%%esp), %%ecx\n" | ||||
| "        movb    (%%edi), %%al\n" | ||||
| "        subl    $3, %%ecx\n" | ||||
|  | ||||
| "        movb    %%al, 1(%%edi)\n"       /* memset out with from[-1] */ | ||||
| "        movb    %%al, 2(%%edi)\n" | ||||
| "        movb    %%al, 3(%%edi)\n" | ||||
| "        addl    $4, %%edi\n" | ||||
| "        rep     stosb\n" | ||||
| "        movl    44(%%esp), %%ebp\n"      /* ebp = lcode */ | ||||
| "        jmp     .L_while_test\n" | ||||
|  | ||||
| ".L_test_for_second_level_length:\n" | ||||
| "        testb   $64, %%al\n" | ||||
| "        jnz     .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ | ||||
|  | ||||
| "        movl    $1, %%eax\n" | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        decl    %%eax\n" | ||||
| "        andl    %%edx, %%eax\n"         /* eax &= hold */ | ||||
| "        addl    60(%%esp), %%eax\n"     /* eax += this.val */ | ||||
| "        movl    (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ | ||||
| "        jmp     .L_dolen\n" | ||||
|  | ||||
| ".L_test_for_second_level_dist:\n" | ||||
| "        testb   $64, %%al\n" | ||||
| "        jnz     .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ | ||||
|  | ||||
| "        movl    $1, %%eax\n" | ||||
| "        shll    %%cl, %%eax\n" | ||||
| "        decl    %%eax\n" | ||||
| "        andl    %%edx, %%eax\n"         /* eax &= hold */ | ||||
| "        addl    %%ebp, %%eax\n"         /* eax += this.val */ | ||||
| "        movl    48(%%esp), %%ecx\n"     /* ecx = dcode */ | ||||
| "        movl    (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ | ||||
| "        jmp     .L_dodist\n" | ||||
|  | ||||
| ".L_clip_window:\n" | ||||
| "        movl    %%eax, %%ecx\n" | ||||
| "        movl    24(%%esp), %%eax\n"     /* prepare for dist compare */ | ||||
| "        negl    %%ecx\n"                /* nbytes = -nbytes */ | ||||
| "        movl    32(%%esp), %%esi\n"     /* from = window */ | ||||
|  | ||||
| "        cmpl    %%ebp, %%eax\n" | ||||
| "        jb      .L_invalid_distance_too_far\n" /* if (dist > wsize) */ | ||||
|  | ||||
| "        addl    %%ebp, %%ecx\n"         /* nbytes = dist - nbytes */ | ||||
| "        cmpl    $0, 28(%%esp)\n" | ||||
| "        jne     .L_wrap_around_window\n" /* if (write != 0) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n" | ||||
| "        addl    %%eax, %%esi\n"         /* from += wsize - nbytes */ | ||||
|  | ||||
| "        movl    60(%%esp), %%eax\n" | ||||
| "        cmpl    %%ecx, %%eax\n" | ||||
| "        jbe     .L_do_copy1\n"          /* if (nbytes >= len) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n"         /* len -= nbytes */ | ||||
| "        rep     movsb\n" | ||||
| "        movl    %%edi, %%esi\n" | ||||
| "        subl    %%ebp, %%esi\n"         /* from = out - dist */ | ||||
| "        jmp     .L_do_copy1\n" | ||||
|  | ||||
| "        cmpl    %%ecx, %%eax\n" | ||||
| "        jbe     .L_do_copy1\n"          /* if (nbytes >= len) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n"         /* len -= nbytes */ | ||||
| "        rep     movsb\n" | ||||
| "        movl    %%edi, %%esi\n" | ||||
| "        subl    %%ebp, %%esi\n"         /* from = out - dist */ | ||||
| "        jmp     .L_do_copy1\n" | ||||
|  | ||||
| ".L_wrap_around_window:\n" | ||||
| "        movl    28(%%esp), %%eax\n" | ||||
| "        cmpl    %%eax, %%ecx\n" | ||||
| "        jbe     .L_contiguous_in_window\n" /* if (write >= nbytes) */ | ||||
|  | ||||
| "        addl    24(%%esp), %%esi\n" | ||||
| "        addl    %%eax, %%esi\n" | ||||
| "        subl    %%ecx, %%esi\n"         /* from += wsize + write - nbytes */ | ||||
| "        subl    %%eax, %%ecx\n"         /* nbytes -= write */ | ||||
|  | ||||
| "        movl    60(%%esp), %%eax\n" | ||||
| "        cmpl    %%ecx, %%eax\n" | ||||
| "        jbe     .L_do_copy1\n"          /* if (nbytes >= len) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n"         /* len -= nbytes */ | ||||
| "        rep     movsb\n" | ||||
| "        movl    32(%%esp), %%esi\n"     /* from = window */ | ||||
| "        movl    28(%%esp), %%ecx\n"     /* nbytes = write */ | ||||
| "        cmpl    %%ecx, %%eax\n" | ||||
| "        jbe     .L_do_copy1\n"          /* if (nbytes >= len) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n"         /* len -= nbytes */ | ||||
| "        rep     movsb\n" | ||||
| "        movl    %%edi, %%esi\n" | ||||
| "        subl    %%ebp, %%esi\n"         /* from = out - dist */ | ||||
| "        jmp     .L_do_copy1\n" | ||||
|  | ||||
| ".L_contiguous_in_window:\n" | ||||
| "        addl    %%eax, %%esi\n" | ||||
| "        subl    %%ecx, %%esi\n"         /* from += write - nbytes */ | ||||
|  | ||||
| "        movl    60(%%esp), %%eax\n" | ||||
| "        cmpl    %%ecx, %%eax\n" | ||||
| "        jbe     .L_do_copy1\n"          /* if (nbytes >= len) */ | ||||
|  | ||||
| "        subl    %%ecx, %%eax\n"         /* len -= nbytes */ | ||||
| "        rep     movsb\n" | ||||
| "        movl    %%edi, %%esi\n" | ||||
| "        subl    %%ebp, %%esi\n"         /* from = out - dist */ | ||||
|  | ||||
| ".L_do_copy1:\n" | ||||
| "        movl    %%eax, %%ecx\n" | ||||
| "        rep     movsb\n" | ||||
|  | ||||
| "        movl    4(%%esp), %%esi\n"      /* move in back to %esi, toss from */ | ||||
| "        movl    44(%%esp), %%ebp\n"     /* ebp = lcode */ | ||||
| "        jmp     .L_while_test\n" | ||||
|  | ||||
| ".L_test_for_end_of_block:\n" | ||||
| "        testb   $32, %%al\n" | ||||
| "        jz      .L_invalid_literal_length_code\n" | ||||
| "        movl    $1, 68(%%esp)\n" | ||||
| "        jmp     .L_break_loop_with_status\n" | ||||
|  | ||||
| ".L_invalid_literal_length_code:\n" | ||||
| "        movl    $2, 68(%%esp)\n" | ||||
| "        jmp     .L_break_loop_with_status\n" | ||||
|  | ||||
| ".L_invalid_distance_code:\n" | ||||
| "        movl    $3, 68(%%esp)\n" | ||||
| "        jmp     .L_break_loop_with_status\n" | ||||
|  | ||||
| ".L_invalid_distance_too_far:\n" | ||||
| "        movl    4(%%esp), %%esi\n" | ||||
| "        movl    $4, 68(%%esp)\n" | ||||
| "        jmp     .L_break_loop_with_status\n" | ||||
|  | ||||
| ".L_break_loop:\n" | ||||
| "        movl    $0, 68(%%esp)\n" | ||||
|  | ||||
| ".L_break_loop_with_status:\n" | ||||
| /* put in, out, bits, and hold back into ar and pop esp */ | ||||
| "        movl    %%esi, 4(%%esp)\n" | ||||
| "        movl    %%edi, 12(%%esp)\n" | ||||
| "        movl    %%ebx, 40(%%esp)\n" | ||||
| "        movl    %%edx, 36(%%esp)\n" | ||||
| "        movl    (%%esp), %%esp\n" | ||||
| "        popl    %%ebp\n" | ||||
| "        popf\n" | ||||
|           : | ||||
|           : "m" (ar) | ||||
|           : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" | ||||
|     ); | ||||
| #elif defined( _MSC_VER ) | ||||
|     __asm { | ||||
| 	lea	eax, ar | ||||
| 	pushfd | ||||
| 	push	ebp | ||||
| 	mov	[eax], esp | ||||
| 	mov	esp, eax | ||||
| 	mov	esi, [esp+4]       /* esi = in */ | ||||
| 	mov	edi, [esp+12]      /* edi = out */ | ||||
| 	mov	edx, [esp+36]      /* edx = hold */ | ||||
| 	mov	ebx, [esp+40]      /* ebx = bits */ | ||||
| 	mov	ebp, [esp+44]      /* ebp = lcode */ | ||||
|  | ||||
| 	cld | ||||
| 	jmp	L_do_loop | ||||
|  | ||||
| L_while_test: | ||||
| 	cmp	[esp+20], edi | ||||
| 	jbe	L_break_loop | ||||
| 	cmp	[esp+8], esi | ||||
| 	jbe	L_break_loop | ||||
|  | ||||
| L_do_loop: | ||||
| 	cmp	bl, 15 | ||||
| 	ja	L_get_length_code    /* if (15 < bits) */ | ||||
|  | ||||
| 	xor	eax, eax | ||||
| 	lodsw                         /* al = *(ushort *)in++ */ | ||||
| 	mov	cl, bl            /* cl = bits, needs it for shifting */ | ||||
| 	add	bl, 16             /* bits += 16 */ | ||||
| 	shl	eax, cl | ||||
| 	or	edx, eax        /* hold |= *((ushort *)in)++ << bits */ | ||||
|  | ||||
| L_get_length_code: | ||||
| 	mov	eax, [esp+52]      /* eax = lmask */ | ||||
| 	and	eax, edx          /* eax &= hold */ | ||||
| 	mov	eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */ | ||||
|  | ||||
| L_dolen: | ||||
| 	mov	cl, ah            /* cl = this.bits */ | ||||
| 	sub	bl, ah            /* bits -= this.bits */ | ||||
| 	shr	edx, cl           /* hold >>= this.bits */ | ||||
|  | ||||
| 	test	al, al | ||||
| 	jnz	L_test_for_length_base /* if (op != 0) 45.7% */ | ||||
|  | ||||
| 	shr	eax, 16            /* output this.val char */ | ||||
| 	stosb | ||||
| 	jmp	L_while_test | ||||
|  | ||||
| L_test_for_length_base: | ||||
| 	mov	ecx, eax          /* len = this */ | ||||
| 	shr	ecx, 16            /* len = this.val */ | ||||
| 	mov	[esp+60], ecx      /* len = this */ | ||||
| 	mov	cl, al | ||||
|  | ||||
| 	test	al, 16 | ||||
| 	jz	L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ | ||||
| 	and	cl, 15             /* op &= 15 */ | ||||
| 	jz	L_decode_distance    /* if (!op) */ | ||||
| 	cmp	bl, cl | ||||
| 	jae	L_add_bits_to_len    /* if (op <= bits) */ | ||||
|  | ||||
| 	mov	ch, cl            /* stash op in ch, freeing cl */ | ||||
| 	xor	eax, eax | ||||
| 	lodsw                         /* al = *(ushort *)in++ */ | ||||
| 	mov	cl, bl            /* cl = bits, needs it for shifting */ | ||||
| 	add	bl, 16             /* bits += 16 */ | ||||
| 	shl	eax, cl | ||||
| 	or	edx, eax         /* hold |= *((ushort *)in)++ << bits */ | ||||
| 	mov	cl, ch            /* move op back to ecx */ | ||||
|  | ||||
| L_add_bits_to_len: | ||||
| 	mov	eax, 1 | ||||
| 	shl	eax, cl | ||||
| 	dec	eax | ||||
| 	sub	bl, cl | ||||
| 	and	eax, edx          /* eax &= hold */ | ||||
| 	shr	edx, cl | ||||
| 	add	[esp+60], eax      /* len += hold & mask[op] */ | ||||
|  | ||||
| L_decode_distance: | ||||
| 	cmp	bl, 15 | ||||
| 	ja	L_get_distance_code  /* if (15 < bits) */ | ||||
|  | ||||
| 	xor	eax, eax | ||||
| 	lodsw                         /* al = *(ushort *)in++ */ | ||||
| 	mov	cl, bl            /* cl = bits, needs it for shifting */ | ||||
| 	add	bl, 16             /* bits += 16 */ | ||||
| 	shl	eax, cl | ||||
| 	or	edx, eax         /* hold |= *((ushort *)in)++ << bits */ | ||||
|  | ||||
| L_get_distance_code: | ||||
| 	mov	eax, [esp+56]      /* eax = dmask */ | ||||
| 	mov	ecx, [esp+48]      /* ecx = dcode */ | ||||
| 	and	eax, edx          /* eax &= hold */ | ||||
| 	mov	eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */ | ||||
|  | ||||
| L_dodist: | ||||
| 	mov	ebp, eax          /* dist = this */ | ||||
| 	shr	ebp, 16            /* dist = this.val */ | ||||
| 	mov	cl, ah | ||||
| 	sub	bl, ah            /* bits -= this.bits */ | ||||
| 	shr	edx, cl           /* hold >>= this.bits */ | ||||
| 	mov	cl, al            /* cl = this.op */ | ||||
|  | ||||
| 	test	al, 16             /* if ((op & 16) == 0) */ | ||||
| 	jz	L_test_for_second_level_dist | ||||
| 	and	cl, 15             /* op &= 15 */ | ||||
| 	jz	L_check_dist_one | ||||
| 	cmp	bl, cl | ||||
| 	jae	L_add_bits_to_dist   /* if (op <= bits) 97.6% */ | ||||
|  | ||||
| 	mov	ch, cl            /* stash op in ch, freeing cl */ | ||||
| 	xor	eax, eax | ||||
| 	lodsw                         /* al = *(ushort *)in++ */ | ||||
| 	mov	cl, bl            /* cl = bits, needs it for shifting */ | ||||
| 	add	bl, 16             /* bits += 16 */ | ||||
| 	shl	eax, cl | ||||
| 	or	edx, eax        /* hold |= *((ushort *)in)++ << bits */ | ||||
| 	mov	cl, ch            /* move op back to ecx */ | ||||
|  | ||||
| L_add_bits_to_dist: | ||||
| 	mov	eax, 1 | ||||
| 	shl	eax, cl | ||||
| 	dec	eax                 /* (1 << op) - 1 */ | ||||
| 	sub	bl, cl | ||||
| 	and	eax, edx          /* eax &= hold */ | ||||
| 	shr	edx, cl | ||||
| 	add	ebp, eax          /* dist += hold & ((1 << op) - 1) */ | ||||
|  | ||||
| L_check_window: | ||||
| 	mov	[esp+4], esi       /* save in so from can use it's reg */ | ||||
| 	mov	eax, edi | ||||
| 	sub	eax, [esp+16]      /* nbytes = out - beg */ | ||||
|  | ||||
| 	cmp	eax, ebp | ||||
| 	jb	L_clip_window        /* if (dist > nbytes) 4.2% */ | ||||
|  | ||||
| 	mov	ecx, [esp+60] | ||||
| 	mov	esi, edi | ||||
| 	sub	esi, ebp          /* from = out - dist */ | ||||
|  | ||||
| 	sub	ecx, 3             /* copy from to out */ | ||||
| 	mov	al, [esi] | ||||
| 	mov	[edi], al | ||||
| 	mov	al, [esi+1] | ||||
| 	mov	ah, [esi+2] | ||||
| 	add	esi, 3 | ||||
| 	mov	[edi+1], al | ||||
| 	mov	[edi+2], ah | ||||
| 	add	edi, 3 | ||||
| 	rep     movsb | ||||
|  | ||||
| 	mov	esi, [esp+4]      /* move in back to %esi, toss from */ | ||||
| 	mov	ebp, [esp+44]     /* ebp = lcode */ | ||||
| 	jmp	L_while_test | ||||
|  | ||||
| L_check_dist_one: | ||||
| 	cmp	ebp, 1            /* if dist 1, is a memset */ | ||||
| 	jne	L_check_window | ||||
| 	cmp	[esp+16], edi | ||||
| 	je	L_check_window | ||||
|  | ||||
| 	dec	edi | ||||
| 	mov	ecx, [esp+60] | ||||
| 	mov	al, [edi] | ||||
| 	sub	ecx, 3 | ||||
|  | ||||
| 	mov	[edi+1], al       /* memset out with from[-1] */ | ||||
| 	mov	[edi+2], al | ||||
| 	mov	[edi+3], al | ||||
| 	add	edi, 4 | ||||
| 	rep     stosb | ||||
| 	mov	ebp, [esp+44]      /* ebp = lcode */ | ||||
| 	jmp	L_while_test | ||||
|  | ||||
| L_test_for_second_level_length: | ||||
| 	test	al, 64 | ||||
| 	jnz	L_test_for_end_of_block /* if ((op & 64) != 0) */ | ||||
|  | ||||
| 	mov	eax, 1 | ||||
| 	shl	eax, cl | ||||
| 	dec	eax | ||||
| 	and	eax, edx         /* eax &= hold */ | ||||
| 	add	eax, [esp+60]     /* eax += this.val */ | ||||
| 	mov	eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/ | ||||
| 	jmp	L_dolen | ||||
|  | ||||
| L_test_for_second_level_dist: | ||||
| 	test	al, 64 | ||||
| 	jnz	L_invalid_distance_code /* if ((op & 64) != 0) */ | ||||
|  | ||||
| 	mov	eax, 1 | ||||
| 	shl	eax, cl | ||||
| 	dec	eax | ||||
| 	and	eax, edx         /* eax &= hold */ | ||||
| 	add	eax, ebp         /* eax += this.val */ | ||||
| 	mov	ecx, [esp+48]     /* ecx = dcode */ | ||||
| 	mov	eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/ | ||||
| 	jmp	L_dodist | ||||
|  | ||||
| L_clip_window: | ||||
| 	mov	ecx, eax | ||||
| 	mov	eax, [esp+24]     /* prepare for dist compare */ | ||||
| 	neg	ecx                /* nbytes = -nbytes */ | ||||
| 	mov	esi, [esp+32]     /* from = window */ | ||||
|  | ||||
| 	cmp	eax, ebp | ||||
| 	jb	L_invalid_distance_too_far /* if (dist > wsize) */ | ||||
|  | ||||
| 	add	ecx, ebp         /* nbytes = dist - nbytes */ | ||||
| 	cmp	dword ptr [esp+28], 0 | ||||
| 	jne	L_wrap_around_window /* if (write != 0) */ | ||||
|  | ||||
| 	sub	eax, ecx | ||||
| 	add	esi, eax         /* from += wsize - nbytes */ | ||||
|  | ||||
| 	mov	eax, [esp+60] | ||||
| 	cmp	eax, ecx | ||||
| 	jbe	L_do_copy1          /* if (nbytes >= len) */ | ||||
|  | ||||
| 	sub	eax, ecx         /* len -= nbytes */ | ||||
| 	rep     movsb | ||||
| 	mov	esi, edi | ||||
| 	sub	esi, ebp         /* from = out - dist */ | ||||
| 	jmp	L_do_copy1 | ||||
|  | ||||
| 	cmp	eax, ecx | ||||
| 	jbe	L_do_copy1          /* if (nbytes >= len) */ | ||||
|  | ||||
| 	sub	eax, ecx         /* len -= nbytes */ | ||||
| 	rep     movsb | ||||
| 	mov	esi, edi | ||||
| 	sub	esi, ebp         /* from = out - dist */ | ||||
| 	jmp	L_do_copy1 | ||||
|  | ||||
| L_wrap_around_window: | ||||
| 	mov	eax, [esp+28] | ||||
| 	cmp	ecx, eax | ||||
| 	jbe	L_contiguous_in_window /* if (write >= nbytes) */ | ||||
|  | ||||
| 	add	esi, [esp+24] | ||||
| 	add	esi, eax | ||||
| 	sub	esi, ecx         /* from += wsize + write - nbytes */ | ||||
| 	sub	ecx, eax         /* nbytes -= write */ | ||||
|  | ||||
| 	mov	eax, [esp+60] | ||||
| 	cmp	eax, ecx | ||||
| 	jbe	L_do_copy1          /* if (nbytes >= len) */ | ||||
|  | ||||
| 	sub	eax, ecx         /* len -= nbytes */ | ||||
| 	rep     movsb | ||||
| 	mov	esi, [esp+32]     /* from = window */ | ||||
| 	mov	ecx, [esp+28]     /* nbytes = write */ | ||||
| 	cmp	eax, ecx | ||||
| 	jbe	L_do_copy1          /* if (nbytes >= len) */ | ||||
|  | ||||
| 	sub	eax, ecx         /* len -= nbytes */ | ||||
| 	rep     movsb | ||||
| 	mov	esi, edi | ||||
| 	sub	esi, ebp         /* from = out - dist */ | ||||
| 	jmp	L_do_copy1 | ||||
|  | ||||
| L_contiguous_in_window: | ||||
| 	add	esi, eax | ||||
| 	sub	esi, ecx         /* from += write - nbytes */ | ||||
|  | ||||
| 	mov	eax, [esp+60] | ||||
| 	cmp	eax, ecx | ||||
| 	jbe	L_do_copy1          /* if (nbytes >= len) */ | ||||
|  | ||||
| 	sub	eax, ecx         /* len -= nbytes */ | ||||
| 	rep     movsb | ||||
| 	mov	esi, edi | ||||
| 	sub	esi, ebp         /* from = out - dist */ | ||||
|  | ||||
| L_do_copy1: | ||||
| 	mov	ecx, eax | ||||
| 	rep     movsb | ||||
|  | ||||
| 	mov	esi, [esp+4]      /* move in back to %esi, toss from */ | ||||
| 	mov	ebp, [esp+44]     /* ebp = lcode */ | ||||
| 	jmp	L_while_test | ||||
|  | ||||
| L_test_for_end_of_block: | ||||
| 	test	al, 32 | ||||
| 	jz	L_invalid_literal_length_code | ||||
| 	mov	dword ptr [esp+68], 1 | ||||
| 	jmp	L_break_loop_with_status | ||||
|  | ||||
| L_invalid_literal_length_code: | ||||
| 	mov	dword ptr [esp+68], 2 | ||||
| 	jmp	L_break_loop_with_status | ||||
|  | ||||
| L_invalid_distance_code: | ||||
| 	mov	dword ptr [esp+68], 3 | ||||
| 	jmp	L_break_loop_with_status | ||||
|  | ||||
| L_invalid_distance_too_far: | ||||
| 	mov	esi, [esp+4] | ||||
| 	mov	dword ptr [esp+68], 4 | ||||
| 	jmp	L_break_loop_with_status | ||||
|  | ||||
| L_break_loop: | ||||
| 	mov	dword ptr [esp+68], 0 | ||||
|  | ||||
| L_break_loop_with_status: | ||||
| /* put in, out, bits, and hold back into ar and pop esp */ | ||||
| 	mov	[esp+4], esi | ||||
| 	mov	[esp+12], edi | ||||
| 	mov	[esp+40], ebx | ||||
| 	mov	[esp+36], edx | ||||
| 	mov	esp, [esp] | ||||
| 	pop	ebp | ||||
| 	popfd | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|     if (ar.status > 1) { | ||||
|         if (ar.status == 2) | ||||
|             strm->msg = "invalid literal/length code"; | ||||
|         else if (ar.status == 3) | ||||
|             strm->msg = "invalid distance code"; | ||||
|         else | ||||
|             strm->msg = "invalid distance too far back"; | ||||
|         state->mode = BAD; | ||||
|     } | ||||
|     else if ( ar.status == 1 ) { | ||||
|         state->mode = TYPE; | ||||
|     } | ||||
|  | ||||
|     /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ | ||||
|     ar.len = ar.bits >> 3; | ||||
|     ar.in -= ar.len; | ||||
|     ar.bits -= ar.len << 3; | ||||
|     ar.hold &= (1U << ar.bits) - 1; | ||||
|  | ||||
|     /* update state and return */ | ||||
|     strm->next_in = ar.in; | ||||
|     strm->next_out = ar.out; | ||||
|     strm->avail_in = (unsigned)(ar.in < ar.last ? 5 + (ar.last - ar.in) : | ||||
|                                                   5 - (ar.in - ar.last)); | ||||
|     strm->avail_out = (unsigned)(ar.out < ar.end ? 257 + (ar.end - ar.out) : | ||||
|                                                    257 - (ar.out - ar.end)); | ||||
|     state->hold = ar.hold; | ||||
|     state->bits = ar.bits; | ||||
|     return; | ||||
| } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										35
									
								
								contrib/iostream3/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								contrib/iostream3/README
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| These classes provide a C++ stream interface to the zlib library. It allows you | ||||
| to do things like: | ||||
|  | ||||
|   gzofstream outf("blah.gz"); | ||||
|   outf << "These go into the gzip file " << 123 << endl; | ||||
|    | ||||
| It does this by deriving a specialized stream buffer for gzipped files, which is | ||||
| the way Stroustrup would have done it. :->  | ||||
|  | ||||
| The gzifstream and gzofstream classes were originally written by Kevin Ruland | ||||
| and made available in the zlib contrib/iostream directory. The older version still | ||||
| compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of  | ||||
| this version. | ||||
|  | ||||
| The new classes are as standard-compliant as possible, closely following the  | ||||
| approach of the standard library's fstream classes. It compiles under gcc versions  | ||||
| 3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard  | ||||
| library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs  | ||||
| from the previous one in the following respects: | ||||
| - added showmanyc | ||||
| - added setbuf, with support for unbuffered output via setbuf(0,0) | ||||
| - a few bug fixes of stream behavior | ||||
| - gzipped output file opened with default compression level instead of maximum level | ||||
| - setcompressionlevel()/strategy() members replaced by single setcompression() | ||||
|  | ||||
| The code is provided "as is", with the permission to use, copy, modify, distribute  | ||||
| and sell it for any purpose without fee. | ||||
|  | ||||
| Ludwig Schwardt | ||||
| <schwardt@sun.ac.za> | ||||
|  | ||||
| DSP Lab | ||||
| Electrical & Electronic Engineering Department | ||||
| University of Stellenbosch | ||||
| South Africa | ||||
							
								
								
									
										17
									
								
								contrib/iostream3/TODO
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								contrib/iostream3/TODO
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| Possible upgrades to gzfilebuf: | ||||
|  | ||||
| - The ability to do putback (e.g. putbackfail) | ||||
|  | ||||
| - The ability to seek (zlib supports this, but could be slow/tricky) | ||||
|  | ||||
| - Simultaneous read/write access (does it make sense?) | ||||
|  | ||||
| - Support for ios_base::ate open mode | ||||
|  | ||||
| - Locale support? | ||||
|  | ||||
| - Check public interface to see which calls give problems | ||||
|   (due to dependence on library internals) | ||||
|  | ||||
| - Override operator<<(ostream&, gzfilebuf*) to allow direct copying  | ||||
|   of stream buffer to stream ( i.e. os << is.rdbuf(); ) | ||||
							
								
								
									
										50
									
								
								contrib/iostream3/test.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								contrib/iostream3/test.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
|  * Test program for gzifstream and gzofstream | ||||
|  *  | ||||
|  * by Ludwig Schwardt <schwardt@sun.ac.za> | ||||
|  * original version by Kevin Ruland <kevin@rodin.wustl.edu> | ||||
|  */ | ||||
|  | ||||
| #include "zfstream.h" | ||||
| #include <iostream>      // for cout | ||||
|  | ||||
| int main() { | ||||
|  | ||||
|   gzofstream outf; | ||||
|   gzifstream inf; | ||||
|   char buf[80]; | ||||
|    | ||||
|   outf.open("test1.txt.gz"); | ||||
|   outf << "The quick brown fox sidestepped the lazy canine\n"  | ||||
|        << 1.3 << "\nPlan " << 9 << std::endl; | ||||
|   outf.close(); | ||||
|   std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n" | ||||
|             << "The quick brown fox sidestepped the lazy canine\n" | ||||
|             << 1.3 << "\nPlan " << 9 << std::endl; | ||||
|    | ||||
|   std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n"; | ||||
|   inf.open("test1.txt.gz"); | ||||
|   while (inf.getline(buf,80,'\n')) { | ||||
|     std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; | ||||
|   } | ||||
|   inf.close(); | ||||
|  | ||||
|   outf.rdbuf()->pubsetbuf(0,0); | ||||
|   outf.open("test2.txt.gz"); | ||||
|   outf << setcompression(Z_NO_COMPRESSION) | ||||
|        << "The quick brown fox sidestepped the lazy canine\n" | ||||
|        << 1.3 << "\nPlan " << 9 << std::endl; | ||||
|   outf.close(); | ||||
|   std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form"; | ||||
|  | ||||
|   std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n"; | ||||
|   inf.rdbuf()->pubsetbuf(0,0); | ||||
|   inf.open("test2.txt.gz"); | ||||
|   while (inf.getline(buf,80,'\n')) { | ||||
|     std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; | ||||
|   } | ||||
|   inf.close(); | ||||
|  | ||||
|   return 0; | ||||
|  | ||||
| } | ||||
							
								
								
									
										479
									
								
								contrib/iostream3/zfstream.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										479
									
								
								contrib/iostream3/zfstream.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,479 @@ | ||||
| /* | ||||
|  * A C++ I/O streams interface to the zlib gz* functions | ||||
|  *  | ||||
|  * by Ludwig Schwardt <schwardt@sun.ac.za> | ||||
|  * original version by Kevin Ruland <kevin@rodin.wustl.edu> | ||||
|  *  | ||||
|  * This version is standard-compliant and compatible with gcc 3.x. | ||||
|  */ | ||||
|  | ||||
| #include "zfstream.h" | ||||
| #include <cstring>          // for strcpy, strcat, strlen (mode strings) | ||||
| #include <cstdio>           // for BUFSIZ | ||||
|  | ||||
| // Internal buffer sizes (default and "unbuffered" versions) | ||||
| #define BIGBUFSIZE BUFSIZ | ||||
| #define SMALLBUFSIZE 1 | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| // Default constructor | ||||
| gzfilebuf::gzfilebuf()  | ||||
| : file(NULL), io_mode(std::ios_base::openmode(0)), own_fd(false),  | ||||
|   buffer(NULL), buffer_size(BIGBUFSIZE), own_buffer(true) | ||||
| { | ||||
|   // No buffers to start with | ||||
|   this->disable_buffer(); | ||||
| } | ||||
|  | ||||
| // Destructor | ||||
| gzfilebuf::~gzfilebuf()  | ||||
| { | ||||
|   // Sync output buffer and close only if responsible for file | ||||
|   // (i.e. attached streams should be left open at this stage) | ||||
|   this->sync(); | ||||
|   if (own_fd)  | ||||
|     this->close(); | ||||
|   // Make sure internal buffer is deallocated | ||||
|   this->disable_buffer(); | ||||
| } | ||||
|  | ||||
| // Set compression level and strategy | ||||
| int | ||||
| gzfilebuf::setcompression(int comp_level, | ||||
| 			  int comp_strategy) | ||||
| { | ||||
|   return gzsetparams(file, comp_level, comp_strategy); | ||||
| } | ||||
|  | ||||
| // Open gzipped file | ||||
| gzfilebuf*  | ||||
| gzfilebuf::open(const char *name,  | ||||
| 		std::ios_base::openmode mode) | ||||
| { | ||||
|   // Fail if file already open | ||||
|   if (this->is_open())  | ||||
|     return NULL; | ||||
|   // Don't support simultaneous read/write access (yet) | ||||
|   if ((mode & std::ios_base::in) && (mode & std::ios_base::out))  | ||||
|     return NULL; | ||||
|    | ||||
|   // Build mode string for gzopen and check it [27.8.1.3.2] | ||||
|   char char_mode[6] = "\0\0\0\0\0"; | ||||
|   if (!this->open_mode(mode, char_mode)) | ||||
|     return NULL; | ||||
|    | ||||
|   // Attempt to open file | ||||
|   if ((file = gzopen(name, char_mode)) == NULL)  | ||||
|     return NULL; | ||||
|  | ||||
|   // On success, allocate internal buffer and set flags | ||||
|   this->enable_buffer(); | ||||
|   io_mode = mode; | ||||
|   own_fd = true; | ||||
|   return this; | ||||
| } | ||||
|  | ||||
| // Attach to gzipped file | ||||
| gzfilebuf* | ||||
| gzfilebuf::attach(int fd, | ||||
| 		  std::ios_base::openmode mode)  | ||||
| { | ||||
|   // Fail if file already open | ||||
|   if (this->is_open())  | ||||
|     return NULL; | ||||
|   // Don't support simultaneous read/write access (yet) | ||||
|   if ((mode & std::ios_base::in) && (mode & std::ios_base::out))  | ||||
|     return NULL; | ||||
|    | ||||
|   // Build mode string for gzdopen and check it [27.8.1.3.2] | ||||
|   char char_mode[6] = "\0\0\0\0\0"; | ||||
|   if (!this->open_mode(mode, char_mode)) | ||||
|     return NULL; | ||||
|    | ||||
|   // Attempt to attach to file | ||||
|   if ((file = gzdopen(fd, char_mode)) == NULL) | ||||
|     return NULL; | ||||
|    | ||||
|   // On success, allocate internal buffer and set flags | ||||
|   this->enable_buffer(); | ||||
|   io_mode = mode; | ||||
|   own_fd = false; | ||||
|   return this; | ||||
| } | ||||
|  | ||||
| // Close gzipped file | ||||
| gzfilebuf* | ||||
| gzfilebuf::close()  | ||||
| { | ||||
|   // Fail immediately if no file is open | ||||
|   if (!this->is_open()) | ||||
|     return NULL; | ||||
|   // Assume success | ||||
|   gzfilebuf* retval = this; | ||||
|   // Attempt to sync and close gzipped file | ||||
|   if (this->sync() == -1) | ||||
|     retval = NULL; | ||||
|   if (gzclose(file) < 0) | ||||
|     retval = NULL; | ||||
|   // File is now gone anyway (postcondition [27.8.1.3.8]) | ||||
|   file = NULL; | ||||
|   own_fd = false; | ||||
|   // Destroy internal buffer if it exists | ||||
|   this->disable_buffer(); | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||||
|  | ||||
| // Convert int open mode to mode string | ||||
| bool  | ||||
| gzfilebuf::open_mode(std::ios_base::openmode mode,  | ||||
| 		     char* c_mode) const | ||||
| { | ||||
|   bool testb = mode & std::ios_base::binary; | ||||
|   bool testi = mode & std::ios_base::in; | ||||
|   bool testo = mode & std::ios_base::out; | ||||
|   bool testt = mode & std::ios_base::trunc; | ||||
|   bool testa = mode & std::ios_base::app; | ||||
|        | ||||
|   // Check for valid flag combinations - see [27.8.1.3.2] (Table 92) | ||||
|   // Original zfstream hardcoded the compression level to maximum here... | ||||
|   // Double the time for less than 1% size improvement seems | ||||
|   // excessive though - keeping it at the default level | ||||
|   // To change back, just append "9" to the next three mode strings | ||||
|   if (!testi && testo && !testt && !testa) | ||||
|     strcpy(c_mode, "w"); | ||||
|   if (!testi && testo && !testt && testa) | ||||
|     strcpy(c_mode, "a"); | ||||
|   if (!testi && testo && testt && !testa) | ||||
|     strcpy(c_mode, "w"); | ||||
|   if (testi && !testo && !testt && !testa) | ||||
|     strcpy(c_mode, "r"); | ||||
|   // No read/write mode yet | ||||
| //  if (testi && testo && !testt && !testa) | ||||
| //    strcpy(c_mode, "r+"); | ||||
| //  if (testi && testo && testt && !testa) | ||||
| //    strcpy(c_mode, "w+"); | ||||
|  | ||||
|   // Mode string should be empty for invalid combination of flags     | ||||
|   if (strlen(c_mode) == 0) | ||||
|     return false; | ||||
|   if (testb) | ||||
|     strcat(c_mode, "b"); | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| // Determine number of characters in internal get buffer | ||||
| std::streamsize  | ||||
| gzfilebuf::showmanyc() | ||||
| { | ||||
|   // Calls to underflow will fail if file not opened for reading | ||||
|   if (!this->is_open() || !(io_mode & std::ios_base::in)) | ||||
|     return -1; | ||||
|   // Make sure get area is in use | ||||
|   if (this->gptr() && (this->gptr() < this->egptr())) | ||||
|     return std::streamsize(this->egptr() - this->gptr()); | ||||
|   else | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| // Fill get area from gzipped file | ||||
| gzfilebuf::int_type | ||||
| gzfilebuf::underflow()  | ||||
| { | ||||
|   // If something is left in the get area by chance, return it | ||||
|   // (this shouldn't normally happen, as underflow is only supposed  | ||||
|   // to be called when gptr >= egptr, but it serves as error check) | ||||
|   if (this->gptr() && (this->gptr() < this->egptr())) | ||||
|     return traits_type::to_int_type(*(this->gptr())); | ||||
|  | ||||
|   // If the file hasn't been opened for reading, produce error | ||||
|   if (!this->is_open() || !(io_mode & std::ios_base::in)) | ||||
|     return traits_type::eof(); | ||||
|  | ||||
|   // Attempt to fill internal buffer from gzipped file | ||||
|   // (buffer must be guaranteed to exist...) | ||||
|   int bytes_read = gzread(file, buffer, buffer_size); | ||||
|   // Indicates error or EOF | ||||
|   if (bytes_read <= 0) | ||||
|   { | ||||
|     // Reset get area | ||||
|     this->setg(buffer, buffer, buffer); | ||||
|     return traits_type::eof(); | ||||
|   } | ||||
|   // Make all bytes read from file available as get area | ||||
|   this->setg(buffer, buffer, buffer + bytes_read); | ||||
|    | ||||
|   // Return next character in get area | ||||
|   return traits_type::to_int_type(*(this->gptr())); | ||||
| } | ||||
|  | ||||
| // Write put area to gzipped file | ||||
| gzfilebuf::int_type | ||||
| gzfilebuf::overflow(int_type c)  | ||||
| { | ||||
|   // Determine whether put area is in use | ||||
|   if (this->pbase()) | ||||
|   { | ||||
|     // Double-check pointer range | ||||
|     if (this->pptr() > this->epptr() || this->pptr() < this->pbase()) | ||||
|       return traits_type::eof(); | ||||
|     // Add extra character to buffer if not EOF | ||||
|     if (!traits_type::eq_int_type(c, traits_type::eof())) | ||||
|     { | ||||
|       *(this->pptr()) = traits_type::to_char_type(c); | ||||
|       this->pbump(1); | ||||
|     } | ||||
|     // Number of characters to write to file | ||||
|     int bytes_to_write = this->pptr() - this->pbase(); | ||||
|     // Overflow doesn't fail if nothing is to be written | ||||
|     if (bytes_to_write > 0) | ||||
|     { | ||||
|       // If the file hasn't been opened for writing, produce error | ||||
|       if (!this->is_open() || !(io_mode & std::ios_base::out)) | ||||
| 	return traits_type::eof(); | ||||
|       // If gzipped file won't accept all bytes written to it, fail | ||||
|       if (gzwrite(file, this->pbase(), bytes_to_write) != bytes_to_write) | ||||
| 	return traits_type::eof(); | ||||
|       // Reset next pointer to point to pbase on success | ||||
|       this->pbump(-bytes_to_write); | ||||
|     } | ||||
|   } | ||||
|   // Write extra character to file if not EOF | ||||
|   else if (!traits_type::eq_int_type(c, traits_type::eof())) | ||||
|   { | ||||
|     // If the file hasn't been opened for writing, produce error | ||||
|     if (!this->is_open() || !(io_mode & std::ios_base::out)) | ||||
|       return traits_type::eof(); | ||||
|     // Impromptu char buffer (allows "unbuffered" output) | ||||
|     char_type last_char = traits_type::to_char_type(c); | ||||
|     // If gzipped file won't accept this character, fail | ||||
|     if (gzwrite(file, &last_char, 1) != 1) | ||||
|       return traits_type::eof();       | ||||
|   } | ||||
|  | ||||
|   // If you got here, you have succeeded (even if c was EOF) | ||||
|   // The return value should therefore be non-EOF | ||||
|   if (traits_type::eq_int_type(c, traits_type::eof())) | ||||
|     return traits_type::not_eof(c); | ||||
|   else | ||||
|     return c; | ||||
| } | ||||
|  | ||||
| // Assign new buffer | ||||
| std::streambuf*  | ||||
| gzfilebuf::setbuf(char_type* p, | ||||
| 		  std::streamsize n) | ||||
| { | ||||
|   // First make sure stuff is sync'ed, for safety | ||||
|   if (this->sync() == -1) | ||||
|     return NULL; | ||||
|   // If buffering is turned off on purpose via setbuf(0,0), still allocate one... | ||||
|   // "Unbuffered" only really refers to put [27.8.1.4.10], while get needs at | ||||
|   // least a buffer of size 1 (very inefficient though, therefore make it bigger?) | ||||
|   // This follows from [27.5.2.4.3]/12 (gptr needs to point at something, it seems) | ||||
|   if (!p || !n) | ||||
|   { | ||||
|     // Replace existing buffer (if any) with small internal buffer | ||||
|     this->disable_buffer(); | ||||
|     buffer = NULL; | ||||
|     buffer_size = 0; | ||||
|     own_buffer = true; | ||||
|     this->enable_buffer(); | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     // Replace existing buffer (if any) with external buffer | ||||
|     this->disable_buffer(); | ||||
|     buffer = p; | ||||
|     buffer_size = n; | ||||
|     own_buffer = false; | ||||
|     this->enable_buffer(); | ||||
|   } | ||||
|   return this; | ||||
| } | ||||
|  | ||||
| // Write put area to gzipped file (i.e. ensures that put area is empty) | ||||
| int  | ||||
| gzfilebuf::sync()  | ||||
| { | ||||
|   return traits_type::eq_int_type(this->overflow(), traits_type::eof()) ? -1 : 0; | ||||
| } | ||||
|  | ||||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||||
|  | ||||
| // Allocate internal buffer | ||||
| void  | ||||
| gzfilebuf::enable_buffer()  | ||||
| { | ||||
|   // If internal buffer required, allocate one | ||||
|   if (own_buffer && !buffer)  | ||||
|   { | ||||
|     // Check for buffered vs. "unbuffered" | ||||
|     if (buffer_size > 0) | ||||
|     { | ||||
|       // Allocate internal buffer | ||||
|       buffer = new char_type[buffer_size]; | ||||
|       // Get area starts empty and will be expanded by underflow as need arises | ||||
|       this->setg(buffer, buffer, buffer); | ||||
|       // Setup entire internal buffer as put area. | ||||
|       // The one-past-end pointer actually points to the last element of the buffer, | ||||
|       // so that overflow(c) can safely add the extra character c to the sequence. | ||||
|       // These pointers remain in place for the duration of the buffer | ||||
|       this->setp(buffer, buffer + buffer_size - 1); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|       // Even in "unbuffered" case, (small?) get buffer is still required | ||||
|       buffer_size = SMALLBUFSIZE; | ||||
|       buffer = new char_type[buffer_size]; | ||||
|       this->setg(buffer, buffer, buffer); | ||||
|       // "Unbuffered" means no put buffer | ||||
|       this->setp(0, 0); | ||||
|     } | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     // If buffer already allocated, reset buffer pointers just to make sure no  | ||||
|     // stale chars are lying around | ||||
|     this->setg(buffer, buffer, buffer); | ||||
|     this->setp(buffer, buffer + buffer_size - 1); | ||||
|   }   | ||||
| } | ||||
|  | ||||
| // Destroy internal buffer | ||||
| void  | ||||
| gzfilebuf::disable_buffer()  | ||||
| { | ||||
|   // If internal buffer exists, deallocate it | ||||
|   if (own_buffer && buffer) | ||||
|   { | ||||
|     // Preserve unbuffered status by zeroing size | ||||
|     if (!this->pbase()) | ||||
|       buffer_size = 0; | ||||
|     delete[] buffer; | ||||
|     buffer = NULL; | ||||
|     this->setg(0, 0, 0); | ||||
|     this->setp(0, 0); | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     // Reset buffer pointers to initial state if external buffer exists | ||||
|     this->setg(buffer, buffer, buffer); | ||||
|     if (buffer) | ||||
|       this->setp(buffer, buffer + buffer_size - 1); | ||||
|     else | ||||
|       this->setp(0, 0); | ||||
|   } | ||||
| } | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| // Default constructor initializes stream buffer | ||||
| gzifstream::gzifstream()  | ||||
| : std::istream(NULL), sb() | ||||
| { this->init(&sb); } | ||||
|  | ||||
| // Initialize stream buffer and open file | ||||
| gzifstream::gzifstream(const char* name, | ||||
| 		       std::ios_base::openmode mode) | ||||
| : std::istream(NULL), sb() | ||||
| { | ||||
|   this->init(&sb); | ||||
|   this->open(name, mode); | ||||
| } | ||||
|  | ||||
| // Initialize stream buffer and attach to file | ||||
| gzifstream::gzifstream(int fd, | ||||
| 		       std::ios_base::openmode mode) | ||||
| : std::istream(NULL), sb() | ||||
| { | ||||
|   this->init(&sb); | ||||
|   this->attach(fd, mode); | ||||
| } | ||||
|  | ||||
| // Open file and go into fail() state if unsuccessful | ||||
| void  | ||||
| gzifstream::open(const char* name,  | ||||
| 		 std::ios_base::openmode mode) | ||||
| { | ||||
|   if (!sb.open(name, mode | std::ios_base::in)) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
|   else | ||||
|     this->clear(); | ||||
| } | ||||
|  | ||||
| // Attach to file and go into fail() state if unsuccessful | ||||
| void  | ||||
| gzifstream::attach(int fd,  | ||||
| 		   std::ios_base::openmode mode) | ||||
| { | ||||
|   if (!sb.attach(fd, mode | std::ios_base::in)) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
|   else | ||||
|     this->clear(); | ||||
| } | ||||
|  | ||||
| // Close file | ||||
| void  | ||||
| gzifstream::close() | ||||
| { | ||||
|   if (!sb.close()) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
| } | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| // Default constructor initializes stream buffer | ||||
| gzofstream::gzofstream()  | ||||
| : std::ostream(NULL), sb() | ||||
| { this->init(&sb); } | ||||
|  | ||||
| // Initialize stream buffer and open file | ||||
| gzofstream::gzofstream(const char* name, | ||||
| 		       std::ios_base::openmode mode) | ||||
| : std::ostream(NULL), sb() | ||||
| { | ||||
|   this->init(&sb); | ||||
|   this->open(name, mode); | ||||
| } | ||||
|  | ||||
| // Initialize stream buffer and attach to file | ||||
| gzofstream::gzofstream(int fd, | ||||
| 		       std::ios_base::openmode mode) | ||||
| : std::ostream(NULL), sb() | ||||
| { | ||||
|   this->init(&sb); | ||||
|   this->attach(fd, mode); | ||||
| } | ||||
|  | ||||
| // Open file and go into fail() state if unsuccessful | ||||
| void  | ||||
| gzofstream::open(const char* name,  | ||||
| 		 std::ios_base::openmode mode) | ||||
| { | ||||
|   if (!sb.open(name, mode | std::ios_base::out)) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
|   else | ||||
|     this->clear(); | ||||
| } | ||||
|  | ||||
| // Attach to file and go into fail() state if unsuccessful | ||||
| void  | ||||
| gzofstream::attach(int fd,  | ||||
| 		   std::ios_base::openmode mode) | ||||
| { | ||||
|   if (!sb.attach(fd, mode | std::ios_base::out)) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
|   else | ||||
|     this->clear(); | ||||
| } | ||||
|  | ||||
| // Close file | ||||
| void  | ||||
| gzofstream::close() | ||||
| { | ||||
|   if (!sb.close()) | ||||
|     this->setstate(std::ios_base::failbit); | ||||
| } | ||||
							
								
								
									
										466
									
								
								contrib/iostream3/zfstream.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										466
									
								
								contrib/iostream3/zfstream.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,466 @@ | ||||
| /* | ||||
|  * A C++ I/O streams interface to the zlib gz* functions | ||||
|  *  | ||||
|  * by Ludwig Schwardt <schwardt@sun.ac.za> | ||||
|  * original version by Kevin Ruland <kevin@rodin.wustl.edu> | ||||
|  *  | ||||
|  * This version is standard-compliant and compatible with gcc 3.x. | ||||
|  */ | ||||
|  | ||||
| #ifndef ZFSTREAM_H | ||||
| #define ZFSTREAM_H | ||||
|  | ||||
| #include <istream>  // not iostream, since we don't need cin/cout | ||||
| #include <ostream> | ||||
| #include "zlib.h" | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| /** | ||||
|  *  @brief  Gzipped file stream buffer class. | ||||
|  * | ||||
|  *  This class implements basic_filebuf for gzipped files. It doesn't yet support | ||||
|  *  seeking (allowed by zlib but slow/limited), putback and read/write access  | ||||
|  *  (tricky). Otherwise, it attempts to be a drop-in replacement for the standard  | ||||
|  *  file streambuf. | ||||
| */ | ||||
| class gzfilebuf : public std::streambuf  | ||||
| { | ||||
| public:    | ||||
|   //  Default constructor. | ||||
|   gzfilebuf(); | ||||
|    | ||||
|   //  Destructor. | ||||
|   virtual  | ||||
|   ~gzfilebuf(); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Set compression level and strategy on the fly. | ||||
|    *  @param  comp_level  Compression level (see zlib.h for allowed values)  | ||||
|    *  @param  comp_strategy  Compression strategy (see zlib.h for allowed values)  | ||||
|    *  @return  Z_OK on success, Z_STREAM_ERROR otherwise. | ||||
|    *  | ||||
|    *  Unfortunately, these parameters cannot be modified separately, as the | ||||
|    *  previous zfstream version assumed. Since the strategy is seldom changed, | ||||
|    *  it can default and setcompression(level) then becomes like the old | ||||
|    *  setcompressionlevel(level). | ||||
|   */ | ||||
|   int  | ||||
|   setcompression(int comp_level,  | ||||
| 		 int comp_strategy = Z_DEFAULT_STRATEGY); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Check if file is open. | ||||
|    *  @return  True if file is open. | ||||
|   */ | ||||
|   bool  | ||||
|   is_open() const { return (file != NULL); } | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Open gzipped file. | ||||
|    *  @param  name  File name. | ||||
|    *  @param  mode  Open mode flags. | ||||
|    *  @return  @c this on success, NULL on failure. | ||||
|   */ | ||||
|   gzfilebuf*  | ||||
|   open(const char* name,  | ||||
|        std::ios_base::openmode mode); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Attach to already open gzipped file. | ||||
|    *  @param  fd  File descriptor. | ||||
|    *  @param  mode  Open mode flags. | ||||
|    *  @return  @c this on success, NULL on failure. | ||||
|   */ | ||||
|   gzfilebuf*  | ||||
|   attach(int fd,  | ||||
| 	 std::ios_base::openmode mode); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Close gzipped file. | ||||
|    *  @return  @c this on success, NULL on failure. | ||||
|   */ | ||||
|   gzfilebuf*  | ||||
|   close(); | ||||
|     | ||||
| protected: | ||||
|   /** | ||||
|    *  @brief  Convert ios open mode int to mode string used by zlib. | ||||
|    *  @return  True if valid mode flag combination. | ||||
|   */ | ||||
|   bool  | ||||
|   open_mode(std::ios_base::openmode mode,  | ||||
| 	    char* c_mode) const; | ||||
|    | ||||
|   /** | ||||
|    *  @brief  Number of characters available in stream buffer. | ||||
|    *  @return  Number of characters. | ||||
|    *  | ||||
|    *  This indicates number of characters in get area of stream buffer. | ||||
|    *  These characters can be read without accessing the gzipped file. | ||||
|   */ | ||||
|   virtual std::streamsize | ||||
|   showmanyc(); | ||||
|    | ||||
|   /** | ||||
|    *  @brief  Fill get area from gzipped file. | ||||
|    *  @return  First character in get area on success, EOF on error. | ||||
|    *  | ||||
|    *  This actually reads characters from gzipped file to stream | ||||
|    *  buffer. Always buffered. | ||||
|   */ | ||||
|   virtual int_type | ||||
|   underflow(); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Write put area to gzipped file. | ||||
|    *  @param  c  Extra character to add to buffer contents. | ||||
|    *  @return  Non-EOF on success, EOF on error. | ||||
|    *  | ||||
|    *  This actually writes characters in stream buffer to  | ||||
|    *  gzipped file. With unbuffered output this is done one  | ||||
|    *  character at a time. | ||||
|   */  | ||||
|   virtual int_type  | ||||
|   overflow(int_type c = traits_type::eof()); | ||||
|      | ||||
|   /** | ||||
|    *  @brief  Installs external stream buffer. | ||||
|    *  @param  p  Pointer to char buffer. | ||||
|    *  @param  n  Size of external buffer. | ||||
|    *  @return  @c this on success, NULL on failure. | ||||
|    *  | ||||
|    *  Call setbuf(0,0) to enable unbuffered output. | ||||
|   */ | ||||
|   virtual std::streambuf*  | ||||
|   setbuf(char_type* p,  | ||||
| 	 std::streamsize n); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Flush stream buffer to file. | ||||
|    *  @return  0 on success, -1 on error. | ||||
|    *  | ||||
|    *  This calls underflow(EOF) to do the job. | ||||
|   */ | ||||
|   virtual int  | ||||
|   sync(); | ||||
|     | ||||
| // | ||||
| // Some future enhancements | ||||
| //  | ||||
| //  virtual int_type uflow(); | ||||
| //  virtual int_type pbackfail(int_type c = traits_type::eof()); | ||||
| //  virtual pos_type  | ||||
| //  seekoff(off_type off,  | ||||
| //	    std::ios_base::seekdir way, | ||||
| //	    std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); | ||||
| //  virtual pos_type  | ||||
| //  seekpos(pos_type sp,  | ||||
| //	    std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); | ||||
|     | ||||
| private: | ||||
|   /** | ||||
|    *  @brief  Allocate internal buffer. | ||||
|    *  | ||||
|    *  This function is safe to call multiple times. It will ensure | ||||
|    *  that a proper internal buffer exists if it is required. If the | ||||
|    *  buffer already exists or is external, the buffer pointers will be | ||||
|    *  reset to their original state. | ||||
|   */ | ||||
|   void  | ||||
|   enable_buffer(); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Destroy internal buffer. | ||||
|    *  | ||||
|    *  This function is safe to call multiple times. It will ensure | ||||
|    *  that the internal buffer is deallocated if it exists. In any | ||||
|    *  case, it will also reset the buffer pointers. | ||||
|   */ | ||||
|   void  | ||||
|   disable_buffer(); | ||||
|     | ||||
|   /** | ||||
|    *  Underlying file pointer. | ||||
|   */ | ||||
|   gzFile file; | ||||
|    | ||||
|   /** | ||||
|    *  Mode in which file was opened. | ||||
|   */ | ||||
|   std::ios_base::openmode io_mode; | ||||
|    | ||||
|   /** | ||||
|    *  @brief  True if this object owns file descriptor. | ||||
|    * | ||||
|    *  This makes the class responsible for closing the file  | ||||
|    *  upon destruction. | ||||
|   */ | ||||
|   bool own_fd; | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Stream buffer. | ||||
|    *  | ||||
|    *  For simplicity this remains allocated on the free store for the  | ||||
|    *  entire life span of the gzfilebuf object, unless replaced by setbuf. | ||||
|   */ | ||||
|   char_type* buffer; | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Stream buffer size. | ||||
|    *  | ||||
|    *  Defaults to system default buffer size (typically 8192 bytes). | ||||
|    *  Modified by setbuf. | ||||
|   */ | ||||
|   std::streamsize buffer_size; | ||||
|    | ||||
|   /** | ||||
|    *  @brief  True if this object owns stream buffer. | ||||
|    * | ||||
|    *  This makes the class responsible for deleting the buffer  | ||||
|    *  upon destruction. | ||||
|   */ | ||||
|   bool own_buffer; | ||||
| }; | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| /** | ||||
|  *  @brief  Gzipped file input stream class. | ||||
|  * | ||||
|  *  This class implements ifstream for gzipped files. Seeking and putback | ||||
|  *  is not supported yet. | ||||
| */ | ||||
| class gzifstream : public std::istream  | ||||
| { | ||||
| public: | ||||
|   //  Default constructor | ||||
|   gzifstream(); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Construct stream on gzipped file to be opened. | ||||
|    *  @param  name  File name. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::in). | ||||
|   */ | ||||
|   explicit | ||||
|   gzifstream(const char* name,  | ||||
| 	     std::ios_base::openmode mode = std::ios_base::in); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Construct stream on already open gzipped file. | ||||
|    *  @param  fd    File descriptor. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::in). | ||||
|   */ | ||||
|   explicit  | ||||
|   gzifstream(int fd,  | ||||
| 	     std::ios_base::openmode mode = std::ios_base::in); | ||||
|  | ||||
|   /** | ||||
|    *  Obtain underlying stream buffer. | ||||
|   */   | ||||
|   gzfilebuf*  | ||||
|   rdbuf() const | ||||
|   { return const_cast<gzfilebuf*>(&sb); }   | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Check if file is open. | ||||
|    *  @return  True if file is open. | ||||
|   */ | ||||
|   bool  | ||||
|   is_open() { return sb.is_open(); } | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Open gzipped file. | ||||
|    *  @param  name  File name. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::in). | ||||
|    *   | ||||
|    *  Stream will be in state good() if file opens successfully; | ||||
|    *  otherwise in state fail(). This differs from the behavior of | ||||
|    *  ifstream, which never sets the state to good() and therefore | ||||
|    *  won't allow you to reuse the stream for a second file unless | ||||
|    *  you manually clear() the state. The choice is a matter of | ||||
|    *  convenience. | ||||
|   */ | ||||
|   void  | ||||
|   open(const char* name,  | ||||
|        std::ios_base::openmode mode = std::ios_base::in); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Attach to already open gzipped file. | ||||
|    *  @param  fd  File descriptor. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::in). | ||||
|    *   | ||||
|    *  Stream will be in state good() if attach succeeded; otherwise | ||||
|    *  in state fail(). | ||||
|   */ | ||||
|   void  | ||||
|   attach(int fd,  | ||||
| 	 std::ios_base::openmode mode = std::ios_base::in); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Close gzipped file. | ||||
|    *   | ||||
|    *  Stream will be in state fail() if close failed. | ||||
|   */ | ||||
|   void  | ||||
|   close(); | ||||
|     | ||||
| private: | ||||
|   /** | ||||
|    *  Underlying stream buffer. | ||||
|   */     | ||||
|   gzfilebuf sb; | ||||
| }; | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|  | ||||
| /** | ||||
|  *  @brief  Gzipped file output stream class. | ||||
|  * | ||||
|  *  This class implements ofstream for gzipped files. Seeking and putback | ||||
|  *  is not supported yet. | ||||
| */ | ||||
| class gzofstream : public std::ostream | ||||
| { | ||||
| public: | ||||
|   //  Default constructor | ||||
|   gzofstream(); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Construct stream on gzipped file to be opened. | ||||
|    *  @param  name  File name. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::out). | ||||
|   */ | ||||
|   explicit | ||||
|   gzofstream(const char* name,  | ||||
| 	     std::ios_base::openmode mode = std::ios_base::out); | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Construct stream on already open gzipped file. | ||||
|    *  @param  fd    File descriptor. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::out). | ||||
|   */ | ||||
|   explicit  | ||||
|   gzofstream(int fd,  | ||||
| 	     std::ios_base::openmode mode = std::ios_base::out); | ||||
|  | ||||
|   /** | ||||
|    *  Obtain underlying stream buffer. | ||||
|   */   | ||||
|   gzfilebuf*  | ||||
|   rdbuf() const | ||||
|   { return const_cast<gzfilebuf*>(&sb); }   | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Check if file is open. | ||||
|    *  @return  True if file is open. | ||||
|   */ | ||||
|   bool  | ||||
|   is_open() { return sb.is_open(); } | ||||
|     | ||||
|   /** | ||||
|    *  @brief  Open gzipped file. | ||||
|    *  @param  name  File name. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::out). | ||||
|    *   | ||||
|    *  Stream will be in state good() if file opens successfully; | ||||
|    *  otherwise in state fail(). This differs from the behavior of | ||||
|    *  ofstream, which never sets the state to good() and therefore | ||||
|    *  won't allow you to reuse the stream for a second file unless | ||||
|    *  you manually clear() the state. The choice is a matter of | ||||
|    *  convenience. | ||||
|   */ | ||||
|   void  | ||||
|   open(const char* name,  | ||||
|        std::ios_base::openmode mode = std::ios_base::out); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Attach to already open gzipped file. | ||||
|    *  @param  fd  File descriptor. | ||||
|    *  @param  mode  Open mode flags (forced to contain ios::out). | ||||
|    *   | ||||
|    *  Stream will be in state good() if attach succeeded; otherwise | ||||
|    *  in state fail(). | ||||
|   */ | ||||
|   void  | ||||
|   attach(int fd,  | ||||
| 	 std::ios_base::openmode mode = std::ios_base::out); | ||||
|  | ||||
|   /** | ||||
|    *  @brief  Close gzipped file. | ||||
|    *   | ||||
|    *  Stream will be in state fail() if close failed. | ||||
|   */ | ||||
|   void  | ||||
|   close(); | ||||
|     | ||||
| private: | ||||
|   /** | ||||
|    *  Underlying stream buffer. | ||||
|   */     | ||||
|   gzfilebuf sb; | ||||
| }; | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|    | ||||
| /** | ||||
|  *  @brief  Gzipped file output stream manipulator class. | ||||
|  * | ||||
|  *  This class defines a two-argument manipulator for gzofstream. It is used | ||||
|  *  as base for the setcompression(int,int) manipulator. | ||||
| */ | ||||
| template<typename T1, typename T2> | ||||
|   class gzomanip2 | ||||
|   { | ||||
|   public: | ||||
|     // Allows insertor to peek at internals | ||||
|     template <typename Ta, typename Tb> | ||||
|       friend gzofstream&  | ||||
|       operator<<(gzofstream&,  | ||||
| 		 const gzomanip2<Ta,Tb>&); | ||||
|       | ||||
|     // Constructor | ||||
|     gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2), | ||||
| 	      T1 v1, | ||||
| 	      T2 v2); | ||||
|   private: | ||||
|     // Underlying manipulator function | ||||
|     gzofstream& | ||||
|     (*func)(gzofstream&, T1, T2); | ||||
|       | ||||
|     // Arguments for manipulator function  | ||||
|     T1 val1; | ||||
|     T2 val2; | ||||
|   }; | ||||
|  | ||||
| /*****************************************************************************/ | ||||
|    | ||||
| // Manipulator function thunks through to stream buffer | ||||
| inline gzofstream&  | ||||
| setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) | ||||
| { | ||||
|   (gzs.rdbuf())->setcompression(l, s); | ||||
|   return gzs; | ||||
| } | ||||
|  | ||||
| // Manipulator constructor stores arguments | ||||
| template<typename T1, typename T2> | ||||
|   inline  | ||||
|   gzomanip2<T1,T2>::gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2), | ||||
| 			      T1 v1, | ||||
| 			      T2 v2)  | ||||
|   : func(f), val1(v1), val2(v2) | ||||
|   { } | ||||
|  | ||||
| // Insertor applies underlying manipulator function to stream | ||||
| template<typename T1, typename T2> | ||||
|   inline gzofstream&  | ||||
|   operator<<(gzofstream& s, const gzomanip2<T1,T2>& m)  | ||||
|   { return (*m.func)(s, m.val1, m.val2); } | ||||
|  | ||||
| // Insert this onto stream to simplify setting of compression level | ||||
| inline gzomanip2<int,int>  | ||||
| setcompression(int l, int s = Z_DEFAULT_STRATEGY)  | ||||
| { return gzomanip2<int,int>(&setcompression, l, s); } | ||||
|  | ||||
| #endif // ZFSTREAM_H | ||||
| @@ -1,38 +1,51 @@ | ||||
| Change in 0.15: (19 Mar 98) | ||||
| - fix memory leak in minizip.c | ||||
|  | ||||
| Change in 0.14: (10 Mar 98) | ||||
| - fix bugs in minizip.c sample for zipping big file | ||||
| - fix problem in month in date handling | ||||
| - fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for  | ||||
|     comment handling | ||||
|  | ||||
| Change in 0.13: (6 Mar 98) | ||||
| - fix bugs in zip.c | ||||
| - add real minizip sample | ||||
|  | ||||
| Change in 0.12: (4 Mar 98) | ||||
| - add zip.c and zip.h for creates .zip file | ||||
| - fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) | ||||
| - fix miniunz.c for file without specific record for directory | ||||
|  | ||||
| Change in 0.11: (3 Mar 98) | ||||
| - fix bug in unzGetCurrentFileInfo for get extra field and comment | ||||
| - enhance miniunz sample, remove the bad unztst.c sample | ||||
|  | ||||
| Change in 0.10: (2 Mar 98) | ||||
| - fix bug in unzReadCurrentFile | ||||
| - rename unzip* to unz* function and structure | ||||
| - remove Windows-like hungary notation variable name | ||||
| - modify some structure in unzip.h | ||||
| - add somes comment in source | ||||
| - remove unzipGetcCurrentFile function | ||||
| - replace ZUNZEXPORT by ZEXPORT | ||||
| - add unzGetLocalExtrafield for get the local extrafield info | ||||
| - add a new sample, miniunz.c | ||||
|  | ||||
| Change in 0.4: (25 Feb 98) | ||||
| - suppress the type unzipFileInZip.  | ||||
|   Only on file in the zipfile can be open at the same time | ||||
| - fix somes typo in code | ||||
| - added tm_unz structure in unzip_file_info (date/time in readable format) | ||||
| Change in 0.22: (19 May 03) | ||||
| - crypting support (unless you define NOCRYPT) | ||||
| - append file in existing zipfile | ||||
|  | ||||
| Change in 0.21: (10 Mar 03) | ||||
| - bug fixes | ||||
|  | ||||
| Change in 0.17: (27 Jan 02) | ||||
| - bug fixes | ||||
|  | ||||
| Change in 0.16: (19 Jan 02) | ||||
| - Support of ioapi for virtualize zip file access | ||||
|  | ||||
| Change in 0.15: (19 Mar 98) | ||||
| - fix memory leak in minizip.c | ||||
|  | ||||
| Change in 0.14: (10 Mar 98) | ||||
| - fix bugs in minizip.c sample for zipping big file | ||||
| - fix problem in month in date handling | ||||
| - fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for  | ||||
|     comment handling | ||||
|  | ||||
| Change in 0.13: (6 Mar 98) | ||||
| - fix bugs in zip.c | ||||
| - add real minizip sample | ||||
|  | ||||
| Change in 0.12: (4 Mar 98) | ||||
| - add zip.c and zip.h for creates .zip file | ||||
| - fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) | ||||
| - fix miniunz.c for file without specific record for directory | ||||
|  | ||||
| Change in 0.11: (3 Mar 98) | ||||
| - fix bug in unzGetCurrentFileInfo for get extra field and comment | ||||
| - enhance miniunz sample, remove the bad unztst.c sample | ||||
|  | ||||
| Change in 0.10: (2 Mar 98) | ||||
| - fix bug in unzReadCurrentFile | ||||
| - rename unzip* to unz* function and structure | ||||
| - remove Windows-like hungary notation variable name | ||||
| - modify some structure in unzip.h | ||||
| - add somes comment in source | ||||
| - remove unzipGetcCurrentFile function | ||||
| - replace ZUNZEXPORT by ZEXPORT | ||||
| - add unzGetLocalExtrafield for get the local extrafield info | ||||
| - add a new sample, miniunz.c | ||||
|  | ||||
| Change in 0.4: (25 Feb 98) | ||||
| - suppress the type unzipFileInZip.  | ||||
|   Only on file in the zipfile can be open at the same time | ||||
| - fix somes typo in code | ||||
| - added tm_unz structure in unzip_file_info (date/time in readable format) | ||||
|   | ||||
| @@ -1,25 +1,25 @@ | ||||
| CC=cc | ||||
| CFLAGS=-O -I../.. | ||||
|  | ||||
| UNZ_OBJS = miniunz.o unzip.o ../../libz.a | ||||
| ZIP_OBJS = minizip.o zip.o   ../../libz.a | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| all: miniunz minizip | ||||
|  | ||||
| miniunz:  $(UNZ_OBJS) | ||||
| 	$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) | ||||
|  | ||||
| minizip:  $(ZIP_OBJS) | ||||
| 	$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) | ||||
|  | ||||
| test:	miniunz minizip | ||||
| 	./minizip test readme.txt | ||||
| 	./miniunz -l test.zip | ||||
| 	mv readme.txt readme.old | ||||
| 	./miniunz test.zip | ||||
|  | ||||
| clean: | ||||
| 	/bin/rm -f *.o *~ minizip miniunz | ||||
| CC=cc | ||||
| CFLAGS=-O -I../.. | ||||
|  | ||||
| UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a | ||||
| ZIP_OBJS = minizip.o zip.o   ioapi.o ../../libz.a | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| all: miniunz minizip | ||||
|  | ||||
| miniunz:  $(UNZ_OBJS) | ||||
| 	$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) | ||||
|  | ||||
| minizip:  $(ZIP_OBJS) | ||||
| 	$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) | ||||
|  | ||||
| test:	miniunz minizip | ||||
| 	./minizip test readme.txt | ||||
| 	./miniunz -l test.zip | ||||
| 	mv readme.txt readme.old | ||||
| 	./miniunz test.zip | ||||
|  | ||||
| clean: | ||||
| 	/bin/rm -f *.o *~ minizip miniunz | ||||
|   | ||||
							
								
								
									
										104
									
								
								contrib/minizip/crypt.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								contrib/minizip/crypt.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,104 @@ | ||||
|  | ||||
| #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) | ||||
|  | ||||
| /*********************************************************************** | ||||
|  * Return the next byte in the pseudo-random sequence | ||||
|  */ | ||||
| static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) | ||||
| { | ||||
|     unsigned temp;  /* POTENTIAL BUG:  temp*(temp^1) may overflow in an | ||||
|                      * unpredictable manner on 16-bit systems; not a problem | ||||
|                      * with any known compiler so far, though */ | ||||
|  | ||||
|     temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; | ||||
|     return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); | ||||
| } | ||||
|  | ||||
| /*********************************************************************** | ||||
|  * Update the encryption keys with the next byte of plain text | ||||
|  */ | ||||
| static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) | ||||
| { | ||||
|     (*(pkeys+0)) = CRC32((*(pkeys+0)), c); | ||||
|     (*(pkeys+1)) += (*(pkeys+0)) & 0xff; | ||||
|     (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; | ||||
|     { | ||||
|       register int keyshift = (int)((*(pkeys+1)) >> 24); | ||||
|       (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); | ||||
|     } | ||||
|     return c; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*********************************************************************** | ||||
|  * Initialize the encryption keys and the random header according to | ||||
|  * the given password. | ||||
|  */ | ||||
| static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) | ||||
| { | ||||
|     *(pkeys+0) = 305419896L; | ||||
|     *(pkeys+1) = 591751049L; | ||||
|     *(pkeys+2) = 878082192L; | ||||
|     while (*passwd != '\0') { | ||||
|         update_keys(pkeys,pcrc_32_tab,(int)*passwd); | ||||
|         passwd++; | ||||
|     } | ||||
| } | ||||
|  | ||||
| #define zdecode(pkeys,pcrc_32_tab,c) \ | ||||
|     (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) | ||||
|  | ||||
| #define zencode(pkeys,pcrc_32_tab,c,t) \ | ||||
|     (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) | ||||
|  | ||||
| #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED | ||||
|  | ||||
| #define RAND_HEAD_LEN  12 | ||||
|    /* "last resort" source for second part of crypt seed pattern */ | ||||
| #  ifndef ZCR_SEED2 | ||||
| #    define ZCR_SEED2 (unsigned long)3141592654L     /* use PI as default pattern */ | ||||
| #  endif | ||||
|  | ||||
| static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) | ||||
|     const char *passwd;         /* password string */ | ||||
|     unsigned char *buf;         /* where to write header */ | ||||
|     int bufSize; | ||||
|     unsigned long* pkeys; | ||||
|     const unsigned long* pcrc_32_tab; | ||||
|     unsigned long crcForCrypting; | ||||
| { | ||||
|     int n;                       /* index in random header */ | ||||
|     int t;                       /* temporary */ | ||||
|     int c;                       /* random byte */ | ||||
|     unsigned char header[RAND_HEAD_LEN-2]; /* random header */ | ||||
|     static unsigned calls = 0;   /* ensure different random header each time */ | ||||
|  | ||||
|     if (bufSize<RAND_HEAD_LEN) | ||||
|       return 0; | ||||
|  | ||||
|     /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the | ||||
|      * output of rand() to get less predictability, since rand() is | ||||
|      * often poorly implemented. | ||||
|      */ | ||||
|     if (++calls == 1) | ||||
|     { | ||||
|         srand((unsigned)(time(NULL) ^ ZCR_SEED2)); | ||||
|     } | ||||
|     init_keys(passwd, pkeys, pcrc_32_tab); | ||||
|     for (n = 0; n < RAND_HEAD_LEN-2; n++) | ||||
|     { | ||||
|         c = (rand() >> 7) & 0xff; | ||||
|         header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); | ||||
|     } | ||||
|     /* Encrypt random header (last two bytes is high word of crc) */ | ||||
|     init_keys(passwd, pkeys, pcrc_32_tab); | ||||
|     for (n = 0; n < RAND_HEAD_LEN-2; n++) | ||||
|     { | ||||
|         buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); | ||||
|     } | ||||
|     buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); | ||||
|     buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); | ||||
|     return n; | ||||
| } | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										177
									
								
								contrib/minizip/ioapi.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								contrib/minizip/ioapi.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | ||||
| /* ioapi.c -- IO base function header for compress/uncompress .zip | ||||
|    files using zlib + zip or unzip API | ||||
|  | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
| */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "zlib.h" | ||||
| #include "ioapi.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ | ||||
|  | ||||
| #ifndef SEEK_CUR | ||||
| #define SEEK_CUR    1 | ||||
| #endif | ||||
|  | ||||
| #ifndef SEEK_END | ||||
| #define SEEK_END    2 | ||||
| #endif | ||||
|  | ||||
| #ifndef SEEK_SET | ||||
| #define SEEK_SET    0 | ||||
| #endif | ||||
|  | ||||
| voidpf ZCALLBACK fopen_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    const char* filename, | ||||
|    int mode)); | ||||
|  | ||||
| uLong ZCALLBACK fread_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    void* buf, | ||||
|    uLong size)); | ||||
|  | ||||
| uLong ZCALLBACK fwrite_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    const void* buf, | ||||
|    uLong size)); | ||||
|  | ||||
| long ZCALLBACK ftell_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
| long ZCALLBACK fseek_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    uLong offset, | ||||
|    int origin)); | ||||
|  | ||||
| int ZCALLBACK fclose_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
| int ZCALLBACK ferror_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
|  | ||||
| voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) | ||||
|    voidpf opaque; | ||||
|    const char* filename; | ||||
|    int mode; | ||||
| { | ||||
|     FILE* file = NULL; | ||||
|     const char* mode_fopen = NULL; | ||||
|     if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) | ||||
|         mode_fopen = "rb"; | ||||
|     else | ||||
|     if (mode & ZLIB_FILEFUNC_MODE_EXISTING) | ||||
|         mode_fopen = "r+b"; | ||||
|     else | ||||
|     if (mode & ZLIB_FILEFUNC_MODE_CREATE) | ||||
|         mode_fopen = "wb"; | ||||
|  | ||||
|     if ((filename!=NULL) && (mode_fopen != NULL)) | ||||
|         file = fopen(filename, mode_fopen); | ||||
|     return file; | ||||
| } | ||||
|  | ||||
|  | ||||
| uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    void* buf; | ||||
|    uLong size; | ||||
| { | ||||
|     uLong ret; | ||||
|     ret = fread(buf, 1, (size_t)size, (FILE *)stream); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    const void* buf; | ||||
|    uLong size; | ||||
| { | ||||
|     uLong ret; | ||||
|     ret = fwrite(buf, 1, (size_t)size, (FILE *)stream); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| long ZCALLBACK ftell_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     long ret; | ||||
|     ret = ftell((FILE *)stream); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    uLong offset; | ||||
|    int origin; | ||||
| { | ||||
|     int fseek_origin=0; | ||||
|     long ret; | ||||
|     switch (origin) | ||||
|     { | ||||
|     case ZLIB_FILEFUNC_SEEK_CUR : | ||||
|         fseek_origin = SEEK_CUR; | ||||
|         break; | ||||
|     case ZLIB_FILEFUNC_SEEK_END : | ||||
|         fseek_origin = SEEK_END; | ||||
|         break; | ||||
|     case ZLIB_FILEFUNC_SEEK_SET : | ||||
|         fseek_origin = SEEK_SET; | ||||
|         break; | ||||
|     default: return -1; | ||||
|     } | ||||
|     ret = 0; | ||||
|     fseek((FILE *)stream, offset, fseek_origin); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| int ZCALLBACK fclose_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     int ret; | ||||
|     ret = fclose((FILE *)stream); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| int ZCALLBACK ferror_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     int ret; | ||||
|     ret = ferror((FILE *)stream); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| void fill_fopen_filefunc (pzlib_filefunc_def) | ||||
|   zlib_filefunc_def* pzlib_filefunc_def; | ||||
| { | ||||
|     pzlib_filefunc_def->zopen_file = fopen_file_func; | ||||
|     pzlib_filefunc_def->zread_file = fread_file_func; | ||||
|     pzlib_filefunc_def->zwrite_file = fwrite_file_func; | ||||
|     pzlib_filefunc_def->ztell_file = ftell_file_func; | ||||
|     pzlib_filefunc_def->zseek_file = fseek_file_func; | ||||
|     pzlib_filefunc_def->zclose_file = fclose_file_func; | ||||
|     pzlib_filefunc_def->zerror_file = ferror_file_func; | ||||
|     pzlib_filefunc_def->opaque = NULL; | ||||
| } | ||||
							
								
								
									
										75
									
								
								contrib/minizip/ioapi.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								contrib/minizip/ioapi.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | ||||
| /* ioapi.h -- IO base function header for compress/uncompress .zip | ||||
|    files using zlib + zip or unzip API | ||||
|  | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
| */ | ||||
|  | ||||
| #ifndef _ZLIBIOAPI_H | ||||
| #define _ZLIBIOAPI_H | ||||
|  | ||||
|  | ||||
| #define ZLIB_FILEFUNC_SEEK_CUR (1) | ||||
| #define ZLIB_FILEFUNC_SEEK_END (2) | ||||
| #define ZLIB_FILEFUNC_SEEK_SET (0) | ||||
|  | ||||
| #define ZLIB_FILEFUNC_MODE_READ      (1) | ||||
| #define ZLIB_FILEFUNC_MODE_WRITE     (2) | ||||
| #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) | ||||
|  | ||||
| #define ZLIB_FILEFUNC_MODE_EXISTING (4) | ||||
| #define ZLIB_FILEFUNC_MODE_CREATE   (8) | ||||
|  | ||||
|  | ||||
| #ifndef ZCALLBACK | ||||
|  | ||||
| #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) | ||||
| #define ZCALLBACK CALLBACK | ||||
| #else | ||||
| #define ZCALLBACK | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); | ||||
| typedef uLong  (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); | ||||
| typedef uLong  (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); | ||||
| typedef long   (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); | ||||
| typedef long   (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); | ||||
| typedef int    (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); | ||||
| typedef int    (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); | ||||
|  | ||||
| typedef struct zlib_filefunc_def_s | ||||
| { | ||||
|     open_file_func      zopen_file; | ||||
|     read_file_func      zread_file; | ||||
|     write_file_func     zwrite_file; | ||||
|     tell_file_func      ztell_file; | ||||
|     seek_file_func      zseek_file; | ||||
|     close_file_func     zclose_file; | ||||
|     testerror_file_func zerror_file; | ||||
|     voidpf              opaque; | ||||
| } zlib_filefunc_def; | ||||
|  | ||||
|  | ||||
|  | ||||
| void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); | ||||
|  | ||||
| #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) | ||||
| #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) | ||||
| #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) | ||||
| #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) | ||||
| #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) | ||||
| #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
|  | ||||
							
								
								
									
										271
									
								
								contrib/minizip/iowin32.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										271
									
								
								contrib/minizip/iowin32.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,271 @@ | ||||
| /* iowin32.c -- IO base function header for compress/uncompress .zip | ||||
|    files using zlib + zip or unzip API | ||||
|    This IO API version uses the Win32 API (for Microsoft Windows) | ||||
|  | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
| */ | ||||
|  | ||||
| #include <windows.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| #include "zlib.h" | ||||
| #include "ioapi.h" | ||||
| #include "iowin32.h" | ||||
|  | ||||
| #ifndef INVALID_HANDLE_VALUE | ||||
| #define INVALID_HANDLE_VALUE (0xFFFFFFFF) | ||||
| #endif | ||||
|  | ||||
| #ifndef INVALID_SET_FILE_POINTER | ||||
| #define INVALID_SET_FILE_POINTER ((DWORD)-1) | ||||
| #endif | ||||
|  | ||||
| voidpf ZCALLBACK win32_open_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    const char* filename, | ||||
|    int mode)); | ||||
|  | ||||
| uLong ZCALLBACK win32_read_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    void* buf, | ||||
|    uLong size)); | ||||
|  | ||||
| uLong ZCALLBACK win32_write_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    const void* buf, | ||||
|    uLong size)); | ||||
|  | ||||
| long ZCALLBACK win32_tell_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
| long ZCALLBACK win32_seek_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream, | ||||
|    uLong offset, | ||||
|    int origin)); | ||||
|  | ||||
| long ZCALLBACK win32_close_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
| int ZCALLBACK win32_error_file_func OF(( | ||||
|    voidpf opaque, | ||||
|    voidpf stream)); | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
|     HANDLE hf; | ||||
|     int error; | ||||
| } WIN32FILE_IOWIN; | ||||
|  | ||||
| voidpf ZCALLBACK win32_open_file_func (opaque, filename, mode) | ||||
|    voidpf opaque; | ||||
|    const char* filename; | ||||
|    int mode; | ||||
| { | ||||
|     const char* mode_fopen = NULL; | ||||
|     DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; | ||||
|     HANDLE hFile = 0; | ||||
|     voidpf ret=NULL; | ||||
|  | ||||
|     dwDesiredAccess = dwShareMode = dwFlagsAndAttributes = 0; | ||||
|  | ||||
|     if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) | ||||
|     { | ||||
|         dwDesiredAccess = GENERIC_READ; | ||||
|         dwCreationDisposition = OPEN_EXISTING; | ||||
|         dwShareMode = FILE_SHARE_READ; | ||||
|     } | ||||
|     else | ||||
|     if (mode & ZLIB_FILEFUNC_MODE_EXISTING) | ||||
|     { | ||||
|         dwDesiredAccess = GENERIC_WRITE | GENERIC_READ; | ||||
|         dwCreationDisposition = OPEN_EXISTING; | ||||
|     } | ||||
|     else | ||||
|     if (mode & ZLIB_FILEFUNC_MODE_CREATE) | ||||
|     { | ||||
|         dwDesiredAccess = GENERIC_WRITE | GENERIC_READ; | ||||
|         dwCreationDisposition = CREATE_ALWAYS; | ||||
|     } | ||||
|  | ||||
|     if ((filename!=NULL) && (dwDesiredAccess != 0)) | ||||
|         hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, | ||||
|                       dwCreationDisposition, dwFlagsAndAttributes, NULL); | ||||
|  | ||||
|     if (hFile == INVALID_HANDLE_VALUE) | ||||
|         hFile = NULL; | ||||
|  | ||||
|     if (hFile != NULL) | ||||
|     { | ||||
|         WIN32FILE_IOWIN w32fiow; | ||||
|         w32fiow.hf = hFile; | ||||
|         w32fiow.error = 0; | ||||
|         ret = malloc(sizeof(WIN32FILE_IOWIN)); | ||||
|         if (ret==NULL) | ||||
|             CloseHandle(hFile); | ||||
|         else *((WIN32FILE_IOWIN*)ret) = w32fiow; | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| uLong ZCALLBACK win32_read_file_func (opaque, stream, buf, size) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    void* buf; | ||||
|    uLong size; | ||||
| { | ||||
|     uLong ret=0; | ||||
|     HANDLE hFile = NULL; | ||||
|     if (stream!=NULL) | ||||
|         hFile = ((WIN32FILE_IOWIN*)stream) -> hf; | ||||
|     if (hFile != NULL) | ||||
|         if (!ReadFile(hFile, buf, size, &ret, NULL)) | ||||
|         { | ||||
|             DWORD dwErr = GetLastError(); | ||||
|             if (dwErr == ERROR_HANDLE_EOF) | ||||
|                 dwErr = 0; | ||||
|             ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; | ||||
|         } | ||||
|  | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| uLong ZCALLBACK win32_write_file_func (opaque, stream, buf, size) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    const void* buf; | ||||
|    uLong size; | ||||
| { | ||||
|     uLong ret=0; | ||||
|     HANDLE hFile = NULL; | ||||
|     if (stream!=NULL) | ||||
|         hFile = ((WIN32FILE_IOWIN*)stream) -> hf; | ||||
|  | ||||
|     if (hFile !=NULL) | ||||
|         if (!WriteFile(hFile, buf, size, &ret, NULL)) | ||||
|         { | ||||
|             DWORD dwErr = GetLastError(); | ||||
|             if (dwErr == ERROR_HANDLE_EOF) | ||||
|                 dwErr = 0; | ||||
|             ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; | ||||
|         } | ||||
|  | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| long ZCALLBACK win32_tell_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     long ret=-1; | ||||
|     HANDLE hFile = NULL; | ||||
|     if (stream!=NULL) | ||||
|         hFile = ((WIN32FILE_IOWIN*)stream) -> hf; | ||||
|     if (hFile != NULL) | ||||
|     { | ||||
|         DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); | ||||
|         if (dwSet == INVALID_SET_FILE_POINTER) | ||||
|         { | ||||
|             DWORD dwErr = GetLastError(); | ||||
|             ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; | ||||
|             ret = -1; | ||||
|         } | ||||
|         else | ||||
|             ret=(long)dwSet; | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| long ZCALLBACK win32_seek_file_func (opaque, stream, offset, origin) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
|    uLong offset; | ||||
|    int origin; | ||||
| { | ||||
|     DWORD dwMoveMethod=0xFFFFFFFF; | ||||
|     HANDLE hFile = NULL; | ||||
|  | ||||
|     long ret=-1; | ||||
|     if (stream!=NULL) | ||||
|         hFile = ((WIN32FILE_IOWIN*)stream) -> hf; | ||||
|     switch (origin) | ||||
|     { | ||||
|     case ZLIB_FILEFUNC_SEEK_CUR : | ||||
|         dwMoveMethod = FILE_CURRENT; | ||||
|         break; | ||||
|     case ZLIB_FILEFUNC_SEEK_END : | ||||
|         dwMoveMethod = FILE_END; | ||||
|         break; | ||||
|     case ZLIB_FILEFUNC_SEEK_SET : | ||||
|         dwMoveMethod = FILE_BEGIN; | ||||
|         break; | ||||
|     default: return -1; | ||||
|     } | ||||
|  | ||||
|     if (hFile != NULL) | ||||
|     { | ||||
|         DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod); | ||||
|         if (dwSet == INVALID_SET_FILE_POINTER) | ||||
|         { | ||||
|             DWORD dwErr = GetLastError(); | ||||
|             ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; | ||||
|             ret = -1; | ||||
|         } | ||||
|         else | ||||
|             ret=0; | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| long ZCALLBACK win32_close_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     long ret=-1; | ||||
|  | ||||
|     if (stream!=NULL) | ||||
|     { | ||||
|         HANDLE hFile; | ||||
|         hFile = ((WIN32FILE_IOWIN*)stream) -> hf; | ||||
|         if (hFile != NULL) | ||||
|         { | ||||
|             CloseHandle(hFile); | ||||
|             ret=0; | ||||
|         } | ||||
|         free(stream); | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| int ZCALLBACK win32_error_file_func (opaque, stream) | ||||
|    voidpf opaque; | ||||
|    voidpf stream; | ||||
| { | ||||
|     int ret=-1; | ||||
|     if (stream!=NULL) | ||||
|     { | ||||
|         ret = ((WIN32FILE_IOWIN*)stream) -> error; | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| void fill_win32_filefunc (pzlib_filefunc_def) | ||||
|   zlib_filefunc_def* pzlib_filefunc_def; | ||||
| { | ||||
|     pzlib_filefunc_def->zopen_file = win32_open_file_func; | ||||
|     pzlib_filefunc_def->zread_file = win32_read_file_func; | ||||
|     pzlib_filefunc_def->zwrite_file = win32_write_file_func; | ||||
|     pzlib_filefunc_def->ztell_file = win32_tell_file_func; | ||||
|     pzlib_filefunc_def->zseek_file = win32_seek_file_func; | ||||
|     pzlib_filefunc_def->zclose_file = win32_close_file_func; | ||||
|     pzlib_filefunc_def->zerror_file = win32_error_file_func; | ||||
|     pzlib_filefunc_def->opaque=NULL; | ||||
| } | ||||
							
								
								
									
										19
									
								
								contrib/minizip/iowin32.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								contrib/minizip/iowin32.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| /* iowin32.h -- IO base function header for compress/uncompress .zip | ||||
|    files using zlib + zip or unzip API | ||||
|    This IO API version uses the Win32 API (for Microsoft Windows) | ||||
|  | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
| */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,302 +1,397 @@ | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <time.h> | ||||
| #include <errno.h> | ||||
| #include <fcntl.h> | ||||
|  | ||||
| #ifdef unix | ||||
| # include <unistd.h> | ||||
| # include <utime.h> | ||||
| # include <sys/types.h> | ||||
| # include <sys/stat.h> | ||||
| #else | ||||
| # include <direct.h> | ||||
| # include <io.h> | ||||
| #endif | ||||
|  | ||||
| #include "zip.h" | ||||
|  | ||||
|  | ||||
| #define WRITEBUFFERSIZE (16384) | ||||
| #define MAXFILENAME (256) | ||||
|  | ||||
| #ifdef WIN32 | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|   int ret = 0; | ||||
|   { | ||||
|       FILETIME ftLocal; | ||||
|       HANDLE hFind; | ||||
|       WIN32_FIND_DATA  ff32; | ||||
|  | ||||
|       hFind = FindFirstFile(f,&ff32); | ||||
|       if (hFind != INVALID_HANDLE_VALUE) | ||||
|       { | ||||
|         FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); | ||||
|         FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); | ||||
|         FindClose(hFind); | ||||
|         ret = 1; | ||||
|       } | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
| #else | ||||
| #ifdef unix | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|   int ret=0; | ||||
|   struct stat s;        /* results of stat() */ | ||||
|   struct tm* filedate; | ||||
|   time_t tm_t=0; | ||||
|    | ||||
|   if (strcmp(f,"-")!=0) | ||||
|   { | ||||
|     char name[MAXFILENAME]; | ||||
|     int len = strlen(f); | ||||
|     strcpy(name, f); | ||||
|     if (name[len - 1] == '/') | ||||
|       name[len - 1] = '\0'; | ||||
|     /* not all systems allow stat'ing a file with / appended */ | ||||
|     if (stat(name,&s)==0) | ||||
|     { | ||||
|       tm_t = s.st_mtime; | ||||
|       ret = 1; | ||||
|     } | ||||
|   } | ||||
|   filedate = localtime(&tm_t); | ||||
|  | ||||
|   tmzip->tm_sec  = filedate->tm_sec; | ||||
|   tmzip->tm_min  = filedate->tm_min; | ||||
|   tmzip->tm_hour = filedate->tm_hour; | ||||
|   tmzip->tm_mday = filedate->tm_mday; | ||||
|   tmzip->tm_mon  = filedate->tm_mon ; | ||||
|   tmzip->tm_year = filedate->tm_year; | ||||
|  | ||||
|   return ret; | ||||
| } | ||||
| #else | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| int check_exist_file(filename) | ||||
|     const char* filename; | ||||
| { | ||||
| 	FILE* ftestexist; | ||||
|     int ret = 1; | ||||
| 	ftestexist = fopen(filename,"rb"); | ||||
| 	if (ftestexist==NULL) | ||||
|         ret = 0; | ||||
|     else | ||||
|         fclose(ftestexist); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| void do_banner() | ||||
| { | ||||
| 	printf("MiniZip 0.15, demo of zLib + Zip package written by Gilles Vollant\n"); | ||||
| 	printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n"); | ||||
| } | ||||
|  | ||||
| void do_help() | ||||
| {	 | ||||
| 	printf("Usage : minizip [-o] file.zip [files_to_add]\n\n") ; | ||||
| } | ||||
|  | ||||
| int main(argc,argv) | ||||
| 	int argc; | ||||
| 	char *argv[]; | ||||
| { | ||||
| 	int i; | ||||
| 	int opt_overwrite=0; | ||||
|     int opt_compress_level=Z_DEFAULT_COMPRESSION; | ||||
|     int zipfilenamearg = 0; | ||||
| 	char filename_try[MAXFILENAME]; | ||||
|     int zipok; | ||||
|     int err=0; | ||||
|     int size_buf=0; | ||||
|     void* buf=NULL, | ||||
|  | ||||
|  | ||||
| 	do_banner(); | ||||
| 	if (argc==1) | ||||
| 	{ | ||||
| 		do_help(); | ||||
| 		exit(0); | ||||
|         return 0; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		for (i=1;i<argc;i++) | ||||
| 		{ | ||||
| 			if ((*argv[i])=='-') | ||||
| 			{ | ||||
| 				const char *p=argv[i]+1; | ||||
| 				 | ||||
| 				while ((*p)!='\0') | ||||
| 				{			 | ||||
| 					char c=*(p++);; | ||||
| 					if ((c=='o') || (c=='O')) | ||||
| 						opt_overwrite = 1; | ||||
|                     if ((c>='0') && (c<='9')) | ||||
|                         opt_compress_level = c-'0'; | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 				if (zipfilenamearg == 0) | ||||
|                     zipfilenamearg = i ; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     size_buf = WRITEBUFFERSIZE; | ||||
|     buf = (void*)malloc(size_buf); | ||||
|     if (buf==NULL) | ||||
|     { | ||||
|         printf("Error allocating memory\n"); | ||||
|         return ZIP_INTERNALERROR; | ||||
|     } | ||||
|  | ||||
| 	if (zipfilenamearg==0) | ||||
|         zipok=0; | ||||
|     else | ||||
| 	{ | ||||
|         int i,len; | ||||
|         int dot_found=0; | ||||
|  | ||||
|         zipok = 1 ; | ||||
| 		strcpy(filename_try,argv[zipfilenamearg]); | ||||
|         len=strlen(filename_try); | ||||
|         for (i=0;i<len;i++) | ||||
|             if (filename_try[i]=='.') | ||||
|                 dot_found=1; | ||||
|  | ||||
|         if (dot_found==0) | ||||
|             strcat(filename_try,".zip"); | ||||
|  | ||||
|         if (opt_overwrite==0) | ||||
|             if (check_exist_file(filename_try)!=0) | ||||
| 			{ | ||||
|                 char rep; | ||||
| 				do | ||||
| 				{ | ||||
| 					char answer[128]; | ||||
| 					printf("The file %s exist. Overwrite ? [y]es, [n]o : ",filename_try); | ||||
| 					scanf("%1s",answer); | ||||
| 					rep = answer[0] ; | ||||
| 					if ((rep>='a') && (rep<='z')) | ||||
| 						rep -= 0x20; | ||||
| 				} | ||||
| 				while ((rep!='Y') && (rep!='N')); | ||||
|                 if (rep=='N') | ||||
|                     zipok = 0; | ||||
| 			} | ||||
|     } | ||||
|  | ||||
|     if (zipok==1) | ||||
|     { | ||||
|         zipFile zf; | ||||
|         int errclose; | ||||
|         zf = zipOpen(filename_try,0); | ||||
|         if (zf == NULL) | ||||
|         { | ||||
|             printf("error opening %s\n",filename_try); | ||||
|             err= ZIP_ERRNO; | ||||
|         } | ||||
|         else  | ||||
|             printf("creating %s\n",filename_try); | ||||
|  | ||||
|         for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) | ||||
|         { | ||||
|             if (((*(argv[i]))!='-') && ((*(argv[i]))!='/')) | ||||
|             { | ||||
|                 FILE * fin; | ||||
|                 int size_read; | ||||
|                 const char* filenameinzip = argv[i]; | ||||
|                 zip_fileinfo zi; | ||||
|  | ||||
|                 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =  | ||||
|                 zi.tmz_date.tm_mday = zi.tmz_date.tm_min = zi.tmz_date.tm_year = 0; | ||||
|                 zi.dosDate = 0; | ||||
|                 zi.internal_fa = 0; | ||||
|                 zi.external_fa = 0; | ||||
|                 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); | ||||
|  | ||||
|  | ||||
|                 err = zipOpenNewFileInZip(zf,filenameinzip,&zi, | ||||
|                                  NULL,0,NULL,0,NULL /* comment*/, | ||||
|                                  (opt_compress_level != 0) ? Z_DEFLATED : 0, | ||||
|                                  opt_compress_level); | ||||
|  | ||||
|                 if (err != ZIP_OK) | ||||
|                     printf("error in opening %s in zipfile\n",filenameinzip); | ||||
|                 else | ||||
|                 { | ||||
|                     fin = fopen(filenameinzip,"rb"); | ||||
|                     if (fin==NULL) | ||||
|                     { | ||||
|                         err=ZIP_ERRNO; | ||||
|                         printf("error in opening %s for reading\n",filenameinzip); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (err == ZIP_OK) | ||||
|                     do | ||||
|                     { | ||||
|                         err = ZIP_OK; | ||||
|                         size_read = fread(buf,1,size_buf,fin); | ||||
|                         if (size_read < size_buf) | ||||
|                             if (feof(fin)==0) | ||||
|                         { | ||||
|                             printf("error in reading %s\n",filenameinzip); | ||||
|                             err = ZIP_ERRNO; | ||||
|                         } | ||||
|  | ||||
|                         if (size_read>0) | ||||
|                         { | ||||
|                             err = zipWriteInFileInZip (zf,buf,size_read); | ||||
|                             if (err<0) | ||||
|                             { | ||||
|                                 printf("error in writing %s in the zipfile\n", | ||||
|                                                  filenameinzip); | ||||
|                             } | ||||
|                                  | ||||
|                         } | ||||
|                     } while ((err == ZIP_OK) && (size_read>0)); | ||||
|  | ||||
|                 fclose(fin); | ||||
|                 if (err<0) | ||||
|                     err=ZIP_ERRNO; | ||||
|                 else | ||||
|                 {                     | ||||
|                     err = zipCloseFileInZip(zf); | ||||
|                     if (err!=ZIP_OK) | ||||
|                         printf("error in closing %s in the zipfile\n", | ||||
|                                     filenameinzip); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         errclose = zipClose(zf,NULL); | ||||
|         if (errclose != ZIP_OK) | ||||
|             printf("error in closing %s\n",filename_try); | ||||
|    } | ||||
|  | ||||
|     free(buf); | ||||
|     exit(0); | ||||
| 	return 0;  /* to avoid warning */ | ||||
| } | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <time.h> | ||||
| #include <errno.h> | ||||
| #include <fcntl.h> | ||||
|  | ||||
| #ifdef unix | ||||
| # include <unistd.h> | ||||
| # include <utime.h> | ||||
| # include <sys/types.h> | ||||
| # include <sys/stat.h> | ||||
| #else | ||||
| # include <direct.h> | ||||
| # include <io.h> | ||||
| #endif | ||||
|  | ||||
| #include "zip.h" | ||||
|  | ||||
| #ifdef WIN32 | ||||
| #define USEWIN32IOAPI | ||||
| #include "iowin32.h" | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
| #define WRITEBUFFERSIZE (16384) | ||||
| #define MAXFILENAME (256) | ||||
|  | ||||
| #ifdef WIN32 | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|   int ret = 0; | ||||
|   { | ||||
|       FILETIME ftLocal; | ||||
|       HANDLE hFind; | ||||
|       WIN32_FIND_DATA  ff32; | ||||
|  | ||||
|       hFind = FindFirstFile(f,&ff32); | ||||
|       if (hFind != INVALID_HANDLE_VALUE) | ||||
|       { | ||||
|         FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); | ||||
|         FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); | ||||
|         FindClose(hFind); | ||||
|         ret = 1; | ||||
|       } | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
| #else | ||||
| #ifdef unix | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|   int ret=0; | ||||
|   struct stat s;        /* results of stat() */ | ||||
|   struct tm* filedate; | ||||
|   time_t tm_t=0; | ||||
|  | ||||
|   if (strcmp(f,"-")!=0) | ||||
|   { | ||||
|     char name[MAXFILENAME+1]; | ||||
|     int len = strlen(f); | ||||
|  | ||||
|     strncpy(name, f,MAXFILENAME-1); | ||||
|     /* strncpy doesnt append the trailing NULL, of the string is too long. */ | ||||
|     name[ MAXFILENAME ] = '\0'; | ||||
|  | ||||
|     if (name[len - 1] == '/') | ||||
|       name[len - 1] = '\0'; | ||||
|     /* not all systems allow stat'ing a file with / appended */ | ||||
|     if (stat(name,&s)==0) | ||||
|     { | ||||
|       tm_t = s.st_mtime; | ||||
|       ret = 1; | ||||
|     } | ||||
|   } | ||||
|   filedate = localtime(&tm_t); | ||||
|  | ||||
|   tmzip->tm_sec  = filedate->tm_sec; | ||||
|   tmzip->tm_min  = filedate->tm_min; | ||||
|   tmzip->tm_hour = filedate->tm_hour; | ||||
|   tmzip->tm_mday = filedate->tm_mday; | ||||
|   tmzip->tm_mon  = filedate->tm_mon ; | ||||
|   tmzip->tm_year = filedate->tm_year; | ||||
|  | ||||
|   return ret; | ||||
| } | ||||
| #else | ||||
| uLong filetime(f, tmzip, dt) | ||||
|     char *f;                /* name of file to get info on */ | ||||
|     tm_zip *tmzip;             /* return value: access, modific. and creation times */ | ||||
|     uLong *dt;             /* dostime */ | ||||
| { | ||||
|     return 0; | ||||
| } | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| int check_exist_file(filename) | ||||
|     const char* filename; | ||||
| { | ||||
|     FILE* ftestexist; | ||||
|     int ret = 1; | ||||
|     ftestexist = fopen(filename,"rb"); | ||||
|     if (ftestexist==NULL) | ||||
|         ret = 0; | ||||
|     else | ||||
|         fclose(ftestexist); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| void do_banner() | ||||
| { | ||||
|     printf("MiniZip 0.22, demo of zLib + Zip package written by Gilles Vollant\n"); | ||||
|     printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); | ||||
| } | ||||
|  | ||||
| void do_help() | ||||
| { | ||||
|     printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \ | ||||
|            "  -o  Overwrite existing file.zip\n" \ | ||||
|            "  -a  Append to existing file.zip\n" \ | ||||
|            "  -0  Store only\n" \ | ||||
|            "  -1  Compress faster\n" \ | ||||
|            "  -9  Compress better\n\n"); | ||||
| } | ||||
|  | ||||
| /* calculate the CRC32 of a file, | ||||
|    because to encrypt a file, we need known the CRC32 of the file before */ | ||||
| int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) | ||||
| { | ||||
|    unsigned long calculate_crc=0; | ||||
|    int err=ZIP_OK; | ||||
|    FILE * fin = fopen(filenameinzip,"rb"); | ||||
|    unsigned long size_read = 0; | ||||
|    unsigned long total_read = 0; | ||||
|    if (fin==NULL) | ||||
|    { | ||||
|        err = ZIP_ERRNO; | ||||
|    } | ||||
|  | ||||
|     if (err == ZIP_OK) | ||||
|         do | ||||
|         { | ||||
|             err = ZIP_OK; | ||||
|             size_read = (int)fread(buf,1,size_buf,fin); | ||||
|             if (size_read < size_buf) | ||||
|                 if (feof(fin)==0) | ||||
|             { | ||||
|                 printf("error in reading %s\n",filenameinzip); | ||||
|                 err = ZIP_ERRNO; | ||||
|             } | ||||
|  | ||||
|             if (size_read>0) | ||||
|                 calculate_crc = crc32(calculate_crc,buf,size_read); | ||||
|             total_read += size_read; | ||||
|  | ||||
|         } while ((err == ZIP_OK) && (size_read>0)); | ||||
|  | ||||
|     if (fin) | ||||
|         fclose(fin); | ||||
|  | ||||
|     *result_crc=calculate_crc; | ||||
|     printf("file %s crc %x\n",filenameinzip,calculate_crc); | ||||
|     return err; | ||||
| } | ||||
|  | ||||
| int main(argc,argv) | ||||
|     int argc; | ||||
|     char *argv[]; | ||||
| { | ||||
|     int i; | ||||
|     int opt_overwrite=0; | ||||
|     int opt_compress_level=Z_DEFAULT_COMPRESSION; | ||||
|     int zipfilenamearg = 0; | ||||
|     char filename_try[MAXFILENAME+16]; | ||||
|     int zipok; | ||||
|     int err=0; | ||||
|     int size_buf=0; | ||||
|     void* buf=NULL; | ||||
|     const char* password=NULL; | ||||
|  | ||||
|  | ||||
|     do_banner(); | ||||
|     if (argc==1) | ||||
|     { | ||||
|         do_help(); | ||||
|         return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         for (i=1;i<argc;i++) | ||||
|         { | ||||
|             if ((*argv[i])=='-') | ||||
|             { | ||||
|                 const char *p=argv[i]+1; | ||||
|  | ||||
|                 while ((*p)!='\0') | ||||
|                 { | ||||
|                     char c=*(p++);; | ||||
|                     if ((c=='o') || (c=='O')) | ||||
|                         opt_overwrite = 1; | ||||
|                     if ((c=='a') || (c=='A')) | ||||
|                         opt_overwrite = 2; | ||||
|                     if ((c>='0') && (c<='9')) | ||||
|                         opt_compress_level = c-'0'; | ||||
|  | ||||
|                     if (((c=='p') || (c=='P')) && (i+1<argc)) | ||||
|                     { | ||||
|                         password=argv[i+1]; | ||||
|                         i++; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|                 if (zipfilenamearg == 0) | ||||
|                     zipfilenamearg = i ; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     size_buf = WRITEBUFFERSIZE; | ||||
|     buf = (void*)malloc(size_buf); | ||||
|     if (buf==NULL) | ||||
|     { | ||||
|         printf("Error allocating memory\n"); | ||||
|         return ZIP_INTERNALERROR; | ||||
|     } | ||||
|  | ||||
|     if (zipfilenamearg==0) | ||||
|         zipok=0; | ||||
|     else | ||||
|     { | ||||
|         int i,len; | ||||
|         int dot_found=0; | ||||
|  | ||||
|         zipok = 1 ; | ||||
|         strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1); | ||||
|         /* strncpy doesnt append the trailing NULL, of the string is too long. */ | ||||
|         filename_try[ MAXFILENAME ] = '\0'; | ||||
|  | ||||
|         len=(int)strlen(filename_try); | ||||
|         for (i=0;i<len;i++) | ||||
|             if (filename_try[i]=='.') | ||||
|                 dot_found=1; | ||||
|  | ||||
|         if (dot_found==0) | ||||
|             strcat(filename_try,".zip"); | ||||
|  | ||||
|         if (opt_overwrite==2) | ||||
|         { | ||||
|             /* if the file don't exist, we not append file */ | ||||
|             if (check_exist_file(filename_try)==0) | ||||
|                 opt_overwrite=1; | ||||
|         } | ||||
|         else | ||||
|         if (opt_overwrite==0) | ||||
|             if (check_exist_file(filename_try)!=0) | ||||
|             { | ||||
|                 char rep=0; | ||||
|                 do | ||||
|                 { | ||||
|                     char answer[128]; | ||||
|                     printf("The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try); | ||||
|                     scanf("%1s",answer); | ||||
|                     rep = answer[0] ; | ||||
|                     if ((rep>='a') && (rep<='z')) | ||||
|                         rep -= 0x20; | ||||
|                 } | ||||
|                 while ((rep!='Y') && (rep!='N') && (rep!='A')); | ||||
|                 if (rep=='N') | ||||
|                     zipok = 0; | ||||
|                 if (rep=='A') | ||||
|                     opt_overwrite = 2; | ||||
|             } | ||||
|     } | ||||
|  | ||||
|     if (zipok==1) | ||||
|     { | ||||
|         zipFile zf; | ||||
|         int errclose; | ||||
|         #ifdef USEWIN32IOAPI | ||||
|         zlib_filefunc_def ffunc; | ||||
|         fill_win32_filefunc(&ffunc); | ||||
|         zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); | ||||
|         #else | ||||
|         zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0); | ||||
|         #endif | ||||
|  | ||||
|         if (zf == NULL) | ||||
|         { | ||||
|             printf("error opening %s\n",filename_try); | ||||
|             err= ZIP_ERRNO; | ||||
|         } | ||||
|         else | ||||
|             printf("creating %s\n",filename_try); | ||||
|  | ||||
|         for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) | ||||
|         { | ||||
|             if (((*(argv[i]))!='-') && ((*(argv[i]))!='/')) | ||||
|             { | ||||
|                 FILE * fin; | ||||
|                 int size_read; | ||||
|                 const char* filenameinzip = argv[i]; | ||||
|                 zip_fileinfo zi; | ||||
|                 unsigned long crcFile=0; | ||||
|  | ||||
|                 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = | ||||
|                 zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; | ||||
|                 zi.dosDate = 0; | ||||
|                 zi.internal_fa = 0; | ||||
|                 zi.external_fa = 0; | ||||
|                 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); | ||||
|  | ||||
| /* | ||||
|                 err = zipOpenNewFileInZip(zf,filenameinzip,&zi, | ||||
|                                  NULL,0,NULL,0,NULL / * comment * /, | ||||
|                                  (opt_compress_level != 0) ? Z_DEFLATED : 0, | ||||
|                                  opt_compress_level); | ||||
| */ | ||||
|                 if ((password != NULL) && (err==ZIP_OK)) | ||||
|                     err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); | ||||
|  | ||||
|                 err = zipOpenNewFileInZip3(zf,filenameinzip,&zi, | ||||
|                                  NULL,0,NULL,0,NULL /* comment*/, | ||||
|                                  (opt_compress_level != 0) ? Z_DEFLATED : 0, | ||||
|                                  opt_compress_level,0, | ||||
|                                  /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ | ||||
|                                  -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, | ||||
|                                  password,crcFile); | ||||
|  | ||||
|                 if (err != ZIP_OK) | ||||
|                     printf("error in opening %s in zipfile\n",filenameinzip); | ||||
|                 else | ||||
|                 { | ||||
|                     fin = fopen(filenameinzip,"rb"); | ||||
|                     if (fin==NULL) | ||||
|                     { | ||||
|                         err=ZIP_ERRNO; | ||||
|                         printf("error in opening %s for reading\n",filenameinzip); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (err == ZIP_OK) | ||||
|                     do | ||||
|                     { | ||||
|                         err = ZIP_OK; | ||||
|                         size_read = (int)fread(buf,1,size_buf,fin); | ||||
|                         if (size_read < size_buf) | ||||
|                             if (feof(fin)==0) | ||||
|                         { | ||||
|                             printf("error in reading %s\n",filenameinzip); | ||||
|                             err = ZIP_ERRNO; | ||||
|                         } | ||||
|  | ||||
|                         if (size_read>0) | ||||
|                         { | ||||
|                             err = zipWriteInFileInZip (zf,buf,size_read); | ||||
|                             if (err<0) | ||||
|                             { | ||||
|                                 printf("error in writing %s in the zipfile\n", | ||||
|                                                  filenameinzip); | ||||
|                             } | ||||
|  | ||||
|                         } | ||||
|                     } while ((err == ZIP_OK) && (size_read>0)); | ||||
|  | ||||
|                 if (fin) | ||||
|                     fclose(fin); | ||||
|  | ||||
|                 if (err<0) | ||||
|                     err=ZIP_ERRNO; | ||||
|                 else | ||||
|                 { | ||||
|                     err = zipCloseFileInZip(zf); | ||||
|                     if (err!=ZIP_OK) | ||||
|                         printf("error in closing %s in the zipfile\n", | ||||
|                                     filenameinzip); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         errclose = zipClose(zf,NULL); | ||||
|         if (errclose != ZIP_OK) | ||||
|             printf("error in closing %s\n",filename_try); | ||||
|    } | ||||
|  | ||||
|     free(buf); | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -1,37 +0,0 @@ | ||||
|  | ||||
| UnZip 0.15 additionnal library | ||||
|  | ||||
|  | ||||
|   This unzip package allow extract file from .ZIP file, compatible with  | ||||
| PKZip 2.04g, WinZip, InfoZip tools and compatible. | ||||
|  | ||||
|   Multi volume ZipFile (span) are not supported, and old compression used by old  | ||||
| PKZip 1.x are not supported. | ||||
|  | ||||
| See probdesc.zip from PKWare for specification of .ZIP format. | ||||
|  | ||||
| What is Unzip | ||||
|   The Zlib library support the deflate compression and the creation of gzip (.gz)  | ||||
| file. Zlib is free and small. | ||||
|   The .Zip format, which can contain several compressed files (.gz can containt | ||||
| only one file) is a very popular format. This is why I've written a package for reading file compressed in Zipfile. | ||||
|  | ||||
| Using Unzip package | ||||
|  | ||||
| You need source of Zlib (get zlib111.zip and read zlib.h). | ||||
| Get unzlb015.zip and read unzip.h (whith documentation of unzip functions) | ||||
|  | ||||
| The Unzip package is only two file : unzip.h and unzip.c. But it use the Zlib  | ||||
|   files. | ||||
| unztst.c is a simple sample program, which list file in a zipfile and display | ||||
|   README.TXT or FILE_ID.DIZ (if these files are found). | ||||
| miniunz.c is a mini unzip program. | ||||
|  | ||||
| I'm also currenlyt writing a zipping portion (zip.h, zip.c and test with minizip.c) | ||||
|  | ||||
| Please email me for feedback. | ||||
| I hope my source is compatible with Unix system, but I need your help for be sure | ||||
|  | ||||
| Latest revision : Mar 04th, 1998 | ||||
|  | ||||
| Check http://www.winimage.com/zLibDll/unzip.html for up to date info. | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,15 +0,0 @@ | ||||
| 	unzOpen                       @61 | ||||
| 	unzClose                      @62 | ||||
| 	unzGetGlobalInfo              @63 | ||||
| 	unzGetCurrentFileInfo         @64 | ||||
| 	unzGoToFirstFile              @65 | ||||
| 	unzGoToNextFile               @66 | ||||
| 	unzOpenCurrentFile            @67 | ||||
| 	unzReadCurrentFile            @68 | ||||
| 	unztell                       @70 | ||||
| 	unzeof                        @71 | ||||
| 	unzCloseCurrentFile           @72 | ||||
| 	unzGetGlobalComment           @73 | ||||
| 	unzStringFileNameCompare      @74 | ||||
| 	unzLocateFile                 @75 | ||||
| 	unzGetLocalExtrafield         @76 | ||||
| @@ -1,275 +1,342 @@ | ||||
| /* unzip.h -- IO for uncompress .zip files using zlib  | ||||
|    Version 0.15 beta, Mar 19th, 1998, | ||||
|  | ||||
|    Copyright (C) 1998 Gilles Vollant | ||||
|  | ||||
|    This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g | ||||
|      WinZip, InfoZip tools and compatible. | ||||
|    Encryption and multi volume ZipFile (span) are not supported. | ||||
|    Old compressions used by old PKZip 1.x are not supported | ||||
|  | ||||
|    THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE | ||||
|    CAN CHANGE IN FUTURE VERSION !! | ||||
|    I WAIT FEEDBACK at mail info@winimage.com | ||||
|    Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution | ||||
|  | ||||
|    Condition of use and distribution are the same than zlib : | ||||
|  | ||||
|   This software is provided 'as-is', without any express or implied | ||||
|   warranty.  In no event will the authors be held liable for any damages | ||||
|   arising from the use of this software. | ||||
|  | ||||
|   Permission is granted to anyone to use this software for any purpose, | ||||
|   including commercial applications, and to alter it and redistribute it | ||||
|   freely, subject to the following restrictions: | ||||
|  | ||||
|   1. The origin of this software must not be misrepresented; you must not | ||||
|      claim that you wrote the original software. If you use this software | ||||
|      in a product, an acknowledgment in the product documentation would be | ||||
|      appreciated but is not required. | ||||
|   2. Altered source versions must be plainly marked as such, and must not be | ||||
|      misrepresented as being the original software. | ||||
|   3. This notice may not be removed or altered from any source distribution. | ||||
|  | ||||
|  | ||||
| */ | ||||
| /* for more info about .ZIP format, see  | ||||
|       ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip | ||||
|    PkWare has also a specification at : | ||||
|       ftp://ftp.pkware.com/probdesc.zip */ | ||||
|  | ||||
| #ifndef _unz_H | ||||
| #define _unz_H | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIB_H | ||||
| #include "zlib.h" | ||||
| #endif | ||||
|  | ||||
| #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) | ||||
| /* like the STRICT of WIN32, we define a pointer that cannot be converted | ||||
|     from (void*) without cast */ | ||||
| typedef struct TagunzFile__ { int unused; } unzFile__;  | ||||
| typedef unzFile__ *unzFile; | ||||
| #else | ||||
| typedef voidp unzFile; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define UNZ_OK                                  (0) | ||||
| #define UNZ_END_OF_LIST_OF_FILE (-100) | ||||
| #define UNZ_ERRNO               (Z_ERRNO) | ||||
| #define UNZ_EOF                 (0) | ||||
| #define UNZ_PARAMERROR                  (-102) | ||||
| #define UNZ_BADZIPFILE                  (-103) | ||||
| #define UNZ_INTERNALERROR               (-104) | ||||
| #define UNZ_CRCERROR                    (-105) | ||||
|  | ||||
| /* tm_unz contain date/time info */ | ||||
| typedef struct tm_unz_s  | ||||
| { | ||||
| 	uInt tm_sec;            /* seconds after the minute - [0,59] */ | ||||
| 	uInt tm_min;            /* minutes after the hour - [0,59] */ | ||||
| 	uInt tm_hour;           /* hours since midnight - [0,23] */ | ||||
| 	uInt tm_mday;           /* day of the month - [1,31] */ | ||||
| 	uInt tm_mon;            /* months since January - [0,11] */ | ||||
| 	uInt tm_year;           /* years - [1980..2044] */ | ||||
| } tm_unz; | ||||
|  | ||||
| /* unz_global_info structure contain global data about the ZIPfile | ||||
|    These data comes from the end of central dir */ | ||||
| typedef struct unz_global_info_s | ||||
| { | ||||
| 	uLong number_entry;         /* total number of entries in | ||||
| 				       the central dir on this disk */ | ||||
| 	uLong size_comment;         /* size of the global comment of the zipfile */ | ||||
| } unz_global_info; | ||||
|  | ||||
|  | ||||
| /* unz_file_info contain information about a file in the zipfile */ | ||||
| typedef struct unz_file_info_s | ||||
| { | ||||
|     uLong version;              /* version made by                 2 bytes */ | ||||
|     uLong version_needed;       /* version needed to extract       2 bytes */ | ||||
|     uLong flag;                 /* general purpose bit flag        2 bytes */ | ||||
|     uLong compression_method;   /* compression method              2 bytes */ | ||||
|     uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */ | ||||
|     uLong crc;                  /* crc-32                          4 bytes */ | ||||
|     uLong compressed_size;      /* compressed size                 4 bytes */  | ||||
|     uLong uncompressed_size;    /* uncompressed size               4 bytes */  | ||||
|     uLong size_filename;        /* filename length                 2 bytes */ | ||||
|     uLong size_file_extra;      /* extra field length              2 bytes */ | ||||
|     uLong size_file_comment;    /* file comment length             2 bytes */ | ||||
|  | ||||
|     uLong disk_num_start;       /* disk number start               2 bytes */ | ||||
|     uLong internal_fa;          /* internal file attributes        2 bytes */ | ||||
|     uLong external_fa;          /* external file attributes        4 bytes */ | ||||
|  | ||||
|     tm_unz tmu_date; | ||||
| } unz_file_info; | ||||
|  | ||||
| extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | ||||
| 												 const char* fileName2, | ||||
| 												 int iCaseSensitivity)); | ||||
| /* | ||||
|    Compare two filename (fileName1,fileName2). | ||||
|    If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) | ||||
|    If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi | ||||
| 								or strcasecmp) | ||||
|    If iCaseSenisivity = 0, case sensitivity is defaut of your operating system | ||||
| 	(like 1 on Unix, 2 on Windows) | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern unzFile ZEXPORT unzOpen OF((const char *path)); | ||||
| /* | ||||
|   Open a Zip file. path contain the full pathname (by example, | ||||
|      on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer | ||||
| 	 "zlib/zlib111.zip". | ||||
| 	 If the zipfile cannot be opened (file don't exist or in not valid), the | ||||
| 	   return value is NULL. | ||||
|      Else, the return value is a unzFile Handle, usable with other function | ||||
| 	   of this unzip package. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzClose OF((unzFile file)); | ||||
| /* | ||||
|   Close a ZipFile opened with unzipOpen. | ||||
|   If there is files inside the .Zip opened with unzOpenCurrentFile (see later), | ||||
|     these files MUST be closed with unzipCloseCurrentFile before call unzipClose. | ||||
|   return UNZ_OK if there is no problem. */ | ||||
|  | ||||
| extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, | ||||
| 					unz_global_info *pglobal_info)); | ||||
| /* | ||||
|   Write info about the ZipFile in the *pglobal_info structure. | ||||
|   No preparation of the structure is needed | ||||
|   return UNZ_OK if there is no problem. */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT unzGetGlobalComment OF((unzFile file, | ||||
| 										   char *szComment, | ||||
| 					   uLong uSizeBuf)); | ||||
| /* | ||||
|   Get the global comment string of the ZipFile, in the szComment buffer. | ||||
|   uSizeBuf is the size of the szComment buffer. | ||||
|   return the number of byte copied or an error code <0 | ||||
| */ | ||||
|  | ||||
|  | ||||
| /***************************************************************************/ | ||||
| /* Unzip package allow you browse the directory of the zipfile */ | ||||
|  | ||||
| extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); | ||||
| /* | ||||
|   Set the current file of the zipfile to the first file. | ||||
|   return UNZ_OK if there is no problem | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzGoToNextFile OF((unzFile file)); | ||||
| /* | ||||
|   Set the current file of the zipfile to the next file. | ||||
|   return UNZ_OK if there is no problem | ||||
|   return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzLocateFile OF((unzFile file,  | ||||
| 				     const char *szFileName, | ||||
| 				     int iCaseSensitivity)); | ||||
| /* | ||||
|   Try locate the file szFileName in the zipfile. | ||||
|   For the iCaseSensitivity signification, see unzStringFileNameCompare | ||||
|  | ||||
|   return value : | ||||
|   UNZ_OK if the file is found. It becomes the current file. | ||||
|   UNZ_END_OF_LIST_OF_FILE if the file is not found | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | ||||
| 					     unz_file_info *pfile_info, | ||||
| 					     char *szFileName, | ||||
| 					     uLong fileNameBufferSize, | ||||
| 					     void *extraField, | ||||
| 					     uLong extraFieldBufferSize, | ||||
| 					     char *szComment, | ||||
| 					     uLong commentBufferSize)); | ||||
| /* | ||||
|   Get Info about the current file | ||||
|   if pfile_info!=NULL, the *pfile_info structure will contain somes info about | ||||
| 	    the current file | ||||
|   if szFileName!=NULL, the filemane string will be copied in szFileName | ||||
| 			(fileNameBufferSize is the size of the buffer) | ||||
|   if extraField!=NULL, the extra field information will be copied in extraField | ||||
| 			(extraFieldBufferSize is the size of the buffer). | ||||
| 			This is the Central-header version of the extra field | ||||
|   if szComment!=NULL, the comment string of the file will be copied in szComment | ||||
| 			(commentBufferSize is the size of the buffer) | ||||
| */ | ||||
|  | ||||
| /***************************************************************************/ | ||||
| /* for reading the content of the current zipfile, you can open it, read data | ||||
|    from it, and close it (you can close it before reading all the file) | ||||
|    */ | ||||
|  | ||||
| extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); | ||||
| /* | ||||
|   Open for reading data the current file in the zipfile. | ||||
|   If there is no error, the return value is UNZ_OK. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); | ||||
| /* | ||||
|   Close the file in zip opened with unzOpenCurrentFile | ||||
|   Return UNZ_CRCERROR if all the file was read but the CRC is not good | ||||
| */ | ||||
|  | ||||
| 												 | ||||
| extern int ZEXPORT unzReadCurrentFile OF((unzFile file,  | ||||
| 					  voidp buf, | ||||
| 					  unsigned len)); | ||||
| /* | ||||
|   Read bytes from the current file (opened by unzOpenCurrentFile) | ||||
|   buf contain buffer where data must be copied | ||||
|   len the size of buf. | ||||
|  | ||||
|   return the number of byte copied if somes bytes are copied | ||||
|   return 0 if the end of file was reached | ||||
|   return <0 with error code if there is an error | ||||
|     (UNZ_ERRNO for IO error, or zLib error for uncompress error) | ||||
| */ | ||||
|  | ||||
| extern z_off_t ZEXPORT unztell OF((unzFile file)); | ||||
| /* | ||||
|   Give the current position in uncompressed data | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzeof OF((unzFile file)); | ||||
| /* | ||||
|   return 1 if the end of file was reached, 0 elsewhere  | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, | ||||
| 											 voidp buf, | ||||
| 											 unsigned len)); | ||||
| /* | ||||
|   Read extra field from the current file (opened by unzOpenCurrentFile) | ||||
|   This is the local-header version of the extra field (sometimes, there is | ||||
|     more info in the local-header version than in the central-header) | ||||
|  | ||||
|   if buf==NULL, it return the size of the local extra field | ||||
|  | ||||
|   if buf!=NULL, len is the size of the buffer, the extra header is copied in | ||||
| 	buf. | ||||
|   the return value is the number of bytes copied in buf, or (if <0)  | ||||
| 	the error code | ||||
| */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* _unz_H */ | ||||
| /* unzip.h -- IO for uncompress .zip files using zlib | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
|  | ||||
|    This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g | ||||
|      WinZip, InfoZip tools and compatible. | ||||
|    Encryption and multi volume ZipFile (span) are not supported. | ||||
|    Old compressions used by old PKZip 1.x are not supported | ||||
|  | ||||
|  | ||||
|    I WAIT FEEDBACK at mail info@winimage.com | ||||
|    Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution | ||||
|  | ||||
|    Condition of use and distribution are the same than zlib : | ||||
|  | ||||
|   This software is provided 'as-is', without any express or implied | ||||
|   warranty.  In no event will the authors be held liable for any damages | ||||
|   arising from the use of this software. | ||||
|  | ||||
|   Permission is granted to anyone to use this software for any purpose, | ||||
|   including commercial applications, and to alter it and redistribute it | ||||
|   freely, subject to the following restrictions: | ||||
|  | ||||
|   1. The origin of this software must not be misrepresented; you must not | ||||
|      claim that you wrote the original software. If you use this software | ||||
|      in a product, an acknowledgment in the product documentation would be | ||||
|      appreciated but is not required. | ||||
|   2. Altered source versions must be plainly marked as such, and must not be | ||||
|      misrepresented as being the original software. | ||||
|   3. This notice may not be removed or altered from any source distribution. | ||||
|  | ||||
|  | ||||
| */ | ||||
|  | ||||
| /* for more info about .ZIP format, see | ||||
|       http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip | ||||
|       http://www.info-zip.org/pub/infozip/doc/ | ||||
|    PkWare has also a specification at : | ||||
|       ftp://ftp.pkware.com/probdesc.zip | ||||
| */ | ||||
|  | ||||
| #ifndef _unz_H | ||||
| #define _unz_H | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIB_H | ||||
| #include "zlib.h" | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIBIOAPI_H | ||||
| #include "ioapi.h" | ||||
| #endif | ||||
|  | ||||
| #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) | ||||
| /* like the STRICT of WIN32, we define a pointer that cannot be converted | ||||
|     from (void*) without cast */ | ||||
| typedef struct TagunzFile__ { int unused; } unzFile__; | ||||
| typedef unzFile__ *unzFile; | ||||
| #else | ||||
| typedef voidp unzFile; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define UNZ_OK                          (0) | ||||
| #define UNZ_END_OF_LIST_OF_FILE         (-100) | ||||
| #define UNZ_ERRNO                       (Z_ERRNO) | ||||
| #define UNZ_EOF                         (0) | ||||
| #define UNZ_PARAMERROR                  (-102) | ||||
| #define UNZ_BADZIPFILE                  (-103) | ||||
| #define UNZ_INTERNALERROR               (-104) | ||||
| #define UNZ_CRCERROR                    (-105) | ||||
|  | ||||
| /* tm_unz contain date/time info */ | ||||
| typedef struct tm_unz_s | ||||
| { | ||||
|     uInt tm_sec;            /* seconds after the minute - [0,59] */ | ||||
|     uInt tm_min;            /* minutes after the hour - [0,59] */ | ||||
|     uInt tm_hour;           /* hours since midnight - [0,23] */ | ||||
|     uInt tm_mday;           /* day of the month - [1,31] */ | ||||
|     uInt tm_mon;            /* months since January - [0,11] */ | ||||
|     uInt tm_year;           /* years - [1980..2044] */ | ||||
| } tm_unz; | ||||
|  | ||||
| /* unz_global_info structure contain global data about the ZIPfile | ||||
|    These data comes from the end of central dir */ | ||||
| typedef struct unz_global_info_s | ||||
| { | ||||
|     uLong number_entry;         /* total number of entries in | ||||
|                        the central dir on this disk */ | ||||
|     uLong size_comment;         /* size of the global comment of the zipfile */ | ||||
| } unz_global_info; | ||||
|  | ||||
|  | ||||
| /* unz_file_info contain information about a file in the zipfile */ | ||||
| typedef struct unz_file_info_s | ||||
| { | ||||
|     uLong version;              /* version made by                 2 bytes */ | ||||
|     uLong version_needed;       /* version needed to extract       2 bytes */ | ||||
|     uLong flag;                 /* general purpose bit flag        2 bytes */ | ||||
|     uLong compression_method;   /* compression method              2 bytes */ | ||||
|     uLong dosDate;              /* last mod file date in Dos fmt   4 bytes */ | ||||
|     uLong crc;                  /* crc-32                          4 bytes */ | ||||
|     uLong compressed_size;      /* compressed size                 4 bytes */ | ||||
|     uLong uncompressed_size;    /* uncompressed size               4 bytes */ | ||||
|     uLong size_filename;        /* filename length                 2 bytes */ | ||||
|     uLong size_file_extra;      /* extra field length              2 bytes */ | ||||
|     uLong size_file_comment;    /* file comment length             2 bytes */ | ||||
|  | ||||
|     uLong disk_num_start;       /* disk number start               2 bytes */ | ||||
|     uLong internal_fa;          /* internal file attributes        2 bytes */ | ||||
|     uLong external_fa;          /* external file attributes        4 bytes */ | ||||
|  | ||||
|     tm_unz tmu_date; | ||||
| } unz_file_info; | ||||
|  | ||||
| extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | ||||
|                                                  const char* fileName2, | ||||
|                                                  int iCaseSensitivity)); | ||||
| /* | ||||
|    Compare two filename (fileName1,fileName2). | ||||
|    If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) | ||||
|    If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi | ||||
|                                 or strcasecmp) | ||||
|    If iCaseSenisivity = 0, case sensitivity is defaut of your operating system | ||||
|     (like 1 on Unix, 2 on Windows) | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern unzFile ZEXPORT unzOpen OF((const char *path)); | ||||
| /* | ||||
|   Open a Zip file. path contain the full pathname (by example, | ||||
|      on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer | ||||
|      "zlib/zlib113.zip". | ||||
|      If the zipfile cannot be opened (file don't exist or in not valid), the | ||||
|        return value is NULL. | ||||
|      Else, the return value is a unzFile Handle, usable with other function | ||||
|        of this unzip package. | ||||
| */ | ||||
|  | ||||
| extern unzFile ZEXPORT unzOpen2 OF((const char *path, | ||||
|                                     zlib_filefunc_def* pzlib_filefunc_def)); | ||||
| /* | ||||
|    Open a Zip file, like unzOpen, but provide a set of file low level API | ||||
|       for read/write the zip file (see ioapi.h) | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzClose OF((unzFile file)); | ||||
| /* | ||||
|   Close a ZipFile opened with unzipOpen. | ||||
|   If there is files inside the .Zip opened with unzOpenCurrentFile (see later), | ||||
|     these files MUST be closed with unzipCloseCurrentFile before call unzipClose. | ||||
|   return UNZ_OK if there is no problem. */ | ||||
|  | ||||
| extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, | ||||
|                                         unz_global_info *pglobal_info)); | ||||
| /* | ||||
|   Write info about the ZipFile in the *pglobal_info structure. | ||||
|   No preparation of the structure is needed | ||||
|   return UNZ_OK if there is no problem. */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT unzGetGlobalComment OF((unzFile file, | ||||
|                                            char *szComment, | ||||
|                                            uLong uSizeBuf)); | ||||
| /* | ||||
|   Get the global comment string of the ZipFile, in the szComment buffer. | ||||
|   uSizeBuf is the size of the szComment buffer. | ||||
|   return the number of byte copied or an error code <0 | ||||
| */ | ||||
|  | ||||
|  | ||||
| /***************************************************************************/ | ||||
| /* Unzip package allow you browse the directory of the zipfile */ | ||||
|  | ||||
| extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); | ||||
| /* | ||||
|   Set the current file of the zipfile to the first file. | ||||
|   return UNZ_OK if there is no problem | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzGoToNextFile OF((unzFile file)); | ||||
| /* | ||||
|   Set the current file of the zipfile to the next file. | ||||
|   return UNZ_OK if there is no problem | ||||
|   return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzLocateFile OF((unzFile file, | ||||
|                      const char *szFileName, | ||||
|                      int iCaseSensitivity)); | ||||
| /* | ||||
|   Try locate the file szFileName in the zipfile. | ||||
|   For the iCaseSensitivity signification, see unzStringFileNameCompare | ||||
|  | ||||
|   return value : | ||||
|   UNZ_OK if the file is found. It becomes the current file. | ||||
|   UNZ_END_OF_LIST_OF_FILE if the file is not found | ||||
| */ | ||||
|  | ||||
|  | ||||
| /* ****************************************** */ | ||||
| /* Ryan supplied functions */ | ||||
| /* unz_file_info contain information about a file in the zipfile */ | ||||
| typedef struct unz_file_pos_s | ||||
| { | ||||
|     uLong pos_in_zip_directory;   /* offset in zip file directory */ | ||||
|     uLong num_of_file;            /* # of file */ | ||||
| } unz_file_pos; | ||||
|  | ||||
| extern int ZEXPORT unzGetFilePos( | ||||
|     unzFile file, | ||||
|     unz_file_pos* file_pos); | ||||
|  | ||||
| extern int ZEXPORT unzGoToFilePos( | ||||
|     unzFile file, | ||||
|     unz_file_pos* file_pos); | ||||
|  | ||||
| /* ****************************************** */ | ||||
|  | ||||
| extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | ||||
|                          unz_file_info *pfile_info, | ||||
|                          char *szFileName, | ||||
|                          uLong fileNameBufferSize, | ||||
|                          void *extraField, | ||||
|                          uLong extraFieldBufferSize, | ||||
|                          char *szComment, | ||||
|                          uLong commentBufferSize)); | ||||
| /* | ||||
|   Get Info about the current file | ||||
|   if pfile_info!=NULL, the *pfile_info structure will contain somes info about | ||||
|         the current file | ||||
|   if szFileName!=NULL, the filemane string will be copied in szFileName | ||||
|             (fileNameBufferSize is the size of the buffer) | ||||
|   if extraField!=NULL, the extra field information will be copied in extraField | ||||
|             (extraFieldBufferSize is the size of the buffer). | ||||
|             This is the Central-header version of the extra field | ||||
|   if szComment!=NULL, the comment string of the file will be copied in szComment | ||||
|             (commentBufferSize is the size of the buffer) | ||||
| */ | ||||
|  | ||||
| /***************************************************************************/ | ||||
| /* for reading the content of the current zipfile, you can open it, read data | ||||
|    from it, and close it (you can close it before reading all the file) | ||||
|    */ | ||||
|  | ||||
| extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); | ||||
| /* | ||||
|   Open for reading data the current file in the zipfile. | ||||
|   If there is no error, the return value is UNZ_OK. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, | ||||
|                                                   const char* password)); | ||||
| /* | ||||
|   Open for reading data the current file in the zipfile. | ||||
|   password is a crypting password | ||||
|   If there is no error, the return value is UNZ_OK. | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, | ||||
|                                            int* method, | ||||
|                                            int* level, | ||||
|                                            int raw)); | ||||
| /* | ||||
|   Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) | ||||
|     if raw==1 | ||||
|   *method will receive method of compression, *level will receive level of | ||||
|      compression | ||||
|   note : you can set level parameter as NULL (if you did not want known level, | ||||
|          but you CANNOT set method parameter as NULL | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, | ||||
|                                            int* method, | ||||
|                                            int* level, | ||||
|                                            int raw, | ||||
|                                            const char* password)); | ||||
| /* | ||||
|   Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) | ||||
|     if raw==1 | ||||
|   *method will receive method of compression, *level will receive level of | ||||
|      compression | ||||
|   note : you can set level parameter as NULL (if you did not want known level, | ||||
|          but you CANNOT set method parameter as NULL | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); | ||||
| /* | ||||
|   Close the file in zip opened with unzOpenCurrentFile | ||||
|   Return UNZ_CRCERROR if all the file was read but the CRC is not good | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzReadCurrentFile OF((unzFile file, | ||||
|                       voidp buf, | ||||
|                       unsigned len)); | ||||
| /* | ||||
|   Read bytes from the current file (opened by unzOpenCurrentFile) | ||||
|   buf contain buffer where data must be copied | ||||
|   len the size of buf. | ||||
|  | ||||
|   return the number of byte copied if somes bytes are copied | ||||
|   return 0 if the end of file was reached | ||||
|   return <0 with error code if there is an error | ||||
|     (UNZ_ERRNO for IO error, or zLib error for uncompress error) | ||||
| */ | ||||
|  | ||||
| extern z_off_t ZEXPORT unztell OF((unzFile file)); | ||||
| /* | ||||
|   Give the current position in uncompressed data | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzeof OF((unzFile file)); | ||||
| /* | ||||
|   return 1 if the end of file was reached, 0 elsewhere | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, | ||||
|                                              voidp buf, | ||||
|                                              unsigned len)); | ||||
| /* | ||||
|   Read extra field from the current file (opened by unzOpenCurrentFile) | ||||
|   This is the local-header version of the extra field (sometimes, there is | ||||
|     more info in the local-header version than in the central-header) | ||||
|  | ||||
|   if buf==NULL, it return the size of the local extra field | ||||
|  | ||||
|   if buf!=NULL, len is the size of the buffer, the extra header is copied in | ||||
|     buf. | ||||
|   the return value is the number of bytes copied in buf, or (if <0) | ||||
|     the error code | ||||
| */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* _unz_H */ | ||||
|   | ||||
							
								
								
									
										326
									
								
								contrib/minizip/zconf.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										326
									
								
								contrib/minizip/zconf.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,326 @@ | ||||
| /* zconf.h -- configuration of the zlib compression library | ||||
|  * Copyright (C) 1995-2003 Jean-loup Gailly. | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  */ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #ifndef _ZCONF_H | ||||
| #define _ZCONF_H | ||||
|  | ||||
| /* | ||||
|  * If you *really* need a unique prefix for all types and library functions, | ||||
|  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||||
|  */ | ||||
| #ifdef Z_PREFIX | ||||
| #  define deflateInit_  z_deflateInit_ | ||||
| #  define deflate       z_deflate | ||||
| #  define deflateEnd    z_deflateEnd | ||||
| #  define inflateInit_  z_inflateInit_ | ||||
| #  define inflate       z_inflate | ||||
| #  define inflateEnd    z_inflateEnd | ||||
| #  define deflateInit2_ z_deflateInit2_ | ||||
| #  define deflateSetDictionary z_deflateSetDictionary | ||||
| #  define deflateCopy   z_deflateCopy | ||||
| #  define deflateReset  z_deflateReset | ||||
| #  define deflateParams z_deflateParams | ||||
| #  define deflateBound  z_deflateBound | ||||
| #  define inflateInit2_ z_inflateInit2_ | ||||
| #  define inflateSetDictionary z_inflateSetDictionary | ||||
| #  define inflateSync   z_inflateSync | ||||
| #  define inflateSyncPoint z_inflateSyncPoint | ||||
| #  define inflateCopy   z_inflateCopy | ||||
| #  define inflateReset  z_inflateReset | ||||
| #  define compress      z_compress | ||||
| #  define compress2     z_compress2 | ||||
| #  define compressBound z_compressBound | ||||
| #  define uncompress    z_uncompress | ||||
| #  define adler32       z_adler32 | ||||
| #  define crc32         z_crc32 | ||||
| #  define get_crc_table z_get_crc_table | ||||
|  | ||||
| #  define Byte          z_Byte | ||||
| #  define uInt          z_uInt | ||||
| #  define uLong         z_uLong | ||||
| #  define Bytef         z_Bytef | ||||
| #  define charf         z_charf | ||||
| #  define intf          z_intf | ||||
| #  define uIntf         z_uIntf | ||||
| #  define uLongf        z_uLongf | ||||
| #  define voidpf        z_voidpf | ||||
| #  define voidp         z_voidp | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef __STDC_VERSION__ | ||||
| #  ifndef STDC | ||||
| #    define STDC | ||||
| #  endif | ||||
| #  if __STDC_VERSION__ >= 199901L | ||||
| #    ifndef STDC99 | ||||
| #      define STDC99 | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | ||||
| #  define WIN32 | ||||
| #endif | ||||
| #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) | ||||
| #  ifndef __32BIT__ | ||||
| #    define __32BIT__ | ||||
| #  endif | ||||
| #endif | ||||
| #if defined(__MSDOS__) && !defined(MSDOS) | ||||
| #  define MSDOS | ||||
| #endif | ||||
|  | ||||
| /* | ||||
|  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||||
|  * than 64k bytes at a time (needed on systems with 16-bit int). | ||||
|  */ | ||||
| #if defined(MSDOS) && !defined(__32BIT__) | ||||
| #  define MAXSEG_64K | ||||
| #endif | ||||
| #ifdef MSDOS | ||||
| #  define UNALIGNED_OK | ||||
| #endif | ||||
|  | ||||
| #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC) | ||||
| #  define STDC | ||||
| #endif | ||||
| #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) | ||||
| #  ifndef STDC | ||||
| #    define STDC | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if defined __HOS_AIX__ | ||||
| #  ifndef STDC | ||||
| #    define STDC | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #ifndef STDC | ||||
| #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||||
| #    define const   /* note: need a more gentle solution here */ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* Some Mac compilers merge all .h files incorrectly: */ | ||||
| #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) | ||||
| #  define NO_DUMMY_DECL | ||||
| #endif | ||||
|  | ||||
| /* Old Borland C incorrectly complains about missing returns: */ | ||||
| #if defined(__BORLANDC__) && (__BORLANDC__ < 0x460) | ||||
| #  define NEED_DUMMY_RETURN | ||||
| #endif | ||||
| #if defined(__TURBOC__) && !defined(__BORLANDC__) | ||||
| #  define NEED_DUMMY_RETURN | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* Maximum value for memLevel in deflateInit2 */ | ||||
| #ifndef MAX_MEM_LEVEL | ||||
| #  ifdef MAXSEG_64K | ||||
| #    define MAX_MEM_LEVEL 8 | ||||
| #  else | ||||
| #    define MAX_MEM_LEVEL 9 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||||
|  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||||
|  * created by gzip. (Files created by minigzip can still be extracted by | ||||
|  * gzip.) | ||||
|  */ | ||||
| #ifndef MAX_WBITS | ||||
| #  define MAX_WBITS   15 /* 32K LZ77 window */ | ||||
| #endif | ||||
|  | ||||
| /* The memory requirements for deflate are (in bytes): | ||||
|             (1 << (windowBits+2)) +  (1 << (memLevel+9)) | ||||
|  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values) | ||||
|  plus a few kilobytes for small objects. For example, if you want to reduce | ||||
|  the default memory requirements from 256K to 128K, compile with | ||||
|      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||||
|  Of course this will generally degrade compression (there's no free lunch). | ||||
|  | ||||
|    The memory requirements for inflate are (in bytes) 1 << windowBits | ||||
|  that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||||
|  for small objects. | ||||
| */ | ||||
|  | ||||
|                         /* Type declarations */ | ||||
|  | ||||
| #ifndef OF /* function prototypes */ | ||||
| #  ifdef STDC | ||||
| #    define OF(args)  args | ||||
| #  else | ||||
| #    define OF(args)  () | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* | ||||
|  * Microsoft Visual Studio define _vsnprintf but not vsnprintf | ||||
|  */ | ||||
| #if !defined(STDC99) && !(defined(__TURBOC__) && __TURBOC__ >= 0x550) && !defined(VSNPRINTF_DEFINED) | ||||
| #  ifdef MSDOS | ||||
|      /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), | ||||
|         but for now we just assume it doesn't. */ | ||||
| #    define NO_vsnprintf | ||||
| #  endif | ||||
| #  ifdef WIN32 | ||||
|      /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ | ||||
| #    if !defined(vsnprintf) && !defined(__TURBOC__) | ||||
| #      define vsnprintf _vsnprintf | ||||
| #    endif | ||||
| #  endif | ||||
| #  ifdef __TURBOC__ | ||||
| #    define NO_vsnprintf | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* The following definitions for FAR are needed only for MSDOS mixed | ||||
|  * model programming (small or medium model with some far allocations). | ||||
|  * This was tested only with MSC; for other MSDOS compilers you may have | ||||
|  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model, | ||||
|  * just define FAR to be empty. | ||||
|  */ | ||||
| #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) | ||||
|    /* MSC small or medium model */ | ||||
| #  define SMALL_MEDIUM | ||||
| #  ifdef _MSC_VER | ||||
| #    define FAR _far | ||||
| #  else | ||||
| #    define FAR far | ||||
| #  endif | ||||
| #endif | ||||
| #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) | ||||
| #  ifndef __32BIT__ | ||||
| #    define SMALL_MEDIUM | ||||
| #    define FAR _far | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if defined(WIN32) && (!defined(ZLIB_WIN32_NODLL)) && (!defined(ZLIB_DLL)) | ||||
| #  define ZLIB_DLL | ||||
| #endif | ||||
|  | ||||
| /* Compile with -DZLIB_DLL for Windows DLL support */ | ||||
| #if defined(ZLIB_DLL) | ||||
| #  if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32) | ||||
| #    ifndef WINAPIV | ||||
| #      ifdef FAR | ||||
| #        undef FAR | ||||
| #      endif | ||||
| #      include <windows.h> | ||||
| #    endif | ||||
| #    ifdef WIN32 | ||||
| #      define ZEXPORT  WINAPI | ||||
| #      define ZEXPORTVA  WINAPIV | ||||
| #    else | ||||
| #      define ZEXPORT  WINAPI _export | ||||
| #      define ZEXPORTVA  FAR _cdecl _export | ||||
| #    endif | ||||
| #  endif | ||||
| #  if defined (__BORLANDC__) | ||||
| #    if (__BORLANDC__ >= 0x0500) && defined (WIN32) | ||||
| #      include <windows.h> | ||||
| #      define ZEXPORT __declspec(dllexport) WINAPI | ||||
| #      define ZEXPORTVA __declspec(dllexport) WINAPIV | ||||
| #    else | ||||
| #      if defined (_Windows) && defined (__DLL__) | ||||
| #        define ZEXPORT _export | ||||
| #        define ZEXPORTVA _export | ||||
| #      endif | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if defined (__BEOS__) | ||||
| #  if defined (ZLIB_DLL) | ||||
| #    define ZEXTERN extern __declspec(dllexport) | ||||
| #  else | ||||
| #    define ZEXTERN extern __declspec(dllimport) | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #ifndef ZEXPORT | ||||
| #  define ZEXPORT | ||||
| #endif | ||||
| #ifndef ZEXPORTVA | ||||
| #  define ZEXPORTVA | ||||
| #endif | ||||
| #ifndef ZEXTERN | ||||
| #  define ZEXTERN extern | ||||
| #endif | ||||
|  | ||||
| #ifndef FAR | ||||
| #   define FAR | ||||
| #endif | ||||
|  | ||||
| #if !defined(__MACTYPES__) | ||||
| typedef unsigned char  Byte;  /* 8 bits */ | ||||
| #endif | ||||
| typedef unsigned int   uInt;  /* 16 bits or more */ | ||||
| typedef unsigned long  uLong; /* 32 bits or more */ | ||||
|  | ||||
| #ifdef SMALL_MEDIUM | ||||
|    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||||
| #  define Bytef Byte FAR | ||||
| #else | ||||
|    typedef Byte  FAR Bytef; | ||||
| #endif | ||||
| typedef char  FAR charf; | ||||
| typedef int   FAR intf; | ||||
| typedef uInt  FAR uIntf; | ||||
| typedef uLong FAR uLongf; | ||||
|  | ||||
| #ifdef STDC | ||||
|    typedef void const *voidpc; | ||||
|    typedef void FAR *voidpf; | ||||
|    typedef void     *voidp; | ||||
| #else | ||||
|    typedef Byte const *voidpc; | ||||
|    typedef Byte FAR *voidpf; | ||||
|    typedef Byte     *voidp; | ||||
| #endif | ||||
|  | ||||
| #if 0   /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||||
| #  include <sys/types.h> /* for off_t */ | ||||
| #  include <unistd.h>    /* for SEEK_* and off_t */ | ||||
| #  ifdef VMS | ||||
| #    include <unixio.h>   /* for off_t */ | ||||
| #  endif | ||||
| #  define z_off_t  off_t | ||||
| #endif | ||||
| #ifndef SEEK_SET | ||||
| #  define SEEK_SET        0       /* Seek from beginning of file.  */ | ||||
| #  define SEEK_CUR        1       /* Seek from current position.  */ | ||||
| #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */ | ||||
| #endif | ||||
| #ifndef z_off_t | ||||
| #  define  z_off_t long | ||||
| #endif | ||||
|  | ||||
| /* MVS linker does not support external names larger than 8 bytes */ | ||||
| #if defined(__MVS__) | ||||
| #   pragma map(deflateInit_,"DEIN") | ||||
| #   pragma map(deflateInit2_,"DEIN2") | ||||
| #   pragma map(deflateEnd,"DEEND") | ||||
| #   pragma map(deflateBound,"DEBND") | ||||
| #   pragma map(inflateInit_,"ININ") | ||||
| #   pragma map(inflateInit2_,"ININ2") | ||||
| #   pragma map(inflateEnd,"INEND") | ||||
| #   pragma map(inflateSync,"INSY") | ||||
| #   pragma map(inflateSetDictionary,"INSEDI") | ||||
| #   pragma map(compressBound,"CMBND") | ||||
| #   pragma map(inflate_table,"INTABL") | ||||
| #   pragma map(inflate_fast,"INFA") | ||||
| #   pragma map(inflate_copyright,"INCOPY") | ||||
| #endif | ||||
|  | ||||
| #endif /* _ZCONF_H */ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,5 +0,0 @@ | ||||
| 	zipOpen                       @80 | ||||
| 	zipOpenNewFileInZip           @81 | ||||
| 	zipWriteInFileInZip           @82 | ||||
| 	zipCloseFileInZip             @83 | ||||
| 	zipClose                      @84 | ||||
| @@ -1,150 +1,235 @@ | ||||
| /* zip.h -- IO for compress .zip files using zlib  | ||||
|    Version 0.15 alpha, Mar 19th, 1998, | ||||
|  | ||||
|    Copyright (C) 1998 Gilles Vollant | ||||
|  | ||||
|    This unzip package allow creates .ZIP file, compatible with PKZip 2.04g | ||||
|      WinZip, InfoZip tools and compatible. | ||||
|    Encryption and multi volume ZipFile (span) are not supported. | ||||
|    Old compressions used by old PKZip 1.x are not supported | ||||
|  | ||||
|   For uncompress .zip file, look at unzip.h | ||||
|  | ||||
|    THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE | ||||
|    CAN CHANGE IN FUTURE VERSION !! | ||||
|    I WAIT FEEDBACK at mail info@winimage.com | ||||
|    Visit also http://www.winimage.com/zLibDll/zip.htm for evolution | ||||
|  | ||||
|    Condition of use and distribution are the same than zlib : | ||||
|  | ||||
|   This software is provided 'as-is', without any express or implied | ||||
|   warranty.  In no event will the authors be held liable for any damages | ||||
|   arising from the use of this software. | ||||
|  | ||||
|   Permission is granted to anyone to use this software for any purpose, | ||||
|   including commercial applications, and to alter it and redistribute it | ||||
|   freely, subject to the following restrictions: | ||||
|  | ||||
|   1. The origin of this software must not be misrepresented; you must not | ||||
|      claim that you wrote the original software. If you use this software | ||||
|      in a product, an acknowledgment in the product documentation would be | ||||
|      appreciated but is not required. | ||||
|   2. Altered source versions must be plainly marked as such, and must not be | ||||
|      misrepresented as being the original software. | ||||
|   3. This notice may not be removed or altered from any source distribution. | ||||
|  | ||||
|  | ||||
| */ | ||||
|  | ||||
| /* for more info about .ZIP format, see  | ||||
|       ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip | ||||
|    PkWare has also a specification at : | ||||
|       ftp://ftp.pkware.com/probdesc.zip | ||||
| */ | ||||
|  | ||||
| #ifndef _zip_H | ||||
| #define _zip_H | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIB_H | ||||
| #include "zlib.h" | ||||
| #endif | ||||
|  | ||||
| #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) | ||||
| /* like the STRICT of WIN32, we define a pointer that cannot be converted | ||||
|     from (void*) without cast */ | ||||
| typedef struct TagzipFile__ { int unused; } zipFile__;  | ||||
| typedef zipFile__ *zipFile; | ||||
| #else | ||||
| typedef voidp zipFile; | ||||
| #endif | ||||
|  | ||||
| #define ZIP_OK                                  (0) | ||||
| #define ZIP_ERRNO               (Z_ERRNO) | ||||
| #define ZIP_PARAMERROR                  (-102) | ||||
| #define ZIP_INTERNALERROR               (-104) | ||||
|  | ||||
| /* tm_zip contain date/time info */ | ||||
| typedef struct tm_zip_s  | ||||
| { | ||||
| 	uInt tm_sec;            /* seconds after the minute - [0,59] */ | ||||
| 	uInt tm_min;            /* minutes after the hour - [0,59] */ | ||||
| 	uInt tm_hour;           /* hours since midnight - [0,23] */ | ||||
| 	uInt tm_mday;           /* day of the month - [1,31] */ | ||||
| 	uInt tm_mon;            /* months since January - [0,11] */ | ||||
| 	uInt tm_year;           /* years - [1980..2044] */ | ||||
| } tm_zip; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	tm_zip      tmz_date;       /* date in understandable format           */ | ||||
|     uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */ | ||||
| /*    uLong       flag;        */   /* general purpose bit flag        2 bytes */ | ||||
|  | ||||
|     uLong       internal_fa;    /* internal file attributes        2 bytes */ | ||||
|     uLong       external_fa;    /* external file attributes        4 bytes */ | ||||
| } zip_fileinfo; | ||||
|  | ||||
| extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); | ||||
| /* | ||||
|   Create a zipfile. | ||||
| 	 pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on | ||||
| 	   an Unix computer "zlib/zlib111.zip". | ||||
| 	 if the file pathname exist and append=1, the zip will be created at the end | ||||
| 	   of the file. (useful if the file contain a self extractor code) | ||||
| 	 If the zipfile cannot be opened, the return value is NULL. | ||||
|      Else, the return value is a zipFile Handle, usable with other function | ||||
| 	   of this zip package. | ||||
|  | ||||
|  | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | ||||
| 					   const char* filename, | ||||
| 					   const zip_fileinfo* zipfi, | ||||
| 					   const void* extrafield_local, | ||||
| 					   uInt size_extrafield_local, | ||||
| 					   const void* extrafield_global, | ||||
| 					   uInt size_extrafield_global, | ||||
| 					   const char* comment, | ||||
| 					   int method, | ||||
| 					   int level)); | ||||
| /* | ||||
|   Open a file in the ZIP for writing. | ||||
|   filename : the filename in zip (if NULL, '-' without quote will be used | ||||
|   *zipfi contain supplemental information | ||||
|   if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local | ||||
|     contains the extrafield data the the local header | ||||
|   if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global | ||||
|     contains the extrafield data the the local header | ||||
|   if comment != NULL, comment contain the comment string | ||||
|   method contain the compression method (0 for store, Z_DEFLATED for deflate) | ||||
|   level contain the level of compression (can be Z_DEFAULT_COMPRESSION) | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, | ||||
| 					   const voidp buf, | ||||
| 					   unsigned len)); | ||||
| /* | ||||
|   Write data in the zipfile | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); | ||||
| /* | ||||
|   Close the current file in the zipfile | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipClose OF((zipFile file, | ||||
| 				const char* global_comment)); | ||||
| /* | ||||
|   Close the zipfile | ||||
| */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* _zip_H */ | ||||
| /* zip.h -- IO for compress .zip files using zlib | ||||
|    Version 0.22, May 19th, 2003 | ||||
|  | ||||
|    Copyright (C) 1998-2003 Gilles Vollant | ||||
|  | ||||
|    This unzip package allow creates .ZIP file, compatible with PKZip 2.04g | ||||
|      WinZip, InfoZip tools and compatible. | ||||
|    Encryption and multi volume ZipFile (span) are not supported. | ||||
|    Old compressions used by old PKZip 1.x are not supported | ||||
|  | ||||
|   For uncompress .zip file, look at unzip.h | ||||
|  | ||||
|  | ||||
|    I WAIT FEEDBACK at mail info@winimage.com | ||||
|    Visit also http://www.winimage.com/zLibDll/unzip.html for evolution | ||||
|  | ||||
|    Condition of use and distribution are the same than zlib : | ||||
|  | ||||
|   This software is provided 'as-is', without any express or implied | ||||
|   warranty.  In no event will the authors be held liable for any damages | ||||
|   arising from the use of this software. | ||||
|  | ||||
|   Permission is granted to anyone to use this software for any purpose, | ||||
|   including commercial applications, and to alter it and redistribute it | ||||
|   freely, subject to the following restrictions: | ||||
|  | ||||
|   1. The origin of this software must not be misrepresented; you must not | ||||
|      claim that you wrote the original software. If you use this software | ||||
|      in a product, an acknowledgment in the product documentation would be | ||||
|      appreciated but is not required. | ||||
|   2. Altered source versions must be plainly marked as such, and must not be | ||||
|      misrepresented as being the original software. | ||||
|   3. This notice may not be removed or altered from any source distribution. | ||||
|  | ||||
|  | ||||
| */ | ||||
|  | ||||
| /* for more info about .ZIP format, see | ||||
|       http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip | ||||
|       http://www.info-zip.org/pub/infozip/doc/ | ||||
|    PkWare has also a specification at : | ||||
|       ftp://ftp.pkware.com/probdesc.zip | ||||
| */ | ||||
|  | ||||
| #ifndef _zip_H | ||||
| #define _zip_H | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIB_H | ||||
| #include "zlib.h" | ||||
| #endif | ||||
|  | ||||
| #ifndef _ZLIBIOAPI_H | ||||
| #include "ioapi.h" | ||||
| #endif | ||||
|  | ||||
| #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) | ||||
| /* like the STRICT of WIN32, we define a pointer that cannot be converted | ||||
|     from (void*) without cast */ | ||||
| typedef struct TagzipFile__ { int unused; } zipFile__; | ||||
| typedef zipFile__ *zipFile; | ||||
| #else | ||||
| typedef voidp zipFile; | ||||
| #endif | ||||
|  | ||||
| #define ZIP_OK                          (0) | ||||
| #define ZIP_EOF                         (0) | ||||
| #define ZIP_ERRNO                       (Z_ERRNO) | ||||
| #define ZIP_PARAMERROR                  (-102) | ||||
| #define ZIP_BADZIPFILE                  (-103) | ||||
| #define ZIP_INTERNALERROR               (-104) | ||||
|  | ||||
| #ifndef DEF_MEM_LEVEL | ||||
| #  if MAX_MEM_LEVEL >= 8 | ||||
| #    define DEF_MEM_LEVEL 8 | ||||
| #  else | ||||
| #    define DEF_MEM_LEVEL  MAX_MEM_LEVEL | ||||
| #  endif | ||||
| #endif | ||||
| /* default memLevel */ | ||||
|  | ||||
| /* tm_zip contain date/time info */ | ||||
| typedef struct tm_zip_s | ||||
| { | ||||
|     uInt tm_sec;            /* seconds after the minute - [0,59] */ | ||||
|     uInt tm_min;            /* minutes after the hour - [0,59] */ | ||||
|     uInt tm_hour;           /* hours since midnight - [0,23] */ | ||||
|     uInt tm_mday;           /* day of the month - [1,31] */ | ||||
|     uInt tm_mon;            /* months since January - [0,11] */ | ||||
|     uInt tm_year;           /* years - [1980..2044] */ | ||||
| } tm_zip; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
|     tm_zip      tmz_date;       /* date in understandable format           */ | ||||
|     uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */ | ||||
| /*    uLong       flag;        */   /* general purpose bit flag        2 bytes */ | ||||
|  | ||||
|     uLong       internal_fa;    /* internal file attributes        2 bytes */ | ||||
|     uLong       external_fa;    /* external file attributes        4 bytes */ | ||||
| } zip_fileinfo; | ||||
|  | ||||
| typedef const char* zipcharpc; | ||||
|  | ||||
|  | ||||
| #define APPEND_STATUS_CREATE        (0) | ||||
| #define APPEND_STATUS_CREATEAFTER   (1) | ||||
| #define APPEND_STATUS_ADDINZIP      (2) | ||||
|  | ||||
| extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); | ||||
| /* | ||||
|   Create a zipfile. | ||||
|      pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on | ||||
|        an Unix computer "zlib/zlib113.zip". | ||||
|      if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip | ||||
|        will be created at the end of the file. | ||||
|          (useful if the file contain a self extractor code) | ||||
|      if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will | ||||
|        add files in existing zip (be sure you don't add file that doesn't exist) | ||||
|      If the zipfile cannot be opened, the return value is NULL. | ||||
|      Else, the return value is a zipFile Handle, usable with other function | ||||
|        of this zip package. | ||||
| */ | ||||
|  | ||||
| /* Note : there is no delete function into a zipfile. | ||||
|    If you want delete file into a zipfile, you must open a zipfile, and create another | ||||
|    Of couse, you can use RAW reading and writing to copy the file you did not want delte | ||||
| */ | ||||
|  | ||||
| extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, | ||||
|                                    int append, | ||||
|                                    zipcharpc* globalcomment, | ||||
|                                    zlib_filefunc_def* pzlib_filefunc_def)); | ||||
|  | ||||
| extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | ||||
|                        const char* filename, | ||||
|                        const zip_fileinfo* zipfi, | ||||
|                        const void* extrafield_local, | ||||
|                        uInt size_extrafield_local, | ||||
|                        const void* extrafield_global, | ||||
|                        uInt size_extrafield_global, | ||||
|                        const char* comment, | ||||
|                        int method, | ||||
|                        int level)); | ||||
| /* | ||||
|   Open a file in the ZIP for writing. | ||||
|   filename : the filename in zip (if NULL, '-' without quote will be used | ||||
|   *zipfi contain supplemental information | ||||
|   if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local | ||||
|     contains the extrafield data the the local header | ||||
|   if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global | ||||
|     contains the extrafield data the the local header | ||||
|   if comment != NULL, comment contain the comment string | ||||
|   method contain the compression method (0 for store, Z_DEFLATED for deflate) | ||||
|   level contain the level of compression (can be Z_DEFAULT_COMPRESSION) | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, | ||||
|                                             const char* filename, | ||||
|                                             const zip_fileinfo* zipfi, | ||||
|                                             const void* extrafield_local, | ||||
|                                             uInt size_extrafield_local, | ||||
|                                             const void* extrafield_global, | ||||
|                                             uInt size_extrafield_global, | ||||
|                                             const char* comment, | ||||
|                                             int method, | ||||
|                                             int level, | ||||
|                                             int raw)); | ||||
|  | ||||
| /* | ||||
|   Same than zipOpenNewFileInZip, except if raw=1, we write raw file | ||||
|  */ | ||||
|  | ||||
| extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, | ||||
|                                             const char* filename, | ||||
|                                             const zip_fileinfo* zipfi, | ||||
|                                             const void* extrafield_local, | ||||
|                                             uInt size_extrafield_local, | ||||
|                                             const void* extrafield_global, | ||||
|                                             uInt size_extrafield_global, | ||||
|                                             const char* comment, | ||||
|                                             int method, | ||||
|                                             int level, | ||||
|                                             int raw, | ||||
|                                             int windowBits, | ||||
|                                             int memLevel, | ||||
|                                             int strategy, | ||||
|                                             const char* password, | ||||
|                                             uLong crcForCtypting)); | ||||
|  | ||||
| /* | ||||
|   Same than zipOpenNewFileInZip2, except | ||||
|     windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 | ||||
|     password : crypting password (NULL for no crypting) | ||||
|     crcForCtypting : crc of file to compress (needed for crypting) | ||||
|  */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, | ||||
|                        const void* buf, | ||||
|                        unsigned len)); | ||||
| /* | ||||
|   Write data in the zipfile | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); | ||||
| /* | ||||
|   Close the current file in the zipfile | ||||
| */ | ||||
|  | ||||
|  | ||||
| extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, | ||||
|                                             uLong uncompressed_size, | ||||
|                                             uLong crc32)); | ||||
| /* | ||||
|   Close the current file in the zipfile, for fiel opened with | ||||
|     parameter raw=1 in zipOpenNewFileInZip2 | ||||
|   uncompressed_size and crc32 are value for the uncompressed size | ||||
| */ | ||||
|  | ||||
| extern int ZEXPORT zipClose OF((zipFile file, | ||||
|                 const char* global_comment)); | ||||
| /* | ||||
|   Close the zipfile | ||||
| */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* _zip_H */ | ||||
|   | ||||
| @@ -1,651 +0,0 @@ | ||||
| # Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4> | ||||
| # Microsoft Developer Studio Generated Build File, Format Version 5.00 | ||||
| # ** DO NOT EDIT ** | ||||
|  | ||||
| # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 | ||||
| # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 | ||||
|  | ||||
| CFG=zlibvc - Win32 Release | ||||
| !MESSAGE This is not a valid makefile. To build this project using NMAKE, | ||||
| !MESSAGE use the Export Makefile command and run | ||||
| !MESSAGE  | ||||
| !MESSAGE NMAKE /f "zlibvc.mak". | ||||
| !MESSAGE  | ||||
| !MESSAGE You can specify a configuration when running NMAKE | ||||
| !MESSAGE by defining the macro CFG on the command line. For example: | ||||
| !MESSAGE  | ||||
| !MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release" | ||||
| !MESSAGE  | ||||
| !MESSAGE Possible choices for configuration are: | ||||
| !MESSAGE  | ||||
| !MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\ | ||||
|  "Win32 (ALPHA) Dynamic-Link Library") | ||||
| !MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\ | ||||
|  "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\ | ||||
|  "Win32 (x86) Dynamic-Link Library") | ||||
| !MESSAGE  | ||||
|  | ||||
| # Begin Project | ||||
| # PROP Scc_ProjName "" | ||||
| # PROP Scc_LocalPath "" | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 0 | ||||
| # PROP BASE Output_Dir ".\Release" | ||||
| # PROP BASE Intermediate_Dir ".\Release" | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 0 | ||||
| # PROP Output_Dir ".\Release" | ||||
| # PROP Intermediate_Dir ".\Release" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| CPP=cl.exe | ||||
| # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c | ||||
| # ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c | ||||
| # SUBTRACT CPP /YX | ||||
| MTL=midl.exe | ||||
| # ADD BASE MTL /nologo /D "NDEBUG" /win32 | ||||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| RSC=rc.exe | ||||
| # ADD BASE RSC /l 0x40c /d "NDEBUG" | ||||
| # ADD RSC /l 0x40c /d "NDEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 | ||||
| # ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" | ||||
| # SUBTRACT LINK32 /pdb:none | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 1 | ||||
| # PROP BASE Output_Dir ".\Debug" | ||||
| # PROP BASE Intermediate_Dir ".\Debug" | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 1 | ||||
| # PROP Output_Dir ".\Debug" | ||||
| # PROP Intermediate_Dir ".\Debug" | ||||
| # PROP Target_Dir "" | ||||
| CPP=cl.exe | ||||
| # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c | ||||
| # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /FD /c | ||||
| # SUBTRACT CPP /YX | ||||
| MTL=midl.exe | ||||
| # ADD BASE MTL /nologo /D "_DEBUG" /win32 | ||||
| # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 | ||||
| RSC=rc.exe | ||||
| # ADD BASE RSC /l 0x40c /d "_DEBUG" | ||||
| # ADD RSC /l 0x40c /d "_DEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 | ||||
| # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 0 | ||||
| # PROP BASE Output_Dir "zlibvc__" | ||||
| # PROP BASE Intermediate_Dir "zlibvc__" | ||||
| # PROP BASE Ignore_Export_Lib 0 | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 0 | ||||
| # PROP Output_Dir "zlibvc__" | ||||
| # PROP Intermediate_Dir "zlibvc__" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| MTL=midl.exe | ||||
| # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| CPP=cl.exe | ||||
| # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c | ||||
| # ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c | ||||
| # SUBTRACT CPP /YX | ||||
| RSC=rc.exe | ||||
| # ADD BASE RSC /l 0x40c /d "NDEBUG" | ||||
| # ADD RSC /l 0x40c /d "NDEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll" | ||||
| # SUBTRACT BASE LINK32 /pdb:none | ||||
| # ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll" | ||||
| # SUBTRACT LINK32 /pdb:none | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 0 | ||||
| # PROP BASE Output_Dir "zlibvc_0" | ||||
| # PROP BASE Intermediate_Dir "zlibvc_0" | ||||
| # PROP BASE Ignore_Export_Lib 0 | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 0 | ||||
| # PROP Output_Dir "zlibvc_0" | ||||
| # PROP Intermediate_Dir "zlibvc_0" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| CPP=cl.exe | ||||
| # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c | ||||
| # ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c | ||||
| # SUBTRACT CPP /YX | ||||
| MTL=midl.exe | ||||
| # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| RSC=rc.exe | ||||
| # ADD BASE RSC /l 0x40c /d "NDEBUG" | ||||
| # ADD RSC /l 0x40c /d "NDEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" | ||||
| # SUBTRACT BASE LINK32 /pdb:none | ||||
| # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll" | ||||
| # SUBTRACT LINK32 /pdb:none | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| # PROP BASE Use_MFC 0 | ||||
| # PROP BASE Use_Debug_Libraries 0 | ||||
| # PROP BASE Output_Dir "zlibvc_1" | ||||
| # PROP BASE Intermediate_Dir "zlibvc_1" | ||||
| # PROP BASE Ignore_Export_Lib 0 | ||||
| # PROP BASE Target_Dir "" | ||||
| # PROP Use_MFC 0 | ||||
| # PROP Use_Debug_Libraries 0 | ||||
| # PROP Output_Dir "zlibvc_1" | ||||
| # PROP Intermediate_Dir "zlibvc_1" | ||||
| # PROP Ignore_Export_Lib 0 | ||||
| # PROP Target_Dir "" | ||||
| CPP=cl.exe | ||||
| # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c | ||||
| # ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c | ||||
| # SUBTRACT CPP /YX | ||||
| MTL=midl.exe | ||||
| # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | ||||
| RSC=rc.exe | ||||
| # ADD BASE RSC /l 0x40c /d "NDEBUG" | ||||
| # ADD RSC /l 0x40c /d "NDEBUG" | ||||
| BSC32=bscmake.exe | ||||
| # ADD BASE BSC32 /nologo | ||||
| # ADD BSC32 /nologo | ||||
| LINK32=link.exe | ||||
| # ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll" | ||||
| # SUBTRACT BASE LINK32 /pdb:none | ||||
| # ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll" | ||||
| # SUBTRACT LINK32 /pdb:none | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # Begin Target | ||||
|  | ||||
| # Name "zlibvc - Win32 Release" | ||||
| # Name "zlibvc - Win32 Debug" | ||||
| # Name "zlibvc - Win32 ReleaseAxp" | ||||
| # Name "zlibvc - Win32 ReleaseWithoutAsm" | ||||
| # Name "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
| # Begin Group "Source Files" | ||||
|  | ||||
| # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\adler32.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_ADLER=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\compress.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_COMPR=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\crc32.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_CRC32=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\deflate.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_DEFLA=\ | ||||
| 	".\deflate.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\gvmat32c.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\gzio.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_GZIO_=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infblock.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFBL=\ | ||||
| 	".\infblock.h"\ | ||||
| 	".\infcodes.h"\ | ||||
| 	".\inftrees.h"\ | ||||
| 	".\infutil.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infcodes.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFCO=\ | ||||
| 	".\infblock.h"\ | ||||
| 	".\infcodes.h"\ | ||||
| 	".\inffast.h"\ | ||||
| 	".\inftrees.h"\ | ||||
| 	".\infutil.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\inffast.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFFA=\ | ||||
| 	".\infblock.h"\ | ||||
| 	".\infcodes.h"\ | ||||
| 	".\inffast.h"\ | ||||
| 	".\inftrees.h"\ | ||||
| 	".\infutil.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\inflate.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFLA=\ | ||||
| 	".\infblock.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\inftrees.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFTR=\ | ||||
| 	".\inftrees.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infutil.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_INFUT=\ | ||||
| 	".\infblock.h"\ | ||||
| 	".\infcodes.h"\ | ||||
| 	".\inftrees.h"\ | ||||
| 	".\infutil.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\trees.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_TREES=\ | ||||
| 	".\deflate.h"\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\uncompr.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_UNCOM=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\unzip.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zip.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zlib.rc | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zlibvc.def | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zutil.c | ||||
|  | ||||
| !IF  "$(CFG)" == "zlibvc - Win32 Release" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 Debug" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseAxp" | ||||
|  | ||||
| DEP_CPP_ZUTIL=\ | ||||
| 	".\zconf.h"\ | ||||
| 	".\zlib.h"\ | ||||
| 	".\zutil.h"\ | ||||
| 	 | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm" | ||||
|  | ||||
| !ELSEIF  "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll" | ||||
|  | ||||
| !ENDIF  | ||||
|  | ||||
| # End Source File | ||||
| # End Group | ||||
| # Begin Group "Header Files" | ||||
|  | ||||
| # PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\deflate.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infblock.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infcodes.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\inffast.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\inftrees.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\infutil.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zconf.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zlib.h | ||||
| # End Source File | ||||
| # Begin Source File | ||||
|  | ||||
| SOURCE=.\zutil.h | ||||
| # End Source File | ||||
| # End Group | ||||
| # Begin Group "Resource Files" | ||||
|  | ||||
| # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" | ||||
| # End Group | ||||
| # End Target | ||||
| # End Project | ||||
| @@ -1,41 +0,0 @@ | ||||
| Microsoft Developer Studio Workspace File, Format Version 5.00 | ||||
| # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "zlibstat"=.\zlibstat.dsp - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Project: "zlibvc"=.\zlibvc.dsp - Package Owner=<4> | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<4> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
| Global: | ||||
|  | ||||
| Package=<5> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| Package=<3> | ||||
| {{{ | ||||
| }}} | ||||
|  | ||||
| ############################################################################### | ||||
|  | ||||
							
								
								
									
										149
									
								
								contrib/testzlib/testzlib.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								contrib/testzlib/testzlib.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,149 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <windows.h> | ||||
| #include "zlib.h" | ||||
|  | ||||
| int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr) | ||||
| { | ||||
|     FILE* stream; | ||||
|     void* ptr; | ||||
|     int retVal=1; | ||||
|     stream=fopen(filename, "rb"); | ||||
|     if (stream==NULL) | ||||
|         return 0; | ||||
|  | ||||
|     fseek(stream,0,SEEK_END); | ||||
|  | ||||
|     *plFileSize=ftell(stream); | ||||
|     fseek(stream,0,SEEK_SET); | ||||
|     ptr=malloc((*plFileSize)+1); | ||||
|     if (ptr==NULL) | ||||
|         retVal=0; | ||||
|     else | ||||
|     { | ||||
|         if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize)) | ||||
|             retVal=0; | ||||
|     } | ||||
|     fclose(stream); | ||||
|     *pFilePtr=ptr; | ||||
|     return retVal; | ||||
| } | ||||
|  | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
|     int BlockSizeCompress=0x8000; | ||||
|     int BlockSizeUncompress=0x8000; | ||||
|     int cprLevel=Z_DEFAULT_COMPRESSION ; | ||||
|     long lFileSize; | ||||
|     unsigned char* FilePtr; | ||||
|     long lBufferSizeCpr; | ||||
|     long lBufferSizeUncpr; | ||||
|     long lCompressedSize=0; | ||||
|     unsigned char* CprPtr; | ||||
|     unsigned char* UncprPtr; | ||||
|     long lSizeCpr,lSizeUncpr; | ||||
|     DWORD dwGetTick; | ||||
|  | ||||
|     if (argc<=1) | ||||
|     { | ||||
|         printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n"); | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0) | ||||
|     { | ||||
|         printf("error reading %s\n",argv[1]); | ||||
|         return 1; | ||||
|     } | ||||
|     else printf("file %s read, %u bytes\n",argv[1],lFileSize); | ||||
|  | ||||
|     if (argc>=3) | ||||
|         BlockSizeCompress=atol(argv[2]); | ||||
|  | ||||
|     if (argc>=4) | ||||
|         BlockSizeUncompress=atol(argv[3]); | ||||
|  | ||||
|     if (argc>=5) | ||||
|         cprLevel=(int)atol(argv[4]); | ||||
|  | ||||
|     lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200; | ||||
|     lBufferSizeUncpr = lBufferSizeCpr; | ||||
|  | ||||
|     CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress); | ||||
|     UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress); | ||||
|  | ||||
|     dwGetTick=GetTickCount(); | ||||
|     { | ||||
|         z_stream zcpr; | ||||
|         int ret=Z_OK; | ||||
|         long lOrigToDo = lFileSize; | ||||
|         long lOrigDone = 0; | ||||
|         int step=0; | ||||
|         memset(&zcpr,0,sizeof(z_stream)); | ||||
|         deflateInit(&zcpr,cprLevel); | ||||
|  | ||||
|         zcpr.next_in = FilePtr; | ||||
|         zcpr.next_out = CprPtr; | ||||
|  | ||||
|  | ||||
|         do | ||||
|         { | ||||
|             long all_read_before = zcpr.total_in; | ||||
|             zcpr.avail_in = min(lOrigToDo,BlockSizeCompress); | ||||
|             zcpr.avail_out = BlockSizeCompress; | ||||
|             ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH); | ||||
|             lOrigDone += (zcpr.total_in-all_read_before); | ||||
|             lOrigToDo -= (zcpr.total_in-all_read_before); | ||||
|             step++; | ||||
|         } while (ret==Z_OK); | ||||
|  | ||||
|         lSizeCpr=zcpr.total_out; | ||||
|         deflateEnd(&zcpr); | ||||
|         dwGetTick=GetTickCount()-dwGetTick; | ||||
|         printf("total compress size = %u, in %u step\n",lSizeCpr,step); | ||||
|         printf("time = %u msec = %f sec\n\n",dwGetTick,dwGetTick/(double)1000.); | ||||
|     } | ||||
|  | ||||
|     dwGetTick=GetTickCount(); | ||||
|     { | ||||
|         z_stream zcpr; | ||||
|         int ret=Z_OK; | ||||
|         long lOrigToDo = lSizeCpr; | ||||
|         long lOrigDone = 0; | ||||
|         int step=0; | ||||
|         memset(&zcpr,0,sizeof(z_stream)); | ||||
|         inflateInit(&zcpr); | ||||
|  | ||||
|         zcpr.next_in = CprPtr; | ||||
|         zcpr.next_out = UncprPtr; | ||||
|  | ||||
|  | ||||
|         do | ||||
|         { | ||||
|             long all_read_before = zcpr.total_in; | ||||
|             zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress); | ||||
|             zcpr.avail_out = BlockSizeUncompress; | ||||
|             ret=inflate(&zcpr,Z_SYNC_FLUSH); | ||||
|             lOrigDone += (zcpr.total_in-all_read_before); | ||||
|             lOrigToDo -= (zcpr.total_in-all_read_before); | ||||
|             step++; | ||||
|         } while (ret==Z_OK); | ||||
|  | ||||
|         lSizeUncpr=zcpr.total_out; | ||||
|         inflateEnd(&zcpr); | ||||
|         dwGetTick=GetTickCount()-dwGetTick; | ||||
|         printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step); | ||||
|         printf("time = %u msec = %f sec\n\n",dwGetTick,dwGetTick/(double)1000.); | ||||
|     } | ||||
|  | ||||
|     if (lSizeUncpr==lFileSize) | ||||
|     { | ||||
|         if (memcmp(FilePtr,UncprPtr,lFileSize)==0) | ||||
|             printf("compare ok\n"); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
|  | ||||
| } | ||||
							
								
								
									
										21
									
								
								contrib/testzlib/testzlib.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								contrib/testzlib/testzlib.sln
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| Microsoft Visual Studio Solution File, Format Version 7.00 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfiguration) = preSolution | ||||
| 		ConfigName.0 = Debug | ||||
| 		ConfigName.1 = Release | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectDependencies) = postSolution | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfiguration) = postSolution | ||||
| 		{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug.ActiveCfg = Debug|Win32 | ||||
| 		{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug.Build.0 = Debug|Win32 | ||||
| 		{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release.ActiveCfg = Release|Win32 | ||||
| 		{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityAddIns) = postSolution | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										124
									
								
								contrib/testzlib/testzlib.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								contrib/testzlib/testzlib.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| <?xml version="1.0" encoding = "Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="7.00" | ||||
| 	Name="testzlib" | ||||
| 	ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" | ||||
| 	Keyword="Win32Proj"> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32"/> | ||||
| 	</Platforms> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory="Debug" | ||||
| 			IntermediateDirectory="Debug" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | ||||
| 				MinimalRebuild="TRUE" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="5" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="4"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/testzlib.exe" | ||||
| 				LinkIncremental="2" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				ProgramDatabaseFile="$(OutDir)/testzlib.pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="Release" | ||||
| 			IntermediateDirectory="Release" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				OmitFramePointers="TRUE" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | ||||
| 				StringPooling="TRUE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="3"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/testzlib.exe" | ||||
| 				LinkIncremental="1" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> | ||||
| 			<File | ||||
| 				RelativePath="testzlib.c"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc"> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="zlib.lib"> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										22
									
								
								contrib/vstudio/readme.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								contrib/vstudio/readme.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| For create the 16 and 32 bits DLL of Zlib 1.20 | ||||
|  | ||||
| For the 16 bits : | ||||
| unzip zlib120.zip and copy file from contrib\vstudio\vc15_16 and from contrib\minizip in the same directory | ||||
| open zlib16.mak with Microsoft Visual C++ 1.52 | ||||
|  | ||||
|  | ||||
| For the 32 bits : | ||||
| unzip zlib120.zip and copy file from contrib\vstudio\vc70_32 and from contrib\minizip in the same directory | ||||
| You can also need unzip http://www.winimage.com/zLibDll/crtdll.zip | ||||
|  | ||||
| If you are using x86, use target Release | ||||
| open zlibvc.sln with Microsoft Visual C++ 7.0 (Visual Studio .net) | ||||
|  | ||||
|  | ||||
| Note : You don't need recompile yourself. There is compiled .LIB in | ||||
|   http://www.winimage.com/zLibDll . See this page for more information | ||||
|  | ||||
|  | ||||
|  | ||||
| Gilles Vollant | ||||
| info@winimage.com | ||||
							
								
								
									
										94
									
								
								contrib/vstudio/vc15_16/zlib16.def
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								contrib/vstudio/vc15_16/zlib16.def
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| LIBRARY		"zlib" | ||||
|  | ||||
| DESCRIPTION	'"""zlib data compression library"""' | ||||
|  | ||||
| EXETYPE		WINDOWS | ||||
|  | ||||
| VERSION		1.21 | ||||
|  | ||||
| CODE    PRELOAD MOVEABLE DISCARDABLE | ||||
| DATA    PRELOAD MOVEABLE SINGLE | ||||
|  | ||||
|  | ||||
| HEAPSIZE	32768,8192 | ||||
|  | ||||
| EXPORTS | ||||
|         adler32                                  @1 | ||||
|         compress                                 @2 | ||||
|         crc32                                    @3 | ||||
|         deflate                                  @4 | ||||
|         deflateCopy                              @5 | ||||
|         deflateEnd                               @6 | ||||
|         deflateInit2_                            @7 | ||||
|         deflateInit_                             @8 | ||||
|         deflateParams                            @9 | ||||
|         deflateReset                             @10 | ||||
|         deflateSetDictionary                     @11 | ||||
|         gzclose                                  @12 | ||||
|         gzdopen                                  @13 | ||||
|         gzerror                                  @14 | ||||
|         gzflush                                  @15 | ||||
|         gzopen                                   @16 | ||||
|         gzread                                   @17 | ||||
|         gzwrite                                  @18 | ||||
|         inflate                                  @19 | ||||
|         inflateEnd                               @20 | ||||
|         inflateInit2_                            @21 | ||||
|         inflateInit_                             @22 | ||||
|         inflateReset                             @23 | ||||
|         inflateSetDictionary                     @24 | ||||
|         inflateSync                              @25 | ||||
|         uncompress                               @26 | ||||
|         zlibVersion                              @27 | ||||
|         _gzprintf                                @28 | ||||
|         gzputc                                   @29 | ||||
|         gzgetc                                   @30 | ||||
|         gzseek                                   @31 | ||||
|         gzrewind                                 @32 | ||||
|         gztell                                   @33 | ||||
|         gzeof                                    @34 | ||||
|         gzsetparams                              @35 | ||||
|         zError                                   @36 | ||||
|         inflateSyncPoint                         @37 | ||||
|         get_crc_table                            @38 | ||||
|         compress2                                @39 | ||||
|         gzputs                                   @40 | ||||
|         gzgets                                   @41 | ||||
|         inflateCopy                              @42 | ||||
|         inflateBackInit_                         @43 | ||||
|         inflateBack                              @44 | ||||
|         inflateBackEnd                           @45 | ||||
|         compressBound                            @46 | ||||
|  | ||||
|         unzOpen                                  @61 | ||||
|         unzClose                                 @62 | ||||
|         unzGetGlobalInfo                         @63 | ||||
|         unzGetCurrentFileInfo                    @64 | ||||
|         unzGoToFirstFile                         @65 | ||||
|         unzGoToNextFile                          @66 | ||||
|         unzOpenCurrentFile                       @67 | ||||
|         unzReadCurrentFile                       @68 | ||||
|         unzOpenCurrentFile3                      @69 | ||||
|         unztell                                  @70 | ||||
|         unzeof                                   @71 | ||||
|         unzCloseCurrentFile                      @72 | ||||
|         unzGetGlobalComment                      @73 | ||||
|         unzStringFileNameCompare                 @74 | ||||
|         unzLocateFile                            @75 | ||||
|         unzGetLocalExtrafield                    @76 | ||||
|         unzOpen2                                 @77 | ||||
|         unzOpenCurrentFile2                      @78 | ||||
|         unzOpenCurrentFilePassword               @79 | ||||
|  | ||||
|         zipOpen                                  @80 | ||||
|         zipOpenNewFileInZip                      @81 | ||||
|         zipWriteInFileInZip                      @82 | ||||
|         zipCloseFileInZip                        @83 | ||||
|         zipClose                                 @84 | ||||
|         zipOpenNewFileInZip2                     @86 | ||||
|         zipCloseFileInZipRaw                     @87 | ||||
|         zipOpen2                                 @88 | ||||
|         zipOpenNewFileInZip3                     @89 | ||||
|  | ||||
|         unzGetFilePos                            @100 | ||||
|         unzGoToFilePos                           @101 | ||||
							
								
								
									
										256
									
								
								contrib/vstudio/vc15_16/zlib16.mak
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										256
									
								
								contrib/vstudio/vc15_16/zlib16.mak
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,256 @@ | ||||
| # Microsoft Visual C++ generated build script - Do not modify | ||||
|  | ||||
| PROJ = ZLIB16 | ||||
| DEBUG = 0 | ||||
| PROGTYPE = 1 | ||||
| CALLER =  | ||||
| ARGS =  | ||||
| DLLS =  | ||||
| D_RCDEFINES = -d_DEBUG | ||||
| R_RCDEFINES = -dNDEBUG | ||||
| ORIGIN = MSVC | ||||
| ORIGIN_VER = 1.00 | ||||
| PROJPATH = c:\zlib\ | ||||
| USEMFC = 0 | ||||
| CC = cl | ||||
| CPP = cl | ||||
| CXX = cl | ||||
| CCREATEPCHFLAG =  | ||||
| CPPCREATEPCHFLAG =  | ||||
| CUSEPCHFLAG =  | ||||
| CPPUSEPCHFLAG =  | ||||
| FIRSTC = ADLER32.C    | ||||
| FIRSTCPP =              | ||||
| RC = rc | ||||
| CFLAGS_D_WDLL = /nologo /G2 /W3 /Zi /ALw /Od /D "_DEBUG" /D "WINDOWS" /D "ZLIB_DLL" /FR /GD /Fd"ZLIB.PDB" | ||||
| CFLAGS_R_WDLL = /nologo /W3 /ALw /O1 /D "NDEBUG" /D "WINDOWS" /D "ZLIB_DLL" /FR /GD  | ||||
| LFLAGS_D_WDLL = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /CO /NOE /ALIGN:16 /MAP:FULL | ||||
| LFLAGS_R_WDLL = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /NOE /ALIGN:16 /MAP:FULL | ||||
| LIBS_D_WDLL = oldnames libw commdlg shell olecli olesvr ldllcew | ||||
| LIBS_R_WDLL = oldnames libw commdlg shell olecli olesvr ldllcew | ||||
| RCFLAGS = /nologo | ||||
| RESFLAGS = /nologo | ||||
| RUNFLAGS =  | ||||
| DEFFILE = ZLIB16.DEF | ||||
| OBJS_EXT =  | ||||
| LIBS_EXT =  | ||||
| !if "$(DEBUG)" == "1" | ||||
| CFLAGS = $(CFLAGS_D_WDLL) | ||||
| LFLAGS = $(LFLAGS_D_WDLL) | ||||
| LIBS = $(LIBS_D_WDLL) | ||||
| MAPFILE = nul | ||||
| RCDEFINES = $(D_RCDEFINES) | ||||
| !else | ||||
| CFLAGS = $(CFLAGS_R_WDLL) | ||||
| LFLAGS = $(LFLAGS_R_WDLL) | ||||
| LIBS = $(LIBS_R_WDLL) | ||||
| MAPFILE = nul | ||||
| RCDEFINES = $(R_RCDEFINES) | ||||
| !endif | ||||
| !if [if exist MSVC.BND del MSVC.BND] | ||||
| !endif | ||||
| SBRS = ADLER32.SBR \ | ||||
| 		COMPRESS.SBR \ | ||||
| 		CRC32.SBR \ | ||||
| 		DEFLATE.SBR \ | ||||
| 		GZIO.SBR \ | ||||
| 		INFFAST.SBR \ | ||||
| 		INFLATE.SBR \ | ||||
| 		TREES.SBR \ | ||||
| 		UNCOMPR.SBR \ | ||||
| 		ZUTIL.SBR \ | ||||
| 		ZIP.SBR \ | ||||
| 		UNZIP.SBR \ | ||||
| 		INFBACK.SBR \ | ||||
| 		IOAPI.SBR \ | ||||
| 		INFTREES.SBR | ||||
|  | ||||
|  | ||||
| ADLER32_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| COMPRESS_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| CRC32_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\crc32.h | ||||
|  | ||||
|  | ||||
| DEFLATE_DEP = c:\zlib\deflate.h \ | ||||
| 	c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| GZIO_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| INFFAST_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\inftrees.h \ | ||||
| 	c:\zlib\inflate.h \ | ||||
| 	c:\zlib\inffast.h | ||||
|  | ||||
|  | ||||
| INFLATE_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\inftrees.h \ | ||||
| 	c:\zlib\inflate.h \ | ||||
| 	c:\zlib\inffast.h \ | ||||
| 	c:\zlib\inffixed.h | ||||
|  | ||||
|  | ||||
| TREES_DEP = c:\zlib\deflate.h \ | ||||
| 	c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\trees.h | ||||
|  | ||||
|  | ||||
| UNCOMPR_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| ZUTIL_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h | ||||
|  | ||||
|  | ||||
| ZLIB16_RCDEP =  | ||||
|  | ||||
| ZIP_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\zip.h \ | ||||
| 	c:\zlib\ioapi.h | ||||
|  | ||||
|  | ||||
| UNZIP_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\unzip.h \ | ||||
| 	c:\zlib\ioapi.h | ||||
|  | ||||
|  | ||||
| INFBACK_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\inftrees.h \ | ||||
| 	c:\zlib\inflate.h \ | ||||
| 	c:\zlib\inffast.h \ | ||||
| 	c:\zlib\inffixed.h | ||||
|  | ||||
|  | ||||
| IOAPI_DEP = c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\ioapi.h | ||||
|  | ||||
|  | ||||
| INFTREES_DEP = c:\zlib\zutil.h \ | ||||
| 	c:\zlib\zlib.h \ | ||||
| 	c:\zlib\zconf.h \ | ||||
| 	c:\zlib\inftrees.h | ||||
|  | ||||
|  | ||||
| all:	$(PROJ).DLL $(PROJ).BSC | ||||
|  | ||||
| ADLER32.OBJ:	ADLER32.C $(ADLER32_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c ADLER32.C | ||||
|  | ||||
| COMPRESS.OBJ:	COMPRESS.C $(COMPRESS_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c COMPRESS.C | ||||
|  | ||||
| CRC32.OBJ:	CRC32.C $(CRC32_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c CRC32.C | ||||
|  | ||||
| DEFLATE.OBJ:	DEFLATE.C $(DEFLATE_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c DEFLATE.C | ||||
|  | ||||
| GZIO.OBJ:	GZIO.C $(GZIO_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c GZIO.C | ||||
|  | ||||
| INFFAST.OBJ:	INFFAST.C $(INFFAST_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c INFFAST.C | ||||
|  | ||||
| INFLATE.OBJ:	INFLATE.C $(INFLATE_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c INFLATE.C | ||||
|  | ||||
| TREES.OBJ:	TREES.C $(TREES_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c TREES.C | ||||
|  | ||||
| UNCOMPR.OBJ:	UNCOMPR.C $(UNCOMPR_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c UNCOMPR.C | ||||
|  | ||||
| ZUTIL.OBJ:	ZUTIL.C $(ZUTIL_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c ZUTIL.C | ||||
|  | ||||
| ZLIB16.RES:	ZLIB16.RC $(ZLIB16_RCDEP) | ||||
| 	$(RC) $(RCFLAGS) $(RCDEFINES) -r ZLIB16.RC | ||||
|  | ||||
| ZIP.OBJ:	ZIP.C $(ZIP_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c ZIP.C | ||||
|  | ||||
| UNZIP.OBJ:	UNZIP.C $(UNZIP_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c UNZIP.C | ||||
|  | ||||
| INFBACK.OBJ:	INFBACK.C $(INFBACK_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c INFBACK.C | ||||
|  | ||||
| IOAPI.OBJ:	IOAPI.C $(IOAPI_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c IOAPI.C | ||||
|  | ||||
| INFTREES.OBJ:	INFTREES.C $(INFTREES_DEP) | ||||
| 	$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c INFTREES.C | ||||
|  | ||||
|  | ||||
| $(PROJ).DLL::	ZLIB16.RES | ||||
|  | ||||
| $(PROJ).DLL::	ADLER32.OBJ COMPRESS.OBJ CRC32.OBJ DEFLATE.OBJ GZIO.OBJ INFFAST.OBJ \ | ||||
| 	INFLATE.OBJ TREES.OBJ UNCOMPR.OBJ ZUTIL.OBJ ZIP.OBJ UNZIP.OBJ INFBACK.OBJ IOAPI.OBJ \ | ||||
| 	INFTREES.OBJ $(OBJS_EXT) $(DEFFILE) | ||||
| 	echo >NUL @<<$(PROJ).CRF | ||||
| ADLER32.OBJ + | ||||
| COMPRESS.OBJ + | ||||
| CRC32.OBJ + | ||||
| DEFLATE.OBJ + | ||||
| GZIO.OBJ + | ||||
| INFFAST.OBJ + | ||||
| INFLATE.OBJ + | ||||
| TREES.OBJ + | ||||
| UNCOMPR.OBJ + | ||||
| ZUTIL.OBJ + | ||||
| ZIP.OBJ + | ||||
| UNZIP.OBJ + | ||||
| INFBACK.OBJ + | ||||
| IOAPI.OBJ + | ||||
| INFTREES.OBJ + | ||||
| $(OBJS_EXT) | ||||
| $(PROJ).DLL | ||||
| $(MAPFILE) | ||||
| C:\MSVC\LIB\+ | ||||
| C:\MSVC\MFC\LIB\+ | ||||
| E:\PROGRAMFILES\MICROSOFTVISUALSTUDIO.NET\FRAMEWORKSDK\LIB\+ | ||||
| $(LIBS) | ||||
| $(DEFFILE); | ||||
| << | ||||
| 	link $(LFLAGS) @$(PROJ).CRF | ||||
| 	$(RC) $(RESFLAGS) ZLIB16.RES $@ | ||||
| 	@copy $(PROJ).CRF MSVC.BND | ||||
| 	implib /nowep $(PROJ).LIB $(PROJ).DLL | ||||
|  | ||||
| $(PROJ).DLL::	ZLIB16.RES | ||||
| 	if not exist MSVC.BND 	$(RC) $(RESFLAGS) ZLIB16.RES $@ | ||||
|  | ||||
| run: $(PROJ).DLL | ||||
| 	$(PROJ) $(RUNFLAGS) | ||||
|  | ||||
|  | ||||
| $(PROJ).BSC: $(SBRS) | ||||
| 	bscmake @<< | ||||
| /o$@ $(SBRS) | ||||
| << | ||||
							
								
								
									
										33
									
								
								contrib/vstudio/vc15_16/zlib16.rc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								contrib/vstudio/vc15_16/zlib16.rc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| #include <windows.h> | ||||
| #include <ver.h> | ||||
|  | ||||
| #define IDR_VERSION1  1 | ||||
| IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE | ||||
|   FILEVERSION	 1,2,1,0 | ||||
|   PRODUCTVERSION 1,2,1,0 | ||||
|   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK | ||||
|   FILEFLAGS	0 | ||||
|   FILEOS	VOS_DOS_WINDOWS16 | ||||
|   FILETYPE	VFT_DLL | ||||
|   FILESUBTYPE	0	// not used | ||||
| BEGIN | ||||
|   BLOCK "StringFileInfo" | ||||
|   BEGIN | ||||
|     BLOCK "040904E4" | ||||
|     //language ID = U.S. English, char set = Windows, Multilingual | ||||
|  | ||||
|     BEGIN | ||||
|       VALUE "FileDescription", "zlib data compression library\0" | ||||
|       VALUE "FileVersion",	"1.2.1\0" | ||||
|       VALUE "InternalName",	"zlib16\0" | ||||
|       VALUE "OriginalFilename",	"zlib16.dll\0" | ||||
|       VALUE "ProductName",	"ZLib16.DLL\0" | ||||
|       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" | ||||
|       VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" | ||||
|     END | ||||
|   END | ||||
|   BLOCK "VarFileInfo" | ||||
|   BEGIN | ||||
|     VALUE "Translation", 0x0409, 1252 | ||||
|   END | ||||
| END | ||||
							
								
								
									
										905
									
								
								contrib/vstudio/vc70_32/gvmat32.asm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										905
									
								
								contrib/vstudio/vc70_32/gvmat32.asm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,905 @@ | ||||
| ; | ||||
| ; gvmat32.asm -- Asm portion of the optimized longest_match for 32 bits x86 | ||||
| ; Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant. | ||||
| ; File written by Gilles Vollant, by modifiying the longest_match | ||||
| ;  from Jean-loup Gailly in deflate.c | ||||
| ; It need wmask == 0x7fff | ||||
| ;     (assembly code is faster with a fixed wmask) | ||||
| ; | ||||
| ; For Visual C++ 4.2 and ML 6.11c (version in directory \MASM611C of Win95 DDK) | ||||
| ;   I compile with : "ml /coff /Zi /c gvmat32.asm" | ||||
| ; | ||||
|  | ||||
| ;uInt longest_match_7fff(s, cur_match) | ||||
| ;    deflate_state *s; | ||||
| ;    IPos cur_match;                             /* current match */ | ||||
|  | ||||
|         NbStack         equ     76 | ||||
|         cur_match       equ     dword ptr[esp+NbStack-0] | ||||
|         str_s           equ     dword ptr[esp+NbStack-4] | ||||
| ; 5 dword on top (ret,ebp,esi,edi,ebx) | ||||
|         adrret          equ     dword ptr[esp+NbStack-8] | ||||
|         pushebp         equ     dword ptr[esp+NbStack-12] | ||||
|         pushedi         equ     dword ptr[esp+NbStack-16] | ||||
|         pushesi         equ     dword ptr[esp+NbStack-20] | ||||
|         pushebx         equ     dword ptr[esp+NbStack-24] | ||||
|  | ||||
|         chain_length    equ     dword ptr [esp+NbStack-28] | ||||
|         limit           equ     dword ptr [esp+NbStack-32] | ||||
|         best_len        equ     dword ptr [esp+NbStack-36] | ||||
|         window          equ     dword ptr [esp+NbStack-40] | ||||
|         prev            equ     dword ptr [esp+NbStack-44] | ||||
|         scan_start      equ      word ptr [esp+NbStack-48] | ||||
|         wmask           equ     dword ptr [esp+NbStack-52] | ||||
|         match_start_ptr equ     dword ptr [esp+NbStack-56] | ||||
|         nice_match      equ     dword ptr [esp+NbStack-60] | ||||
|         scan            equ     dword ptr [esp+NbStack-64] | ||||
|  | ||||
|         windowlen       equ     dword ptr [esp+NbStack-68] | ||||
|         match_start     equ     dword ptr [esp+NbStack-72] | ||||
|         strend          equ     dword ptr [esp+NbStack-76] | ||||
|         NbStackAdd      equ     (NbStack-24) | ||||
|  | ||||
|     .386p | ||||
|  | ||||
|     name    gvmatch | ||||
|     .MODEL  FLAT | ||||
|  | ||||
|  | ||||
|  | ||||
| ;  all the +4 offsets are due to the addition of pending_buf_size (in zlib | ||||
| ;  in the deflate_state structure since the asm code was first written | ||||
| ;  (if you compile with zlib 1.0.4 or older, remove the +4). | ||||
| ;  Note : these value are good with a 8 bytes boundary pack structure | ||||
|     dep_chain_length    equ     70h+4 | ||||
|     dep_window          equ     2ch+4 | ||||
|     dep_strstart        equ     60h+4 | ||||
|     dep_prev_length     equ     6ch+4 | ||||
|     dep_nice_match      equ     84h+4 | ||||
|     dep_w_size          equ     20h+4 | ||||
|     dep_prev            equ     34h+4 | ||||
|     dep_w_mask          equ     28h+4 | ||||
|     dep_good_match      equ     80h+4 | ||||
|     dep_match_start     equ     64h+4 | ||||
|     dep_lookahead       equ     68h+4 | ||||
|  | ||||
|  | ||||
| _TEXT                   segment | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
|                         public  longest_match_7fff | ||||
|                         public  longest_match_686 | ||||
| ;                        public  match_init | ||||
| ELSE | ||||
|                         public  _longest_match_7fff | ||||
|                         public  _longest_match_686 | ||||
| ;                        public  _match_init | ||||
| ENDIF | ||||
|  | ||||
|     MAX_MATCH           equ     258 | ||||
|     MIN_MATCH           equ     3 | ||||
|     MIN_LOOKAHEAD       equ     (MAX_MATCH+MIN_MATCH+1) | ||||
|  | ||||
|  | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| ;match_init      proc near | ||||
| ;                ret | ||||
| ;match_init      endp | ||||
| ELSE | ||||
| ;_match_init     proc near | ||||
| ;                ret | ||||
| ;_match_init     endp | ||||
| ENDIF | ||||
|  | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| longest_match_7fff   proc near | ||||
| ELSE | ||||
| _longest_match_7fff  proc near | ||||
| ENDIF | ||||
|  | ||||
|         mov     edx,[esp+4] | ||||
|  | ||||
|  | ||||
|  | ||||
|         push    ebp | ||||
|         push    edi | ||||
|         push    esi | ||||
|         push    ebx | ||||
|  | ||||
|         sub     esp,NbStackAdd | ||||
|  | ||||
| ; initialize or check the variables used in match.asm. | ||||
|         mov     ebp,edx | ||||
|  | ||||
| ; chain_length = s->max_chain_length | ||||
| ; if (prev_length>=good_match) chain_length >>= 2 | ||||
|         mov     edx,[ebp+dep_chain_length] | ||||
|         mov     ebx,[ebp+dep_prev_length] | ||||
|         cmp     [ebp+dep_good_match],ebx | ||||
|         ja      noshr | ||||
|         shr     edx,2 | ||||
| noshr: | ||||
| ; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop | ||||
|         inc     edx | ||||
|         mov     edi,[ebp+dep_nice_match] | ||||
|         mov     chain_length,edx | ||||
|         mov     eax,[ebp+dep_lookahead] | ||||
|         cmp     eax,edi | ||||
| ; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; | ||||
|         jae     nolookaheadnicematch | ||||
|         mov     edi,eax | ||||
| nolookaheadnicematch: | ||||
| ; best_len = s->prev_length | ||||
|         mov     best_len,ebx | ||||
|  | ||||
| ; window = s->window | ||||
|         mov     esi,[ebp+dep_window] | ||||
|         mov     ecx,[ebp+dep_strstart] | ||||
|         mov     window,esi | ||||
|  | ||||
|         mov     nice_match,edi | ||||
| ; scan = window + strstart | ||||
|         add     esi,ecx | ||||
|         mov     scan,esi | ||||
| ; dx = *window | ||||
|         mov     dx,word ptr [esi] | ||||
| ; bx = *(window+best_len-1) | ||||
|         mov     bx,word ptr [esi+ebx-1] | ||||
|         add     esi,MAX_MATCH-1 | ||||
| ; scan_start = *scan | ||||
|         mov     scan_start,dx | ||||
| ; strend = scan + MAX_MATCH-1 | ||||
|         mov     strend,esi | ||||
| ; bx = scan_end = *(window+best_len-1) | ||||
|  | ||||
| ;    IPos limit = s->strstart > (IPos)MAX_DIST(s) ? | ||||
| ;        s->strstart - (IPos)MAX_DIST(s) : NIL; | ||||
|  | ||||
|         mov     esi,[ebp+dep_w_size] | ||||
|         sub     esi,MIN_LOOKAHEAD | ||||
| ; here esi = MAX_DIST(s) | ||||
|         sub     ecx,esi | ||||
|         ja      nodist | ||||
|         xor     ecx,ecx | ||||
| nodist: | ||||
|         mov     limit,ecx | ||||
|  | ||||
| ; prev = s->prev | ||||
|         mov     edx,[ebp+dep_prev] | ||||
|         mov     prev,edx | ||||
|  | ||||
| ; | ||||
|         mov     edx,dword ptr [ebp+dep_match_start] | ||||
|         mov     bp,scan_start | ||||
|         mov     eax,cur_match | ||||
|         mov     match_start,edx | ||||
|  | ||||
|         mov     edx,window | ||||
|         mov     edi,edx | ||||
|         add     edi,best_len | ||||
|         mov     esi,prev | ||||
|         dec     edi | ||||
| ; windowlen = window + best_len -1 | ||||
|         mov     windowlen,edi | ||||
|  | ||||
|         jmp     beginloop2 | ||||
|         align   4 | ||||
|  | ||||
| ; here, in the loop | ||||
| ;       eax = ax = cur_match | ||||
| ;       ecx = limit | ||||
| ;        bx = scan_end | ||||
| ;        bp = scan_start | ||||
| ;       edi = windowlen (window + best_len -1) | ||||
| ;       esi = prev | ||||
|  | ||||
|  | ||||
| ;// here; chain_length <=16 | ||||
| normalbeg0add16: | ||||
|         add     chain_length,16 | ||||
|         jz      exitloop | ||||
| normalbeg0: | ||||
|         cmp     word ptr[edi+eax],bx | ||||
|         je      normalbeg2noroll | ||||
| rcontlabnoroll: | ||||
| ; cur_match = prev[cur_match & wmask] | ||||
|         and     eax,7fffh | ||||
|         mov     ax,word ptr[esi+eax*2] | ||||
| ; if cur_match > limit, go to exitloop | ||||
|         cmp     ecx,eax | ||||
|         jnb     exitloop | ||||
| ; if --chain_length != 0, go to exitloop | ||||
|         dec     chain_length | ||||
|         jnz     normalbeg0 | ||||
|         jmp     exitloop | ||||
|  | ||||
| normalbeg2noroll: | ||||
| ; if (scan_start==*(cur_match+window)) goto normalbeg2 | ||||
|         cmp     bp,word ptr[edx+eax] | ||||
|         jne     rcontlabnoroll | ||||
|         jmp     normalbeg2 | ||||
|  | ||||
| contloop3: | ||||
|         mov     edi,windowlen | ||||
|  | ||||
| ; cur_match = prev[cur_match & wmask] | ||||
|         and     eax,7fffh | ||||
|         mov     ax,word ptr[esi+eax*2] | ||||
| ; if cur_match > limit, go to exitloop | ||||
|         cmp     ecx,eax | ||||
| jnbexitloopshort1: | ||||
|         jnb     exitloop | ||||
| ; if --chain_length != 0, go to exitloop | ||||
|  | ||||
|  | ||||
| ; begin the main loop | ||||
| beginloop2: | ||||
|         sub     chain_length,16+1 | ||||
| ; if chain_length <=16, don't use the unrolled loop | ||||
|         jna     normalbeg0add16 | ||||
|  | ||||
| do16: | ||||
|         cmp     word ptr[edi+eax],bx | ||||
|         je      normalbeg2dc0 | ||||
|  | ||||
| maccn   MACRO   lab | ||||
|         and     eax,7fffh | ||||
|         mov     ax,word ptr[esi+eax*2] | ||||
|         cmp     ecx,eax | ||||
|         jnb     exitloop | ||||
|         cmp     word ptr[edi+eax],bx | ||||
|         je      lab | ||||
|         ENDM | ||||
|  | ||||
| rcontloop0: | ||||
|         maccn   normalbeg2dc1 | ||||
|  | ||||
| rcontloop1: | ||||
|         maccn   normalbeg2dc2 | ||||
|  | ||||
| rcontloop2: | ||||
|         maccn   normalbeg2dc3 | ||||
|  | ||||
| rcontloop3: | ||||
|         maccn   normalbeg2dc4 | ||||
|  | ||||
| rcontloop4: | ||||
|         maccn   normalbeg2dc5 | ||||
|  | ||||
| rcontloop5: | ||||
|         maccn   normalbeg2dc6 | ||||
|  | ||||
| rcontloop6: | ||||
|         maccn   normalbeg2dc7 | ||||
|  | ||||
| rcontloop7: | ||||
|         maccn   normalbeg2dc8 | ||||
|  | ||||
| rcontloop8: | ||||
|         maccn   normalbeg2dc9 | ||||
|  | ||||
| rcontloop9: | ||||
|         maccn   normalbeg2dc10 | ||||
|  | ||||
| rcontloop10: | ||||
|         maccn   short normalbeg2dc11 | ||||
|  | ||||
| rcontloop11: | ||||
|         maccn   short normalbeg2dc12 | ||||
|  | ||||
| rcontloop12: | ||||
|         maccn   short normalbeg2dc13 | ||||
|  | ||||
| rcontloop13: | ||||
|         maccn   short normalbeg2dc14 | ||||
|  | ||||
| rcontloop14: | ||||
|         maccn   short normalbeg2dc15 | ||||
|  | ||||
| rcontloop15: | ||||
|         and     eax,7fffh | ||||
|         mov     ax,word ptr[esi+eax*2] | ||||
|         cmp     ecx,eax | ||||
|         jnb     exitloop | ||||
|  | ||||
|         sub     chain_length,16 | ||||
|         ja      do16 | ||||
|         jmp     normalbeg0add16 | ||||
|  | ||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
|  | ||||
| normbeg MACRO   rcontlab,valsub | ||||
| ; if we are here, we know that *(match+best_len-1) == scan_end | ||||
|         cmp     bp,word ptr[edx+eax] | ||||
| ; if (match != scan_start) goto rcontlab | ||||
|         jne     rcontlab | ||||
| ; calculate the good chain_length, and we'll compare scan and match string | ||||
|         add     chain_length,16-valsub | ||||
|         jmp     iseq | ||||
|         ENDM | ||||
|  | ||||
|  | ||||
| normalbeg2dc11: | ||||
|         normbeg rcontloop11,11 | ||||
|  | ||||
| normalbeg2dc12: | ||||
|         normbeg short rcontloop12,12 | ||||
|  | ||||
| normalbeg2dc13: | ||||
|         normbeg short rcontloop13,13 | ||||
|  | ||||
| normalbeg2dc14: | ||||
|         normbeg short rcontloop14,14 | ||||
|  | ||||
| normalbeg2dc15: | ||||
|         normbeg short rcontloop15,15 | ||||
|  | ||||
| normalbeg2dc10: | ||||
|         normbeg rcontloop10,10 | ||||
|  | ||||
| normalbeg2dc9: | ||||
|         normbeg rcontloop9,9 | ||||
|  | ||||
| normalbeg2dc8: | ||||
|         normbeg rcontloop8,8 | ||||
|  | ||||
| normalbeg2dc7: | ||||
|         normbeg rcontloop7,7 | ||||
|  | ||||
| normalbeg2dc6: | ||||
|         normbeg rcontloop6,6 | ||||
|  | ||||
| normalbeg2dc5: | ||||
|         normbeg rcontloop5,5 | ||||
|  | ||||
| normalbeg2dc4: | ||||
|         normbeg rcontloop4,4 | ||||
|  | ||||
| normalbeg2dc3: | ||||
|         normbeg rcontloop3,3 | ||||
|  | ||||
| normalbeg2dc2: | ||||
|         normbeg rcontloop2,2 | ||||
|  | ||||
| normalbeg2dc1: | ||||
|         normbeg rcontloop1,1 | ||||
|  | ||||
| normalbeg2dc0: | ||||
|         normbeg rcontloop0,0 | ||||
|  | ||||
|  | ||||
| ; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end | ||||
|  | ||||
| normalbeg2: | ||||
|         mov     edi,window | ||||
|  | ||||
|         cmp     bp,word ptr[edi+eax] | ||||
|         jne     contloop3                   ; if *(ushf*)match != scan_start, continue | ||||
|  | ||||
| iseq: | ||||
| ; if we are here, we know that *(match+best_len-1) == scan_end | ||||
| ; and (match == scan_start) | ||||
|  | ||||
|         mov     edi,edx | ||||
|         mov     esi,scan                    ; esi = scan | ||||
|         add     edi,eax                     ; edi = window + cur_match = match | ||||
|  | ||||
|         mov     edx,[esi+3]                 ; compare manually dword at match+3 | ||||
|         xor     edx,[edi+3]                 ; and scan +3 | ||||
|  | ||||
|         jz      begincompare                ; if equal, go to long compare | ||||
|  | ||||
| ; we will determine the unmatch byte and calculate len (in esi) | ||||
|         or      dl,dl | ||||
|         je      eq1rr | ||||
|         mov     esi,3 | ||||
|         jmp     trfinval | ||||
| eq1rr: | ||||
|         or      dx,dx | ||||
|         je      eq1 | ||||
|  | ||||
|         mov     esi,4 | ||||
|         jmp     trfinval | ||||
| eq1: | ||||
|         and     edx,0ffffffh | ||||
|         jz      eq11 | ||||
|         mov     esi,5 | ||||
|         jmp     trfinval | ||||
| eq11: | ||||
|         mov     esi,6 | ||||
|         jmp     trfinval | ||||
|  | ||||
| begincompare: | ||||
|         ; here we now scan and match begin same | ||||
|         add     edi,6 | ||||
|         add     esi,6 | ||||
|         mov     ecx,(MAX_MATCH-(2+4))/4     ; scan for at most MAX_MATCH bytes | ||||
|         repe    cmpsd                       ; loop until mismatch | ||||
|  | ||||
|         je      trfin                       ; go to trfin if not unmatch | ||||
| ; we determine the unmatch byte | ||||
|         sub     esi,4 | ||||
|         mov     edx,[edi-4] | ||||
|         xor     edx,[esi] | ||||
|  | ||||
|         or      dl,dl | ||||
|         jnz     trfin | ||||
|         inc     esi | ||||
|  | ||||
|         or      dx,dx | ||||
|         jnz     trfin | ||||
|         inc     esi | ||||
|  | ||||
|         and     edx,0ffffffh | ||||
|         jnz     trfin | ||||
|         inc     esi | ||||
|  | ||||
| trfin: | ||||
|         sub     esi,scan          ; esi = len | ||||
| trfinval: | ||||
| ; here we have finised compare, and esi contain len of equal string | ||||
|         cmp     esi,best_len        ; if len > best_len, go newbestlen | ||||
|         ja      short newbestlen | ||||
| ; now we restore edx, ecx and esi, for the big loop | ||||
|         mov     esi,prev | ||||
|         mov     ecx,limit | ||||
|         mov     edx,window | ||||
|         jmp     contloop3 | ||||
|  | ||||
| newbestlen: | ||||
|         mov     best_len,esi        ; len become best_len | ||||
|  | ||||
|         mov     match_start,eax     ; save new position as match_start | ||||
|         cmp     esi,nice_match      ; if best_len >= nice_match, exit | ||||
|         jae     exitloop | ||||
|         mov     ecx,scan | ||||
|         mov     edx,window          ; restore edx=window | ||||
|         add     ecx,esi | ||||
|         add     esi,edx | ||||
|  | ||||
|         dec     esi | ||||
|         mov     windowlen,esi       ; windowlen = window + best_len-1 | ||||
|         mov     bx,[ecx-1]          ; bx = *(scan+best_len-1) = scan_end | ||||
|  | ||||
| ; now we restore ecx and esi, for the big loop : | ||||
|         mov     esi,prev | ||||
|         mov     ecx,limit | ||||
|         jmp     contloop3 | ||||
|  | ||||
| exitloop: | ||||
| ; exit : s->match_start=match_start | ||||
|         mov     ebx,match_start | ||||
|         mov     ebp,str_s | ||||
|         mov     ecx,best_len | ||||
|         mov     dword ptr [ebp+dep_match_start],ebx         | ||||
|         mov     eax,dword ptr [ebp+dep_lookahead] | ||||
|         cmp     ecx,eax | ||||
|         ja      minexlo | ||||
|         mov     eax,ecx | ||||
| minexlo: | ||||
| ; return min(best_len,s->lookahead) | ||||
|          | ||||
| ; restore stack and register ebx,esi,edi,ebp | ||||
|         add     esp,NbStackAdd | ||||
|  | ||||
|         pop     ebx | ||||
|         pop     esi | ||||
|         pop     edi | ||||
|         pop     ebp | ||||
|         ret | ||||
| InfoAuthor: | ||||
| ; please don't remove this string ! | ||||
| ; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary! | ||||
|         db     0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah | ||||
|  | ||||
|  | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| longest_match_7fff   endp | ||||
| ELSE | ||||
| _longest_match_7fff  endp | ||||
| ENDIF | ||||
|  | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| cpudetect32     proc near | ||||
| ELSE | ||||
| _cpudetect32    proc near | ||||
| ENDIF | ||||
|  | ||||
| 	push	ebx | ||||
|  | ||||
| 	pushfd                  ; push original EFLAGS | ||||
| 	pop     eax             ; get original EFLAGS | ||||
| 	mov     ecx, eax        ; save original EFLAGS | ||||
| 	xor     eax, 40000h     ; flip AC bit in EFLAGS | ||||
| 	push    eax             ; save new EFLAGS value on stack | ||||
| 	popfd                   ; replace current EFLAGS value | ||||
| 	pushfd                  ; get new EFLAGS | ||||
| 	pop     eax             ; store new EFLAGS in EAX | ||||
| 	xor     eax, ecx        ; can<61>t toggle AC bit, processor=80386 | ||||
| 	jz      end_cpu_is_386  ; jump if 80386 processor | ||||
| 	push    ecx | ||||
| 	popfd                   ; restore AC bit in EFLAGS first | ||||
|  | ||||
| 	pushfd | ||||
| 	pushfd | ||||
| 	pop     ecx | ||||
| 			 | ||||
| 	mov     eax, ecx        ; get original EFLAGS | ||||
| 	xor     eax, 200000h    ; flip ID bit in EFLAGS | ||||
| 	push    eax             ; save new EFLAGS value on stack | ||||
| 	popfd                   ; replace current EFLAGS value | ||||
| 	pushfd                  ; get new EFLAGS | ||||
| 	pop		eax	            ; store new EFLAGS in EAX | ||||
| 	popfd                   ; restore original EFLAGS | ||||
| 	xor		eax, ecx        ; can<61>t toggle ID bit, | ||||
| 	je		is_old_486		; processor=old | ||||
|  | ||||
| 	mov     eax,1 | ||||
| 	db      0fh,0a2h        ;CPUID    | ||||
|  | ||||
| exitcpudetect: | ||||
| 	pop	ebx | ||||
| 	ret | ||||
|  | ||||
| end_cpu_is_386: | ||||
| 	mov     eax,0300h | ||||
| 	jmp     exitcpudetect | ||||
|  | ||||
| is_old_486: | ||||
| 	mov     eax,0400h | ||||
| 	jmp     exitcpudetect | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| cpudetect32     endp | ||||
| ELSE | ||||
| _cpudetect32    endp | ||||
| ENDIF | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| MAX_MATCH       equ     258 | ||||
| MIN_MATCH       equ     3 | ||||
| MIN_LOOKAHEAD   equ     (MAX_MATCH + MIN_MATCH + 1) | ||||
| MAX_MATCH_8_     equ     ((MAX_MATCH + 7) AND 0FFF0h) | ||||
|  | ||||
|  | ||||
| ;;; stack frame offsets | ||||
|  | ||||
| chainlenwmask	equ  esp + 0	; high word: current chain len | ||||
| 					; low word: s->wmask | ||||
| window		equ  esp + 4	; local copy of s->window | ||||
| windowbestlen	equ  esp + 8	; s->window + bestlen | ||||
| scanstart	equ  esp + 16	; first two bytes of string | ||||
| scanend		equ  esp + 12	; last two bytes of string | ||||
| scanalign	equ  esp + 20	; dword-misalignment of string | ||||
| nicematch	equ  esp + 24	; a good enough match size | ||||
| bestlen		equ  esp + 28	; size of best match so far | ||||
| scan		equ  esp + 32	; ptr to string wanting match | ||||
|  | ||||
| LocalVarsSize	equ 36 | ||||
| ;	saved ebx	byte esp + 36 | ||||
| ;	saved edi	byte esp + 40 | ||||
| ;	saved esi	byte esp + 44 | ||||
| ;	saved ebp	byte esp + 48 | ||||
| ;	return address	byte esp + 52 | ||||
| deflatestate	equ  esp + 56	; the function arguments | ||||
| curmatch	equ  esp + 60 | ||||
|  | ||||
| ;;; Offsets for fields in the deflate_state structure. These numbers | ||||
| ;;; are calculated from the definition of deflate_state, with the | ||||
| ;;; assumption that the compiler will dword-align the fields. (Thus, | ||||
| ;;; changing the definition of deflate_state could easily cause this | ||||
| ;;; program to crash horribly, without so much as a warning at | ||||
| ;;; compile time. Sigh.) | ||||
|  | ||||
| dsWSize		equ 36 | ||||
| dsWMask		equ 44 | ||||
| dsWindow	equ 48 | ||||
| dsPrev		equ 56 | ||||
| dsMatchLen	equ 88 | ||||
| dsPrevMatch	equ 92 | ||||
| dsStrStart	equ 100 | ||||
| dsMatchStart	equ 104 | ||||
| dsLookahead	equ 108 | ||||
| dsPrevLen	equ 112 | ||||
| dsMaxChainLen	equ 116 | ||||
| dsGoodMatch	equ 132 | ||||
| dsNiceMatch	equ 136 | ||||
|  | ||||
|  | ||||
| ;;; match.asm -- Pentium-Pro-optimized version of longest_match() | ||||
| ;;; Written for zlib 1.1.2 | ||||
| ;;; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com> | ||||
| ;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html | ||||
| ;;; | ||||
| ;;; This is free software; you can redistribute it and/or modify it | ||||
| ;;; under the terms of the GNU General Public License. | ||||
|  | ||||
| ;GLOBAL	_longest_match, _match_init | ||||
|  | ||||
|  | ||||
| ;SECTION	.text | ||||
|  | ||||
| ;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch) | ||||
|  | ||||
| ;_longest_match: | ||||
| IFDEF NOUNDERLINE | ||||
| longest_match_686   proc near | ||||
| ELSE | ||||
| _longest_match_686  proc near | ||||
| ENDIF | ||||
|  | ||||
|  | ||||
| ;;; Save registers that the compiler may be using, and adjust esp to | ||||
| ;;; make room for our stack frame. | ||||
|  | ||||
| 		push	ebp | ||||
| 		push	edi | ||||
| 		push	esi | ||||
| 		push	ebx | ||||
| 		sub	esp, LocalVarsSize | ||||
|  | ||||
| ;;; Retrieve the function arguments. ecx will hold cur_match | ||||
| ;;; throughout the entire function. edx will hold the pointer to the | ||||
| ;;; deflate_state structure during the function's setup (before | ||||
| ;;; entering the main loop. | ||||
|  | ||||
| 		mov	edx, [deflatestate] | ||||
| 		mov	ecx, [curmatch] | ||||
|  | ||||
| ;;; uInt wmask = s->w_mask; | ||||
| ;;; unsigned chain_length = s->max_chain_length; | ||||
| ;;; if (s->prev_length >= s->good_match) { | ||||
| ;;;     chain_length >>= 2; | ||||
| ;;; } | ||||
|  | ||||
| 		mov	eax, [edx + dsPrevLen] | ||||
| 		mov	ebx, [edx + dsGoodMatch] | ||||
| 		cmp	eax, ebx | ||||
| 		mov	eax, [edx + dsWMask] | ||||
| 		mov	ebx, [edx + dsMaxChainLen] | ||||
| 		jl	LastMatchGood | ||||
| 		shr	ebx, 2 | ||||
| LastMatchGood: | ||||
|  | ||||
| ;;; chainlen is decremented once beforehand so that the function can | ||||
| ;;; use the sign flag instead of the zero flag for the exit test. | ||||
| ;;; It is then shifted into the high word, to make room for the wmask | ||||
| ;;; value, which it will always accompany. | ||||
|  | ||||
| 		dec	ebx | ||||
| 		shl	ebx, 16 | ||||
| 		or	ebx, eax | ||||
| 		mov	[chainlenwmask], ebx | ||||
|  | ||||
| ;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; | ||||
|  | ||||
| 		mov	eax, [edx + dsNiceMatch] | ||||
| 		mov	ebx, [edx + dsLookahead] | ||||
| 		cmp	ebx, eax | ||||
| 		jl	LookaheadLess | ||||
| 		mov	ebx, eax | ||||
| LookaheadLess:	mov	[nicematch], ebx | ||||
|  | ||||
| ;;; register Bytef *scan = s->window + s->strstart; | ||||
|  | ||||
| 		mov	esi, [edx + dsWindow] | ||||
| 		mov	[window], esi | ||||
| 		mov	ebp, [edx + dsStrStart] | ||||
| 		lea	edi, [esi + ebp] | ||||
| 		mov	[scan], edi | ||||
|  | ||||
| ;;; Determine how many bytes the scan ptr is off from being | ||||
| ;;; dword-aligned. | ||||
|  | ||||
| 		mov	eax, edi | ||||
| 		neg	eax | ||||
| 		and	eax, 3 | ||||
| 		mov	[scanalign], eax | ||||
|  | ||||
| ;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? | ||||
| ;;;     s->strstart - (IPos)MAX_DIST(s) : NIL; | ||||
|  | ||||
| 		mov	eax, [edx + dsWSize] | ||||
| 		sub	eax, MIN_LOOKAHEAD | ||||
| 		sub	ebp, eax | ||||
| 		jg	LimitPositive | ||||
| 		xor	ebp, ebp | ||||
| LimitPositive: | ||||
|  | ||||
| ;;; int best_len = s->prev_length; | ||||
|  | ||||
| 		mov	eax, [edx + dsPrevLen] | ||||
| 		mov	[bestlen], eax | ||||
|  | ||||
| ;;; Store the sum of s->window + best_len in esi locally, and in esi. | ||||
|  | ||||
| 		add	esi, eax | ||||
| 		mov	[windowbestlen], esi | ||||
|  | ||||
| ;;; register ush scan_start = *(ushf*)scan; | ||||
| ;;; register ush scan_end   = *(ushf*)(scan+best_len-1); | ||||
| ;;; Posf *prev = s->prev; | ||||
|  | ||||
| 		movzx	ebx, word ptr [edi] | ||||
| 		mov	[scanstart], ebx | ||||
| 		movzx	ebx, word ptr [edi + eax - 1] | ||||
| 		mov	[scanend], ebx | ||||
| 		mov	edi, [edx + dsPrev] | ||||
|  | ||||
| ;;; Jump into the main loop. | ||||
|  | ||||
| 		mov	edx, [chainlenwmask] | ||||
| 		jmp	short LoopEntry | ||||
|  | ||||
| align 4 | ||||
|  | ||||
| ;;; do { | ||||
| ;;;     match = s->window + cur_match; | ||||
| ;;;     if (*(ushf*)(match+best_len-1) != scan_end || | ||||
| ;;;         *(ushf*)match != scan_start) continue; | ||||
| ;;;     [...] | ||||
| ;;; } while ((cur_match = prev[cur_match & wmask]) > limit | ||||
| ;;;          && --chain_length != 0); | ||||
| ;;; | ||||
| ;;; Here is the inner loop of the function. The function will spend the | ||||
| ;;; majority of its time in this loop, and majority of that time will | ||||
| ;;; be spent in the first ten instructions. | ||||
| ;;; | ||||
| ;;; Within this loop: | ||||
| ;;; ebx = scanend | ||||
| ;;; ecx = curmatch | ||||
| ;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) | ||||
| ;;; esi = windowbestlen - i.e., (window + bestlen) | ||||
| ;;; edi = prev | ||||
| ;;; ebp = limit | ||||
|  | ||||
| LookupLoop: | ||||
| 		and	ecx, edx | ||||
| 		movzx	ecx, word ptr [edi + ecx*2] | ||||
| 		cmp	ecx, ebp | ||||
| 		jbe	LeaveNow | ||||
| 		sub	edx, 00010000h | ||||
| 		js	LeaveNow | ||||
| LoopEntry:	movzx	eax, word ptr [esi + ecx - 1] | ||||
| 		cmp	eax, ebx | ||||
| 		jnz	LookupLoop | ||||
| 		mov	eax, [window] | ||||
| 		movzx	eax, word ptr [eax + ecx] | ||||
| 		cmp	eax, [scanstart] | ||||
| 		jnz	LookupLoop | ||||
|  | ||||
| ;;; Store the current value of chainlen. | ||||
|  | ||||
| 		mov	[chainlenwmask], edx | ||||
|  | ||||
| ;;; Point edi to the string under scrutiny, and esi to the string we | ||||
| ;;; are hoping to match it up with. In actuality, esi and edi are | ||||
| ;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is | ||||
| ;;; initialized to -(MAX_MATCH_8 - scanalign). | ||||
|  | ||||
| 		mov	esi, [window] | ||||
| 		mov	edi, [scan] | ||||
| 		add	esi, ecx | ||||
| 		mov	eax, [scanalign] | ||||
| 		mov	edx, 0fffffef8h; -(MAX_MATCH_8) | ||||
| 		lea	edi, [edi + eax + 0108h] ;MAX_MATCH_8] | ||||
| 		lea	esi, [esi + eax + 0108h] ;MAX_MATCH_8] | ||||
|  | ||||
| ;;; Test the strings for equality, 8 bytes at a time. At the end, | ||||
| ;;; adjust edx so that it is offset to the exact byte that mismatched. | ||||
| ;;; | ||||
| ;;; We already know at this point that the first three bytes of the | ||||
| ;;; strings match each other, and they can be safely passed over before | ||||
| ;;; starting the compare loop. So what this code does is skip over 0-3 | ||||
| ;;; bytes, as much as necessary in order to dword-align the edi | ||||
| ;;; pointer. (esi will still be misaligned three times out of four.) | ||||
| ;;; | ||||
| ;;; It should be confessed that this loop usually does not represent | ||||
| ;;; much of the total running time. Replacing it with a more | ||||
| ;;; straightforward "rep cmpsb" would not drastically degrade | ||||
| ;;; performance. | ||||
|  | ||||
| LoopCmps: | ||||
| 		mov	eax, [esi + edx] | ||||
| 		xor	eax, [edi + edx] | ||||
| 		jnz	LeaveLoopCmps | ||||
| 		mov	eax, [esi + edx + 4] | ||||
| 		xor	eax, [edi + edx + 4] | ||||
| 		jnz	LeaveLoopCmps4 | ||||
| 		add	edx, 8 | ||||
| 		jnz	LoopCmps | ||||
| 		jmp	short LenMaximum | ||||
| LeaveLoopCmps4:	add	edx, 4 | ||||
| LeaveLoopCmps:	test	eax, 0000FFFFh | ||||
| 		jnz	LenLower | ||||
| 		add	edx,  2 | ||||
| 		shr	eax, 16 | ||||
| LenLower:	sub	al, 1 | ||||
| 		adc	edx, 0 | ||||
|  | ||||
| ;;; Calculate the length of the match. If it is longer than MAX_MATCH, | ||||
| ;;; then automatically accept it as the best possible match and leave. | ||||
|  | ||||
| 		lea	eax, [edi + edx] | ||||
| 		mov	edi, [scan] | ||||
| 		sub	eax, edi | ||||
| 		cmp	eax, MAX_MATCH | ||||
| 		jge	LenMaximum | ||||
|  | ||||
| ;;; If the length of the match is not longer than the best match we | ||||
| ;;; have so far, then forget it and return to the lookup loop. | ||||
|  | ||||
| 		mov	edx, [deflatestate] | ||||
| 		mov	ebx, [bestlen] | ||||
| 		cmp	eax, ebx | ||||
| 		jg	LongerMatch | ||||
| 		mov	esi, [windowbestlen] | ||||
| 		mov	edi, [edx + dsPrev] | ||||
| 		mov	ebx, [scanend] | ||||
| 		mov	edx, [chainlenwmask] | ||||
| 		jmp	LookupLoop | ||||
|  | ||||
| ;;;         s->match_start = cur_match; | ||||
| ;;;         best_len = len; | ||||
| ;;;         if (len >= nice_match) break; | ||||
| ;;;         scan_end = *(ushf*)(scan+best_len-1); | ||||
|  | ||||
| LongerMatch:	mov	ebx, [nicematch] | ||||
| 		mov	[bestlen], eax | ||||
| 		mov	[edx + dsMatchStart], ecx | ||||
| 		cmp	eax, ebx | ||||
| 		jge	LeaveNow | ||||
| 		mov	esi, [window] | ||||
| 		add	esi, eax | ||||
| 		mov	[windowbestlen], esi | ||||
| 		movzx	ebx, word ptr [edi + eax - 1] | ||||
| 		mov	edi, [edx + dsPrev] | ||||
| 		mov	[scanend], ebx | ||||
| 		mov	edx, [chainlenwmask] | ||||
| 		jmp	LookupLoop | ||||
|  | ||||
| ;;; Accept the current string, with the maximum possible length. | ||||
|  | ||||
| LenMaximum:	mov	edx, [deflatestate] | ||||
| 		mov	dword ptr [bestlen], MAX_MATCH | ||||
| 		mov	[edx + dsMatchStart], ecx | ||||
|  | ||||
| ;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; | ||||
| ;;; return s->lookahead; | ||||
|  | ||||
| LeaveNow: | ||||
| 		mov	edx, [deflatestate] | ||||
| 		mov	ebx, [bestlen] | ||||
| 		mov	eax, [edx + dsLookahead] | ||||
| 		cmp	ebx, eax | ||||
| 		jg	LookaheadRet | ||||
| 		mov	eax, ebx | ||||
| LookaheadRet: | ||||
|  | ||||
| ;;; Restore the stack and return from whence we came. | ||||
|  | ||||
| 		add	esp, LocalVarsSize | ||||
| 		pop	ebx | ||||
| 		pop	esi | ||||
| 		pop	edi | ||||
| 		pop	ebp | ||||
|  | ||||
| 		ret | ||||
| ; please don't remove this string ! | ||||
| ; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary! | ||||
|         db     0dh,0ah,"asm686 with masm, code optimised assembly code from Brian Raiter, written 1998",0dh,0ah | ||||
|  | ||||
| IFDEF NOUNDERLINE | ||||
| longest_match_686   endp | ||||
| ELSE | ||||
| _longest_match_686  endp | ||||
| ENDIF | ||||
|  | ||||
| _TEXT   ends | ||||
| end | ||||
							
								
								
									
										
											BIN
										
									
								
								contrib/vstudio/vc70_32/gvmat32.obj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								contrib/vstudio/vc70_32/gvmat32.obj
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										209
									
								
								contrib/vstudio/vc70_32/gvmat32c.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								contrib/vstudio/vc70_32/gvmat32c.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,209 @@ | ||||
| /* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86 | ||||
|  * Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant. | ||||
|  * File written by Gilles Vollant, by modifiying the longest_match | ||||
|  *  from Jean-loup Gailly in deflate.c | ||||
|  *  it prepare all parameters and call the assembly longest_match_gvasm | ||||
|  *  longest_match execute standard C code is wmask != 0x7fff | ||||
|  *     (assembly code is faster with a fixed wmask) | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #include "deflate.h" | ||||
|  | ||||
| #undef FAR | ||||
| //#include <windows.h> | ||||
|  | ||||
| #ifdef ASMV | ||||
| #define NIL 0 | ||||
|  | ||||
| #define UNALIGNED_OK | ||||
|  | ||||
|  | ||||
| /* if your C compiler don't add underline before function name, | ||||
|         define ADD_UNDERLINE_ASMFUNC */ | ||||
| #ifdef ADD_UNDERLINE_ASMFUNC | ||||
| #define longest_match_7fff _longest_match_7fff | ||||
| #define longest_match_686  _longest_match_686 | ||||
| #define cpudetect32        _cpudetect32 | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
| void match_init() | ||||
| { | ||||
| } | ||||
|  | ||||
| unsigned long cpudetect32(); | ||||
|  | ||||
| uInt longest_match_c( | ||||
|     deflate_state *s, | ||||
|     IPos cur_match);                             /* current match */ | ||||
|  | ||||
|  | ||||
| uInt longest_match_7fff( | ||||
|     deflate_state *s, | ||||
|     IPos cur_match);                             /* current match */ | ||||
|  | ||||
| uInt longest_match_686( | ||||
|     deflate_state *s, | ||||
|     IPos cur_match);                             /* current match */ | ||||
|  | ||||
| uInt longest_match( | ||||
|     deflate_state *s, | ||||
|     IPos cur_match)                             /* current match */ | ||||
| { | ||||
|     static uInt iIsPPro=2; | ||||
|  | ||||
|     if ((s->w_mask == 0x7fff) && (iIsPPro==0)) | ||||
|         return longest_match_7fff(s,cur_match); | ||||
|  | ||||
|     if (iIsPPro==1) | ||||
|         return longest_match_686(s,cur_match); | ||||
|  | ||||
|     if (iIsPPro==2) | ||||
|         iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0; | ||||
|  | ||||
|     return longest_match_c(s,cur_match); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| uInt longest_match_c(s, cur_match) | ||||
|     deflate_state *s; | ||||
|     IPos cur_match;                             /* current match */ | ||||
| { | ||||
|     unsigned chain_length = s->max_chain_length;/* max hash chain length */ | ||||
|     register Bytef *scan = s->window + s->strstart; /* current string */ | ||||
|     register Bytef *match;                       /* matched string */ | ||||
|     register int len;                           /* length of current match */ | ||||
|     int best_len = s->prev_length;              /* best match length so far */ | ||||
|     int nice_match = s->nice_match;             /* stop if match long enough */ | ||||
|     IPos limit = s->strstart > (IPos)MAX_DIST(s) ? | ||||
|         s->strstart - (IPos)MAX_DIST(s) : NIL; | ||||
|     /* Stop when cur_match becomes <= limit. To simplify the code, | ||||
|      * we prevent matches with the string of window index 0. | ||||
|      */ | ||||
|     Posf *prev = s->prev; | ||||
|     uInt wmask = s->w_mask; | ||||
|  | ||||
| #ifdef UNALIGNED_OK | ||||
|     /* Compare two bytes at a time. Note: this is not always beneficial. | ||||
|      * Try with and without -DUNALIGNED_OK to check. | ||||
|      */ | ||||
|     register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; | ||||
|     register ush scan_start = *(ushf*)scan; | ||||
|     register ush scan_end   = *(ushf*)(scan+best_len-1); | ||||
| #else | ||||
|     register Bytef *strend = s->window + s->strstart + MAX_MATCH; | ||||
|     register Byte scan_end1  = scan[best_len-1]; | ||||
|     register Byte scan_end   = scan[best_len]; | ||||
| #endif | ||||
|  | ||||
|     /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. | ||||
|      * It is easy to get rid of this optimization if necessary. | ||||
|      */ | ||||
|     Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); | ||||
|  | ||||
|     /* Do not waste too much time if we already have a good match: */ | ||||
|     if (s->prev_length >= s->good_match) { | ||||
|         chain_length >>= 2; | ||||
|     } | ||||
|     /* Do not look for matches beyond the end of the input. This is necessary | ||||
|      * to make deflate deterministic. | ||||
|      */ | ||||
|     if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; | ||||
|  | ||||
|     Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); | ||||
|  | ||||
|     do { | ||||
|         Assert(cur_match < s->strstart, "no future"); | ||||
|         match = s->window + cur_match; | ||||
|  | ||||
|         /* Skip to next match if the match length cannot increase | ||||
|          * or if the match length is less than 2: | ||||
|          */ | ||||
| #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) | ||||
|         /* This code assumes sizeof(unsigned short) == 2. Do not use | ||||
|          * UNALIGNED_OK if your compiler uses a different size. | ||||
|          */ | ||||
|         if (*(ushf*)(match+best_len-1) != scan_end || | ||||
|             *(ushf*)match != scan_start) continue; | ||||
|  | ||||
|         /* It is not necessary to compare scan[2] and match[2] since they are | ||||
|          * always equal when the other bytes match, given that the hash keys | ||||
|          * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at | ||||
|          * strstart+3, +5, ... up to strstart+257. We check for insufficient | ||||
|          * lookahead only every 4th comparison; the 128th check will be made | ||||
|          * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is | ||||
|          * necessary to put more guard bytes at the end of the window, or | ||||
|          * to check more often for insufficient lookahead. | ||||
|          */ | ||||
|         Assert(scan[2] == match[2], "scan[2]?"); | ||||
|         scan++, match++; | ||||
|         do { | ||||
|         } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||||
|                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||||
|                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||||
|                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) && | ||||
|                  scan < strend); | ||||
|         /* The funny "do {}" generates better code on most compilers */ | ||||
|  | ||||
|         /* Here, scan <= window+strstart+257 */ | ||||
|         Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||||
|         if (*scan == *match) scan++; | ||||
|  | ||||
|         len = (MAX_MATCH - 1) - (int)(strend-scan); | ||||
|         scan = strend - (MAX_MATCH-1); | ||||
|  | ||||
| #else /* UNALIGNED_OK */ | ||||
|  | ||||
|         if (match[best_len]   != scan_end  || | ||||
|             match[best_len-1] != scan_end1 || | ||||
|             *match            != *scan     || | ||||
|             *++match          != scan[1])      continue; | ||||
|  | ||||
|         /* The check at best_len-1 can be removed because it will be made | ||||
|          * again later. (This heuristic is not always a win.) | ||||
|          * It is not necessary to compare scan[2] and match[2] since they | ||||
|          * are always equal when the other bytes match, given that | ||||
|          * the hash keys are equal and that HASH_BITS >= 8. | ||||
|          */ | ||||
|         scan += 2, match++; | ||||
|         Assert(*scan == *match, "match[2]?"); | ||||
|  | ||||
|         /* We check for insufficient lookahead only every 8th comparison; | ||||
|          * the 256th check will be made at strstart+258. | ||||
|          */ | ||||
|         do { | ||||
|         } while (*++scan == *++match && *++scan == *++match && | ||||
|                  *++scan == *++match && *++scan == *++match && | ||||
|                  *++scan == *++match && *++scan == *++match && | ||||
|                  *++scan == *++match && *++scan == *++match && | ||||
|                  scan < strend); | ||||
|  | ||||
|         Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||||
|  | ||||
|         len = MAX_MATCH - (int)(strend - scan); | ||||
|         scan = strend - MAX_MATCH; | ||||
|  | ||||
| #endif /* UNALIGNED_OK */ | ||||
|  | ||||
|         if (len > best_len) { | ||||
|             s->match_start = cur_match; | ||||
|             best_len = len; | ||||
|             if (len >= nice_match) break; | ||||
| #ifdef UNALIGNED_OK | ||||
|             scan_end = *(ushf*)(scan+best_len-1); | ||||
| #else | ||||
|             scan_end1  = scan[best_len-1]; | ||||
|             scan_end   = scan[best_len]; | ||||
| #endif | ||||
|         } | ||||
|     } while ((cur_match = prev[cur_match & wmask]) > limit | ||||
|              && --chain_length != 0); | ||||
|  | ||||
|     if ((uInt)best_len <= s->lookahead) return (uInt)best_len; | ||||
|     return s->lookahead; | ||||
| } | ||||
|  | ||||
| #endif /* ASMV */ | ||||
							
								
								
									
										1020
									
								
								contrib/vstudio/vc70_32/inffastAsm.asm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1020
									
								
								contrib/vstudio/vc70_32/inffastAsm.asm
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								contrib/vstudio/vc70_32/inffastAsm.obj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								contrib/vstudio/vc70_32/inffastAsm.obj
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										124
									
								
								contrib/vstudio/vc70_32/miniunz.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								contrib/vstudio/vc70_32/miniunz.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| <?xml version="1.0" encoding = "Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="7.00" | ||||
| 	Name="miniunz" | ||||
| 	ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694382A}" | ||||
| 	Keyword="Win32Proj"> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32"/> | ||||
| 	</Platforms> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory="Debug" | ||||
| 			IntermediateDirectory="Debug" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | ||||
| 				MinimalRebuild="TRUE" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="5" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="4"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/miniunz.exe" | ||||
| 				LinkIncremental="2" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				ProgramDatabaseFile="$(OutDir)/miniunz.pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="Release" | ||||
| 			IntermediateDirectory="Release" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				OmitFramePointers="TRUE" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | ||||
| 				StringPooling="TRUE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="3"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/miniunz.exe" | ||||
| 				LinkIncremental="1" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> | ||||
| 			<File | ||||
| 				RelativePath="miniunz.c"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc"> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="zlib.lib"> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										124
									
								
								contrib/vstudio/vc70_32/minizip.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								contrib/vstudio/vc70_32/minizip.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| <?xml version="1.0" encoding = "Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="7.00" | ||||
| 	Name="minizip" | ||||
| 	ProjectGUID="{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" | ||||
| 	Keyword="Win32Proj"> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32"/> | ||||
| 	</Platforms> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory="Debug" | ||||
| 			IntermediateDirectory="Debug" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | ||||
| 				MinimalRebuild="TRUE" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="5" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="4"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/minizip.exe" | ||||
| 				LinkIncremental="2" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				ProgramDatabaseFile="$(OutDir)/minizip.pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="Release" | ||||
| 			IntermediateDirectory="Release" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				OmitFramePointers="TRUE" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | ||||
| 				StringPooling="TRUE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				UsePrecompiledHeader="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="TRUE" | ||||
| 				DebugInformationFormat="3"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)/minizip.exe" | ||||
| 				LinkIncremental="1" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				TargetMachine="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> | ||||
| 			<File | ||||
| 				RelativePath="minizip.c"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc"> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="zlib.lib"> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										2
									
								
								contrib/vstudio/vc70_32/mkgvmt32.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								contrib/vstudio/vc70_32/mkgvmt32.bat
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| c:\masm611\bin\ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm | ||||
| c:\masm611\bin\ml /coff /Zi /c /FlinffastAsm.lst inffastAsm.asm | ||||
							
								
								
									
										32
									
								
								contrib/vstudio/vc70_32/zlib.rc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								contrib/vstudio/vc70_32/zlib.rc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| #include <windows.h> | ||||
|  | ||||
| #define IDR_VERSION1  1 | ||||
| IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE | ||||
|   FILEVERSION	 1,2,1,0 | ||||
|   PRODUCTVERSION 1,2,1,0 | ||||
|   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK | ||||
|   FILEFLAGS	0 | ||||
|   FILEOS	VOS_DOS_WINDOWS32 | ||||
|   FILETYPE	VFT_DLL | ||||
|   FILESUBTYPE	0	// not used | ||||
| BEGIN | ||||
|   BLOCK "StringFileInfo" | ||||
|   BEGIN | ||||
|     BLOCK "040904E4" | ||||
|     //language ID = U.S. English, char set = Windows, Multilingual | ||||
|  | ||||
|     BEGIN | ||||
|       VALUE "FileDescription", "zlib data compression library\0" | ||||
|       VALUE "FileVersion",	"1.2.1.0\0" | ||||
|       VALUE "InternalName",	"zlib\0" | ||||
|       VALUE "OriginalFilename",	"zlib.dll\0" | ||||
|       VALUE "ProductName",	"ZLib.DLL\0" | ||||
|       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" | ||||
|       VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" | ||||
|     END | ||||
|   END | ||||
|   BLOCK "VarFileInfo" | ||||
|   BEGIN | ||||
|     VALUE "Translation", 0x0409, 1252 | ||||
|   END | ||||
| END | ||||
							
								
								
									
										253
									
								
								contrib/vstudio/vc70_32/zlibstat.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										253
									
								
								contrib/vstudio/vc70_32/zlibstat.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,253 @@ | ||||
| <?xml version="1.0" encoding = "Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="7.00" | ||||
| 	Name="zlibstat" | ||||
| 	SccProjectName="" | ||||
| 	SccLocalPath=""> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32"/> | ||||
| 	</Platforms> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\zlibstatDebug" | ||||
| 			IntermediateDirectory=".\zlibstatDebug" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="5" | ||||
| 				PrecompiledHeaderFile=".\zlibstatDebug/zlibstat.pch" | ||||
| 				AssemblerListingLocation=".\zlibstatDebug/" | ||||
| 				ObjectFile=".\zlibstatDebug/" | ||||
| 				ProgramDataBaseFileName=".\zlibstatDebug/" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				DebugInformationFormat="1"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalOptions="/NODEFAULTLIB " | ||||
| 				OutputFile=".\zlibstatDebug\zlibstat.lib" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="ReleaseAxp|Win32" | ||||
| 			OutputDirectory=".\zlibsta0" | ||||
| 			IntermediateDirectory=".\zlibsta0" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibsta0/zlibstat.pch" | ||||
| 				AssemblerListingLocation=".\zlibsta0/" | ||||
| 				ObjectFile=".\zlibsta0/" | ||||
| 				ProgramDataBaseFileName=".\zlibsta0/" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalOptions="/NODEFAULTLIB " | ||||
| 				OutputFile=".\zlibsta0\zlibstat.lib" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\zlibstat" | ||||
| 			IntermediateDirectory=".\zlibstat" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32,ASMV" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibstat/zlibstat.pch" | ||||
| 				AssemblerListingLocation=".\zlibstat/" | ||||
| 				ObjectFile=".\zlibstat/" | ||||
| 				ProgramDataBaseFileName=".\zlibstat/" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalOptions="gvmat32.obj  inffastAsm.obj /NODEFAULTLIB " | ||||
| 				OutputFile=".\zlibstat\zlibstat.lib" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="ReleaseWithoutAsm|Win32" | ||||
| 			OutputDirectory="zlibstatWithoutAsm" | ||||
| 			IntermediateDirectory="zlibstatWithoutAsm" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="4" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibstat/zlibstat.pch" | ||||
| 				AssemblerListingLocation=".\zlibstatWithoutAsm/" | ||||
| 				ObjectFile=".\zlibstatWithoutAsm/" | ||||
| 				ProgramDataBaseFileName=".\zlibstatWithoutAsm/" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalOptions=" /NODEFAULTLIB " | ||||
| 				OutputFile=".\zlibstatWithoutAsm\zlibstat.lib" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter=""> | ||||
| 			<File | ||||
| 				RelativePath=".\adler32.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\compress.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\crc32.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\deflate.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\gvmat32c.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\gzio.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\infback.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inffast.c"> | ||||
| 				<FileConfiguration | ||||
| 					Name="Release|Win32" | ||||
| 					ExcludedFromBuild="TRUE"> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool"/> | ||||
| 				</FileConfiguration> | ||||
| 				<FileConfiguration | ||||
| 					Name="ReleaseWithoutAsm|Win32"> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool"/> | ||||
| 				</FileConfiguration> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inflate.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inftrees.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\ioapi.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\trees.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\uncompr.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\unzip.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zip.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zlib.rc"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zlibvc.def"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zutil.c"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										88
									
								
								contrib/vstudio/vc70_32/zlibvc.def
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								contrib/vstudio/vc70_32/zlibvc.def
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| LIBRARY		"zlib" | ||||
|  | ||||
| VERSION		1.21 | ||||
|  | ||||
| HEAPSIZE	1048576,8192 | ||||
|  | ||||
| EXPORTS | ||||
|         adler32                                  @1 | ||||
|         compress                                 @2 | ||||
|         crc32                                    @3 | ||||
|         deflate                                  @4 | ||||
|         deflateCopy                              @5 | ||||
|         deflateEnd                               @6 | ||||
|         deflateInit2_                            @7 | ||||
|         deflateInit_                             @8 | ||||
|         deflateParams                            @9 | ||||
|         deflateReset                             @10 | ||||
|         deflateSetDictionary                     @11 | ||||
|         gzclose                                  @12 | ||||
|         gzdopen                                  @13 | ||||
|         gzerror                                  @14 | ||||
|         gzflush                                  @15 | ||||
|         gzopen                                   @16 | ||||
|         gzread                                   @17 | ||||
|         gzwrite                                  @18 | ||||
|         inflate                                  @19 | ||||
|         inflateEnd                               @20 | ||||
|         inflateInit2_                            @21 | ||||
|         inflateInit_                             @22 | ||||
|         inflateReset                             @23 | ||||
|         inflateSetDictionary                     @24 | ||||
|         inflateSync                              @25 | ||||
|         uncompress                               @26 | ||||
|         zlibVersion                              @27 | ||||
|         gzprintf                                 @28 | ||||
|         gzputc                                   @29 | ||||
|         gzgetc                                   @30 | ||||
|         gzseek                                   @31 | ||||
|         gzrewind                                 @32 | ||||
|         gztell                                   @33 | ||||
|         gzeof                                    @34 | ||||
|         gzsetparams                              @35 | ||||
|         zError                                   @36 | ||||
|         inflateSyncPoint                         @37 | ||||
|         get_crc_table                            @38 | ||||
|         compress2                                @39 | ||||
|         gzputs                                   @40 | ||||
|         gzgets                                   @41 | ||||
|         inflateCopy                              @42 | ||||
|         inflateBackInit_                         @43 | ||||
|         inflateBack                              @44 | ||||
|         inflateBackEnd                           @45 | ||||
|         compressBound                            @46 | ||||
|  | ||||
|         unzOpen                                  @61 | ||||
|         unzClose                                 @62 | ||||
|         unzGetGlobalInfo                         @63 | ||||
|         unzGetCurrentFileInfo                    @64 | ||||
|         unzGoToFirstFile                         @65 | ||||
|         unzGoToNextFile                          @66 | ||||
|         unzOpenCurrentFile                       @67 | ||||
|         unzReadCurrentFile                       @68 | ||||
|         unzOpenCurrentFile3                      @69 | ||||
|         unztell                                  @70 | ||||
|         unzeof                                   @71 | ||||
|         unzCloseCurrentFile                      @72 | ||||
|         unzGetGlobalComment                      @73 | ||||
|         unzStringFileNameCompare                 @74 | ||||
|         unzLocateFile                            @75 | ||||
|         unzGetLocalExtrafield                    @76 | ||||
|         unzOpen2                                 @77 | ||||
|         unzOpenCurrentFile2                      @78 | ||||
|         unzOpenCurrentFilePassword               @79 | ||||
|  | ||||
|         zipOpen                                  @80 | ||||
|         zipOpenNewFileInZip                      @81 | ||||
|         zipWriteInFileInZip                      @82 | ||||
|         zipCloseFileInZip                        @83 | ||||
|         zipClose                                 @84 | ||||
|         zipOpenNewFileInZip2                     @86 | ||||
|         zipCloseFileInZipRaw                     @87 | ||||
|         zipOpen2                                 @88 | ||||
|         zipOpenNewFileInZip3                     @89 | ||||
|  | ||||
|         unzGetFilePos                            @100 | ||||
|         unzGoToFilePos                           @101 | ||||
|  | ||||
|         fill_win32_filefunc                      @110 | ||||
							
								
								
									
										66
									
								
								contrib/vstudio/vc70_32/zlibvc.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								contrib/vstudio/vc70_32/zlibvc.sln
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| Microsoft Visual Studio Solution File, Format Version 7.00 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfiguration) = preSolution | ||||
| 		ConfigName.0 = Debug | ||||
| 		ConfigName.1 = Release | ||||
| 		ConfigName.2 = ReleaseAxp | ||||
| 		ConfigName.3 = ReleaseWithoutAsm | ||||
| 		ConfigName.4 = ReleaseWithoutCrtdll | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectDependencies) = postSolution | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfiguration) = postSolution | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.ActiveCfg = Debug|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.Build.0 = Debug|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.ActiveCfg = Release|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.Build.0 = Release|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.Build.0 = ReleaseAxp|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseAxp|Win32 | ||||
| 		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.Build.0 = ReleaseAxp|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.ActiveCfg = Debug|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.Build.0 = Debug|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.ActiveCfg = Release|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.Build.0 = Release|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.Build.0 = ReleaseAxp|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseWithoutCrtdll|Win32 | ||||
| 		{8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.Build.0 = ReleaseWithoutCrtdll|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.ActiveCfg = Debug|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.Build.0 = Debug|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.ActiveCfg = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.Build.0 = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.ActiveCfg = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.Build.0 = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.ActiveCfg = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.Build.0 = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 | ||||
| 		{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.ActiveCfg = Debug|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.Build.0 = Debug|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.ActiveCfg = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.Build.0 = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.ActiveCfg = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.Build.0 = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.ActiveCfg = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 | ||||
| 		{C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityAddIns) = postSolution | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										434
									
								
								contrib/vstudio/vc70_32/zlibvc.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										434
									
								
								contrib/vstudio/vc70_32/zlibvc.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,434 @@ | ||||
| <?xml version="1.0" encoding = "Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="7.00" | ||||
| 	Name="zlibvc" | ||||
| 	SccProjectName="" | ||||
| 	SccLocalPath=""> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32"/> | ||||
| 	</Platforms> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\DebugDll" | ||||
| 			IntermediateDirectory=".\DebugDll" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32,ASMV" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile=".\DebugDll/zlibvc.pch" | ||||
| 				AssemblerListingLocation=".\DebugDll/" | ||||
| 				ObjectFile=".\DebugDll/" | ||||
| 				ProgramDataBaseFileName=".\DebugDll/" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				DebugInformationFormat="4"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/MACHINE:I386" | ||||
| 				AdditionalDependencies="gvmat32.obj " | ||||
| 				OutputFile=".\DebugDll\zlib.dll" | ||||
| 				LinkIncremental="2" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				ModuleDefinitionFile=".\zlibvc.def" | ||||
| 				GenerateDebugInformation="TRUE" | ||||
| 				ProgramDatabaseFile=".\DebugDll/zlib.pdb" | ||||
| 				SubSystem="2" | ||||
| 				ImportLibrary=".\DebugDll/zlib.lib"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="TRUE" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\DebugDll/zlibvc.tlb"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="ReleaseWithoutAsm|Win32" | ||||
| 			OutputDirectory=".\zlibDllWithoutAsm" | ||||
| 			IntermediateDirectory=".\zlibDllWithoutAsm" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibDllWithoutAsm/zlibvc.pch" | ||||
| 				AssemblerOutput="2" | ||||
| 				AssemblerListingLocation=".\zlibDllWithoutAsm/" | ||||
| 				ObjectFile=".\zlibDllWithoutAsm/" | ||||
| 				ProgramDataBaseFileName=".\zlibDllWithoutAsm/" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/MACHINE:I386" | ||||
| 				AdditionalDependencies="crtdll.lib" | ||||
| 				OutputFile=".\zlibDllWithoutAsm\zlib.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				IgnoreAllDefaultLibraries="TRUE" | ||||
| 				ModuleDefinitionFile=".\zlibvc.def" | ||||
| 				ProgramDatabaseFile=".\zlibDllWithoutAsm/zlib.pdb" | ||||
| 				GenerateMapFile="TRUE" | ||||
| 				MapFileName=".\zlibDllWithoutAsm/zlib.map" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				ImportLibrary=".\zlibDllWithoutAsm/zlib.lib"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="TRUE" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\zlibDllWithoutAsm/zlibvc.tlb"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="ReleaseWithoutCrtdll|Win32" | ||||
| 			OutputDirectory=".\zlibDllWithoutCrtDll" | ||||
| 			IntermediateDirectory=".\zlibDllWithoutCrtDll" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32,ASMV" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibDllWithoutCrtDll/zlibvc.pch" | ||||
| 				AssemblerOutput="2" | ||||
| 				AssemblerListingLocation=".\zlibDllWithoutCrtDll/" | ||||
| 				ObjectFile=".\zlibDllWithoutCrtDll/" | ||||
| 				ProgramDataBaseFileName=".\zlibDllWithoutCrtDll/" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/MACHINE:I386" | ||||
| 				AdditionalDependencies="gvmat32.obj inffastAsm.obj " | ||||
| 				OutputFile=".\zlibDllWithoutCrtDll\zlib.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				IgnoreAllDefaultLibraries="FALSE" | ||||
| 				ModuleDefinitionFile=".\zlibvc.def" | ||||
| 				ProgramDatabaseFile=".\zlibDllWithoutCrtDll/zlib.pdb" | ||||
| 				GenerateMapFile="TRUE" | ||||
| 				MapFileName=".\zlibDllWithoutCrtDll/zlib.map" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				ImportLibrary=".\zlibDllWithoutCrtDll/zlib.lib"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="TRUE" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\zlibDllWithoutCrtDll/zlibvc.tlb"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="ReleaseAxp|Win32" | ||||
| 			OutputDirectory=".\zlibvc__" | ||||
| 			IntermediateDirectory=".\zlibvc__" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\zlibvc__/zlibvc.pch" | ||||
| 				AssemblerOutput="2" | ||||
| 				AssemblerListingLocation=".\zlibvc__/" | ||||
| 				ObjectFile=".\zlibvc__/" | ||||
| 				ProgramDataBaseFileName=".\zlibvc__/" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="crtdll.lib" | ||||
| 				OutputFile="zlibvc__\zlib.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				IgnoreAllDefaultLibraries="TRUE" | ||||
| 				ModuleDefinitionFile=".\zlibvc.def" | ||||
| 				ProgramDatabaseFile=".\zlibvc__/zlib.pdb" | ||||
| 				GenerateMapFile="TRUE" | ||||
| 				MapFileName=".\zlibvc__/zlib.map" | ||||
| 				SubSystem="2" | ||||
| 				ImportLibrary=".\zlibvc__/zlib.lib"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="TRUE" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\zlibvc__/zlibvc.tlb"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\ReleaseDll" | ||||
| 			IntermediateDirectory=".\ReleaseDll" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="FALSE"> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				PreprocessorDefinitions="WIN32,ASMV" | ||||
| 				StringPooling="TRUE" | ||||
| 				ExceptionHandling="FALSE" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="TRUE" | ||||
| 				PrecompiledHeaderFile=".\ReleaseDll/zlibvc.pch" | ||||
| 				AssemblerOutput="2" | ||||
| 				AssemblerListingLocation=".\ReleaseDll/" | ||||
| 				ObjectFile=".\ReleaseDll/" | ||||
| 				ProgramDataBaseFileName=".\ReleaseDll/" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="TRUE"/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalOptions="/MACHINE:I386" | ||||
| 				AdditionalDependencies="gvmat32.obj inffastAsm.obj crtdll.lib" | ||||
| 				OutputFile=".\ReleaseDll\zlib.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				IgnoreAllDefaultLibraries="TRUE" | ||||
| 				ModuleDefinitionFile=".\zlibvc.def" | ||||
| 				ProgramDatabaseFile=".\ReleaseDll/zlib.pdb" | ||||
| 				GenerateMapFile="TRUE" | ||||
| 				MapFileName=".\ReleaseDll/zlib.map" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeForWindows98="1" | ||||
| 				ImportLibrary=".\ReleaseDll/zlib.lib"/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="TRUE" | ||||
| 				SuppressStartupBanner="TRUE" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Release/zlibvc.tlb"/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1036"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool"/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool"/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"> | ||||
| 			<File | ||||
| 				RelativePath=".\adler32.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\compress.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\crc32.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\deflate.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\gvmat32c.c"> | ||||
| 				<FileConfiguration | ||||
| 					Name="ReleaseWithoutAsm|Win32" | ||||
| 					ExcludedFromBuild="TRUE"> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool"/> | ||||
| 				</FileConfiguration> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\gzio.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\infback.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inffast.c"> | ||||
| 				<FileConfiguration | ||||
| 					Name="ReleaseWithoutCrtdll|Win32" | ||||
| 					ExcludedFromBuild="TRUE"> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool"/> | ||||
| 				</FileConfiguration> | ||||
| 				<FileConfiguration | ||||
| 					Name="Release|Win32" | ||||
| 					ExcludedFromBuild="TRUE"> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool"/> | ||||
| 				</FileConfiguration> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inflate.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inftrees.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\ioapi.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\iowin32.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\trees.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\uncompr.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\unzip.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zip.c"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zlib.rc"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zlibvc.def"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zutil.c"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;fi;fd"> | ||||
| 			<File | ||||
| 				RelativePath=".\deflate.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\infblock.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\infcodes.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inffast.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\inftrees.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\infutil.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zconf.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zlib.h"> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\zutil.h"> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										257
									
								
								contrib/zlib_dll_FAQ.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										257
									
								
								contrib/zlib_dll_FAQ.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,257 @@ | ||||
|  | ||||
|             Frequently Asked Questions about ZLIB.DLL | ||||
|  | ||||
|  | ||||
| This FAQ is about the design, the rationale, and the use of | ||||
| ZLIB.DLL. If you have general questions about zlib, you should | ||||
| check the file "FAQ" found in the zlib distribution, or at the | ||||
| location http://www.gzip.org/zlib/zlib_faq.html | ||||
|  | ||||
|  | ||||
|  1. Why am I having problems using ZLIB.DLL? My application works | ||||
|     with the static build of zlib just fine, and I didn't make any | ||||
|     modification when recompiling it for ZLIB.DLL. | ||||
|  | ||||
|   - Make sure you define ZLIB_DLL before including "zlib.h". | ||||
|     Applications that link to ZLIB.DLL will work properly if | ||||
|     the source files are compiled in this (or in a compatible) | ||||
|     way, and the executables are linked to MSVCRT.DLL. | ||||
|  | ||||
|  | ||||
|  2. Why do I have to do this? When I use other libraries, I can | ||||
|     link my code to their static or dynamic versions, without | ||||
|     needing any source code modification or recompilation. | ||||
|  | ||||
|   - In order to preserve the backwards compatibility with the | ||||
|     older versions of ZLIB.DLL, and give the ability to use zlib | ||||
|     to the non-C programmers at the same time, we had to do this | ||||
|     compromise. | ||||
|  | ||||
|  | ||||
|  3. What exactly is this mess about, and why is it happening? | ||||
|  | ||||
|   - It's about the calling convention used for the zlib functions. | ||||
|     If linked in statically, zlib uses the C (CDECL) convention. | ||||
|     If linked in dynamically (via ZLIB.DLL), it uses the STDCALL | ||||
|     convention. The ZLIB_DLL macro switches on the use of STDCALL. | ||||
|  | ||||
|     It happens because we need to preserve compatibility with the | ||||
|     old releases of ZLIB.DLL that use STDCALL, and, at the same | ||||
|     time, we must provide support for programmers who use other | ||||
|     programming languages with bindings that require CDECL. | ||||
|  | ||||
|  | ||||
|  4. Why not use the STDCALL convention all the time? | ||||
|     It's the standard convention in Win32, and I need it in my | ||||
|     Visual Basic project! | ||||
|  | ||||
|   - Most of the Win32 API functions (without varargs) use indeed | ||||
|     the STDCALL (WINAPI) convention, but the standard C functions | ||||
|     use the default CDECL. If one calls Win32 functions such as | ||||
|     CreateFile(), sometimes it makes sense to decorate one's own | ||||
|     functions with STDCALL. But if one is aiming at ANSI C or | ||||
|     POSIX portability, and calls functions such as fopen(), it is | ||||
|     not a sound decision to include <windows.h> or to use non-ANSI | ||||
|     constructs only to make one's functions STDCALL-able. This is | ||||
|     not the biggest problem, however. | ||||
|  | ||||
|     Technically, STDCALL is not bad; it is even a little faster | ||||
|     than CDECL. The problem of using STDCALL is actually a problem | ||||
|     of using any explicit calling convention. FASTCALL falls into | ||||
|     the same category. | ||||
|  | ||||
|     Explicit specification of calling conventions, whether it's | ||||
|     direct or indirect via a macro, happens commonly in Windows, | ||||
|     but it is regarded as a noisy, non-standard C quirk on other | ||||
|     platforms. It isn't possible to write an ANSI C -conforming | ||||
|     program, for example, if it is necessary to specify calling | ||||
|     conventions. Libraries can hide the dirty stuff in header | ||||
|     files, under macros, but callbacks will still remain exposed. | ||||
|     This is why the zlib callbacks will not be decorated. | ||||
|     (The old Windows callbacks, such as WndProc, are decorated, | ||||
|     but the newer ones are not.) | ||||
|  | ||||
|     There is one more problem with explicit, non-default calling | ||||
|     conventions: the ability to use zlib in other programming | ||||
|     languages. Some of them, like Ada (GNAT) and Fortran (GNU G77) | ||||
|     have C bindings implemented initially on Unix, hence relying | ||||
|     on the C calling convention. | ||||
|  | ||||
|     So we are decorating the functions using STDCALL in ZLIB.DLL | ||||
|     to maintain compatibility with the old versions, but we are | ||||
|     using the default CDECL in the static library, to allow other | ||||
|     programming languages to use zlib in a portable fashion, via | ||||
|     C bindings. | ||||
|  | ||||
|  | ||||
|  5. Why not use the default (CDECL) convention all the time? | ||||
|     It's the standard convention in C, and I need it in my Ada | ||||
|     project! | ||||
|  | ||||
|   - Originally, ZLIB.DLL was intended to run under Visual Basic, | ||||
|     and VB6 and earlier need STDCALL. | ||||
|  | ||||
|     We admit that cluttering the main zlib sources, for the sake | ||||
|     of interfacing with Visual Basic and at the expense of other | ||||
|     programming languages, is not fair. It would have been better | ||||
|     to maintain a "VB-only" project in the contrib/ directory, and | ||||
|     to build a custom ZLIBVB.DLL, for example -- as we did with | ||||
|     the Delphi projects. Another possible solution would have been | ||||
|     to build STDCALL wrappers around the CDECL-exported functions. | ||||
|  | ||||
|     But this was the accident that we have to live with, in order | ||||
|     to maintain binary compatibility with the older versions of | ||||
|     ZLIB.DLL. | ||||
|  | ||||
|  | ||||
|  6. If my application uses ZLIB.DLL, do I have to link it to | ||||
|     MSVCRT.DLL? Why? | ||||
|  | ||||
|   - The executables (.EXE, .DLL, etc.) that are involved in the | ||||
|     same process and are using the C run-time library (i.e. they | ||||
|     are calling any standard C function), must link to the same | ||||
|     library. There are several libraries in the Win32 system: | ||||
|     CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. | ||||
|     Since ZLIB.DLL is linked to MSVCRT.DLL, the executables that | ||||
|     depend on it must also link to MSVCRT.DLL. | ||||
|  | ||||
|  | ||||
|  7. Why are you saying that ZLIB.DLL and my application must be | ||||
|     linked to the same C run-time library (CRT)? I linked my | ||||
|     application and my DLLs to different C libraries (e.g. my | ||||
|     application to a static library, and my DLLs to MSVCRT.DLL), | ||||
|     and everything works fine. | ||||
|  | ||||
|   - If a library invokes only pure Win32 API (i.e. accessible | ||||
|     via <windows.h>), its DLL build will work in any context. | ||||
|     But if a library invokes standard C functions, things get | ||||
|     more complicated. | ||||
|  | ||||
|     There is a single Win32 library in a Win32 system. Every | ||||
|     function in this library resides in a single DLL module, that | ||||
|     is safe to call from anywhere. On the other hand, there are | ||||
|     multiple versions of the C library that are all at the same | ||||
|     time in the system, and all of them have internal states, | ||||
|     therefore it is dangerous to intermix them with each other. | ||||
|  | ||||
|     Intermixing multiple C libraries is possible, as long as their | ||||
|     internal states are kept intact. The Microsoft Knowledge Base | ||||
|     article Q140584 "HOWTO: Link with the Correct C Run-Time (CRT) | ||||
|     Library" enumerates some of the potential problems raised by | ||||
|     intermixing, but does not offer a complete description of how | ||||
|     to avoid them, except by advising not to mix the C libraries. | ||||
|     If you can send us more information about this issue, we will | ||||
|     highly appreciate it. (But please do NOT send us source code | ||||
|     from Microsoft, even if it comes with your legitimate copy of | ||||
|     Visual C++!) | ||||
|  | ||||
|     If this kind of intermixing works for you, it's because your | ||||
|     application and DLLs are avoiding the corruption of the CRT's | ||||
|     internal states, due to a fortunate accident. It's not because | ||||
|     those libraries really work together. | ||||
|  | ||||
|     Also note that linking ZLIB.DLL to non-Microsoft C libraries | ||||
|     (such as Borland's) raises similar problems. | ||||
|  | ||||
|  | ||||
|  8. Why are you linking ZLIB.DLL to MSVCRT.DLL? | ||||
|  | ||||
|   - MSVCRT.DLL exists on every Windows 95 with a new service pack | ||||
|     installed, or with Microsoft Internet Explorer 4 or later, and | ||||
|     on all other Windows 4.x or later (Windows 98, Windows NT 4, | ||||
|     or later). It is freely distributable; if not present in the | ||||
|     system, it can be downloaded from Microsoft or from other | ||||
|     software provider for free. | ||||
|  | ||||
|     The fact that MSVCRT.DLL does not exist on a virgin Windows 95 | ||||
|     is not so problematic. The number of Windows 95 installations | ||||
|     is rapidly decreasing, Microsoft stopped supporting it a long | ||||
|     time ago, and many recent applications from various vendors | ||||
|     including Microsoft, do not even run on it. Even without these | ||||
|     arguments, no serious user should run Windows 95 without a | ||||
|     proper update installed. | ||||
|  | ||||
|     There is also the fact that the mainstream C compilers for | ||||
|     Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both | ||||
|     are producing executables that link to MSVCRT.DLL by default, | ||||
|     without offering other dynamic CRTs as alternatives easy to | ||||
|     select by users. | ||||
|  | ||||
|  | ||||
|  9. Why are you not linking ZLIB.DLL to | ||||
|     <<my favorite C run-time library>> ? | ||||
|  | ||||
|   - We considered and abandoned the following alternatives: | ||||
|  | ||||
|     * Linking ZLIB.DLL to a static C library (LIBC.LIB, or | ||||
|       LIBCMT.LIB) is not a good option. People are using ZLIB.DLL | ||||
|       mainly to save disk space. If you are linking your program | ||||
|       to a static C library, you may as well consider linking zlib | ||||
|       in statically, too. | ||||
|  | ||||
|     * Linking ZLIB.DLL to CRTDLL.DLL looks very appealing, | ||||
|       because CRTDLL.DLL is present on every Win32 installation. | ||||
|       Unfortunately, it has a series of problems: it raises | ||||
|       difficulties when linking to the Microsoft C++ libraries, | ||||
|       it is not thread-safe, and Microsoft has discontinued its | ||||
|       support a long time ago. | ||||
|  | ||||
|     * Linking ZLIB.DLL to MSVCRT70.DLL, supplied with the | ||||
|       Microsoft .NET platform and Visual C++ 7.0, is not a good | ||||
|       option. Although it can be downloaded and distributed | ||||
|       freely, it is hardly present on today's Win32 installations. | ||||
|       If it will become more popular than MSVCRT.DLL, and will be | ||||
|       pre-installed on the future Win32 systems, we will probably | ||||
|       think again about it. | ||||
|  | ||||
|     * Linking ZLIB.DLL to NTDLL.DLL is not possible. | ||||
|       NTDLL.DLL exports only a part of the C library, and only | ||||
|       on Windows NT systems. | ||||
|  | ||||
|  | ||||
| 10. I understand your reasons. However, my project needs ZLIB.DLL | ||||
|     linked to something different than MSVCRT.DLL. What can I do? | ||||
|  | ||||
|     Feel free to rebuild this DLL from the zlib sources, and link | ||||
|     it the way you want. It is required, however, to clearly | ||||
|     state that your build is unofficial. Another thing that is not | ||||
|     required, but highly recommended, is to name that custom DLL | ||||
|     differently, and/or to install it in a private directory that | ||||
|     can be accessed by your application, but is not visible to the | ||||
|     others (e.g. it's not the SYSTEM or the SYSTEM32 directory, | ||||
|     and it's not in the PATH). Otherwise, your build may clash | ||||
|     with applications that link to the official build. | ||||
|  | ||||
|     For example, in Cygwin, zlib is linked to their runtime | ||||
|     CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. | ||||
|  | ||||
|  | ||||
| 11. My I include additional pieces of code that I find useful, | ||||
|     link them in ZLIB.DLL, and export them? | ||||
|  | ||||
|     No. A legitimate build of ZLIB.DLL must not include code that | ||||
|     does not originate from the official zlib sources. But you can | ||||
|     make your own private build, and give it a different name, as | ||||
|     suggested in the previous answer. | ||||
|  | ||||
|     For example, in Borland Delphi and C++ Builder, zlib is part | ||||
|     of the standard VCL library. If an application links to VCL | ||||
|     dynamically, the name of the distributable binary (VCLxx.DLL) | ||||
|     does not posess any danger of clashing with a legitimate but | ||||
|     incompatible ZLIB.DLL. | ||||
|  | ||||
|  | ||||
| 12. I see that I may have all kinds of problems if I use ZLIB.DLL. | ||||
|     Do you recommend to link zlib in statically? Do I get rid of | ||||
|     problems? | ||||
|  | ||||
|   - Yes, definitely. In fact, unless you are distributing a large | ||||
|     number of executables, each of them linking to zlib, you will | ||||
|     save space by linking zlib in statically (assuming that you | ||||
|     would otherwise distribute ZLIB.DLL with your application). | ||||
|     zlib is not a big library, and the space saved by ZLIB.DLL is | ||||
|     little. Much of the actual size of the DLL is due to the 4KB | ||||
|     alignment in the binary. | ||||
|  | ||||
|     But you may have reasons, other than size, to use the DLL. | ||||
|     That is entirely up to you. | ||||
							
								
								
									
										28
									
								
								crc32.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								crc32.c
									
									
									
									
									
								
							| @@ -18,25 +18,29 @@ | ||||
| #  endif /* !DYNAMIC_CRC_TABLE */ | ||||
| #endif /* MAKECRCH */ | ||||
|  | ||||
| #include "zlib.h" | ||||
| #include "zutil.h" | ||||
|  | ||||
| #define local static | ||||
|  | ||||
| /* Find a four-byte integer type for crc32_little() and crc32_big(). */ | ||||
| #ifndef NOBYFOUR | ||||
| #  ifdef __STDC__       /* need ANSI C limits.h to determine sizes */ | ||||
| #  ifdef STDC           /* need ANSI C limits.h to determine sizes */ | ||||
| #    include <limits.h> | ||||
| #    define BYFOUR | ||||
| #    if (UINT_MAX == 4294967295) | ||||
| #    if (UINT_MAX == 0xffffffffUL) | ||||
|        typedef unsigned int u4; | ||||
| #    elif (ULONG_MAX == 4294967295) | ||||
|        typedef unsigned long u4; | ||||
| #    elif (USHRT_MAX == 4294967295) | ||||
|        typedef unsigned short u4; | ||||
| #    else | ||||
| #      undef BYFOUR     /* can't find a four-byte integer type! */ | ||||
| #      if (ULONG_MAX == 0xffffffffUL) | ||||
|          typedef unsigned long u4; | ||||
| #      else | ||||
| #        if (USHRT_MAX == 0xffffffffUL) | ||||
|            typedef unsigned short u4; | ||||
| #        else | ||||
| #          undef BYFOUR     /* can't find a four-byte integer type! */ | ||||
| #        endif | ||||
| #      endif | ||||
| #    endif | ||||
| #  endif /* __STDC__ */ | ||||
| #  endif /* STDC */ | ||||
| #endif /* !NOBYFOUR */ | ||||
|  | ||||
| /* Definitions for doing the crc four data bytes at a time. */ | ||||
| @@ -95,7 +99,7 @@ local void make_crc_table() | ||||
|     /* terms of polynomial defining this crc (except x^32): */ | ||||
|     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; | ||||
|  | ||||
|     /* make exclusive-or pattern from polynomial (0xedb88320L) */ | ||||
|     /* make exclusive-or pattern from polynomial (0xedb88320UL) */ | ||||
|     poly = 0UL; | ||||
|     for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) | ||||
|         poly |= 1UL << (31 - p[n]); | ||||
| @@ -240,7 +244,7 @@ local unsigned long crc32_little(crc, buf, len) | ||||
|  | ||||
|     c = (u4)crc; | ||||
|     c = ~c; | ||||
|     while (len && ((int)buf & 3)) { | ||||
|     while (len && ((size_t)buf & 3)) { | ||||
|         c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); | ||||
|         len--; | ||||
|     } | ||||
| @@ -280,7 +284,7 @@ local unsigned long crc32_big(crc, buf, len) | ||||
|  | ||||
|     c = REV((u4)crc); | ||||
|     c = ~c; | ||||
|     while (len && ((int)buf & 3)) { | ||||
|     while (len && ((size_t)buf & 3)) { | ||||
|         c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); | ||||
|         len--; | ||||
|     } | ||||
|   | ||||
							
								
								
									
										323
									
								
								deflate.c
									
									
									
									
									
								
							
							
						
						
									
										323
									
								
								deflate.c
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /* deflate.c -- compress data using the deflation algorithm | ||||
|  * Copyright (C) 1995-2003 Jean-loup Gailly. | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h  | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  */ | ||||
|  | ||||
| /* | ||||
| @@ -37,7 +37,7 @@ | ||||
|  *  REFERENCES | ||||
|  * | ||||
|  *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". | ||||
|  *      Available in ftp://ds.internic.net/rfc/rfc1951.txt | ||||
|  *      Available in http://www.ietf.org/rfc/rfc1951.txt | ||||
|  * | ||||
|  *      A description of the Rabin and Karp algorithm is given in the book | ||||
|  *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252. | ||||
| @@ -52,7 +52,7 @@ | ||||
| #include "deflate.h" | ||||
|  | ||||
| const char deflate_copyright[] = | ||||
|    " deflate 1.2.0 Copyright 1995-2003 Jean-loup Gailly "; | ||||
|    " deflate 1.2.0.2 Copyright 1995-2003 Jean-loup Gailly "; | ||||
| /* | ||||
|   If you use the zlib library in a product, an acknowledgment is welcome | ||||
|   in the documentation of your product. If for some reason you cannot | ||||
| @@ -76,17 +76,22 @@ typedef block_state (*compress_func) OF((deflate_state *s, int flush)); | ||||
| local void fill_window    OF((deflate_state *s)); | ||||
| local block_state deflate_stored OF((deflate_state *s, int flush)); | ||||
| local block_state deflate_fast   OF((deflate_state *s, int flush)); | ||||
| #ifndef FASTEST | ||||
| local block_state deflate_slow   OF((deflate_state *s, int flush)); | ||||
| #endif | ||||
| local void lm_init        OF((deflate_state *s)); | ||||
| local void putShortMSB    OF((deflate_state *s, uInt b)); | ||||
| local void flush_pending  OF((z_streamp strm)); | ||||
| local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size)); | ||||
| #ifndef FASTEST | ||||
| #ifdef ASMV | ||||
|       void match_init OF((void)); /* asm code initialization */ | ||||
|       uInt longest_match  OF((deflate_state *s, IPos cur_match)); | ||||
| #else | ||||
| local uInt longest_match  OF((deflate_state *s, IPos cur_match)); | ||||
| #endif | ||||
| #endif | ||||
| local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); | ||||
|  | ||||
| #ifdef DEBUG | ||||
| local  void check_match OF((deflate_state *s, IPos start, IPos match, | ||||
| @@ -123,6 +128,12 @@ typedef struct config_s { | ||||
|    compress_func func; | ||||
| } config; | ||||
|  | ||||
| #ifdef FASTEST | ||||
| local const config configuration_table[2] = { | ||||
| /*      good lazy nice chain */ | ||||
| /* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */ | ||||
| /* 1 */ {4,    4,  8,    4, deflate_fast}}; /* maximum speed, no lazy matches */ | ||||
| #else | ||||
| local const config configuration_table[10] = { | ||||
| /*      good lazy nice chain */ | ||||
| /* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */ | ||||
| @@ -136,6 +147,7 @@ local const config configuration_table[10] = { | ||||
| /* 7 */ {8,   32, 128, 256, deflate_slow}, | ||||
| /* 8 */ {32, 128, 258, 1024, deflate_slow}, | ||||
| /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */ | ||||
| #endif | ||||
|  | ||||
| /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 | ||||
|  * For deflate_fast() (levels <= 3) good is ignored and lazy has a different | ||||
| @@ -145,7 +157,9 @@ local const config configuration_table[10] = { | ||||
| #define EQUAL 0 | ||||
| /* result of memcmp for equal strings */ | ||||
|  | ||||
| #ifndef NO_DUMMY_DECL | ||||
| struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | ||||
| #endif | ||||
|  | ||||
| /* =========================================================================== | ||||
|  * Update a hash value with the given input byte | ||||
| @@ -194,13 +208,13 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) | ||||
|     int stream_size; | ||||
| { | ||||
|     return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, | ||||
| 			 Z_DEFAULT_STRATEGY, version, stream_size); | ||||
|                          Z_DEFAULT_STRATEGY, version, stream_size); | ||||
|     /* To do: ignore strm->next_in if we use it as window */ | ||||
| } | ||||
|  | ||||
| /* ========================================================================= */ | ||||
| int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | ||||
| 		  version, stream_size) | ||||
|                   version, stream_size) | ||||
|     z_streamp strm; | ||||
|     int  level; | ||||
|     int  method; | ||||
| @@ -221,20 +235,21 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | ||||
|  | ||||
|     if (version == Z_NULL || version[0] != my_version[0] || | ||||
|         stream_size != sizeof(z_stream)) { | ||||
| 	return Z_VERSION_ERROR; | ||||
|         return Z_VERSION_ERROR; | ||||
|     } | ||||
|     if (strm == Z_NULL) return Z_STREAM_ERROR; | ||||
|  | ||||
|     strm->msg = Z_NULL; | ||||
|     if (strm->zalloc == Z_NULL) { | ||||
| 	strm->zalloc = zcalloc; | ||||
| 	strm->opaque = (voidpf)0; | ||||
|         strm->zalloc = zcalloc; | ||||
|         strm->opaque = (voidpf)0; | ||||
|     } | ||||
|     if (strm->zfree == Z_NULL) strm->zfree = zcfree; | ||||
|  | ||||
|     if (level == Z_DEFAULT_COMPRESSION) level = 6; | ||||
| #ifdef FASTEST | ||||
|     level = 1; | ||||
|     if (level != 0) level = 1; | ||||
| #else | ||||
|     if (level == Z_DEFAULT_COMPRESSION) level = 6; | ||||
| #endif | ||||
|  | ||||
|     if (windowBits < 0) { /* undocumented feature: suppress zlib header */ | ||||
| @@ -242,10 +257,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | ||||
|         windowBits = -windowBits; | ||||
|     } | ||||
|     if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || | ||||
|         windowBits < 9 || windowBits > 15 || level < 0 || level > 9 || | ||||
| 	strategy < 0 || strategy > Z_HUFFMAN_ONLY) { | ||||
|         windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || | ||||
|         strategy < 0 || strategy > Z_RLE) { | ||||
|         return Z_STREAM_ERROR; | ||||
|     } | ||||
|     if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */ | ||||
|     s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); | ||||
|     if (s == Z_NULL) return Z_MEM_ERROR; | ||||
|     strm->state = (struct internal_state FAR *)s; | ||||
| @@ -309,9 +325,9 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | ||||
|  | ||||
|     if (length < MIN_MATCH) return Z_OK; | ||||
|     if (length > MAX_DIST(s)) { | ||||
| 	length = MAX_DIST(s); | ||||
|         length = MAX_DIST(s); | ||||
| #ifndef USE_DICT_HEAD | ||||
| 	dictionary += dictLength - length; /* use the tail of the dictionary */ | ||||
|         dictionary += dictLength - length; /* use the tail of the dictionary */ | ||||
| #endif | ||||
|     } | ||||
|     zmemcpy(s->window, dictionary, length); | ||||
| @@ -325,7 +341,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | ||||
|     s->ins_h = s->window[0]; | ||||
|     UPDATE_HASH(s, s->ins_h, s->window[1]); | ||||
|     for (n = 0; n <= length - MIN_MATCH; n++) { | ||||
| 	INSERT_STRING(s, n, hash_head); | ||||
|         INSERT_STRING(s, n, hash_head); | ||||
|     } | ||||
|     if (hash_head) hash_head = 0;  /* to make compiler happy */ | ||||
|     return Z_OK; | ||||
| @@ -336,7 +352,7 @@ int ZEXPORT deflateReset (strm) | ||||
|     z_streamp strm; | ||||
| { | ||||
|     deflate_state *s; | ||||
|      | ||||
|  | ||||
|     if (strm == Z_NULL || strm->state == Z_NULL || | ||||
|         strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; | ||||
|  | ||||
| @@ -374,24 +390,26 @@ int ZEXPORT deflateParams(strm, level, strategy) | ||||
|     if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||||
|     s = strm->state; | ||||
|  | ||||
|     if (level == Z_DEFAULT_COMPRESSION) { | ||||
| 	level = 6; | ||||
|     } | ||||
|     if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { | ||||
| 	return Z_STREAM_ERROR; | ||||
| #ifdef FASTEST | ||||
|     if (level != 0) level = 1; | ||||
| #else | ||||
|     if (level == Z_DEFAULT_COMPRESSION) level = 6; | ||||
| #endif | ||||
|     if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) { | ||||
|         return Z_STREAM_ERROR; | ||||
|     } | ||||
|     func = configuration_table[s->level].func; | ||||
|  | ||||
|     if (func != configuration_table[level].func && strm->total_in != 0) { | ||||
| 	/* Flush the last buffer: */ | ||||
| 	err = deflate(strm, Z_PARTIAL_FLUSH); | ||||
|         /* Flush the last buffer: */ | ||||
|         err = deflate(strm, Z_PARTIAL_FLUSH); | ||||
|     } | ||||
|     if (s->level != level) { | ||||
| 	s->level = level; | ||||
| 	s->max_lazy_match   = configuration_table[level].max_lazy; | ||||
| 	s->good_match       = configuration_table[level].good_length; | ||||
| 	s->nice_match       = configuration_table[level].nice_length; | ||||
| 	s->max_chain_length = configuration_table[level].max_chain; | ||||
|         s->level = level; | ||||
|         s->max_lazy_match   = configuration_table[level].max_lazy; | ||||
|         s->good_match       = configuration_table[level].good_length; | ||||
|         s->nice_match       = configuration_table[level].nice_length; | ||||
|         s->max_chain_length = configuration_table[level].max_chain; | ||||
|     } | ||||
|     s->strategy = strategy; | ||||
|     return err; | ||||
| @@ -449,7 +467,7 @@ local void putShortMSB (s, b) | ||||
| { | ||||
|     put_byte(s, (Byte)(b >> 8)); | ||||
|     put_byte(s, (Byte)(b & 0xff)); | ||||
| }    | ||||
| } | ||||
|  | ||||
| /* ========================================================================= | ||||
|  * Flush as much pending output as possible. All deflate() output goes | ||||
| @@ -485,14 +503,14 @@ int ZEXPORT deflate (strm, flush) | ||||
|     deflate_state *s; | ||||
|  | ||||
|     if (strm == Z_NULL || strm->state == Z_NULL || | ||||
| 	flush > Z_FINISH || flush < 0) { | ||||
|         flush > Z_FINISH || flush < 0) { | ||||
|         return Z_STREAM_ERROR; | ||||
|     } | ||||
|     s = strm->state; | ||||
|  | ||||
|     if (strm->next_out == Z_NULL || | ||||
|         (strm->next_in == Z_NULL && strm->avail_in != 0) || | ||||
| 	(s->status == FINISH_STATE && flush != Z_FINISH)) { | ||||
|         (s->status == FINISH_STATE && flush != Z_FINISH)) { | ||||
|         ERR_RETURN(strm, Z_STREAM_ERROR); | ||||
|     } | ||||
|     if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); | ||||
| @@ -505,44 +523,51 @@ int ZEXPORT deflate (strm, flush) | ||||
|     if (s->status == INIT_STATE) { | ||||
|  | ||||
|         uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; | ||||
|         uInt level_flags = (s->level-1) >> 1; | ||||
|         uInt level_flags; | ||||
|  | ||||
|         if (level_flags > 3) level_flags = 3; | ||||
|         if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) | ||||
|             level_flags = 0; | ||||
|         else if (s->level < 6) | ||||
|             level_flags = 1; | ||||
|         else if (s->level == 6) | ||||
|             level_flags = 2; | ||||
|         else | ||||
|             level_flags = 3; | ||||
|         header |= (level_flags << 6); | ||||
| 	if (s->strstart != 0) header |= PRESET_DICT; | ||||
|         if (s->strstart != 0) header |= PRESET_DICT; | ||||
|         header += 31 - (header % 31); | ||||
|  | ||||
|         s->status = BUSY_STATE; | ||||
|         putShortMSB(s, header); | ||||
|  | ||||
| 	/* Save the adler32 of the preset dictionary: */ | ||||
| 	if (s->strstart != 0) { | ||||
| 	    putShortMSB(s, (uInt)(strm->adler >> 16)); | ||||
| 	    putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||||
| 	} | ||||
| 	strm->adler = 1L; | ||||
|         /* Save the adler32 of the preset dictionary: */ | ||||
|         if (s->strstart != 0) { | ||||
|             putShortMSB(s, (uInt)(strm->adler >> 16)); | ||||
|             putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||||
|         } | ||||
|         strm->adler = 1L; | ||||
|     } | ||||
|  | ||||
|     /* Flush as much pending output as possible */ | ||||
|     if (s->pending != 0) { | ||||
|         flush_pending(strm); | ||||
|         if (strm->avail_out == 0) { | ||||
| 	    /* Since avail_out is 0, deflate will be called again with | ||||
| 	     * more output space, but possibly with both pending and | ||||
| 	     * avail_in equal to zero. There won't be anything to do, | ||||
| 	     * but this is not an error situation so make sure we | ||||
| 	     * return OK instead of BUF_ERROR at next call of deflate: | ||||
|             /* Since avail_out is 0, deflate will be called again with | ||||
|              * more output space, but possibly with both pending and | ||||
|              * avail_in equal to zero. There won't be anything to do, | ||||
|              * but this is not an error situation so make sure we | ||||
|              * return OK instead of BUF_ERROR at next call of deflate: | ||||
|              */ | ||||
| 	    s->last_flush = -1; | ||||
| 	    return Z_OK; | ||||
| 	} | ||||
|             s->last_flush = -1; | ||||
|             return Z_OK; | ||||
|         } | ||||
|  | ||||
|     /* Make sure there is something to do and avoid duplicate consecutive | ||||
|      * flushes. For repeated and useless calls with Z_FINISH, we keep | ||||
|      * returning Z_STREAM_END instead of Z_BUFF_ERROR. | ||||
|      * returning Z_STREAM_END instead of Z_BUF_ERROR. | ||||
|      */ | ||||
|     } else if (strm->avail_in == 0 && flush <= old_flush && | ||||
| 	       flush != Z_FINISH) { | ||||
|                flush != Z_FINISH) { | ||||
|         ERR_RETURN(strm, Z_BUF_ERROR); | ||||
|     } | ||||
|  | ||||
| @@ -557,24 +582,24 @@ int ZEXPORT deflate (strm, flush) | ||||
|         (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { | ||||
|         block_state bstate; | ||||
|  | ||||
| 	bstate = (*(configuration_table[s->level].func))(s, flush); | ||||
|         bstate = (*(configuration_table[s->level].func))(s, flush); | ||||
|  | ||||
|         if (bstate == finish_started || bstate == finish_done) { | ||||
|             s->status = FINISH_STATE; | ||||
|         } | ||||
|         if (bstate == need_more || bstate == finish_started) { | ||||
| 	    if (strm->avail_out == 0) { | ||||
| 	        s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ | ||||
| 	    } | ||||
| 	    return Z_OK; | ||||
| 	    /* If flush != Z_NO_FLUSH && avail_out == 0, the next call | ||||
| 	     * of deflate should use the same flush parameter to make sure | ||||
| 	     * that the flush is complete. So we don't have to output an | ||||
| 	     * empty block here, this will be done at next call. This also | ||||
| 	     * ensures that for a very small output buffer, we emit at most | ||||
| 	     * one empty block. | ||||
| 	     */ | ||||
| 	} | ||||
|             if (strm->avail_out == 0) { | ||||
|                 s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ | ||||
|             } | ||||
|             return Z_OK; | ||||
|             /* If flush != Z_NO_FLUSH && avail_out == 0, the next call | ||||
|              * of deflate should use the same flush parameter to make sure | ||||
|              * that the flush is complete. So we don't have to output an | ||||
|              * empty block here, this will be done at next call. This also | ||||
|              * ensures that for a very small output buffer, we emit at most | ||||
|              * one empty block. | ||||
|              */ | ||||
|         } | ||||
|         if (bstate == block_done) { | ||||
|             if (flush == Z_PARTIAL_FLUSH) { | ||||
|                 _tr_align(s); | ||||
| @@ -588,10 +613,10 @@ int ZEXPORT deflate (strm, flush) | ||||
|                 } | ||||
|             } | ||||
|             flush_pending(strm); | ||||
| 	    if (strm->avail_out == 0) { | ||||
| 	      s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ | ||||
| 	      return Z_OK; | ||||
| 	    } | ||||
|             if (strm->avail_out == 0) { | ||||
|               s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ | ||||
|               return Z_OK; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     Assert(strm->avail_out > 0, "bug2"); | ||||
| @@ -620,7 +645,7 @@ int ZEXPORT deflateEnd (strm) | ||||
|  | ||||
|     status = strm->state->status; | ||||
|     if (status != INIT_STATE && status != BUSY_STATE && | ||||
| 	status != FINISH_STATE) { | ||||
|         status != FINISH_STATE) { | ||||
|       return Z_STREAM_ERROR; | ||||
|     } | ||||
|  | ||||
| @@ -693,7 +718,7 @@ int ZEXPORT deflateCopy (dest, source) | ||||
|     ds->bl_desc.dyn_tree = ds->bl_tree; | ||||
|  | ||||
|     return Z_OK; | ||||
| #endif | ||||
| #endif /* MAXSEG_64K */ | ||||
| } | ||||
|  | ||||
| /* =========================================================================== | ||||
| @@ -753,6 +778,7 @@ local void lm_init (s) | ||||
| #endif | ||||
| } | ||||
|  | ||||
| #ifndef FASTEST | ||||
| /* =========================================================================== | ||||
|  * Set match_start to the longest match starting at the given string and | ||||
|  * return its length. Matches shorter or equal to prev_length are discarded, | ||||
| @@ -766,7 +792,6 @@ local void lm_init (s) | ||||
| /* For 80x86 and 680x0, an optimized version will be provided in match.asm or | ||||
|  * match.S. The code will be functionally equivalent. | ||||
|  */ | ||||
| #ifndef FASTEST | ||||
| local uInt longest_match(s, cur_match) | ||||
|     deflate_state *s; | ||||
|     IPos cur_match;                             /* current match */ | ||||
| @@ -904,12 +929,13 @@ local uInt longest_match(s, cur_match) | ||||
|     if ((uInt)best_len <= s->lookahead) return (uInt)best_len; | ||||
|     return s->lookahead; | ||||
| } | ||||
| #endif /* ASMV */ | ||||
| #endif /* FASTEST */ | ||||
|  | ||||
| #else /* FASTEST */ | ||||
| /* --------------------------------------------------------------------------- | ||||
|  * Optimized version for level == 1 only | ||||
|  * Optimized version for level == 1 or strategy == Z_RLE only | ||||
|  */ | ||||
| local uInt longest_match(s, cur_match) | ||||
| local uInt longest_match_fast(s, cur_match) | ||||
|     deflate_state *s; | ||||
|     IPos cur_match;                             /* current match */ | ||||
| { | ||||
| @@ -947,10 +973,10 @@ local uInt longest_match(s, cur_match) | ||||
|      */ | ||||
|     do { | ||||
|     } while (*++scan == *++match && *++scan == *++match && | ||||
| 	     *++scan == *++match && *++scan == *++match && | ||||
| 	     *++scan == *++match && *++scan == *++match && | ||||
| 	     *++scan == *++match && *++scan == *++match && | ||||
| 	     scan < strend); | ||||
|              *++scan == *++match && *++scan == *++match && | ||||
|              *++scan == *++match && *++scan == *++match && | ||||
|              *++scan == *++match && *++scan == *++match && | ||||
|              scan < strend); | ||||
|  | ||||
|     Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); | ||||
|  | ||||
| @@ -959,10 +985,8 @@ local uInt longest_match(s, cur_match) | ||||
|     if (len < MIN_MATCH) return MIN_MATCH - 1; | ||||
|  | ||||
|     s->match_start = cur_match; | ||||
|     return len <= s->lookahead ? len : s->lookahead; | ||||
|     return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; | ||||
| } | ||||
| #endif /* FASTEST */ | ||||
| #endif /* ASMV */ | ||||
|  | ||||
| #ifdef DEBUG | ||||
| /* =========================================================================== | ||||
| @@ -977,10 +1001,10 @@ local void check_match(s, start, match, length) | ||||
|     if (zmemcmp(s->window + match, | ||||
|                 s->window + start, length) != EQUAL) { | ||||
|         fprintf(stderr, " start %u, match %u, length %d\n", | ||||
| 		start, match, length); | ||||
|                 start, match, length); | ||||
|         do { | ||||
| 	    fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); | ||||
| 	} while (--length != 0); | ||||
|             fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); | ||||
|         } while (--length != 0); | ||||
|         z_error("invalid match"); | ||||
|     } | ||||
|     if (z_verbose > 1) { | ||||
| @@ -990,7 +1014,7 @@ local void check_match(s, start, match, length) | ||||
| } | ||||
| #else | ||||
| #  define check_match(s, start, match, length) | ||||
| #endif | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
| /* =========================================================================== | ||||
|  * Fill the window when the lookahead becomes insufficient. | ||||
| @@ -1014,19 +1038,22 @@ local void fill_window(s) | ||||
|         more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); | ||||
|  | ||||
|         /* Deal with !@#$% 64K limit: */ | ||||
|         if (more == 0 && s->strstart == 0 && s->lookahead == 0) { | ||||
|             more = wsize; | ||||
|  | ||||
|         } else if (more == (unsigned)(-1)) { | ||||
|             /* Very unlikely, but possible on 16 bit machine if strstart == 0 | ||||
|              * and lookahead == 1 (input done one byte at time) | ||||
|              */ | ||||
|             more--; | ||||
|         if (sizeof(int) <= 2) { | ||||
|             if (more == 0 && s->strstart == 0 && s->lookahead == 0) { | ||||
|                 more = wsize; | ||||
|      | ||||
|             } else if (more == (unsigned)(-1)) { | ||||
|                 /* Very unlikely, but possible on 16 bit machine if | ||||
|                  * strstart == 0 && lookahead == 1 (input done one byte at time) | ||||
|                  */ | ||||
|                 more--; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /* If the window is almost full and there is insufficient lookahead, | ||||
|          * move the upper half to the lower one to make room in the upper half. | ||||
|          */ | ||||
|         } else if (s->strstart >= wsize+MAX_DIST(s)) { | ||||
|         if (s->strstart >= wsize+MAX_DIST(s)) { | ||||
|  | ||||
|             zmemcpy(s->window, s->window+wsize, (unsigned)wsize); | ||||
|             s->match_start -= wsize; | ||||
| @@ -1039,23 +1066,23 @@ local void fill_window(s) | ||||
|                later. (Using level 0 permanently is not an optimal usage of | ||||
|                zlib, so we don't care about this pathological case.) | ||||
|              */ | ||||
| 	    n = s->hash_size; | ||||
| 	    p = &s->head[n]; | ||||
| 	    do { | ||||
| 		m = *--p; | ||||
| 		*p = (Pos)(m >= wsize ? m-wsize : NIL); | ||||
| 	    } while (--n); | ||||
|             n = s->hash_size; | ||||
|             p = &s->head[n]; | ||||
|             do { | ||||
|                 m = *--p; | ||||
|                 *p = (Pos)(m >= wsize ? m-wsize : NIL); | ||||
|             } while (--n); | ||||
|  | ||||
| 	    n = wsize; | ||||
|             n = wsize; | ||||
| #ifndef FASTEST | ||||
| 	    p = &s->prev[n]; | ||||
| 	    do { | ||||
| 		m = *--p; | ||||
| 		*p = (Pos)(m >= wsize ? m-wsize : NIL); | ||||
| 		/* If n is not on any hash chain, prev[n] is garbage but | ||||
| 		 * its value will never be used. | ||||
| 		 */ | ||||
| 	    } while (--n); | ||||
|             p = &s->prev[n]; | ||||
|             do { | ||||
|                 m = *--p; | ||||
|                 *p = (Pos)(m >= wsize ? m-wsize : NIL); | ||||
|                 /* If n is not on any hash chain, prev[n] is garbage but | ||||
|                  * its value will never be used. | ||||
|                  */ | ||||
|             } while (--n); | ||||
| #endif | ||||
|             more += wsize; | ||||
|         } | ||||
| @@ -1100,8 +1127,8 @@ local void fill_window(s) | ||||
|    _tr_flush_block(s, (s->block_start >= 0L ? \ | ||||
|                    (charf *)&s->window[(unsigned)s->block_start] : \ | ||||
|                    (charf *)Z_NULL), \ | ||||
| 		(ulg)((long)s->strstart - s->block_start), \ | ||||
| 		(eof)); \ | ||||
|                 (ulg)((long)s->strstart - s->block_start), \ | ||||
|                 (eof)); \ | ||||
|    s->block_start = s->strstart; \ | ||||
|    flush_pending(s->strm); \ | ||||
|    Tracev((stderr,"[FLUSH]")); \ | ||||
| @@ -1142,32 +1169,32 @@ local block_state deflate_stored(s, flush) | ||||
|         if (s->lookahead <= 1) { | ||||
|  | ||||
|             Assert(s->strstart < s->w_size+MAX_DIST(s) || | ||||
| 		   s->block_start >= (long)s->w_size, "slide too late"); | ||||
|                    s->block_start >= (long)s->w_size, "slide too late"); | ||||
|  | ||||
|             fill_window(s); | ||||
|             if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; | ||||
|  | ||||
|             if (s->lookahead == 0) break; /* flush the current block */ | ||||
|         } | ||||
| 	Assert(s->block_start >= 0L, "block gone"); | ||||
|         Assert(s->block_start >= 0L, "block gone"); | ||||
|  | ||||
| 	s->strstart += s->lookahead; | ||||
| 	s->lookahead = 0; | ||||
|         s->strstart += s->lookahead; | ||||
|         s->lookahead = 0; | ||||
|  | ||||
| 	/* Emit a stored block if pending_buf will be full: */ | ||||
|  	max_start = s->block_start + max_block_size; | ||||
|         /* Emit a stored block if pending_buf will be full: */ | ||||
|         max_start = s->block_start + max_block_size; | ||||
|         if (s->strstart == 0 || (ulg)s->strstart >= max_start) { | ||||
| 	    /* strstart == 0 is possible when wraparound on 16-bit machine */ | ||||
| 	    s->lookahead = (uInt)(s->strstart - max_start); | ||||
| 	    s->strstart = (uInt)max_start; | ||||
|             /* strstart == 0 is possible when wraparound on 16-bit machine */ | ||||
|             s->lookahead = (uInt)(s->strstart - max_start); | ||||
|             s->strstart = (uInt)max_start; | ||||
|             FLUSH_BLOCK(s, 0); | ||||
| 	} | ||||
| 	/* Flush if we may have to slide, otherwise block_start may become | ||||
|         } | ||||
|         /* Flush if we may have to slide, otherwise block_start may become | ||||
|          * negative and the data will be gone: | ||||
|          */ | ||||
|         if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { | ||||
|             FLUSH_BLOCK(s, 0); | ||||
| 	} | ||||
|         } | ||||
|     } | ||||
|     FLUSH_BLOCK(s, flush == Z_FINISH); | ||||
|     return flush == Z_FINISH ? finish_done : block_done; | ||||
| @@ -1196,8 +1223,8 @@ local block_state deflate_fast(s, flush) | ||||
|         if (s->lookahead < MIN_LOOKAHEAD) { | ||||
|             fill_window(s); | ||||
|             if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { | ||||
| 	        return need_more; | ||||
| 	    } | ||||
|                 return need_more; | ||||
|             } | ||||
|             if (s->lookahead == 0) break; /* flush the current block */ | ||||
|         } | ||||
|  | ||||
| @@ -1216,10 +1243,19 @@ local block_state deflate_fast(s, flush) | ||||
|              * of window index 0 (in particular we have to avoid a match | ||||
|              * of the string with itself at the start of the input file). | ||||
|              */ | ||||
|             if (s->strategy != Z_HUFFMAN_ONLY) { | ||||
|                 s->match_length = longest_match (s, hash_head); | ||||
| #ifdef FASTEST | ||||
|             if ((s->strategy < Z_HUFFMAN_ONLY) || | ||||
|                 (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { | ||||
|                 s->match_length = longest_match_fast (s, hash_head); | ||||
|             } | ||||
|             /* longest_match() sets match_start */ | ||||
| #else | ||||
|             if (s->strategy < Z_HUFFMAN_ONLY) { | ||||
|                 s->match_length = longest_match (s, hash_head); | ||||
|             } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { | ||||
|                 s->match_length = longest_match_fast (s, hash_head); | ||||
|             } | ||||
| #endif | ||||
|             /* longest_match() or longest_match_fast() sets match_start */ | ||||
|         } | ||||
|         if (s->match_length >= MIN_MATCH) { | ||||
|             check_match(s, s->strstart, s->match_start, s->match_length); | ||||
| @@ -1243,10 +1279,10 @@ local block_state deflate_fast(s, flush) | ||||
|                      * always MIN_MATCH bytes ahead. | ||||
|                      */ | ||||
|                 } while (--s->match_length != 0); | ||||
|                 s->strstart++;  | ||||
|                 s->strstart++; | ||||
|             } else | ||||
| #endif | ||||
| 	    { | ||||
|             { | ||||
|                 s->strstart += s->match_length; | ||||
|                 s->match_length = 0; | ||||
|                 s->ins_h = s->window[s->strstart]; | ||||
| @@ -1263,7 +1299,7 @@ local block_state deflate_fast(s, flush) | ||||
|             Tracevv((stderr,"%c", s->window[s->strstart])); | ||||
|             _tr_tally_lit (s, s->window[s->strstart], bflush); | ||||
|             s->lookahead--; | ||||
|             s->strstart++;  | ||||
|             s->strstart++; | ||||
|         } | ||||
|         if (bflush) FLUSH_BLOCK(s, 0); | ||||
|     } | ||||
| @@ -1271,6 +1307,7 @@ local block_state deflate_fast(s, flush) | ||||
|     return flush == Z_FINISH ? finish_done : block_done; | ||||
| } | ||||
|  | ||||
| #ifndef FASTEST | ||||
| /* =========================================================================== | ||||
|  * Same as above, but achieves better compression. We use a lazy | ||||
|  * evaluation for matches: a match is finally adopted only if there is | ||||
| @@ -1293,8 +1330,8 @@ local block_state deflate_slow(s, flush) | ||||
|         if (s->lookahead < MIN_LOOKAHEAD) { | ||||
|             fill_window(s); | ||||
|             if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { | ||||
| 	        return need_more; | ||||
| 	    } | ||||
|                 return need_more; | ||||
|             } | ||||
|             if (s->lookahead == 0) break; /* flush the current block */ | ||||
|         } | ||||
|  | ||||
| @@ -1316,14 +1353,19 @@ local block_state deflate_slow(s, flush) | ||||
|              * of window index 0 (in particular we have to avoid a match | ||||
|              * of the string with itself at the start of the input file). | ||||
|              */ | ||||
|             if (s->strategy != Z_HUFFMAN_ONLY) { | ||||
|             if (s->strategy < Z_HUFFMAN_ONLY) { | ||||
|                 s->match_length = longest_match (s, hash_head); | ||||
|             } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { | ||||
|                 s->match_length = longest_match_fast (s, hash_head); | ||||
|             } | ||||
|             /* longest_match() sets match_start */ | ||||
|             /* longest_match() or longest_match_fast() sets match_start */ | ||||
|  | ||||
|             if (s->match_length <= 5 && (s->strategy == Z_FILTERED || | ||||
|                  (s->match_length == MIN_MATCH && | ||||
|                   s->strstart - s->match_start > TOO_FAR))) { | ||||
|             if (s->match_length <= 5 && (s->strategy == Z_FILTERED | ||||
| #if TOO_FAR < 32768 | ||||
|                 || (s->match_length == MIN_MATCH && | ||||
|                     s->strstart - s->match_start > TOO_FAR) | ||||
| #endif | ||||
|                 )) { | ||||
|  | ||||
|                 /* If prev_match is also MIN_MATCH, match_start is garbage | ||||
|                  * but we will ignore the current match anyway. | ||||
| @@ -1341,7 +1383,7 @@ local block_state deflate_slow(s, flush) | ||||
|             check_match(s, s->strstart-1, s->prev_match, s->prev_length); | ||||
|  | ||||
|             _tr_tally_dist(s, s->strstart -1 - s->prev_match, | ||||
| 			   s->prev_length - MIN_MATCH, bflush); | ||||
|                            s->prev_length - MIN_MATCH, bflush); | ||||
|  | ||||
|             /* Insert in hash table all strings up to the end of the match. | ||||
|              * strstart-1 and strstart are already inserted. If there is not | ||||
| @@ -1367,8 +1409,8 @@ local block_state deflate_slow(s, flush) | ||||
|              * is longer, truncate the previous match to a single literal. | ||||
|              */ | ||||
|             Tracevv((stderr,"%c", s->window[s->strstart-1])); | ||||
| 	    _tr_tally_lit(s, s->window[s->strstart-1], bflush); | ||||
| 	    if (bflush) { | ||||
|             _tr_tally_lit(s, s->window[s->strstart-1], bflush); | ||||
|             if (bflush) { | ||||
|                 FLUSH_BLOCK_ONLY(s, 0); | ||||
|             } | ||||
|             s->strstart++; | ||||
| @@ -1392,3 +1434,4 @@ local block_state deflate_slow(s, flush) | ||||
|     FLUSH_BLOCK(s, flush == Z_FINISH); | ||||
|     return flush == Z_FINISH ? finish_done : block_done; | ||||
| } | ||||
| #endif /* FASTEST */ | ||||
|   | ||||
| @@ -10,8 +10,8 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #ifndef _DEFLATE_H | ||||
| #define _DEFLATE_H | ||||
| #ifndef DEFLATE_H | ||||
| #define DEFLATE_H | ||||
|  | ||||
| #include "zutil.h" | ||||
|  | ||||
| @@ -269,7 +269,7 @@ typedef struct internal_state { | ||||
| void _tr_init         OF((deflate_state *s)); | ||||
| int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc)); | ||||
| void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len, | ||||
| 			  int eof)); | ||||
|                           int eof)); | ||||
| void _tr_align        OF((deflate_state *s)); | ||||
| void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, | ||||
|                           int eof)); | ||||
| @@ -315,4 +315,4 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, | ||||
|               flush = _tr_tally(s, distance, length)  | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
| #endif /* DEFLATE_H */ | ||||
|   | ||||
							
								
								
									
										95
									
								
								example.c
									
									
									
									
									
								
							
							
						
						
									
										95
									
								
								example.c
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /* example.c -- usage example of the zlib compression library | ||||
|  * Copyright (C) 1995-2003 Jean-loup Gailly. | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h  | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  */ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
| @@ -37,22 +37,22 @@ const char dictionary[] = "hello"; | ||||
| uLong dictId; /* Adler32 value of the dictionary */ | ||||
|  | ||||
| void test_compress      OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
| void test_gzio          OF((const char *out, const char *in,  | ||||
| 		            Byte *uncompr, int uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| void test_gzio          OF((const char *out, const char *in, | ||||
|                             Byte *uncompr, int uncomprLen)); | ||||
| void test_deflate       OF((Byte *compr, uLong comprLen)); | ||||
| void test_inflate       OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| void test_large_deflate OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| void test_large_inflate OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| void test_flush         OF((Byte *compr, uLong *comprLen)); | ||||
| void test_sync          OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| void test_dict_deflate  OF((Byte *compr, uLong comprLen)); | ||||
| void test_dict_inflate  OF((Byte *compr, uLong comprLen, | ||||
| 		            Byte *uncompr, uLong uncomprLen)); | ||||
|                             Byte *uncompr, uLong uncomprLen)); | ||||
| int  main               OF((int argc, char *argv[])); | ||||
|  | ||||
| /* =========================================================================== | ||||
| @@ -75,7 +75,7 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) | ||||
|  | ||||
|     if (strcmp((char*)uncompr, hello)) { | ||||
|         fprintf(stderr, "bad uncompress\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("uncompress(): %s\n", (char *)uncompr); | ||||
|     } | ||||
| @@ -103,11 +103,11 @@ void test_gzio(out, in, uncompr, uncomprLen) | ||||
|     gzputc(file, 'h'); | ||||
|     if (gzputs(file, "ello") != 4) { | ||||
|         fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     if (gzprintf(file, ", %s!", "hello") != 8) { | ||||
|         fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ | ||||
|     gzclose(file); | ||||
| @@ -121,36 +121,41 @@ void test_gzio(out, in, uncompr, uncomprLen) | ||||
|     uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); | ||||
|     if (uncomprLen != len) { | ||||
|         fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     if (strcmp((char*)uncompr, hello)) { | ||||
|         fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("gzread(): %s\n", (char *)uncompr); | ||||
|     } | ||||
|  | ||||
|     pos = gzseek(file, -8L, SEEK_CUR); | ||||
|     if (pos != 6 || gztell(file) != pos) { | ||||
| 	fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", | ||||
| 		(long)pos, (long)gztell(file)); | ||||
| 	exit(1); | ||||
|         fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", | ||||
|                 (long)pos, (long)gztell(file)); | ||||
|         exit(1); | ||||
|     } | ||||
|  | ||||
|     if (gzgetc(file) != ' ') { | ||||
| 	fprintf(stderr, "gzgetc error\n"); | ||||
| 	exit(1); | ||||
|         fprintf(stderr, "gzgetc error\n"); | ||||
|         exit(1); | ||||
|     } | ||||
|  | ||||
|     if (gzungetc(' ', file) != ' ') { | ||||
|         fprintf(stderr, "gzungetc error\n"); | ||||
|         exit(1); | ||||
|     } | ||||
|  | ||||
|     gzgets(file, (char*)uncompr, uncomprLen); | ||||
|     uncomprLen = strlen((char*)uncompr); | ||||
|     if (uncomprLen != 6) { /* "hello!" */ | ||||
|     if (uncomprLen != 7) { /* " hello!" */ | ||||
|         fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     if (strcmp((char*)uncompr, hello+7)) { | ||||
|     if (strcmp((char*)uncompr, hello+6)) { | ||||
|         fprintf(stderr, "bad gzgets after gzseek\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("gzgets() after gzseek: %s\n", (char *)uncompr); | ||||
|     } | ||||
| @@ -231,7 +236,7 @@ void test_inflate(compr, comprLen, uncompr, uncomprLen) | ||||
|  | ||||
|     if (strcmp((char*)uncompr, hello)) { | ||||
|         fprintf(stderr, "bad inflate\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("inflate(): %s\n", (char *)uncompr); | ||||
|     } | ||||
| @@ -266,7 +271,7 @@ void test_large_deflate(compr, comprLen, uncompr, uncomprLen) | ||||
|     CHECK_ERR(err, "deflate"); | ||||
|     if (c_stream.avail_in != 0) { | ||||
|         fprintf(stderr, "deflate not greedy\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|  | ||||
|     /* Feed in already compressed data and switch to no compression: */ | ||||
| @@ -286,7 +291,7 @@ void test_large_deflate(compr, comprLen, uncompr, uncomprLen) | ||||
|     err = deflate(&c_stream, Z_FINISH); | ||||
|     if (err != Z_STREAM_END) { | ||||
|         fprintf(stderr, "deflate should report Z_STREAM_END\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     err = deflateEnd(&c_stream); | ||||
|     CHECK_ERR(err, "deflateEnd"); | ||||
| @@ -316,7 +321,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen) | ||||
|  | ||||
|     for (;;) { | ||||
|         d_stream.next_out = uncompr;            /* discard the output */ | ||||
| 	d_stream.avail_out = (uInt)uncomprLen; | ||||
|         d_stream.avail_out = (uInt)uncomprLen; | ||||
|         err = inflate(&d_stream, Z_NO_FLUSH); | ||||
|         if (err == Z_STREAM_END) break; | ||||
|         CHECK_ERR(err, "large inflate"); | ||||
| @@ -327,7 +332,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen) | ||||
|  | ||||
|     if (d_stream.total_out != 2*uncomprLen + comprLen/2) { | ||||
|         fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("large_inflate(): OK\n"); | ||||
|     } | ||||
| @@ -407,7 +412,7 @@ void test_sync(compr, comprLen, uncompr, uncomprLen) | ||||
|     if (err != Z_DATA_ERROR) { | ||||
|         fprintf(stderr, "inflate should report DATA_ERROR\n"); | ||||
|         /* Because of incorrect adler32 */ | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     err = inflateEnd(&d_stream); | ||||
|     CHECK_ERR(err, "inflateEnd"); | ||||
| @@ -433,7 +438,7 @@ void test_dict_deflate(compr, comprLen) | ||||
|     CHECK_ERR(err, "deflateInit"); | ||||
|  | ||||
|     err = deflateSetDictionary(&c_stream, | ||||
| 			       (const Bytef*)dictionary, sizeof(dictionary)); | ||||
|                                (const Bytef*)dictionary, sizeof(dictionary)); | ||||
|     CHECK_ERR(err, "deflateSetDictionary"); | ||||
|  | ||||
|     dictId = c_stream.adler; | ||||
| @@ -446,7 +451,7 @@ void test_dict_deflate(compr, comprLen) | ||||
|     err = deflate(&c_stream, Z_FINISH); | ||||
|     if (err != Z_STREAM_END) { | ||||
|         fprintf(stderr, "deflate should report Z_STREAM_END\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     err = deflateEnd(&c_stream); | ||||
|     CHECK_ERR(err, "deflateEnd"); | ||||
| @@ -480,14 +485,14 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) | ||||
|     for (;;) { | ||||
|         err = inflate(&d_stream, Z_NO_FLUSH); | ||||
|         if (err == Z_STREAM_END) break; | ||||
| 	if (err == Z_NEED_DICT) { | ||||
| 	    if (d_stream.adler != dictId) { | ||||
| 		fprintf(stderr, "unexpected dictionary"); | ||||
| 		exit(1); | ||||
| 	    } | ||||
| 	    err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, | ||||
| 				       sizeof(dictionary)); | ||||
| 	} | ||||
|         if (err == Z_NEED_DICT) { | ||||
|             if (d_stream.adler != dictId) { | ||||
|                 fprintf(stderr, "unexpected dictionary"); | ||||
|                 exit(1); | ||||
|             } | ||||
|             err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, | ||||
|                                        sizeof(dictionary)); | ||||
|         } | ||||
|         CHECK_ERR(err, "inflate with dict"); | ||||
|     } | ||||
|  | ||||
| @@ -496,7 +501,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) | ||||
|  | ||||
|     if (strcmp((char*)uncompr, hello)) { | ||||
|         fprintf(stderr, "bad inflate with dict\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } else { | ||||
|         printf("inflate with dictionary: %s\n", (char *)uncompr); | ||||
|     } | ||||
| @@ -523,6 +528,9 @@ int main(argc, argv) | ||||
|         fprintf(stderr, "warning: different zlib version\n"); | ||||
|     } | ||||
|  | ||||
|     printf("zlib version %s = 0x%04x, compile flags = 0x%x\n", | ||||
|             ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); | ||||
|  | ||||
|     compr    = (Byte*)calloc((uInt)comprLen, 1); | ||||
|     uncompr  = (Byte*)calloc((uInt)uncomprLen, 1); | ||||
|     /* compr and uncompr are cleared to avoid reading uninitialized | ||||
| @@ -530,13 +538,13 @@ int main(argc, argv) | ||||
|      */ | ||||
|     if (compr == Z_NULL || uncompr == Z_NULL) { | ||||
|         printf("out of memory\n"); | ||||
| 	exit(1); | ||||
|         exit(1); | ||||
|     } | ||||
|     test_compress(compr, comprLen, uncompr, uncomprLen); | ||||
|  | ||||
|     test_gzio((argc > 1 ? argv[1] : TESTFILE), | ||||
|               (argc > 2 ? argv[2] : TESTFILE), | ||||
| 	      uncompr, (int)uncomprLen); | ||||
|               uncompr, (int)uncomprLen); | ||||
|  | ||||
|     test_deflate(compr, comprLen); | ||||
|     test_inflate(compr, comprLen, uncompr, uncomprLen); | ||||
| @@ -554,6 +562,5 @@ int main(argc, argv) | ||||
|     free(compr); | ||||
|     free(uncompr); | ||||
|  | ||||
|     exit(0); | ||||
|     return 0; /* to avoid warning */ | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
							
								
								
									
										378
									
								
								gzio.c
									
									
									
									
									
								
							
							
						
						
									
										378
									
								
								gzio.c
									
									
									
									
									
								
							| @@ -11,7 +11,9 @@ | ||||
|  | ||||
| #include "zutil.h" | ||||
|  | ||||
| #ifndef NO_DUMMY_DECL | ||||
| struct internal_state {int dummy;}; /* for buggy compilers */ | ||||
| #endif | ||||
|  | ||||
| #ifndef Z_BUFSIZE | ||||
| #  ifdef MAXSEG_64K | ||||
| @@ -55,6 +57,8 @@ typedef struct gz_stream { | ||||
|     int      transparent; /* 1 if input file is not a .gz file */ | ||||
|     char     mode;    /* 'w' or 'r' */ | ||||
|     long     startpos; /* start of compressed data in file (header skipped) */ | ||||
|     int      back;    /* one character push-back */ | ||||
|     int      last;    /* true if push-back is last character */ | ||||
| } gz_stream; | ||||
|  | ||||
|  | ||||
| @@ -102,6 +106,7 @@ local gzFile gz_open (path, mode, fd) | ||||
|     s->file = NULL; | ||||
|     s->z_err = Z_OK; | ||||
|     s->z_eof = 0; | ||||
|     s->back = EOF; | ||||
|     s->crc = crc32(0L, Z_NULL, 0); | ||||
|     s->msg = NULL; | ||||
|     s->transparent = 0; | ||||
| @@ -117,17 +122,19 @@ local gzFile gz_open (path, mode, fd) | ||||
|         if (*p == 'r') s->mode = 'r'; | ||||
|         if (*p == 'w' || *p == 'a') s->mode = 'w'; | ||||
|         if (*p >= '0' && *p <= '9') { | ||||
| 	    level = *p - '0'; | ||||
| 	} else if (*p == 'f') { | ||||
| 	  strategy = Z_FILTERED; | ||||
| 	} else if (*p == 'h') { | ||||
| 	  strategy = Z_HUFFMAN_ONLY; | ||||
| 	} else { | ||||
| 	    *m++ = *p; /* copy the mode */ | ||||
| 	} | ||||
|             level = *p - '0'; | ||||
|         } else if (*p == 'f') { | ||||
|           strategy = Z_FILTERED; | ||||
|         } else if (*p == 'h') { | ||||
|           strategy = Z_HUFFMAN_ONLY; | ||||
|         } else if (*p == 'R') { | ||||
|           strategy = Z_RLE; | ||||
|         } else { | ||||
|             *m++ = *p; /* copy the mode */ | ||||
|         } | ||||
|     } while (*p++ && m != fmode + sizeof(fmode)); | ||||
|     if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; | ||||
|      | ||||
|  | ||||
|     if (s->mode == 'w') { | ||||
| #ifdef NO_DEFLATE | ||||
|         err = Z_STREAM_ERROR; | ||||
| @@ -168,17 +175,17 @@ local gzFile gz_open (path, mode, fd) | ||||
|          */ | ||||
|         fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], | ||||
|              Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); | ||||
| 	s->startpos = 10L; | ||||
| 	/* We use 10L instead of ftell(s->file) to because ftell causes an | ||||
|         s->startpos = 10L; | ||||
|         /* We use 10L instead of ftell(s->file) to because ftell causes an | ||||
|          * fflush on some systems. This version of the library doesn't use | ||||
|          * startpos anyway in write mode, so this initialization is not | ||||
|          * necessary. | ||||
|          */ | ||||
|     } else { | ||||
| 	check_header(s); /* skip the .gz header */ | ||||
| 	s->startpos = (ftell(s->file) - s->stream.avail_in); | ||||
|         check_header(s); /* skip the .gz header */ | ||||
|         s->startpos = (ftell(s->file) - s->stream.avail_in); | ||||
|     } | ||||
|      | ||||
|  | ||||
|     return (gzFile)s; | ||||
| } | ||||
|  | ||||
| @@ -223,11 +230,11 @@ int ZEXPORT gzsetparams (file, level, strategy) | ||||
|     /* Make room to allow flushing */ | ||||
|     if (s->stream.avail_out == 0) { | ||||
|  | ||||
| 	s->stream.next_out = s->outbuf; | ||||
| 	if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { | ||||
| 	    s->z_err = Z_ERRNO; | ||||
| 	} | ||||
| 	s->stream.avail_out = Z_BUFSIZE; | ||||
|         s->stream.next_out = s->outbuf; | ||||
|         if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { | ||||
|             s->z_err = Z_ERRNO; | ||||
|         } | ||||
|         s->stream.avail_out = Z_BUFSIZE; | ||||
|     } | ||||
|  | ||||
|     return deflateParams (&(s->stream), level, strategy); | ||||
| @@ -243,14 +250,14 @@ local int get_byte(s) | ||||
| { | ||||
|     if (s->z_eof) return EOF; | ||||
|     if (s->stream.avail_in == 0) { | ||||
| 	errno = 0; | ||||
| 	s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); | ||||
| 	if (s->stream.avail_in == 0) { | ||||
| 	    s->z_eof = 1; | ||||
| 	    if (ferror(s->file)) s->z_err = Z_ERRNO; | ||||
| 	    return EOF; | ||||
| 	} | ||||
| 	s->stream.next_in = s->inbuf; | ||||
|         errno = 0; | ||||
|         s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); | ||||
|         if (s->stream.avail_in == 0) { | ||||
|             s->z_eof = 1; | ||||
|             if (ferror(s->file)) s->z_err = Z_ERRNO; | ||||
|             return EOF; | ||||
|         } | ||||
|         s->stream.next_in = s->inbuf; | ||||
|     } | ||||
|     s->stream.avail_in--; | ||||
|     return *(s->stream.next_in)++; | ||||
| @@ -292,7 +299,7 @@ local void check_header(s) | ||||
|  | ||||
|     /* Peek ahead to check the gzip magic header */ | ||||
|     if (s->stream.next_in[0] != gz_magic[0] || | ||||
| 	s->stream.next_in[1] != gz_magic[1]) { | ||||
|         s->stream.next_in[1] != gz_magic[1]) { | ||||
|         s->transparent = 1; | ||||
|         return; | ||||
|     } | ||||
| @@ -303,27 +310,27 @@ local void check_header(s) | ||||
|     method = get_byte(s); | ||||
|     flags = get_byte(s); | ||||
|     if (method != Z_DEFLATED || (flags & RESERVED) != 0) { | ||||
| 	s->z_err = Z_DATA_ERROR; | ||||
| 	return; | ||||
|         s->z_err = Z_DATA_ERROR; | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     /* Discard time, xflags and OS code: */ | ||||
|     for (len = 0; len < 6; len++) (void)get_byte(s); | ||||
|  | ||||
|     if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ | ||||
| 	len  =  (uInt)get_byte(s); | ||||
| 	len += ((uInt)get_byte(s))<<8; | ||||
| 	/* len is garbage if EOF but the loop below will quit anyway */ | ||||
| 	while (len-- != 0 && get_byte(s) != EOF) ; | ||||
|         len  =  (uInt)get_byte(s); | ||||
|         len += ((uInt)get_byte(s))<<8; | ||||
|         /* len is garbage if EOF but the loop below will quit anyway */ | ||||
|         while (len-- != 0 && get_byte(s) != EOF) ; | ||||
|     } | ||||
|     if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ | ||||
| 	while ((c = get_byte(s)) != 0 && c != EOF) ; | ||||
|         while ((c = get_byte(s)) != 0 && c != EOF) ; | ||||
|     } | ||||
|     if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */ | ||||
| 	while ((c = get_byte(s)) != 0 && c != EOF) ; | ||||
|         while ((c = get_byte(s)) != 0 && c != EOF) ; | ||||
|     } | ||||
|     if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */ | ||||
| 	for (len = 0; len < 2; len++) (void)get_byte(s); | ||||
|         for (len = 0; len < 2; len++) (void)get_byte(s); | ||||
|     } | ||||
|     s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; | ||||
| } | ||||
| @@ -342,21 +349,21 @@ local int destroy (s) | ||||
|     TRYFREE(s->msg); | ||||
|  | ||||
|     if (s->stream.state != NULL) { | ||||
| 	if (s->mode == 'w') { | ||||
|         if (s->mode == 'w') { | ||||
| #ifdef NO_DEFLATE | ||||
| 	    err = Z_STREAM_ERROR; | ||||
|             err = Z_STREAM_ERROR; | ||||
| #else | ||||
| 	    err = deflateEnd(&(s->stream)); | ||||
|             err = deflateEnd(&(s->stream)); | ||||
| #endif | ||||
| 	} else if (s->mode == 'r') { | ||||
| 	    err = inflateEnd(&(s->stream)); | ||||
| 	} | ||||
|         } else if (s->mode == 'r') { | ||||
|             err = inflateEnd(&(s->stream)); | ||||
|         } | ||||
|     } | ||||
|     if (s->file != NULL && fclose(s->file)) { | ||||
| #ifdef ESPIPE | ||||
| 	if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ | ||||
|         if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ | ||||
| #endif | ||||
| 	    err = Z_ERRNO; | ||||
|             err = Z_ERRNO; | ||||
|     } | ||||
|     if (s->z_err < 0) err = s->z_err; | ||||
|  | ||||
| @@ -389,71 +396,83 @@ int ZEXPORT gzread (file, buf, len) | ||||
|     s->stream.next_out = (Bytef*)buf; | ||||
|     s->stream.avail_out = len; | ||||
|  | ||||
|     if (s->stream.avail_out && s->back != EOF) { | ||||
|         *next_out++ = s->back; | ||||
|         s->stream.next_out++; | ||||
|         s->stream.avail_out--; | ||||
|         s->back = EOF; | ||||
|         s->stream.total_out++; | ||||
|         if (s->last) { | ||||
|             s->z_err = Z_STREAM_END; | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     while (s->stream.avail_out != 0) { | ||||
|  | ||||
| 	if (s->transparent) { | ||||
| 	    /* Copy first the lookahead bytes: */ | ||||
| 	    uInt n = s->stream.avail_in; | ||||
| 	    if (n > s->stream.avail_out) n = s->stream.avail_out; | ||||
| 	    if (n > 0) { | ||||
| 		zmemcpy(s->stream.next_out, s->stream.next_in, n); | ||||
| 		next_out += n; | ||||
| 		s->stream.next_out = next_out; | ||||
| 		s->stream.next_in   += n; | ||||
| 		s->stream.avail_out -= n; | ||||
| 		s->stream.avail_in  -= n; | ||||
| 	    } | ||||
| 	    if (s->stream.avail_out > 0) { | ||||
| 		s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, | ||||
| 					     s->file); | ||||
| 	    } | ||||
| 	    len -= s->stream.avail_out; | ||||
| 	    s->stream.total_in  += (uLong)len; | ||||
| 	    s->stream.total_out += (uLong)len; | ||||
|         if (s->transparent) { | ||||
|             /* Copy first the lookahead bytes: */ | ||||
|             uInt n = s->stream.avail_in; | ||||
|             if (n > s->stream.avail_out) n = s->stream.avail_out; | ||||
|             if (n > 0) { | ||||
|                 zmemcpy(s->stream.next_out, s->stream.next_in, n); | ||||
|                 next_out += n; | ||||
|                 s->stream.next_out = next_out; | ||||
|                 s->stream.next_in   += n; | ||||
|                 s->stream.avail_out -= n; | ||||
|                 s->stream.avail_in  -= n; | ||||
|             } | ||||
|             if (s->stream.avail_out > 0) { | ||||
|                 s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, | ||||
|                                              s->file); | ||||
|             } | ||||
|             len -= s->stream.avail_out; | ||||
|             s->stream.total_in  += (uLong)len; | ||||
|             s->stream.total_out += (uLong)len; | ||||
|             if (len == 0) s->z_eof = 1; | ||||
| 	    return (int)len; | ||||
| 	} | ||||
|             return (int)len; | ||||
|         } | ||||
|         if (s->stream.avail_in == 0 && !s->z_eof) { | ||||
|  | ||||
|             errno = 0; | ||||
|             s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); | ||||
|             if (s->stream.avail_in == 0) { | ||||
|                 s->z_eof = 1; | ||||
| 		if (ferror(s->file)) { | ||||
| 		    s->z_err = Z_ERRNO; | ||||
| 		    break; | ||||
| 		} | ||||
|                 if (ferror(s->file)) { | ||||
|                     s->z_err = Z_ERRNO; | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|             s->stream.next_in = s->inbuf; | ||||
|         } | ||||
|         s->z_err = inflate(&(s->stream), Z_NO_FLUSH); | ||||
|  | ||||
| 	if (s->z_err == Z_STREAM_END) { | ||||
| 	    /* Check CRC and original size */ | ||||
| 	    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); | ||||
| 	    start = s->stream.next_out; | ||||
|         if (s->z_err == Z_STREAM_END) { | ||||
|             /* Check CRC and original size */ | ||||
|             s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); | ||||
|             start = s->stream.next_out; | ||||
|  | ||||
| 	    if (getLong(s) != s->crc) { | ||||
| 		s->z_err = Z_DATA_ERROR; | ||||
| 	    } else { | ||||
| 	        (void)getLong(s); | ||||
|             if (getLong(s) != s->crc) { | ||||
|                 s->z_err = Z_DATA_ERROR; | ||||
|             } else { | ||||
|                 (void)getLong(s); | ||||
|                 /* The uncompressed length returned by above getlong() may | ||||
|                  * be different from s->stream.total_out) in case of | ||||
| 		 * concatenated .gz files. Check for such files: | ||||
| 		 */ | ||||
| 		check_header(s); | ||||
| 		if (s->z_err == Z_OK) { | ||||
| 		    uLong total_in = s->stream.total_in; | ||||
| 		    uLong total_out = s->stream.total_out; | ||||
|                  * concatenated .gz files. Check for such files: | ||||
|                  */ | ||||
|                 check_header(s); | ||||
|                 if (s->z_err == Z_OK) { | ||||
|                     uLong total_in = s->stream.total_in; | ||||
|                     uLong total_out = s->stream.total_out; | ||||
|  | ||||
| 		    inflateReset(&(s->stream)); | ||||
| 		    s->stream.total_in = total_in; | ||||
| 		    s->stream.total_out = total_out; | ||||
| 		    s->crc = crc32(0L, Z_NULL, 0); | ||||
| 		} | ||||
| 	    } | ||||
| 	} | ||||
| 	if (s->z_err != Z_OK || s->z_eof) break; | ||||
|                     inflateReset(&(s->stream)); | ||||
|                     s->stream.total_in = total_in; | ||||
|                     s->stream.total_out = total_out; | ||||
|                     s->crc = crc32(0L, Z_NULL, 0); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if (s->z_err != Z_OK || s->z_eof) break; | ||||
|     } | ||||
|     s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); | ||||
|  | ||||
| @@ -474,6 +493,24 @@ int ZEXPORT gzgetc(file) | ||||
| } | ||||
|  | ||||
|  | ||||
| /* =========================================================================== | ||||
|       Push one byte back onto the stream. | ||||
| */ | ||||
| int ZEXPORT gzungetc(c, file) | ||||
|     int c; | ||||
|     gzFile file; | ||||
| { | ||||
|     gz_stream *s = (gz_stream*)file; | ||||
|  | ||||
|     if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; | ||||
|     s->back = c; | ||||
|     s->stream.total_out--; | ||||
|     s->last = (s->z_err == Z_STREAM_END); | ||||
|     if (s->z_eof) s->z_eof = 0; | ||||
|     return c; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* =========================================================================== | ||||
|       Reads bytes from the compressed file until len-1 characters are | ||||
|    read, or a newline character is read and transferred to buf, or an | ||||
| @@ -533,6 +570,7 @@ int ZEXPORT gzwrite (file, buf, len) | ||||
|     return (int)(len - s->stream.avail_in); | ||||
| } | ||||
|  | ||||
|  | ||||
| /* =========================================================================== | ||||
|      Converts, formats, and writes the args to the compressed file under | ||||
|    control of the format string, as in fprintf. gzprintf returns the number of | ||||
| @@ -547,75 +585,67 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) | ||||
|     va_list va; | ||||
|     int len; | ||||
|  | ||||
|     buf[sizeof(buf) - 1] = 0; | ||||
|     va_start(va, format); | ||||
| #ifdef NO_vsnprintf | ||||
| #  ifdef HAS_vsprintf_void | ||||
|     (void)vsprintf(buf, format, va); | ||||
|     va_end(va); | ||||
|     len = strlen(buf); /* some *sprintf don't return the nb of bytes written */ | ||||
|     if (len <= 0) return 0; | ||||
|     for (len = 0; len < sizeof(buf); len++) | ||||
|         if (buf[len] == 0) break; | ||||
| #  else | ||||
|     len = vsprintf(buf, format, va); | ||||
|     va_end(va); | ||||
|     if (len <= 0 || len >= sizeof(buf)) | ||||
|         return 0; | ||||
| #  endif | ||||
| #else | ||||
| #  ifdef HAS_vsnprintf_void | ||||
|     (void)vsnprintf(buf, sizeof(buf), format, va); | ||||
|     va_end(va); | ||||
|     len = strlen(buf); | ||||
|     if (len <= 0) | ||||
|         return 0; | ||||
| #  else | ||||
|     len = vsnprintf(buf, sizeof(buf), format, va); | ||||
|     va_end(va); | ||||
|     if (len <= 0 || len >= sizeof(buf)) | ||||
|         return 0; | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
|     if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) | ||||
|         return 0; | ||||
|     return gzwrite(file, buf, (unsigned)len); | ||||
| } | ||||
| #else /* not ANSI C */ | ||||
|  | ||||
| int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | ||||
| 	               a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) | ||||
|                        a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) | ||||
|     gzFile file; | ||||
|     const char *format; | ||||
|     int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | ||||
| 	a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; | ||||
|         a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; | ||||
| { | ||||
|     char buf[Z_PRINTF_BUFSIZE]; | ||||
|     int len; | ||||
|  | ||||
|     buf[sizeof(buf) - 1] = 0; | ||||
| #ifdef NO_snprintf | ||||
| #  ifdef HAS_sprintf_void | ||||
|     sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, | ||||
| 	    a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|     len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */ | ||||
|     if (len <= 0) return 0; | ||||
|             a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|     for (len = 0; len < sizeof(buf); len++) | ||||
|         if (buf[len] == 0) break; | ||||
| #  else | ||||
|     len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, | ||||
| 	        a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|     if (len <= 0 || len >= sizeof(buf)) | ||||
|         return 0; | ||||
|                 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
| #  endif | ||||
| #else | ||||
| #  ifdef HAS_snprintf_void | ||||
|     snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, | ||||
| 	     a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|              a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|     len = strlen(buf); | ||||
|     if (len <= 0) | ||||
|         return 0; | ||||
| #  else | ||||
|     len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, | ||||
| 	         a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
|     if (len <= 0 || len >= sizeof(buf)) | ||||
|         return 0; | ||||
|                  a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
|     if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) | ||||
|         return 0; | ||||
|     return gzwrite(file, buf, len); | ||||
| } | ||||
| #endif | ||||
| @@ -677,14 +707,14 @@ local int do_flush (file, flush) | ||||
|         if (done) break; | ||||
|         s->z_err = deflate(&(s->stream), flush); | ||||
|  | ||||
| 	/* Ignore the second of two consecutive flushes: */ | ||||
| 	if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; | ||||
|         /* Ignore the second of two consecutive flushes: */ | ||||
|         if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; | ||||
|  | ||||
|         /* deflate has finished flushing only when it hasn't used up | ||||
|          * all the available space in the output buffer:  | ||||
|          * all the available space in the output buffer: | ||||
|          */ | ||||
|         done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); | ||||
|   | ||||
|  | ||||
|         if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; | ||||
|     } | ||||
|     return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err; | ||||
| @@ -719,97 +749,105 @@ z_off_t ZEXPORT gzseek (file, offset, whence) | ||||
|     gz_stream *s = (gz_stream*)file; | ||||
|  | ||||
|     if (s == NULL || whence == SEEK_END || | ||||
| 	s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { | ||||
| 	return -1L; | ||||
|         s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { | ||||
|         return -1L; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     if (s->mode == 'w') { | ||||
| #ifdef NO_DEFLATE | ||||
| 	return -1L; | ||||
|         return -1L; | ||||
| #else | ||||
| 	if (whence == SEEK_SET) { | ||||
| 	    offset -= s->stream.total_in; | ||||
| 	} | ||||
| 	if (offset < 0) return -1L; | ||||
|         if (whence == SEEK_SET) { | ||||
|             offset -= s->stream.total_in; | ||||
|         } | ||||
|         if (offset < 0) return -1L; | ||||
|  | ||||
| 	/* At this point, offset is the number of zero bytes to write. */ | ||||
| 	if (s->inbuf == Z_NULL) { | ||||
| 	    s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ | ||||
|         /* At this point, offset is the number of zero bytes to write. */ | ||||
|         if (s->inbuf == Z_NULL) { | ||||
|             s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ | ||||
|             if (s->inbuf == Z_NULL) return -1L; | ||||
| 	    zmemzero(s->inbuf, Z_BUFSIZE); | ||||
| 	} | ||||
| 	while (offset > 0)  { | ||||
| 	    uInt size = Z_BUFSIZE; | ||||
| 	    if (offset < Z_BUFSIZE) size = (uInt)offset; | ||||
|             zmemzero(s->inbuf, Z_BUFSIZE); | ||||
|         } | ||||
|         while (offset > 0)  { | ||||
|             uInt size = Z_BUFSIZE; | ||||
|             if (offset < Z_BUFSIZE) size = (uInt)offset; | ||||
|  | ||||
| 	    size = gzwrite(file, s->inbuf, size); | ||||
| 	    if (size == 0) return -1L; | ||||
|             size = gzwrite(file, s->inbuf, size); | ||||
|             if (size == 0) return -1L; | ||||
|  | ||||
| 	    offset -= size; | ||||
| 	} | ||||
| 	return (z_off_t)s->stream.total_in; | ||||
|             offset -= size; | ||||
|         } | ||||
|         return (z_off_t)s->stream.total_in; | ||||
| #endif | ||||
|     } | ||||
|     /* Rest of function is for reading only */ | ||||
|  | ||||
|     /* compute absolute position */ | ||||
|     if (whence == SEEK_CUR) { | ||||
| 	offset += s->stream.total_out; | ||||
|         offset += s->stream.total_out; | ||||
|     } | ||||
|     if (offset < 0) return -1L; | ||||
|  | ||||
|     if (s->transparent) { | ||||
| 	/* map to fseek */ | ||||
| 	s->stream.avail_in = 0; | ||||
| 	s->stream.next_in = s->inbuf; | ||||
|         /* map to fseek */ | ||||
|         s->back = EOF; | ||||
|         s->stream.avail_in = 0; | ||||
|         s->stream.next_in = s->inbuf; | ||||
|         if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; | ||||
|  | ||||
| 	s->stream.total_in = s->stream.total_out = (uLong)offset; | ||||
| 	return offset; | ||||
|         s->stream.total_in = s->stream.total_out = (uLong)offset; | ||||
|         return offset; | ||||
|     } | ||||
|  | ||||
|     /* For a negative seek, rewind and use positive seek */ | ||||
|     if ((uLong)offset >= s->stream.total_out) { | ||||
| 	offset -= s->stream.total_out; | ||||
|         offset -= s->stream.total_out; | ||||
|     } else if (gzrewind(file) < 0) { | ||||
| 	return -1L; | ||||
|         return -1L; | ||||
|     } | ||||
|     /* offset is now the number of bytes to skip. */ | ||||
|  | ||||
|     if (offset != 0 && s->outbuf == Z_NULL) { | ||||
| 	s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); | ||||
|         s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); | ||||
|         if (s->outbuf == Z_NULL) return -1L; | ||||
|     } | ||||
|     if (offset && s->back != EOF) { | ||||
|         s->back == EOF; | ||||
|         s->stream.total_out++; | ||||
|         offset--; | ||||
|         if (s->last) s->z_err = Z_STREAM_END; | ||||
|     } | ||||
|     while (offset > 0)  { | ||||
| 	int size = Z_BUFSIZE; | ||||
| 	if (offset < Z_BUFSIZE) size = (int)offset; | ||||
|         int size = Z_BUFSIZE; | ||||
|         if (offset < Z_BUFSIZE) size = (int)offset; | ||||
|  | ||||
| 	size = gzread(file, s->outbuf, (uInt)size); | ||||
| 	if (size <= 0) return -1L; | ||||
| 	offset -= size; | ||||
|         size = gzread(file, s->outbuf, (uInt)size); | ||||
|         if (size <= 0) return -1L; | ||||
|         offset -= size; | ||||
|     } | ||||
|     return (z_off_t)s->stream.total_out; | ||||
| } | ||||
|  | ||||
| /* =========================================================================== | ||||
|      Rewinds input file.  | ||||
|      Rewinds input file. | ||||
| */ | ||||
| int ZEXPORT gzrewind (file) | ||||
|     gzFile file; | ||||
| { | ||||
|     gz_stream *s = (gz_stream*)file; | ||||
|      | ||||
|  | ||||
|     if (s == NULL || s->mode != 'r') return -1; | ||||
|  | ||||
|     s->z_err = Z_OK; | ||||
|     s->z_eof = 0; | ||||
|     s->back = EOF; | ||||
|     s->stream.avail_in = 0; | ||||
|     s->stream.next_in = s->inbuf; | ||||
|     s->crc = crc32(0L, Z_NULL, 0); | ||||
| 	 | ||||
|  | ||||
|     if (s->startpos == 0) { /* not a compressed file */ | ||||
| 	rewind(s->file); | ||||
| 	return 0; | ||||
|         fseek(s->file, 0L, SEEK_SET);   /* rewind() is not always available */ | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     (void) inflateReset(&s->stream); | ||||
| @@ -835,7 +873,7 @@ int ZEXPORT gzeof (file) | ||||
|     gzFile file; | ||||
| { | ||||
|     gz_stream *s = (gz_stream*)file; | ||||
|      | ||||
|  | ||||
|     return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; | ||||
| } | ||||
|  | ||||
| @@ -885,7 +923,7 @@ int ZEXPORT gzclose (file) | ||||
|  | ||||
|     if (s->mode == 'w') { | ||||
| #ifdef NO_DEFLATE | ||||
| 	return Z_STREAM_ERROR; | ||||
|         return Z_STREAM_ERROR; | ||||
| #else | ||||
|         err = do_flush (file, Z_FINISH); | ||||
|         if (err != Z_OK) return destroy((gz_stream*)file); | ||||
| @@ -904,7 +942,7 @@ int ZEXPORT gzclose (file) | ||||
|    errnum is set to Z_ERRNO and the application may consult errno | ||||
|    to get the exact error code. | ||||
| */ | ||||
| const char*  ZEXPORT gzerror (file, errnum) | ||||
| const char * ZEXPORT gzerror (file, errnum) | ||||
|     gzFile file; | ||||
|     int *errnum; | ||||
| { | ||||
| @@ -930,3 +968,17 @@ const char*  ZEXPORT gzerror (file, errnum) | ||||
|     strcat(s->msg, m); | ||||
|     return (const char*)s->msg; | ||||
| } | ||||
|  | ||||
| /* =========================================================================== | ||||
|      Clear the error and end-of-file flags, and do the same for the real file. | ||||
| */ | ||||
| void ZEXPORT gzclearerr (file) | ||||
|     gzFile file; | ||||
| { | ||||
|     gz_stream *s = (gz_stream*)file; | ||||
|  | ||||
|     if (s == NULL) return; | ||||
|     if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; | ||||
|     s->z_eof = 0; | ||||
|     clearerr(s->file); | ||||
| } | ||||
|   | ||||
							
								
								
									
										15
									
								
								infback.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								infback.c
									
									
									
									
									
								
							| @@ -151,7 +151,7 @@ struct inflate_state FAR *state; | ||||
|             if (have == 0) { \ | ||||
|                 next = Z_NULL; \ | ||||
|                 ret = Z_BUF_ERROR; \ | ||||
|                 goto leave; \ | ||||
|                 goto inf_leave; \ | ||||
|             } \ | ||||
|         } \ | ||||
|     } while (0) | ||||
| @@ -203,7 +203,7 @@ struct inflate_state FAR *state; | ||||
|             left = state->wsize; \ | ||||
|             if (out(out_desc, put, left)) { \ | ||||
|                 ret = Z_BUF_ERROR; \ | ||||
|                 goto leave; \ | ||||
|                 goto inf_leave; \ | ||||
|             } \ | ||||
|         } \ | ||||
|     } while (0) | ||||
| @@ -582,19 +582,19 @@ void FAR *out_desc; | ||||
|                 if (out(out_desc, state->window, state->wsize - left)) | ||||
|                     ret = Z_BUF_ERROR; | ||||
|             } | ||||
|             goto leave; | ||||
|             goto inf_leave; | ||||
|  | ||||
|         case BAD: | ||||
|             ret = Z_DATA_ERROR; | ||||
|             goto leave; | ||||
|             goto inf_leave; | ||||
|  | ||||
|         default:                /* can't happen, but makes compilers happy */ | ||||
|             ret = Z_STREAM_ERROR; | ||||
|             goto leave; | ||||
|             goto inf_leave; | ||||
|         } | ||||
|  | ||||
|     /* Return unused input */ | ||||
|   leave: | ||||
|   inf_leave: | ||||
|     strm->next_in = next; | ||||
|     strm->avail_in = have; | ||||
|     return ret; | ||||
| @@ -603,11 +603,8 @@ void FAR *out_desc; | ||||
| int ZEXPORT inflateBackEnd(strm) | ||||
| z_stream FAR *strm; | ||||
| { | ||||
|     struct inflate_state FAR *state; | ||||
|  | ||||
|     if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == Z_NULL) | ||||
|         return Z_STREAM_ERROR; | ||||
|     state = (struct inflate_state FAR *)strm->state; | ||||
|     ZFREE(strm, strm->state); | ||||
|     strm->state = Z_NULL; | ||||
|     Tracev((stderr, "inflate: end\n")); | ||||
|   | ||||
| @@ -133,7 +133,7 @@ unsigned start;         /* inflate()'s starting value for strm->avail_out */ | ||||
|                     hold += (unsigned long)(PUP(in)) << bits; | ||||
|                     bits += 8; | ||||
|                 } | ||||
|                 len += hold & ((1U << op) - 1); | ||||
|                 len += (unsigned)hold & ((1U << op) - 1); | ||||
|                 hold >>= op; | ||||
|                 bits -= op; | ||||
|             } | ||||
| @@ -161,7 +161,7 @@ unsigned start;         /* inflate()'s starting value for strm->avail_out */ | ||||
|                         bits += 8; | ||||
|                     } | ||||
|                 } | ||||
|                 dist += hold & ((1U << op) - 1); | ||||
|                 dist += (unsigned)hold & ((1U << op) - 1); | ||||
|                 hold >>= op; | ||||
|                 bits -= op; | ||||
|                 Tracevv((stderr, "inflate:         distance %u\n", dist)); | ||||
|   | ||||
							
								
								
									
										63
									
								
								inflate.c
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								inflate.c
									
									
									
									
									
								
							| @@ -70,14 +70,14 @@ | ||||
|  * - Changed many types to unsigned or unsigned short to avoid warnings | ||||
|  * - Added inflateCopy() function | ||||
|  * | ||||
|  * 1.2.0	9 Mar 2003 | ||||
|  * 1.2.0        9 Mar 2003 | ||||
|  * - Changed inflateBack() interface to provide separate opaque descriptors | ||||
|  *   for the in() and out() functions | ||||
|  * - Changed inflateBack() argument and in_func typedef to swap the length | ||||
|  *   and buffer address return values for the input function | ||||
|  * - Check next_in and next_out for Z_NULL on entry to inflate() | ||||
|  * | ||||
|  * Remainder of change history is in ChangeLog in zlib distribution. | ||||
|  * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. | ||||
|  */ | ||||
|  | ||||
| #include "zutil.h" | ||||
| @@ -147,8 +147,12 @@ int stream_size; | ||||
|         state->wrap = 0; | ||||
|         windowBits = -windowBits; | ||||
|     } | ||||
|     else | ||||
|         state->wrap = 1; | ||||
|     else { | ||||
|         state->wrap = (windowBits >> 4) + 1; | ||||
| #ifdef GUNZIP | ||||
|         windowBits &= 15; | ||||
| #endif | ||||
|     } | ||||
|     if (windowBits < 8 || windowBits > 15) { | ||||
|         ZFREE(strm, state); | ||||
|         strm->state = Z_NULL; | ||||
| @@ -403,7 +407,7 @@ unsigned out; | ||||
|    if there is no input available. */ | ||||
| #define PULLBYTE() \ | ||||
|     do { \ | ||||
|         if (have == 0) goto leave; \ | ||||
|         if (have == 0) goto inf_leave; \ | ||||
|         have--; \ | ||||
|         hold += (unsigned long)(*next++) << bits; \ | ||||
|         bits += 8; \ | ||||
| @@ -502,14 +506,14 @@ unsigned out; | ||||
|    complete that state.  Those states are copying stored data, writing a | ||||
|    literal byte, and copying a matching string. | ||||
|  | ||||
|    When returning, a "goto leave" is used to update the total counters, update | ||||
|    the check value, and determine whether any progress has been made during | ||||
|    that inflate() call in order to return the proper return code.  Progress is | ||||
|    defined as a change in either strm->avail_in or strm->avail_out.  When there | ||||
|    is a window, goto leave will update the window with the last output written. | ||||
|    If a goto leave occurs in the middle of decompression and there is no window | ||||
|    currently, goto leave will create one and copy output to the window for the | ||||
|    next call of inflate(). | ||||
|    When returning, a "goto inf_leave" is used to update the total counters, | ||||
|    update the check value, and determine whether any progress has been made | ||||
|    during that inflate() call in order to return the proper return code. | ||||
|    Progress is defined as a change in either strm->avail_in or strm->avail_out. | ||||
|    When there is a window, goto inf_leave will update the window with the last | ||||
|    output written.  If a goto inf_leave occurs in the middle of decompression | ||||
|    and there is no window currently, goto inf_leave will create one and copy | ||||
|    output to the window for the next call of inflate(). | ||||
|  | ||||
|    In this implementation, the flush parameter of inflate() only affects the | ||||
|    return code (per zlib.h).  inflate() always writes as much as possible to | ||||
| @@ -562,16 +566,19 @@ int flush; | ||||
|             } | ||||
|             NEEDBITS(16); | ||||
| #ifdef GUNZIP | ||||
|             if (hold == 0x8b1f) {       /* gzip header */ | ||||
|             if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */ | ||||
|                 state->check = crc32(0L, Z_NULL, 0); | ||||
|                 CRC2(state->check, hold); | ||||
|                 INITBITS(); | ||||
|                 state->mode = FLAGS; | ||||
|                 break; | ||||
|             } | ||||
|             state->flags = 0;                   /* expect zlib header */ | ||||
|             state->flags = 0;           /* expect zlib header */ | ||||
|             if (!(state->wrap & 1) ||   /* check if zlib header allowed */ | ||||
| #else | ||||
|             if ( | ||||
| #endif | ||||
|             if (((BITS(8) << 8) + (hold >> 8)) % 31) { | ||||
|                 ((BITS(8) << 8) + (hold >> 8)) % 31) { | ||||
|                 strm->msg = (char *)"incorrect header check"; | ||||
|                 state->mode = BAD; | ||||
|                 break; | ||||
| @@ -638,12 +645,12 @@ int flush; | ||||
|                     next += copy; | ||||
|                     state->length -= copy; | ||||
|                 } | ||||
|                 if (state->length) goto leave; | ||||
|                 if (state->length) goto inf_leave; | ||||
|             } | ||||
|             state->mode = NAME; | ||||
|         case NAME: | ||||
|             if (state->flags & 0x0800) { | ||||
|                 if (have == 0) goto leave; | ||||
|                 if (have == 0) goto inf_leave; | ||||
|                 copy = 0; | ||||
|                 do { | ||||
|                     len = (unsigned)(next[copy++]); | ||||
| @@ -652,12 +659,12 @@ int flush; | ||||
|                     state->check = crc32(state->check, next, copy); | ||||
|                 have -= copy; | ||||
|                 next += copy; | ||||
|                 if (len) goto leave; | ||||
|                 if (len) goto inf_leave; | ||||
|             } | ||||
|             state->mode = COMMENT; | ||||
|         case COMMENT: | ||||
|             if (state->flags & 0x1000) { | ||||
|                 if (have == 0) goto leave; | ||||
|                 if (have == 0) goto inf_leave; | ||||
|                 copy = 0; | ||||
|                 do { | ||||
|                     len = (unsigned)(next[copy++]); | ||||
| @@ -666,7 +673,7 @@ int flush; | ||||
|                     state->check = crc32(state->check, next, copy); | ||||
|                 have -= copy; | ||||
|                 next += copy; | ||||
|                 if (len) goto leave; | ||||
|                 if (len) goto inf_leave; | ||||
|             } | ||||
|             state->mode = HCRC; | ||||
|         case HCRC: | ||||
| @@ -745,7 +752,7 @@ int flush; | ||||
|             if (copy) { | ||||
|                 if (copy > have) copy = have; | ||||
|                 if (copy > left) copy = left; | ||||
|                 if (copy == 0) goto leave; | ||||
|                 if (copy == 0) goto inf_leave; | ||||
|                 zmemcpy(put, next, copy); | ||||
|                 have -= copy; | ||||
|                 next += copy; | ||||
| @@ -958,7 +965,7 @@ int flush; | ||||
|             Tracevv((stderr, "inflate:         distance %u\n", state->offset)); | ||||
|             state->mode = MATCH; | ||||
|         case MATCH: | ||||
|             if (left == 0) goto leave; | ||||
|             if (left == 0) goto inf_leave; | ||||
|             copy = out - left; | ||||
|             if (state->offset > copy) {         /* copy from window */ | ||||
|                 copy = state->offset - copy; | ||||
| @@ -983,7 +990,7 @@ int flush; | ||||
|             if (state->length == 0) state->mode = LEN; | ||||
|             break; | ||||
|         case LIT: | ||||
|             if (left == 0) goto leave; | ||||
|             if (left == 0) goto inf_leave; | ||||
|             *put++ = (unsigned char)(state->length); | ||||
|             left--; | ||||
|             state->mode = LEN; | ||||
| @@ -1015,7 +1022,7 @@ int flush; | ||||
|         case LENGTH: | ||||
|             if (state->wrap && state->flags) { | ||||
|                 NEEDBITS(32); | ||||
|                 if (hold != (state->total & 0xffffffff)) { | ||||
|                 if (hold != (state->total & 0xffffffffUL)) { | ||||
|                     strm->msg = (char *)"incorrect length check"; | ||||
|                     state->mode = BAD; | ||||
|                     break; | ||||
| @@ -1027,10 +1034,10 @@ int flush; | ||||
|             state->mode = DONE; | ||||
|         case DONE: | ||||
|             ret = Z_STREAM_END; | ||||
|             goto leave; | ||||
|             goto inf_leave; | ||||
|         case BAD: | ||||
|             ret = Z_DATA_ERROR; | ||||
|             goto leave; | ||||
|             goto inf_leave; | ||||
|         case MEM: | ||||
|             return Z_MEM_ERROR; | ||||
|         case SYNC: | ||||
| @@ -1044,7 +1051,7 @@ int flush; | ||||
|        error.  Call updatewindow() to create and/or update the window state. | ||||
|        Note: a memory error from inflate() is non-recoverable. | ||||
|      */ | ||||
|   leave: | ||||
|   inf_leave: | ||||
|     RESTORE(); | ||||
|     if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) | ||||
|         if (updatewindow(strm, out)) { | ||||
|   | ||||
| @@ -80,7 +80,7 @@ typedef enum { | ||||
| struct inflate_state { | ||||
|     inflate_mode mode;          /* current inflate mode */ | ||||
|     int last;                   /* true if processing last block */ | ||||
|     int wrap;                   /* true to process header and trailer */ | ||||
|     int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */ | ||||
|     int havedict;               /* true if dictionary provided */ | ||||
|     int flags;                  /* gzip header method and flags (0 if zlib) */ | ||||
|     unsigned long check;        /* protected copy of check value */ | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #define MAXBITS 15 | ||||
|  | ||||
| const char inflate_copyright[] = | ||||
|    " inflate 1.2.0 Copyright 1995-2003 Mark Adler "; | ||||
|    " inflate 1.2.0.2 Copyright 1995-2003 Mark Adler "; | ||||
| /* | ||||
|   If you use the zlib library in a product, an acknowledgment is welcome | ||||
|   in the documentation of your product. If for some reason you cannot | ||||
| @@ -62,7 +62,7 @@ unsigned short FAR *work; | ||||
|         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; | ||||
|     static const unsigned short lext[31] = { /* Length codes 257..285 extra */ | ||||
|         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, | ||||
|         19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 194}; | ||||
|         19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 67, 201}; | ||||
|     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ | ||||
|         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | ||||
|         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | ||||
|   | ||||
							
								
								
									
										33
									
								
								minigzip.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								minigzip.c
									
									
									
									
									
								
							| @@ -1,6 +1,7 @@ | ||||
| /* minigzip.c -- simulate gzip using the zlib compression library | ||||
|  * Copyright (C) 1995-2002 Jean-loup Gailly. | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h  | ||||
|  * Adapted for Z_RLE by Cosmin Truta, 2003. | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  */ | ||||
|  | ||||
| /* | ||||
| @@ -112,7 +113,7 @@ void gz_compress(in, out) | ||||
|     if (gz_compress_mmap(in, out) == Z_OK) return; | ||||
| #endif | ||||
|     for (;;) { | ||||
|         len = fread(buf, 1, sizeof(buf), in); | ||||
|         len = (int)fread(buf, 1, sizeof(buf), in); | ||||
|         if (ferror(in)) { | ||||
|             perror("fread"); | ||||
|             exit(1); | ||||
| @@ -147,7 +148,7 @@ int gz_compress_mmap(in, out) | ||||
|     if (buf_len <= 0) return Z_ERRNO; | ||||
|  | ||||
|     /* Now do the actual mmap: */ | ||||
|     buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);  | ||||
|     buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); | ||||
|     if (buf == (caddr_t)(-1)) return Z_ERRNO; | ||||
|  | ||||
|     /* Compress the whole file at once: */ | ||||
| @@ -179,8 +180,8 @@ void gz_uncompress(in, out) | ||||
|         if (len == 0) break; | ||||
|  | ||||
|         if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { | ||||
| 	    error("failed fwrite"); | ||||
| 	} | ||||
|             error("failed fwrite"); | ||||
|         } | ||||
|     } | ||||
|     if (fclose(out)) error("failed fclose"); | ||||
|  | ||||
| @@ -229,7 +230,7 @@ void file_uncompress(file) | ||||
|     char *infile, *outfile; | ||||
|     FILE  *out; | ||||
|     gzFile in; | ||||
|     int len = strlen(file); | ||||
|     int len = (int)strlen(file); | ||||
|  | ||||
|     strcpy(buf, file); | ||||
|  | ||||
| @@ -260,10 +261,11 @@ void file_uncompress(file) | ||||
|  | ||||
|  | ||||
| /* =========================================================================== | ||||
|  * Usage:  minigzip [-d] [-f] [-h] [-1 to -9] [files...] | ||||
|  * Usage:  minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...] | ||||
|  *   -d : decompress | ||||
|  *   -f : compress with Z_FILTERED | ||||
|  *   -h : compress with Z_HUFFMAN_ONLY | ||||
|  *   -r : compress with Z_RLE | ||||
|  *   -1 to -9 : compression level | ||||
|  */ | ||||
|  | ||||
| @@ -282,16 +284,18 @@ int main(argc, argv) | ||||
|  | ||||
|     while (argc > 0) { | ||||
|       if (strcmp(*argv, "-d") == 0) | ||||
| 	uncompr = 1; | ||||
|         uncompr = 1; | ||||
|       else if (strcmp(*argv, "-f") == 0) | ||||
| 	outmode[3] = 'f'; | ||||
|         outmode[3] = 'f'; | ||||
|       else if (strcmp(*argv, "-h") == 0) | ||||
| 	outmode[3] = 'h'; | ||||
|         outmode[3] = 'h'; | ||||
|       else if (strcmp(*argv, "-r") == 0) | ||||
|         outmode[3] = 'R'; | ||||
|       else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && | ||||
| 	       (*argv)[2] == 0) | ||||
| 	outmode[2] = (*argv)[1]; | ||||
|                (*argv)[2] == 0) | ||||
|         outmode[2] = (*argv)[1]; | ||||
|       else | ||||
| 	break; | ||||
|         break; | ||||
|       argc--, argv++; | ||||
|     } | ||||
|     if (argc == 0) { | ||||
| @@ -315,6 +319,5 @@ int main(argc, argv) | ||||
|             } | ||||
|         } while (argv++, --argc); | ||||
|     } | ||||
|     exit(0); | ||||
|     return 0; /* to avoid warning */ | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
							
								
								
									
										109
									
								
								msdos/Makefile.bor
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								msdos/Makefile.bor
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| # Makefile for zlib | ||||
| # Borland C++ | ||||
| # Updated for zlib-1.2.x by Cosmin Truta, 15-Mar-2003. | ||||
|  | ||||
| # To use, do "make -fmakefile.bor" | ||||
| # To compile in small model, set below: MODEL=s | ||||
|  | ||||
| # WARNING: the small model is supported but only for small values of | ||||
| # MAX_WBITS and MAX_MEM_LEVEL. For example: | ||||
| #    -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| # If you wish to reduce the memory requirements (default 256K for big | ||||
| # objects plus a few K), you can add to the LOC macro below: | ||||
| #   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | ||||
| # See zconf.h for details about the memory requirements. | ||||
|  | ||||
| # ------------ Turbo C++, Borland C++ ------------ | ||||
|  | ||||
| #    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) | ||||
| #    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added | ||||
| #    to the declaration of LOC here: | ||||
| LOC = $(LOCAL_ZLIB) | ||||
|  | ||||
| # type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. | ||||
| CPU_TYP = 0 | ||||
|  | ||||
| # memory model: one of s, m, c, l (small, medium, compact, large) | ||||
| MODEL=l | ||||
|  | ||||
| # replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version | ||||
| CC=bcc | ||||
| LD=bcc | ||||
| AR=tlib | ||||
|  | ||||
| # compiler flags | ||||
| # replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 | ||||
| CFLAGS=-O2 -Z -m$(MODEL) $(LOC) | ||||
|  | ||||
| LDFLAGS=-m$(MODEL) -f- | ||||
|  | ||||
|  | ||||
| # variables | ||||
| ZLIB_LIB = zlib_$(MODEL).lib | ||||
|  | ||||
| OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj | ||||
| OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||||
| OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj | ||||
| OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj | ||||
|  | ||||
|  | ||||
| # targets | ||||
| all: $(ZLIB_LIB) example.exe minigzip.exe | ||||
|  | ||||
| .c.obj: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| adler32.obj: adler32.c zlib.h zconf.h | ||||
|  | ||||
| compress.obj: compress.c zlib.h zconf.h | ||||
|  | ||||
| crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||||
|  | ||||
| gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h | ||||
|  | ||||
| inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||||
|  | ||||
| trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||||
|  | ||||
| uncompr.obj: uncompr.c zlib.h zconf.h | ||||
|  | ||||
| zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| example.obj: example.c zlib.h zconf.h | ||||
|  | ||||
| minigzip.obj: minigzip.c zlib.h zconf.h | ||||
|  | ||||
|  | ||||
| # the command line is cut to fit in the MS-DOS 128 byte limit: | ||||
| $(ZLIB_LIB): $(OBJ1) $(OBJ2) | ||||
| 	-del $(ZLIB_LIB) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP1) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP2) | ||||
|  | ||||
| example.exe: example.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) | ||||
|  | ||||
| minigzip.exe: minigzip.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) | ||||
|  | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d | ||||
|  | ||||
| clean: | ||||
| 	-del *.obj | ||||
| 	-del *.exe | ||||
| 	-del *.lib | ||||
| 	-del zlib_$(MODEL).bak | ||||
| 	-del foo.gz | ||||
							
								
								
									
										94
									
								
								msdos/Makefile.tc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								msdos/Makefile.tc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| # Makefile for zlib | ||||
| # Turbo C 2.01, Turbo C++ 1.01 | ||||
| # Updated for zlib-1.2.x by Cosmin Truta, 15-Mar-2003. | ||||
|  | ||||
| # To use, do "make -fmakefile.tc" | ||||
| # To compile in small model, set below: MODEL=s | ||||
|  | ||||
| # WARNING: the small model is supported but only for small values of | ||||
| # MAX_WBITS and MAX_MEM_LEVEL. For example: | ||||
| #    -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| # If you wish to reduce the memory requirements (default 256K for big | ||||
| # objects plus a few K), you can add to CFLAGS below: | ||||
| #   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | ||||
| # See zconf.h for details about the memory requirements. | ||||
|  | ||||
| # ------------ Turbo C 2.01, Turbo C++ 1.01 ------------ | ||||
| MODEL=l | ||||
| CC=tcc | ||||
| LD=tcc | ||||
| AR=tlib | ||||
| # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| CFLAGS=-O2 -G -Z -m$(MODEL) | ||||
| LDFLAGS=-m$(MODEL) -f- | ||||
|  | ||||
|  | ||||
| # variables | ||||
| ZLIB_LIB = zlib_$(MODEL).lib | ||||
|  | ||||
| OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj | ||||
| OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||||
| OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj | ||||
| OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj | ||||
|  | ||||
|  | ||||
| # targets | ||||
| all: $(ZLIB_LIB) example.exe minigzip.exe | ||||
|  | ||||
| .c.obj: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| adler32.obj: adler32.c zlib.h zconf.h | ||||
|  | ||||
| compress.obj: compress.c zlib.h zconf.h | ||||
|  | ||||
| crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||||
|  | ||||
| gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h | ||||
|  | ||||
| inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||||
|  | ||||
| trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||||
|  | ||||
| uncompr.obj: uncompr.c zlib.h zconf.h | ||||
|  | ||||
| zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| example.obj: example.c zlib.h zconf.h | ||||
|  | ||||
| minigzip.obj: minigzip.c zlib.h zconf.h | ||||
|  | ||||
|  | ||||
| # the command line is cut to fit in the MS-DOS 128 byte limit: | ||||
| $(ZLIB_LIB): $(OBJ1) $(OBJ2) | ||||
| 	-del $(ZLIB_LIB) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP1) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP2) | ||||
|  | ||||
| example.exe: example.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) | ||||
|  | ||||
| minigzip.exe: minigzip.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) | ||||
|  | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d | ||||
|  | ||||
| clean: | ||||
| 	-del *.obj | ||||
| 	-del *.exe | ||||
| 	-del *.lib | ||||
| 	-del zlib_$(MODEL).bak | ||||
| 	-del foo.gz | ||||
| @@ -1,125 +0,0 @@ | ||||
| # Makefile for zlib | ||||
| # Borland C++   ************ UNTESTED *********** | ||||
|  | ||||
| # To use, do "make -fmakefile.bor" | ||||
| # To compile in small model, set below: MODEL=s | ||||
|  | ||||
| # WARNING: the small model is supported but only for small values of | ||||
| # MAX_WBITS and MAX_MEM_LEVEL. For example: | ||||
| #    -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| # If you wish to reduce the memory requirements (default 256K for big | ||||
| # objects plus a few K), you can add to the LOC macro below: | ||||
| #   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | ||||
| # See zconf.h for details about the memory requirements. | ||||
|  | ||||
| # ------------- Turbo C++, Borland C++ ------------- | ||||
|  | ||||
| #    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) | ||||
| #    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added | ||||
| #    to the declaration of LOC here: | ||||
| LOC = $(LOCAL_ZLIB) | ||||
|  | ||||
| # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. | ||||
| CPU_TYP = 0 | ||||
|  | ||||
| # Memory model: one of s, m, c, l (small, medium, compact, large) | ||||
| MODEL=l | ||||
|  | ||||
| CC=bcc | ||||
| #   replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version | ||||
| LD=$(CC) | ||||
| AR=tlib | ||||
|  | ||||
| # compiler flags | ||||
| CFLAGS=-O2 -Z -m$(MODEL) $(LOC) | ||||
| #   replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 | ||||
|  | ||||
| LDFLAGS=-m$(MODEL) | ||||
|  | ||||
| O=.obj | ||||
|  | ||||
| # variables | ||||
| OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \ | ||||
|   trees$(O) | ||||
| OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\ | ||||
|   trees$(O) | ||||
| OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \ | ||||
|   infutil$(O) inffast$(O) | ||||
| OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | ||||
|   infutil$(O)+inffast$(O) | ||||
|  | ||||
| ZLIB_H = zlib.h zconf.h | ||||
| ZUTIL_H = zutil.h $(ZLIB_H) | ||||
|  | ||||
| ZLIB_LIB = zlib_$(MODEL).lib | ||||
|  | ||||
| all: test | ||||
|  | ||||
| # individual dependencies and action rules: | ||||
| adler32.obj: adler32.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| compress.obj: compress.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| crc32.obj: crc32.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| gzio.obj: gzio.c $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inflate.obj: inflate.c $(ZUTIL_H) infblock.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| trees.obj: trees.c deflate.h $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| uncompr.obj: uncompr.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| zutil.obj: zutil.c $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| example.obj: example.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| minigzip.obj: minigzip.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| # we must cut the command line to fit in the MS/DOS 128 byte limit: | ||||
| $(ZLIB_LIB): $(OBJ1) $(OBJ2) | ||||
| 	del $(ZLIB_LIB) | ||||
| 	$(AR) $(ZLIB_LIB) +$(OBJP1) | ||||
| 	$(AR) $(ZLIB_LIB) +$(OBJP2) | ||||
|  | ||||
| example.exe: example.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) | ||||
|  | ||||
| minigzip.exe: minigzip.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) | ||||
|  | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d  | ||||
|  | ||||
| #clean: | ||||
| #	del *.obj | ||||
| #	del *.exe | ||||
| @@ -1,108 +0,0 @@ | ||||
| # Makefile for zlib | ||||
| # TurboC 2.0 | ||||
|  | ||||
| # To use, do "make -fmakefile.tc" | ||||
| # To compile in small model, set below: MODEL=-ms | ||||
|  | ||||
| # WARNING: the small model is supported but only for small values of | ||||
| # MAX_WBITS and MAX_MEM_LEVEL. For example: | ||||
| #    -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| # If you wish to reduce the memory requirements (default 256K for big | ||||
| # objects plus a few K), you can add to CFLAGS below: | ||||
| #   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 | ||||
| # See zconf.h for details about the memory requirements. | ||||
|  | ||||
| # ------------- Turbo C 2.0 ------------- | ||||
| MODEL=l | ||||
| # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||||
| CFLAGS=-O2 -G -Z -m$(MODEL) | ||||
| CC=tcc -I\tc\include | ||||
| LD=tcc -L\tc\lib | ||||
| AR=tlib | ||||
| LDFLAGS=-m$(MODEL) -f- | ||||
| O=.obj | ||||
|  | ||||
| # variables | ||||
| OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \ | ||||
|   trees$(O) | ||||
| OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\ | ||||
|   trees$(O) | ||||
| OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \ | ||||
|   infutil$(O) inffast$(O) | ||||
| OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\ | ||||
|   infutil$(O)+inffast$(O) | ||||
|  | ||||
| ZLIB_H = zlib.h zconf.h | ||||
| ZUTIL_H = zutil.h $(ZLIB_H) | ||||
|  | ||||
| ZLIB_LIB = zlib_$(MODEL).lib | ||||
|  | ||||
| all: test | ||||
|  | ||||
| adler32.obj: adler32.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| compress.obj: compress.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| crc32.obj: crc32.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| gzio.obj: gzio.c $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inflate.obj: inflate.c $(ZUTIL_H) infblock.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| trees.obj: trees.c deflate.h $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| uncompr.obj: uncompr.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| zutil.obj: zutil.c $(ZUTIL_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| example.obj: example.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| minigzip.obj: minigzip.c $(ZLIB_H) | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| # we must cut the command line to fit in the MS/DOS 128 byte limit: | ||||
| $(ZLIB_LIB): $(OBJ1) $(OBJ2) | ||||
| 	del $(ZLIB_LIB) | ||||
| 	$(AR) $(ZLIB_LIB) +$(OBJP1) | ||||
| 	$(AR) $(ZLIB_LIB) +$(OBJP2) | ||||
|  | ||||
| example.exe: example.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) -eexample.exe example.obj $(ZLIB_LIB) | ||||
|  | ||||
| minigzip.exe: minigzip.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) -eminigzip.exe minigzip.obj $(ZLIB_LIB) | ||||
|  | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d  | ||||
|  | ||||
| #clean: | ||||
| #	del *.obj | ||||
| #	del *.exe | ||||
							
								
								
									
										107
									
								
								old/zlib.3
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								old/zlib.3
									
									
									
									
									
								
							| @@ -1,107 +0,0 @@ | ||||
| .TH ZLIB 3 "11 March 2002" | ||||
| .SH NAME | ||||
| zlib \- compression/decompression library | ||||
| .SH SYNOPSIS | ||||
| [see | ||||
| .I zlib.h | ||||
| for full description] | ||||
| .SH DESCRIPTION | ||||
| The | ||||
| .I zlib | ||||
| library is a general purpose data compression library. | ||||
| The code is thread safe. | ||||
| It provides in-memory compression and decompression functions, | ||||
| including integrity checks of the uncompressed data. | ||||
| This version of the library supports only one compression method (deflation) | ||||
| but other algorithms will be added later and will have the same stream interface. | ||||
| .LP | ||||
| Compression can be done in a single step if the buffers are large enough | ||||
| (for example if an input file is mmap'ed), | ||||
| or can be done by repeated calls of the compression function. | ||||
| In the latter case, | ||||
| the application must provide more input and/or consume the output | ||||
| (providing more output space) before each call. | ||||
| .LP | ||||
| The library also supports reading and writing files in | ||||
| .I gzip | ||||
| (.gz) format | ||||
| with an interface similar to that of stdio. | ||||
| .LP | ||||
| The library does not install any signal handler. The decoder checks | ||||
| the consistency of the compressed data, so the library should never | ||||
| crash even in case of corrupted input. | ||||
| .LP | ||||
| All functions of the compression library are documented in the file | ||||
| .IR zlib.h. | ||||
| The distribution source includes examples of use of the library | ||||
| the files | ||||
| .I example.c | ||||
| and | ||||
| .IR minigzip.c . | ||||
| .LP | ||||
| A Java implementation of | ||||
| .IR zlib | ||||
| is available in the Java Development Kit 1.1 | ||||
| .IP | ||||
| http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html | ||||
| .LP | ||||
| A Perl interface to | ||||
| .IR zlib , | ||||
| written by Paul Marquess (pmarquess@bfsec.bt.co.uk) | ||||
| is available at CPAN (Comprehensive Perl Archive Network) sites, | ||||
| such as: | ||||
| .IP | ||||
| ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* | ||||
| .LP | ||||
| A Python interface to | ||||
| .IR zlib | ||||
| written by A.M. Kuchling <amk@magnet.com> | ||||
| is available from the Python Software Association sites, such as: | ||||
| .IP | ||||
| ftp://ftp.python.org/pub/python/contrib/Encoding/zlib*.tar.gz | ||||
| .SH "SEE ALSO" | ||||
| Questions about zlib should be sent to: | ||||
| .IP | ||||
| zlib@quest.jpl.nasa.gov | ||||
| or, if this fails, to the author addresses given below. | ||||
| The zlib home page is: | ||||
| .IP | ||||
| http://www.cdrom.com/pub/infozip/zlib/ | ||||
| .LP | ||||
| The data format used by the zlib library is described by RFC | ||||
| (Request for Comments) 1950 to 1952 in the files:  | ||||
| .IP | ||||
| ftp://ds.internic.net/rfc/rfc1950.txt (zlib format) | ||||
| .br | ||||
| rfc1951.txt (deflate format) | ||||
| .br | ||||
| rfc1952.txt (gzip format) | ||||
| .LP | ||||
| These documents are also available in other formats from: | ||||
| .IP | ||||
| ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html | ||||
| .SH AUTHORS | ||||
| Version 1.1.4 | ||||
| Copyright (C) 1995-2002 Jean-loup Gailly (jloup@gzip.org) | ||||
| and Mark Adler (madler@alumni.caltech.edu). | ||||
| .LP | ||||
| This software is provided "as-is," | ||||
| without any express or implied warranty. | ||||
| In no event will the authors be held liable for any damages | ||||
| arising from the use of this software. | ||||
| See the distribution directory with respect to requirements | ||||
| governing redistribution. | ||||
| The deflate format used by | ||||
| .I zlib | ||||
| was defined by Phil Katz. | ||||
| The deflate and | ||||
| .I zlib | ||||
| specifications were written by L. Peter Deutsch. | ||||
| Thanks to all the people who reported problems and suggested various | ||||
| improvements in | ||||
| .IR zlib ; | ||||
| who are too numerous to cite here. | ||||
| .LP | ||||
| UNIX manual page by R. P. C. Rodgers, | ||||
| U.S. National Library of Medicine (rodgers@nlm.nih.gov). | ||||
| .\" end of man page | ||||
							
								
								
									
										76
									
								
								trees.c
									
									
									
									
									
								
							
							
						
						
									
										76
									
								
								trees.c
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /* trees.c -- output deflated data using Huffman coding | ||||
|  * Copyright (C) 1995-2003 Jean-loup Gailly | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h  | ||||
|  * For conditions of distribution and use, see copyright notice in zlib.h | ||||
|  */ | ||||
|  | ||||
| /* | ||||
| @@ -334,42 +334,42 @@ void gen_trees_header() | ||||
|  | ||||
|     Assert (header != NULL, "Can't open trees.h"); | ||||
|     fprintf(header, | ||||
| 	    "/* header created automatically with -DGEN_TREES_H */\n\n"); | ||||
|             "/* header created automatically with -DGEN_TREES_H */\n\n"); | ||||
|  | ||||
|     fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); | ||||
|     for (i = 0; i < L_CODES+2; i++) { | ||||
| 	fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, | ||||
| 		static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); | ||||
|         fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, | ||||
|                 static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); | ||||
|     } | ||||
|  | ||||
|     fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); | ||||
|     for (i = 0; i < D_CODES; i++) { | ||||
| 	fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, | ||||
| 		static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); | ||||
|         fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, | ||||
|                 static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); | ||||
|     } | ||||
|  | ||||
|     fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); | ||||
|     for (i = 0; i < DIST_CODE_LEN; i++) { | ||||
| 	fprintf(header, "%2u%s", _dist_code[i], | ||||
| 		SEPARATOR(i, DIST_CODE_LEN-1, 20)); | ||||
|         fprintf(header, "%2u%s", _dist_code[i], | ||||
|                 SEPARATOR(i, DIST_CODE_LEN-1, 20)); | ||||
|     } | ||||
|  | ||||
|     fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); | ||||
|     for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { | ||||
| 	fprintf(header, "%2u%s", _length_code[i], | ||||
| 		SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); | ||||
|         fprintf(header, "%2u%s", _length_code[i], | ||||
|                 SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); | ||||
|     } | ||||
|  | ||||
|     fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); | ||||
|     for (i = 0; i < LENGTH_CODES; i++) { | ||||
| 	fprintf(header, "%1u%s", base_length[i], | ||||
| 		SEPARATOR(i, LENGTH_CODES-1, 20)); | ||||
|         fprintf(header, "%1u%s", base_length[i], | ||||
|                 SEPARATOR(i, LENGTH_CODES-1, 20)); | ||||
|     } | ||||
|  | ||||
|     fprintf(header, "local const int base_dist[D_CODES] = {\n"); | ||||
|     for (i = 0; i < D_CODES; i++) { | ||||
| 	fprintf(header, "%5u%s", base_dist[i], | ||||
| 		SEPARATOR(i, D_CODES-1, 10)); | ||||
|         fprintf(header, "%5u%s", base_dist[i], | ||||
|                 SEPARATOR(i, D_CODES-1, 10)); | ||||
|     } | ||||
|  | ||||
|     fclose(header); | ||||
| @@ -930,39 +930,39 @@ void _tr_flush_block(s, buf, stored_len, eof) | ||||
|     /* Build the Huffman trees unless a stored block is forced */ | ||||
|     if (s->level > 0) { | ||||
|  | ||||
| 	 /* Check if the file is ascii or binary */ | ||||
| 	if (s->data_type == Z_UNKNOWN) set_data_type(s); | ||||
|          /* Check if the file is ascii or binary */ | ||||
|         if (s->data_type == Z_UNKNOWN) set_data_type(s); | ||||
|  | ||||
| 	/* Construct the literal and distance trees */ | ||||
| 	build_tree(s, (tree_desc *)(&(s->l_desc))); | ||||
| 	Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, | ||||
| 		s->static_len)); | ||||
|         /* Construct the literal and distance trees */ | ||||
|         build_tree(s, (tree_desc *)(&(s->l_desc))); | ||||
|         Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, | ||||
|                 s->static_len)); | ||||
|  | ||||
| 	build_tree(s, (tree_desc *)(&(s->d_desc))); | ||||
| 	Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, | ||||
| 		s->static_len)); | ||||
| 	/* At this point, opt_len and static_len are the total bit lengths of | ||||
| 	 * the compressed block data, excluding the tree representations. | ||||
| 	 */ | ||||
|         build_tree(s, (tree_desc *)(&(s->d_desc))); | ||||
|         Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, | ||||
|                 s->static_len)); | ||||
|         /* At this point, opt_len and static_len are the total bit lengths of | ||||
|          * the compressed block data, excluding the tree representations. | ||||
|          */ | ||||
|  | ||||
| 	/* Build the bit length tree for the above two trees, and get the index | ||||
| 	 * in bl_order of the last bit length code to send. | ||||
| 	 */ | ||||
| 	max_blindex = build_bl_tree(s); | ||||
|         /* Build the bit length tree for the above two trees, and get the index | ||||
|          * in bl_order of the last bit length code to send. | ||||
|          */ | ||||
|         max_blindex = build_bl_tree(s); | ||||
|  | ||||
|         /* Determine the best encoding. Compute the block lengths in bytes. */ | ||||
| 	opt_lenb = (s->opt_len+3+7)>>3; | ||||
| 	static_lenb = (s->static_len+3+7)>>3; | ||||
|         opt_lenb = (s->opt_len+3+7)>>3; | ||||
|         static_lenb = (s->static_len+3+7)>>3; | ||||
|  | ||||
| 	Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", | ||||
| 		opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, | ||||
| 		s->last_lit)); | ||||
|         Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", | ||||
|                 opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, | ||||
|                 s->last_lit)); | ||||
|  | ||||
| 	if (static_lenb <= opt_lenb) opt_lenb = static_lenb; | ||||
|         if (static_lenb <= opt_lenb) opt_lenb = static_lenb; | ||||
|  | ||||
|     } else { | ||||
|         Assert(buf != (char*)0, "lost buf"); | ||||
| 	opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ | ||||
|         opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ | ||||
|     } | ||||
|  | ||||
| #ifdef FORCE_STORED | ||||
| @@ -1199,7 +1199,7 @@ local void copy_block(s, buf, len, header) | ||||
|     s->last_eob_len = 8; /* enough lookahead for inflate */ | ||||
|  | ||||
|     if (header) { | ||||
|         put_short(s, (ush)len);    | ||||
|         put_short(s, (ush)len); | ||||
|         put_short(s, (ush)~len); | ||||
| #ifdef DEBUG | ||||
|         s->bits_sent += 2*16; | ||||
|   | ||||
| @@ -5,6 +5,7 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #define ZLIB_INTERNAL | ||||
| #include "zlib.h" | ||||
|  | ||||
| /* =========================================================================== | ||||
|   | ||||
							
								
								
									
										76
									
								
								win32/Makefile-dll.msc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								win32/Makefile-dll.msc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,76 @@ | ||||
| # Makefile for zlib.dll -- Microsoft (Visual) C. | ||||
| # Author: Cosmin Truta, 11-Mar-2003. | ||||
| # | ||||
| # Usage: nmake -f win32/Makefile-dll.msc | ||||
|  | ||||
| CC = cl | ||||
| LD = cl | ||||
| CFLAGS = -nologo -MD -O2 | ||||
| LDFLAGS = -nologo | ||||
|  | ||||
| OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ | ||||
|        inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||||
|  | ||||
| # targets | ||||
| all: zlib.dll zlib.lib example.exe minigzip.exe | ||||
|  | ||||
| zlib.lib: $(OBJS) | ||||
| 	lib -out:$@ $(OBJS) | ||||
|  | ||||
| zlib.dll: $(OBJS) win32/zlib.def | ||||
| 	link -release -def:win32/zlib.def -dll -out:$@ $(OBJS) | ||||
|  | ||||
| zlib.lib: zlib.dll | ||||
|  | ||||
| example.exe: example.obj zlib.lib | ||||
| 	$(LD) $(LDFLAGS) example.obj zlib.lib | ||||
|  | ||||
| minigzip.exe: minigzip.obj zlib.lib | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj zlib.lib | ||||
|  | ||||
| .c.obj: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| adler32.obj: adler32.c zlib.h zconf.h | ||||
|  | ||||
| compress.obj: compress.c zlib.h zconf.h | ||||
|  | ||||
| crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||||
|  | ||||
| gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h inffixed.h | ||||
|  | ||||
| inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h | ||||
|  | ||||
| inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h inffixed.h | ||||
|  | ||||
| inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||||
|  | ||||
| trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||||
|  | ||||
| uncompr.obj: uncompr.c zlib.h zconf.h | ||||
|  | ||||
| zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| example.obj: example.c zlib.h zconf.h | ||||
|  | ||||
| minigzip.obj: minigzip.c zlib.h zconf.h | ||||
|  | ||||
| # testing | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d  | ||||
|  | ||||
| # cleanup | ||||
| clean: | ||||
| 	del *.obj | ||||
| 	del *.dll | ||||
| 	del *.lib | ||||
| 	del *.exp | ||||
| 	del *.exe | ||||
							
								
								
									
										91
									
								
								win32/Makefile.bor
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								win32/Makefile.bor
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
| # Makefile for zlib | ||||
| # Borland C++ for Win32 | ||||
| # Updated for zlib-1.2.x by Cosmin Truta, 11-Mar-2003. | ||||
|  | ||||
| # Usage: "make -f win32/makefile.bor" | ||||
|  | ||||
| # ------------ Borland C++ for Win32 ------------ | ||||
|  | ||||
| #    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) | ||||
| #    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added | ||||
| #    to the declaration of LOC here: | ||||
| LOC = $(LOCAL_ZLIB) | ||||
|  | ||||
| CC = bcc32 | ||||
| LD = bcc32 | ||||
| AR = tlib | ||||
| CFLAGS = -O2 -d -k- $(LOC) | ||||
| LDFLAGS = $(LOC) | ||||
|  | ||||
|  | ||||
| # variables | ||||
| ZLIB_LIB = zlib.lib | ||||
|  | ||||
| OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj | ||||
| OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||||
| OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj | ||||
| OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj | ||||
|  | ||||
|  | ||||
| # targets | ||||
| all: $(ZLIB_LIB) example.exe minigzip.exe | ||||
|  | ||||
| .c.obj: | ||||
| 	$(CC) -c $(CFLAGS) $*.c | ||||
|  | ||||
| adler32.obj: adler32.c zlib.h zconf.h | ||||
|  | ||||
| compress.obj: compress.c zlib.h zconf.h | ||||
|  | ||||
| crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||||
|  | ||||
| gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h | ||||
|  | ||||
| inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|  inffast.h inffixed.h | ||||
|  | ||||
| inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||||
|  | ||||
| trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||||
|  | ||||
| uncompr.obj: uncompr.c zlib.h zconf.h | ||||
|  | ||||
| zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| example.obj: example.c zlib.h zconf.h | ||||
|  | ||||
| minigzip.obj: minigzip.c zlib.h zconf.h | ||||
|  | ||||
|  | ||||
| # For the sake of the old Borland make, | ||||
| # the command line is cut to fit in the MS-DOS 128 byte limit: | ||||
| $(ZLIB_LIB): $(OBJ1) $(OBJ2) | ||||
| 	-del $(ZLIB_LIB) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP1) | ||||
| 	$(AR) $(ZLIB_LIB) $(OBJP2) | ||||
|  | ||||
| example.exe: example.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) | ||||
|  | ||||
| minigzip.exe: minigzip.obj $(ZLIB_LIB) | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) | ||||
|  | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d  | ||||
|  | ||||
| clean: | ||||
| 	-del *.obj | ||||
| 	-del *.exe | ||||
| 	-del *.lib | ||||
| 	-del *.tds | ||||
| 	-del zlib.bak | ||||
| 	-del foo.gz | ||||
							
								
								
									
										116
									
								
								win32/Makefile.gcc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								win32/Makefile.gcc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | ||||
| # Makefile for zlib, derived from Makefile.dj2. | ||||
| # Modified for mingw32 by C. Spieler, 6/16/98. | ||||
| # Updated for zlib-1.2.x by Cosmin Truta, 11-Mar-2003. | ||||
| # Tested under Cygwin and MinGW. | ||||
|  | ||||
| # Copyright (C) 1995-1998 Jean-loup Gailly. | ||||
| # For conditions of distribution and use, see copyright notice in zlib.h  | ||||
|  | ||||
| # To compile, or to compile and test, type: | ||||
| #  | ||||
| #   make -fmakefile.gcc;  make test -fmakefile.gcc | ||||
| #  | ||||
| # To install libz.a, zconf.h and zlib.h in the system directories, type: | ||||
| #  | ||||
| #    make install -fmakefile.gcc | ||||
| #  | ||||
|  | ||||
| LIB = libz.a | ||||
| SHAREDLIB = zlib.dll | ||||
| VER = 1.2.0 | ||||
|  | ||||
| CC = gcc | ||||
| #CFLAGS = -DDEBUG -MMD -g | ||||
| CFLAGS = $(LOC) -O3 -Wall | ||||
|  | ||||
| AS = $(CC) | ||||
| ASFLAGS = $(LOC) -Wall | ||||
|  | ||||
| LD = $(CC) | ||||
| LDFLAGS = $(LOC) -s | ||||
|  | ||||
| AR = ar | ||||
| ARFLAGS = rcs | ||||
|  | ||||
| RC = windres | ||||
|  | ||||
| CP = cp -fp | ||||
| # If GNU install is available, replace $(CP) with install. | ||||
| INSTALL = $(CP) | ||||
| RM = rm -f | ||||
|  | ||||
| prefix = /usr/local | ||||
| exec_prefix = $(prefix) | ||||
|  | ||||
| OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ | ||||
|        inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o | ||||
|  | ||||
| DLLDEF = win32/zlibgcc.def | ||||
|  | ||||
| # to use the asm code: make OBJA=match.o | ||||
| OBJA = | ||||
|  | ||||
| TEST_OBJS = example.o minigzip.o | ||||
|  | ||||
| all: $(LIB) $(SHAREDLIB) example minigzip | ||||
|  | ||||
| test: all | ||||
| 	./example | ||||
| 	echo hello world | ./minigzip | ./minigzip -d  | ||||
|  | ||||
| .c.o: | ||||
| 	$(CC) $(CFLAGS) -c -o $@ $< | ||||
|  | ||||
| libz.a: $(OBJS) | ||||
| 	$(AR) $(ARFLAGS) $@ $(OBJS) | ||||
|  | ||||
| $(SHAREDLIB): $(OBJS) $(DLLDEF) zlibrc.o | ||||
| 	dllwrap --driver-name $(CC) --def $(DLLDEF) -o $@ $(OBJS) zlibrc.o | ||||
|  | ||||
| example: example.o $(LIB) | ||||
| 	$(LD) -o $@ $< $(LIB) | ||||
|  | ||||
| minigzip: minigzip.o $(LIB) | ||||
| 	$(LD) -o $@ $< $(LIB) | ||||
|  | ||||
| zlibrc.o: win32/zlib.rc | ||||
| 	-$(RC) -o $@ --define GCC_WINDRES win32/zlib.rc | ||||
|  | ||||
|  | ||||
| # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . | ||||
|  | ||||
| .PHONY : uninstall clean | ||||
|  | ||||
| install: zlib.h zconf.h $(LIB) | ||||
| 	-@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH) | ||||
| 	-@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH) | ||||
| 	$(INSTALL) zlib.h $(INCLUDE_PATH) | ||||
| 	$(INSTALL) zconf.h $(INCLUDE_PATH) | ||||
| 	$(INSTALL) $(LIB) $(LIBRARY_PATH) | ||||
|  | ||||
| uninstall: | ||||
| 	$(RM) $(INCLUDE_PATH)/zlib.h | ||||
| 	$(RM) $(INCLUDE_PATH)/zconf.h | ||||
| 	$(RM) $(LIBRARY_PATH)/libz.a | ||||
|  | ||||
| clean: | ||||
| 	$(RM) *.o | ||||
| 	$(RM) *.exe | ||||
| 	$(RM) libz.a | ||||
| 	$(RM) zlib.dll | ||||
| 	$(RM) foo.gz | ||||
|  | ||||
| adler32.o: zlib.h zconf.h | ||||
| compress.o: zlib.h zconf.h | ||||
| crc32.o: crc32.h zlib.h zconf.h | ||||
| deflate.o: deflate.h zutil.h zlib.h zconf.h | ||||
| example.o: zlib.h zconf.h | ||||
| gzio.o: zutil.h zlib.h zconf.h | ||||
| inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | ||||
| inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | ||||
| infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | ||||
| inftrees.o: zutil.h zlib.h zconf.h inftrees.h | ||||
| minigzip.o:  zlib.h zconf.h  | ||||
| trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | ||||
| uncompr.o: zlib.h zconf.h | ||||
| zutil.o: zutil.h zlib.h zconf.h   | ||||
							
								
								
									
										92
									
								
								win32/Makefile.msc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								win32/Makefile.msc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | ||||
| # Makefile for Win32 zlib.dll and the static library zlibstat.lib | ||||
| # -- Microsoft (Visual) C. | ||||
| # Author: Cosmin Truta, 11-Mar-2003 | ||||
| #         Christian Spieler, 19-Mar-2003 | ||||
| # | ||||
| # Usage: nmake -f win32/Makefile.msc | ||||
|  | ||||
| CC = cl | ||||
| LD = cl | ||||
| RC = rc | ||||
| CFLAGS = -nologo -MD -O2 | ||||
| LDFLAGS = -nologo | ||||
|  | ||||
| OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ | ||||
|        inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||||
|  | ||||
| # targets | ||||
| all: zlib.dll zlibstat.lib example.exe minigzip.exe exampl_s.exe minigz_s.exe | ||||
|  | ||||
| zlibstat.lib: $(OBJS) | ||||
| 	lib -out:$@ $(OBJS) | ||||
|  | ||||
| zlib.dll: $(OBJS) zlib.res win32/zlib.def | ||||
| 	link -release -def:win32/zlib.def -dll -out:$@ $(OBJS) zlib.res | ||||
|  | ||||
| zlib.lib: zlib.dll | ||||
|  | ||||
| example.exe: example.obj zlib.lib | ||||
| 	$(LD) $(LDFLAGS) example.obj zlib.lib | ||||
|  | ||||
| minigzip.exe: minigzip.obj zlib.lib | ||||
| 	$(LD) $(LDFLAGS) minigzip.obj zlib.lib | ||||
|  | ||||
| exampl_s.exe: example.obj zlibstat.lib | ||||
| 	$(LD) $(LDFLAGS) -o $@ example.obj zlibstat.lib | ||||
|  | ||||
| minigz_s.exe: minigzip.obj zlibstat.lib | ||||
| 	$(LD) $(LDFLAGS) -o $@ minigzip.obj zlibstat.lib | ||||
|  | ||||
| .c.obj: | ||||
| 	$(CC) -c $(CFLAGS) $< | ||||
|  | ||||
| zlib.res: win32/zlib.rc | ||||
| 	$(RC) /l 0x409 /fo$@ /d WIN32 win32/zlib.rc | ||||
|  | ||||
| adler32.obj: adler32.c zlib.h zconf.h | ||||
|  | ||||
| compress.obj: compress.c zlib.h zconf.h | ||||
|  | ||||
| crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||||
|  | ||||
| deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||||
|  | ||||
| gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h inffixed.h | ||||
|  | ||||
| inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h | ||||
|  | ||||
| inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||||
|              inffast.h inffixed.h | ||||
|  | ||||
| inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||||
|  | ||||
| trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||||
|  | ||||
| uncompr.obj: uncompr.c zlib.h zconf.h | ||||
|  | ||||
| zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||||
|  | ||||
| example.obj: example.c zlib.h zconf.h | ||||
|  | ||||
| minigzip.obj: minigzip.c zlib.h zconf.h | ||||
|  | ||||
| # testing | ||||
| test: example.exe minigzip.exe | ||||
| 	example | ||||
| 	echo hello world | minigzip | minigzip -d  | ||||
|  | ||||
| teststat: exampl_s.exe minigz_s.exe | ||||
| 	exampl_s | ||||
| 	echo hello world | minigz_s | minigz_s -d  | ||||
|  | ||||
| # cleanup | ||||
| clean: | ||||
| 	del *.obj | ||||
| 	del *.dll | ||||
| 	del *.lib | ||||
| 	del *.exp | ||||
| 	del *.exe | ||||
| @@ -1,12 +1,5 @@ | ||||
| LIBRARY		"zlib" | ||||
| 
 | ||||
| DESCRIPTION	'"""zlib data compression library"""' | ||||
| 
 | ||||
| 
 | ||||
| VERSION		1.11 | ||||
| 
 | ||||
| 
 | ||||
| HEAPSIZE	1048576,8192 | ||||
| LIBRARY		zlib.dll | ||||
| DESCRIPTION	"zlib data compression library" | ||||
| 
 | ||||
| EXPORTS | ||||
|     adler32                        @1 | ||||
| @@ -50,25 +43,10 @@ EXPORTS | ||||
|     compress2                      @39 | ||||
|     gzputs                         @40 | ||||
|     gzgets                         @41 | ||||
| 
 | ||||
| 	unzOpen                       @61 | ||||
| 	unzClose                      @62 | ||||
| 	unzGetGlobalInfo              @63 | ||||
| 	unzGetCurrentFileInfo         @64 | ||||
| 	unzGoToFirstFile              @65 | ||||
| 	unzGoToNextFile               @66 | ||||
| 	unzOpenCurrentFile            @67 | ||||
| 	unzReadCurrentFile            @68 | ||||
| 	unztell                       @70 | ||||
| 	unzeof                        @71 | ||||
| 	unzCloseCurrentFile           @72 | ||||
| 	unzGetGlobalComment           @73 | ||||
| 	unzStringFileNameCompare      @74 | ||||
| 	unzLocateFile                 @75 | ||||
| 	unzGetLocalExtrafield         @76 | ||||
| 
 | ||||
| 	zipOpen                       @80 | ||||
| 	zipOpenNewFileInZip           @81 | ||||
| 	zipWriteInFileInZip           @82 | ||||
| 	zipCloseFileInZip             @83 | ||||
| 	zipClose                      @84 | ||||
| ; since zlib-1.2.0: | ||||
|     inflateCopy                    @42 | ||||
|     inflateBackInit_               @43 | ||||
|     inflateBack                    @44 | ||||
|     inflateBackEnd                 @45 | ||||
|     compressBound                  @46 | ||||
|     deflateBound                   @47 | ||||
							
								
								
									
										86
									
								
								zconf.h
									
									
									
									
									
								
							
							
						
						
									
										86
									
								
								zconf.h
									
									
									
									
									
								
							| @@ -5,8 +5,8 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #ifndef _ZCONF_H | ||||
| #define _ZCONF_H | ||||
| #ifndef ZCONF_H | ||||
| #define ZCONF_H | ||||
|  | ||||
| /* | ||||
|  * If you *really* need a unique prefix for all types and library functions, | ||||
| @@ -91,7 +91,7 @@ | ||||
|  | ||||
| #ifndef STDC | ||||
| #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||||
| #    define const	/* note: need a more gentle solution here */ | ||||
| #    define const       /* note: need a more gentle solution here */ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| @@ -100,12 +100,6 @@ | ||||
| #  define NO_DUMMY_DECL | ||||
| #endif | ||||
|  | ||||
| /* Old Borland C incorrectly complains about missing returns: */ | ||||
| #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) | ||||
| #  define NEED_DUMMY_RETURN | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* Maximum value for memLevel in deflateInit2 */ | ||||
| #ifndef MAX_MEM_LEVEL | ||||
| #  ifdef MAXSEG_64K | ||||
| @@ -169,39 +163,54 @@ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* Compile with -DZLIB_DLL for Windows DLL support */ | ||||
| #if defined(ZLIB_DLL) | ||||
| #  if defined(_WINDOWS) || defined(WINDOWS) | ||||
| #    ifdef FAR | ||||
| #      undef FAR | ||||
| #    endif | ||||
| #    include <windows.h> | ||||
| #    define ZEXPORT  WINAPI | ||||
| #    ifdef WIN32 | ||||
| #      define ZEXPORTVA  WINAPIV | ||||
| #    else | ||||
| #      define ZEXPORTVA  FAR _cdecl _export | ||||
| #    endif | ||||
| /* If building or using a Windows DLL, compile with -DZLIB_DLL. | ||||
|  * The calls to ZEXTERN functions will be more efficient this way. | ||||
|  */ | ||||
| #if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32) | ||||
| #  ifdef FAR | ||||
| #    undef FAR | ||||
| #  endif | ||||
| #  if defined (__BORLANDC__) | ||||
| #    if (__BORLANDC__ >= 0x0500) && defined (WIN32) | ||||
| #      include <windows.h> | ||||
| #      define ZEXPORT __declspec(dllexport) WINAPI | ||||
| #      define ZEXPORTRVA __declspec(dllexport) WINAPIV | ||||
|    /* For zlib, the basic Win32 API declarations are sufficient.  Whenever | ||||
|     * a program that uses zlib requires the full Win32 API set, it has | ||||
|     * to include <windows.h> prior to "zlib.h". | ||||
|     */ | ||||
| #  if defined(WIN32) && (!defined(WIN32_LEAN_AND_MEAN)) | ||||
| #    define WIN32_LEAN_AND_MEAN | ||||
| #  endif | ||||
| #  include <windows.h> | ||||
| #  if !defined(WIN32) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x500)) | ||||
| #    if defined(ZLIB_DLL) && defined(ZLIB_INTERNAL) | ||||
| #      define ZEXPORT   WINAPI _export | ||||
| #      define ZEXPORTVA FAR _cdecl _export | ||||
| #    else | ||||
| #      if defined (_Windows) && defined (__DLL__) | ||||
| #        define ZEXPORT _export | ||||
| #        define ZEXPORTVA _export | ||||
| #      define ZEXPORT   WINAPI | ||||
| #      define ZEXPORTVA FAR _cdecl | ||||
| #    endif | ||||
| #  else | ||||
|      /* a fully Win32-compliant compiler */ | ||||
| #    define ZEXPORT   WINAPI | ||||
| #    define ZEXPORTVA CDECL | ||||
| #    ifdef ZLIB_DLL | ||||
| #      ifdef ZLIB_INTERNAL | ||||
| #        define ZEXTERN extern __declspec(dllexport) | ||||
| #      else | ||||
| #        define ZEXTERN extern __declspec(dllimport) | ||||
| #      endif | ||||
| #    else | ||||
| #      define ZEXTERN extern | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if defined (__BEOS__) | ||||
| #  if defined (ZLIB_DLL) | ||||
| #    define ZEXTERN extern __declspec(dllexport) | ||||
| #  else | ||||
| #    define ZEXTERN extern __declspec(dllimport) | ||||
| #  ifdef ZLIB_DLL | ||||
| #    ifdef ZLIB_INTERNAL | ||||
| #      define ZEXPORT   __declspec(dllexport) | ||||
| #      define ZEXPORTVA __declspec(dllexport) | ||||
| #    else | ||||
| #      define ZEXPORT   __declspec(dllimport) | ||||
| #      define ZEXPORTVA __declspec(dllimport) | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| @@ -216,7 +225,7 @@ | ||||
| #endif | ||||
|  | ||||
| #ifndef FAR | ||||
| #   define FAR | ||||
| #  define FAR | ||||
| #endif | ||||
|  | ||||
| #if !defined(__MACTYPES__) | ||||
| @@ -246,9 +255,12 @@ typedef uLong FAR uLongf; | ||||
|    typedef Byte     *voidp; | ||||
| #endif | ||||
|  | ||||
| #if 0	/* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||||
| #if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||||
| #  include <sys/types.h> /* for off_t */ | ||||
| #  include <unistd.h>    /* for SEEK_* and off_t */ | ||||
| #  ifdef VMS | ||||
| #    include <unixio.h>   /* for off_t */ | ||||
| #  endif | ||||
| #  define z_off_t  off_t | ||||
| #endif | ||||
| #ifndef SEEK_SET | ||||
| @@ -277,4 +289,4 @@ typedef uLong FAR uLongf; | ||||
| #   pragma map(inflate_copyright,"INCOPY") | ||||
| #endif | ||||
|  | ||||
| #endif /* _ZCONF_H */ | ||||
| #endif /* ZCONF_H */ | ||||
|   | ||||
							
								
								
									
										86
									
								
								zconf.in.h
									
									
									
									
									
								
							
							
						
						
									
										86
									
								
								zconf.in.h
									
									
									
									
									
								
							| @@ -5,8 +5,8 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #ifndef _ZCONF_H | ||||
| #define _ZCONF_H | ||||
| #ifndef ZCONF_H | ||||
| #define ZCONF_H | ||||
|  | ||||
| /* | ||||
|  * If you *really* need a unique prefix for all types and library functions, | ||||
| @@ -91,7 +91,7 @@ | ||||
|  | ||||
| #ifndef STDC | ||||
| #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||||
| #    define const	/* note: need a more gentle solution here */ | ||||
| #    define const       /* note: need a more gentle solution here */ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| @@ -100,12 +100,6 @@ | ||||
| #  define NO_DUMMY_DECL | ||||
| #endif | ||||
|  | ||||
| /* Old Borland C incorrectly complains about missing returns: */ | ||||
| #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) | ||||
| #  define NEED_DUMMY_RETURN | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* Maximum value for memLevel in deflateInit2 */ | ||||
| #ifndef MAX_MEM_LEVEL | ||||
| #  ifdef MAXSEG_64K | ||||
| @@ -169,39 +163,54 @@ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| /* Compile with -DZLIB_DLL for Windows DLL support */ | ||||
| #if defined(ZLIB_DLL) | ||||
| #  if defined(_WINDOWS) || defined(WINDOWS) | ||||
| #    ifdef FAR | ||||
| #      undef FAR | ||||
| #    endif | ||||
| #    include <windows.h> | ||||
| #    define ZEXPORT  WINAPI | ||||
| #    ifdef WIN32 | ||||
| #      define ZEXPORTVA  WINAPIV | ||||
| #    else | ||||
| #      define ZEXPORTVA  FAR _cdecl _export | ||||
| #    endif | ||||
| /* If building or using a Windows DLL, compile with -DZLIB_DLL. | ||||
|  * The calls to ZEXTERN functions will be more efficient this way. | ||||
|  */ | ||||
| #if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32) | ||||
| #  ifdef FAR | ||||
| #    undef FAR | ||||
| #  endif | ||||
| #  if defined (__BORLANDC__) | ||||
| #    if (__BORLANDC__ >= 0x0500) && defined (WIN32) | ||||
| #      include <windows.h> | ||||
| #      define ZEXPORT __declspec(dllexport) WINAPI | ||||
| #      define ZEXPORTRVA __declspec(dllexport) WINAPIV | ||||
|    /* For zlib, the basic Win32 API declarations are sufficient.  Whenever | ||||
|     * a program that uses zlib requires the full Win32 API set, it has | ||||
|     * to include <windows.h> prior to "zlib.h". | ||||
|     */ | ||||
| #  if defined(WIN32) && (!defined(WIN32_LEAN_AND_MEAN)) | ||||
| #    define WIN32_LEAN_AND_MEAN | ||||
| #  endif | ||||
| #  include <windows.h> | ||||
| #  if !defined(WIN32) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x500)) | ||||
| #    if defined(ZLIB_DLL) && defined(ZLIB_INTERNAL) | ||||
| #      define ZEXPORT   WINAPI _export | ||||
| #      define ZEXPORTVA FAR _cdecl _export | ||||
| #    else | ||||
| #      if defined (_Windows) && defined (__DLL__) | ||||
| #        define ZEXPORT _export | ||||
| #        define ZEXPORTVA _export | ||||
| #      define ZEXPORT   WINAPI | ||||
| #      define ZEXPORTVA FAR _cdecl | ||||
| #    endif | ||||
| #  else | ||||
|      /* a fully Win32-compliant compiler */ | ||||
| #    define ZEXPORT   WINAPI | ||||
| #    define ZEXPORTVA CDECL | ||||
| #    ifdef ZLIB_DLL | ||||
| #      ifdef ZLIB_INTERNAL | ||||
| #        define ZEXTERN extern __declspec(dllexport) | ||||
| #      else | ||||
| #        define ZEXTERN extern __declspec(dllimport) | ||||
| #      endif | ||||
| #    else | ||||
| #      define ZEXTERN extern | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if defined (__BEOS__) | ||||
| #  if defined (ZLIB_DLL) | ||||
| #    define ZEXTERN extern __declspec(dllexport) | ||||
| #  else | ||||
| #    define ZEXTERN extern __declspec(dllimport) | ||||
| #  ifdef ZLIB_DLL | ||||
| #    ifdef ZLIB_INTERNAL | ||||
| #      define ZEXPORT   __declspec(dllexport) | ||||
| #      define ZEXPORTVA __declspec(dllexport) | ||||
| #    else | ||||
| #      define ZEXPORT   __declspec(dllimport) | ||||
| #      define ZEXPORTVA __declspec(dllimport) | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| @@ -216,7 +225,7 @@ | ||||
| #endif | ||||
|  | ||||
| #ifndef FAR | ||||
| #   define FAR | ||||
| #  define FAR | ||||
| #endif | ||||
|  | ||||
| #if !defined(__MACTYPES__) | ||||
| @@ -246,9 +255,12 @@ typedef uLong FAR uLongf; | ||||
|    typedef Byte     *voidp; | ||||
| #endif | ||||
|  | ||||
| #if 0	/* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||||
| #if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||||
| #  include <sys/types.h> /* for off_t */ | ||||
| #  include <unistd.h>    /* for SEEK_* and off_t */ | ||||
| #  ifdef VMS | ||||
| #    include <unixio.h>   /* for off_t */ | ||||
| #  endif | ||||
| #  define z_off_t  off_t | ||||
| #endif | ||||
| #ifndef SEEK_SET | ||||
| @@ -277,4 +289,4 @@ typedef uLong FAR uLongf; | ||||
| #   pragma map(inflate_copyright,"INCOPY") | ||||
| #endif | ||||
|  | ||||
| #endif /* _ZCONF_H */ | ||||
| #endif /* ZCONF_H */ | ||||
|   | ||||
							
								
								
									
										159
									
								
								zlib.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								zlib.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,159 @@ | ||||
| .TH ZLIB 3 "12 May 2003" | ||||
| .SH NAME | ||||
| zlib \- compression/decompression library | ||||
| .SH SYNOPSIS | ||||
| [see | ||||
| .I zlib.h | ||||
| for full description] | ||||
| .SH DESCRIPTION | ||||
| The | ||||
| .I zlib | ||||
| library is a general purpose data compression library. | ||||
| The code is thread safe. | ||||
| It provides in-memory compression and decompression functions, | ||||
| including integrity checks of the uncompressed data. | ||||
| This version of the library supports only one compression method (deflation) | ||||
| but other algorithms will be added later | ||||
| and will have the same stream interface. | ||||
| .LP | ||||
| Compression can be done in a single step if the buffers are large enough | ||||
| (for example if an input file is mmap'ed), | ||||
| or can be done by repeated calls of the compression function. | ||||
| In the latter case, | ||||
| the application must provide more input and/or consume the output | ||||
| (providing more output space) before each call. | ||||
| .LP | ||||
| The library also supports reading and writing files in | ||||
| .IR gzip (1) | ||||
| (.gz) format | ||||
| with an interface similar to that of stdio. | ||||
| .LP | ||||
| The library does not install any signal handler. | ||||
| The decoder checks the consistency of the compressed data, | ||||
| so the library should never crash even in case of corrupted input. | ||||
| .LP | ||||
| All functions of the compression library are documented in the file | ||||
| .IR zlib.h . | ||||
| The distribution source includes examples of use of the library | ||||
| in the files | ||||
| .I example.c | ||||
| and | ||||
| .IR minigzip.c . | ||||
| .LP | ||||
| Changes to this version are documented in the file | ||||
| .I ChangeLog | ||||
| that accompanies the source, | ||||
| and are concerned primarily with bug fixes and portability enhancements. | ||||
| .LP | ||||
| A Java implementation of | ||||
| .I zlib | ||||
| is available in the Java Development Kit 1.1: | ||||
| .IP | ||||
| http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html | ||||
| .LP | ||||
| A Perl interface to | ||||
| .IR zlib , | ||||
| written by Paul Marquess (pmqs@cpan.org), | ||||
| is available at CPAN (Comprehensive Perl Archive Network) sites, | ||||
| including: | ||||
| .IP | ||||
| http://www.cpan.org/modules/by-module/Compress/ | ||||
| .LP | ||||
| A Python interface to | ||||
| .IR zlib , | ||||
| written by A.M. Kuchling (amk@magnet.com), | ||||
| is available in Python 1.5 and later versions: | ||||
| .IP | ||||
| http://www.python.org/doc/lib/module-zlib.html | ||||
| .LP | ||||
| A | ||||
| .I zlib | ||||
| binding for | ||||
| .IR tcl (1), | ||||
| written by Andreas Kupries (a.kupries@westend.com), | ||||
| is availlable at: | ||||
| .IP | ||||
| http://www.westend.com/~kupries/doc/trf/man/man.html | ||||
| .LP | ||||
| An experimental package to read and write files in .zip format, | ||||
| written on top of | ||||
| .I zlib | ||||
| by Gilles Vollant (info@winimage.com), | ||||
| is available at: | ||||
| .IP | ||||
| http://www.winimage.com/zLibDll/unzip.html | ||||
| and also in the | ||||
| .I contrib/minizip | ||||
| directory of the main | ||||
| .I zlib | ||||
| web site. | ||||
| .SH "SEE ALSO" | ||||
| The | ||||
| .I zlib | ||||
| web site can be found at either of these locations: | ||||
| .IP | ||||
| http://www.zlib.org | ||||
| .br | ||||
| http://www.gzip.org/zlib/ | ||||
| .LP | ||||
| The data format used by the zlib library is described by RFC | ||||
| (Request for Comments) 1950 to 1952 in the files:  | ||||
| .IP | ||||
| http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format) | ||||
| .br | ||||
| http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format) | ||||
| .br | ||||
| http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format) | ||||
| .LP | ||||
| These documents are also available in other formats from: | ||||
| .IP | ||||
| ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html | ||||
| .LP | ||||
| Mark Nelson (markn@ieee.org) wrote an article about | ||||
| .I zlib | ||||
| for the Jan. 1997 issue of  Dr. Dobb's Journal; | ||||
| a copy of the article is available at: | ||||
| .IP | ||||
| http://dogma.net/markn/articles/zlibtool/zlibtool.htm | ||||
| .SH "REPORTING PROBLEMS" | ||||
| Before reporting a problem, | ||||
| please check the | ||||
| .I zlib | ||||
| web site to verify that you have the latest version of | ||||
| .IR zlib ; | ||||
| otherwise, | ||||
| obtain the latest version and see if the problem still exists. | ||||
| Please read the | ||||
| .I zlib | ||||
| FAQ at: | ||||
| .IP | ||||
| http://www.gzip.org/zlib/zlib_faq.html | ||||
| .LP | ||||
| before asking for help. | ||||
| Send questions and/or comments to zlib@gzip.org, | ||||
| or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). | ||||
| .SH AUTHORS | ||||
| Version 1.2.0.1 | ||||
| Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) | ||||
| and Mark Adler (madler@alumni.caltech.edu). | ||||
| .LP | ||||
| This software is provided "as-is," | ||||
| without any express or implied warranty. | ||||
| In no event will the authors be held liable for any damages | ||||
| arising from the use of this software. | ||||
| See the distribution directory with respect to requirements | ||||
| governing redistribution. | ||||
| The deflate format used by | ||||
| .I zlib | ||||
| was defined by Phil Katz. | ||||
| The deflate and | ||||
| .I zlib | ||||
| specifications were written by L. Peter Deutsch. | ||||
| Thanks to all the people who reported problems and suggested various | ||||
| improvements in | ||||
| .IR zlib ; | ||||
| who are too numerous to cite here. | ||||
| .LP | ||||
| UNIX manual page by R. P. C. Rodgers, | ||||
| U.S. National Library of Medicine (rodgers@nlm.nih.gov). | ||||
| .\" end of man page | ||||
							
								
								
									
										132
									
								
								zlib.h
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								zlib.h
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| /* zlib.h -- interface of the 'zlib' general purpose compression library | ||||
|   version 1.2.0, March 9th, 2003 | ||||
|   version 1.2.0.2, July 13th, 2003 | ||||
|  | ||||
|   Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler | ||||
|  | ||||
| @@ -28,8 +28,8 @@ | ||||
|   (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). | ||||
| */ | ||||
|  | ||||
| #ifndef _ZLIB_H | ||||
| #define _ZLIB_H | ||||
| #ifndef ZLIB_H | ||||
| #define ZLIB_H | ||||
|  | ||||
| #include "zconf.h" | ||||
|  | ||||
| @@ -37,7 +37,8 @@ | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #define ZLIB_VERSION "1.2.0" | ||||
| #define ZLIB_VERSION "1.2.0.2" | ||||
| #define ZLIB_VERNUM 0x1202 | ||||
|  | ||||
| /*  | ||||
|      The 'zlib' compression library provides in-memory compression and | ||||
| @@ -165,6 +166,7 @@ typedef z_stream FAR *z_streamp; | ||||
|  | ||||
| #define Z_FILTERED            1 | ||||
| #define Z_HUFFMAN_ONLY        2 | ||||
| #define Z_RLE                 3 | ||||
| #define Z_DEFAULT_STRATEGY    0 | ||||
| /* compression strategy; see deflateInit2() below for details */ | ||||
|  | ||||
| @@ -333,9 +335,9 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | ||||
| ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | ||||
| /* | ||||
|     inflate decompresses as much data as possible, and stops when the input | ||||
|   buffer becomes empty or the output buffer becomes full. It may some | ||||
|   introduce some output latency (reading input without producing any output) | ||||
|   except when forced to flush. | ||||
|   buffer becomes empty or the output buffer becomes full. It may introduce | ||||
|   some output latency (reading input without producing any output) except when | ||||
|   forced to flush. | ||||
|  | ||||
|   The detailed semantics are as follows. inflate performs one or both of the | ||||
|   following actions: | ||||
| @@ -461,14 +463,16 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | ||||
|  | ||||
|      The strategy parameter is used to tune the compression algorithm. Use the | ||||
|    value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a | ||||
|    filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no | ||||
|    string match).  Filtered data consists mostly of small values with a | ||||
|    somewhat random distribution. In this case, the compression algorithm is | ||||
|    tuned to compress them better. The effect of Z_FILTERED is to force more | ||||
|    Huffman coding and less string matching; it is somewhat intermediate | ||||
|    between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects | ||||
|    the compression ratio but not the correctness of the compressed output even | ||||
|    if it is not set appropriately. | ||||
|    filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no | ||||
|    string match), or Z_RLE to limit match distances to one (run-length | ||||
|    encoding). Filtered data consists mostly of small values with a somewhat | ||||
|    random distribution. In this case, the compression algorithm is tuned to | ||||
|    compress them better. The effect of Z_FILTERED is to force more Huffman | ||||
|    coding and less string matching; it is somewhat intermediate between | ||||
|    Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as | ||||
|    Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy | ||||
|    parameter only affects the compression ratio but not the correctness of the | ||||
|    compressed output even if it is not set appropriately. | ||||
|  | ||||
|       deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||||
|    memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid | ||||
| @@ -583,20 +587,28 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | ||||
|      The windowBits parameter is the base two logarithm of the maximum window | ||||
|    size (the size of the history buffer).  It should be in the range 8..15 for | ||||
|    this version of the library. The default value is 15 if inflateInit is used | ||||
|    instead. If a compressed stream with a larger window size is given as | ||||
|    input, inflate() will return with the error code Z_DATA_ERROR instead of | ||||
|    trying to allocate a larger window. | ||||
|    instead. windowBits must be greater than or equal to the windowBits value | ||||
|    provided to deflateInit2() while compressing, or it must be equal to 15 if | ||||
|    deflateInit2() was not used. If a compressed stream with a larger window | ||||
|    size is given as input, inflate() will return with the error code | ||||
|    Z_DATA_ERROR instead of trying to allocate a larger window. | ||||
|  | ||||
|      windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits | ||||
|    determines the window size.  inflate() will then process raw deflate data, | ||||
|      windowBits can also be -8..-15 for raw inflate. In this case, -windowBits | ||||
|    determines the window size. inflate() will then process raw deflate data, | ||||
|    not looking for a zlib or gzip header, not generating a check value, and not | ||||
|    looking for any check values for comparison at the end of the stream.  This | ||||
|    looking for any check values for comparison at the end of the stream. This | ||||
|    is for use with other formats that use the deflate compressed data format | ||||
|    such as zip.  Those formats provide their own check values.  If a custom | ||||
|    such as zip.  Those formats provide their own check values. If a custom | ||||
|    format is developed using the raw deflate format for compressed data, it is | ||||
|    recommended that a check value such as an adler32 or a crc32 be applied to | ||||
|    the uncompressed data as is done in the zlib, gzip, and zip formats.  For | ||||
|    most applications, the zlib format should be used as is. | ||||
|    most applications, the zlib format should be used as is. Note that comments | ||||
|    above on the use in deflateInit2() applies to the magnitude of windowBits. | ||||
|  | ||||
|      windowBits can also be greater than 15 for optional gzip decoding. Add | ||||
|    32 to windowBits to enable zlib and gzip decoding with automatic header | ||||
|    detection, or add 16 to decode only the gzip format (the zlib format will | ||||
|    return a Z_DATA_ERROR). | ||||
|  | ||||
|      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||||
|    memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative | ||||
| @@ -768,6 +780,45 @@ ZEXTERN int ZEXPORT inflateBackEnd(z_stream FAR *strm); | ||||
|    state was inconsistent. | ||||
| */ | ||||
|  | ||||
| ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); | ||||
| /* Return flags indicating compile-time options. | ||||
|  | ||||
|     Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: | ||||
|      1.0: size of uInt | ||||
|      3.2: size of uLong | ||||
|      5.4: size of voidpf (pointers) | ||||
|      7.6: size of z_off_t | ||||
|  | ||||
|     Debug options: | ||||
|      8: DEBUG | ||||
|      9-11: 0 (reserved) | ||||
|  | ||||
|     One-time table building (smaller code, but not thread-safe if true): | ||||
|      12: BUILDFIXED -- build static block decoding tables when needed | ||||
|      13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed | ||||
|      14,15: 0 (reserved) | ||||
|  | ||||
|     Library content (indicates missing functionality): | ||||
|      16: NO_DEFLATE -- gz* functions cannot compress (to avoid linking deflate | ||||
|                        code when not needed) | ||||
|      17: NO_GUNZIP -- inflate can't detect and decode gzip streams, to avoid | ||||
|                       linking crc code | ||||
|      18-19: 0 (reserved) | ||||
|  | ||||
|     Operation variations (changes in library functionality): | ||||
|      20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate | ||||
|      21: FASTEST -- deflate algorithm with only one, lowest compression level | ||||
|      22,23: 0 (reserved) | ||||
|  | ||||
|     The sprintf variant used by gzprintf (zero is best): | ||||
|      24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format | ||||
|      25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | ||||
|      26: 0 = returns value, 1 = void -- 1 means inferred string length returned | ||||
|  | ||||
|     Remainder: | ||||
|      27-31: 0 (reserved) | ||||
|  */ | ||||
|  | ||||
|  | ||||
|                         /* utility functions */ | ||||
|  | ||||
| @@ -843,8 +894,9 @@ ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode)); | ||||
|      Opens a gzip (.gz) file for reading or writing. The mode parameter | ||||
|    is as in fopen ("rb" or "wb") but can also include a compression level | ||||
|    ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for | ||||
|    Huffman only compression as in "wb1h". (See the description | ||||
|    of deflateInit2 for more information about the strategy parameter.) | ||||
|    Huffman only compression as in "wb1h", or 'R' for run-length encoding | ||||
|    as in "wb1R". (See the description of deflateInit2 for more information | ||||
|    about the strategy parameter.) | ||||
|  | ||||
|      gzopen can be used to read a file which is not in gzip format; in this | ||||
|    case gzread will directly read from the file without decompression. | ||||
| @@ -896,9 +948,12 @@ ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...)); | ||||
|      Converts, formats, and writes the args to the compressed file under | ||||
|    control of the format string, as in fprintf. gzprintf returns the number of | ||||
|    uncompressed bytes actually written (0 in case of error).  The number of | ||||
|    uncompressed bytes written is limited to 4095.  The caller should assure | ||||
|    that this limit is not exceeded, since otherwise a buffer overflow may | ||||
|    result. | ||||
|    uncompressed bytes written is limited to 4095. The caller should assure that | ||||
|    this limit is not exceeded. If it is exceeded, then gzprintf() will return | ||||
|    return an error (0) with nothing written. In this case, there may also be a | ||||
|    buffer overflow with unpredictable consequences, which is possible only if | ||||
|    zlib was compiled with the insecure functions sprintf() or vsprintf() | ||||
|    because the secure snprintf() or vsnprintf() functions were not available. | ||||
| */ | ||||
|  | ||||
| ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | ||||
| @@ -929,6 +984,16 @@ ZEXTERN int ZEXPORT    gzgetc OF((gzFile file)); | ||||
|    or -1 in case of end of file or error. | ||||
| */ | ||||
|  | ||||
| ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file)); | ||||
| /* | ||||
|       Push one character back onto the stream to be read again later. | ||||
|    Only one character of push-back is allowed.  gzungetc() returns the | ||||
|    character pushed, or -1 on failure.  gzungetc() will fail if a | ||||
|    character has been pushed but not read yet, or if c is -1. The pushed | ||||
|    character will be discarded if the stream is repositioned with gzseek() | ||||
|    or gzrewind(). | ||||
| */ | ||||
|  | ||||
| ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush)); | ||||
| /* | ||||
|      Flushes all pending output into the compressed file. The parameter | ||||
| @@ -995,6 +1060,13 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | ||||
|    to get the exact error code. | ||||
| */ | ||||
|  | ||||
| ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | ||||
| /* | ||||
|      Clears the error and end-of-file flags for file. This is analogous to the | ||||
|    clearerr() function in stdio. This is useful for continuing to read a gzip | ||||
|    file that is being written concurrently. | ||||
| */ | ||||
|  | ||||
|                         /* checksum functions */ | ||||
|  | ||||
| /* | ||||
| @@ -1070,7 +1142,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, | ||||
|         ZLIB_VERSION, sizeof(z_stream)) | ||||
|  | ||||
|  | ||||
| #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) | ||||
| #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | ||||
|     struct internal_state {int dummy;}; /* hack for buggy compilers */ | ||||
| #endif | ||||
|  | ||||
| @@ -1082,4 +1154,4 @@ ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void)); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* _ZLIB_H */ | ||||
| #endif /* ZLIB_H */ | ||||
|   | ||||
							
								
								
									
										83
									
								
								zutil.c
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								zutil.c
									
									
									
									
									
								
							| @@ -7,7 +7,9 @@ | ||||
|  | ||||
| #include "zutil.h" | ||||
|  | ||||
| #ifndef NO_DUMMY_DECL | ||||
| struct internal_state      {int dummy;}; /* for buggy compilers */ | ||||
| #endif | ||||
|  | ||||
| #ifndef STDC | ||||
| extern void exit OF((int)); | ||||
| @@ -31,6 +33,83 @@ const char * ZEXPORT zlibVersion() | ||||
|     return ZLIB_VERSION; | ||||
| } | ||||
|  | ||||
| uLong ZEXPORT zlibCompileFlags() | ||||
| { | ||||
|     uLong flags; | ||||
|  | ||||
|     flags = 0; | ||||
|     switch (sizeof(uInt)) { | ||||
|     case 2:     break; | ||||
|     case 4:     flags += 1;     break; | ||||
|     case 8:     flags += 2;     break; | ||||
|     default:    flags += 3; | ||||
|     } | ||||
|     switch (sizeof(uLong)) { | ||||
|     case 2:     break; | ||||
|     case 4:     flags += 1 << 2;        break; | ||||
|     case 8:     flags += 2 << 2;        break; | ||||
|     default:    flags += 3 << 2; | ||||
|     } | ||||
|     switch (sizeof(voidpf)) { | ||||
|     case 2:     break; | ||||
|     case 4:     flags += 1 << 4;        break; | ||||
|     case 8:     flags += 2 << 4;        break; | ||||
|     default:    flags += 3 << 4; | ||||
|     } | ||||
|     switch (sizeof(z_off_t)) { | ||||
|     case 2:     break; | ||||
|     case 4:     flags += 1 << 6;        break; | ||||
|     case 8:     flags += 2 << 6;        break; | ||||
|     default:    flags += 3 << 6; | ||||
|     } | ||||
| #ifdef DEBUG | ||||
|     flags += 1 << 8; | ||||
| #endif | ||||
| #ifdef BUILDFIXED | ||||
|     flags += 1 << 12; | ||||
| #endif | ||||
| #ifdef DYNAMIC_CRC_TABLE | ||||
|     flags += 1 << 13; | ||||
| #endif | ||||
| #ifdef NO_DEFLATE | ||||
|     flags += 1 << 16; | ||||
| #endif | ||||
| #ifdef NO_GUNZIP | ||||
|     flags += 1 << 17; | ||||
| #endif | ||||
| #ifdef PKZIP_BUG_WORKAROUND | ||||
|     flags += 1 << 20; | ||||
| #endif | ||||
| #ifdef FASTEST | ||||
|     flags += 1 << 21; | ||||
| #endif | ||||
| #ifdef STDC | ||||
| #  ifdef NO_vsnprintf | ||||
|         flags += 1 << 25; | ||||
| #    ifdef HAS_vsprintf_void | ||||
|         flags += 1 << 26; | ||||
| #    endif | ||||
| #  else | ||||
| #    ifdef HAS_vsnprintf_void | ||||
|         flags += 1 << 26; | ||||
| #    endif | ||||
| #  endif | ||||
| #else | ||||
|         flags += 1 << 24; | ||||
| #  ifdef NO_snprintf | ||||
|         flags += 1 << 25; | ||||
| #    ifdef HAS_sprintf_void | ||||
|         flags += 1 << 26; | ||||
| #    endif | ||||
| #  else | ||||
| #    ifdef HAS_snprintf_void | ||||
|         flags += 1 << 26; | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|     return flags; | ||||
| } | ||||
|  | ||||
| #ifdef DEBUG | ||||
|  | ||||
| #  ifndef verbose | ||||
| @@ -55,6 +134,10 @@ const char * ZEXPORT zError(err) | ||||
|     return ERR_MSG(err); | ||||
| } | ||||
|  | ||||
| #if defined(_WIN32_WCE) | ||||
|     /* does not exist on WCE */ | ||||
|     int errno = 0; | ||||
| #endif | ||||
|  | ||||
| #ifndef HAVE_MEMCPY | ||||
|  | ||||
|   | ||||
							
								
								
									
										37
									
								
								zutil.h
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								zutil.h
									
									
									
									
									
								
							| @@ -10,9 +10,10 @@ | ||||
|  | ||||
| /* @(#) $Id$ */ | ||||
|  | ||||
| #ifndef _Z_UTIL_H | ||||
| #define _Z_UTIL_H | ||||
| #ifndef ZUTIL_H | ||||
| #define ZUTIL_H | ||||
|  | ||||
| #define ZLIB_INTERNAL | ||||
| #include "zlib.h" | ||||
|  | ||||
| #ifdef STDC | ||||
| @@ -134,7 +135,11 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | ||||
| #endif | ||||
|  | ||||
| #if (defined(_MSC_VER) && (_MSC_VER > 600)) | ||||
| #  define fdopen(fd,type)  _fdopen(fd,type) | ||||
| #  if defined(_WIN32_WCE) | ||||
| #    define fdopen(fd,mode) NULL /* No fdopen() */ | ||||
| #  else | ||||
| #    define fdopen(fd,type)  _fdopen(fd,type) | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
| @@ -150,6 +155,30 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | ||||
|  | ||||
|          /* functions */ | ||||
|  | ||||
| #ifdef __STDC_VERSION__ | ||||
| #  if __STDC_VERSION__ >= 199901L | ||||
| #    ifndef STDC99 | ||||
| #      define STDC99 | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
| #if !defined(STDC99) && !(defined(__TURBOC__) && __TURBOC__ >= 0x550) && !defined(HAVE_VSNPRINTF) | ||||
| #  ifdef MSDOS | ||||
|      /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), | ||||
|         but for now we just assume it doesn't. */ | ||||
| #    define NO_vsnprintf | ||||
| #  endif | ||||
| #  ifdef WIN32 | ||||
|      /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ | ||||
| #    if !defined(vsnprintf) && !defined(__TURBOC__) | ||||
| #      define vsnprintf _vsnprintf | ||||
| #    endif | ||||
| #  endif | ||||
| #  ifdef __TURBOC__ | ||||
| #    define NO_vsnprintf | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #ifdef HAVE_STRERROR | ||||
|    extern char *strerror OF((int)); | ||||
| #  define zstrerror(errnum) strerror(errnum) | ||||
| @@ -215,4 +244,4 @@ void   zcfree  OF((voidpf opaque, voidpf ptr)); | ||||
| #define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) | ||||
| #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} | ||||
|  | ||||
| #endif /* _Z_UTIL_H */ | ||||
| #endif /* ZUTIL_H */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user