mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 06:01:28 +00:00
Update zlib to 1.2.12
This commit is contained in:
@@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
|||||||
|
|
||||||
project(zlib C)
|
project(zlib C)
|
||||||
|
|
||||||
set(VERSION "1.2.11")
|
set(VERSION "1.2.12")
|
||||||
|
|
||||||
option(ASM686 "Enable building i686 assembly implementation")
|
option(ASM686 "Enable building i686 assembly implementation")
|
||||||
option(AMD64 "Enable building amd64 assembly implementation")
|
option(AMD64 "Enable building amd64 assembly implementation")
|
||||||
|
|||||||
161
libz/ChangeLog
161
libz/ChangeLog
@@ -1,6 +1,69 @@
|
|||||||
|
|
||||||
ChangeLog file for zlib
|
ChangeLog file for zlib
|
||||||
|
|
||||||
|
Changes in 1.2.12 (27 Mar 2022)
|
||||||
|
- Cygwin does not have _wopen(), so do not create gzopen_w() there
|
||||||
|
- Permit a deflateParams() parameter change as soon as possible
|
||||||
|
- Limit hash table inserts after switch from stored deflate
|
||||||
|
- Fix bug when window full in deflate_stored()
|
||||||
|
- Fix CLEAR_HASH macro to be usable as a single statement
|
||||||
|
- Avoid a conversion error in gzseek when off_t type too small
|
||||||
|
- Have Makefile return non-zero error code on test failure
|
||||||
|
- Avoid some conversion warnings in gzread.c and gzwrite.c
|
||||||
|
- Update use of errno for newer Windows CE versions
|
||||||
|
- Small speedup to inflate [psumbera]
|
||||||
|
- Return an error if the gzputs string length can't fit in an int
|
||||||
|
- Add address checking in clang to -w option of configure
|
||||||
|
- Don't compute check value for raw inflate if asked to validate
|
||||||
|
- Handle case where inflateSync used when header never processed
|
||||||
|
- Avoid the use of ptrdiff_t
|
||||||
|
- Avoid an undefined behavior of memcpy() in gzappend()
|
||||||
|
- Avoid undefined behaviors of memcpy() in gz*printf()
|
||||||
|
- Avoid an undefined behavior of memcpy() in _tr_stored_block()
|
||||||
|
- Make the names in functions declarations identical to definitions
|
||||||
|
- Remove old assembler code in which bugs have manifested
|
||||||
|
- Fix deflateEnd() to not report an error at start of raw deflate
|
||||||
|
- Add legal disclaimer to README
|
||||||
|
- Emphasize the need to continue decompressing gzip members
|
||||||
|
- Correct the initialization requirements for deflateInit2()
|
||||||
|
- Fix a bug that can crash deflate on some input when using Z_FIXED
|
||||||
|
- Assure that the number of bits for deflatePrime() is valid
|
||||||
|
- Use a structure to make globals in enough.c evident
|
||||||
|
- Use a macro for the printf format of big_t in enough.c
|
||||||
|
- Clean up code style in enough.c, update version
|
||||||
|
- Use inline function instead of macro for index in enough.c
|
||||||
|
- Clarify that prefix codes are counted in enough.c
|
||||||
|
- Show all the codes for the maximum tables size in enough.c
|
||||||
|
- Add gznorm.c example, which normalizes gzip files
|
||||||
|
- Fix the zran.c example to work on a multiple-member gzip file
|
||||||
|
- Add tables for crc32_combine(), to speed it up by a factor of 200
|
||||||
|
- Add crc32_combine_gen() and crc32_combine_op() for fast combines
|
||||||
|
- Speed up software CRC-32 computation by a factor of 1.5 to 3
|
||||||
|
- Use atomic test and set, if available, for dynamic CRC tables
|
||||||
|
- Don't bother computing check value after successful inflateSync()
|
||||||
|
- Correct comment in crc32.c
|
||||||
|
- Add use of the ARMv8 crc32 instructions when requested
|
||||||
|
- Use ARM crc32 instructions if the ARM architecture has them
|
||||||
|
- Explicitly note that the 32-bit check values are 32 bits
|
||||||
|
- Avoid adding empty gzip member after gzflush with Z_FINISH
|
||||||
|
- Fix memory leak on error in gzlog.c
|
||||||
|
- Fix error in comment on the polynomial representation of a byte
|
||||||
|
- Clarify gz* function interfaces, referring to parameter names
|
||||||
|
- Change macro name in inflate.c to avoid collision in VxWorks
|
||||||
|
- Correct typo in blast.c
|
||||||
|
- Improve portability of contrib/minizip
|
||||||
|
- Fix indentation in minizip's zip.c
|
||||||
|
- Replace black/white with allow/block. (theresa-m)
|
||||||
|
- minizip warning fix if MAXU32 already defined. (gvollant)
|
||||||
|
- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner)
|
||||||
|
- Clean up minizip to reduce warnings for testing
|
||||||
|
- Add fallthrough comments for gcc
|
||||||
|
- Eliminate use of ULL constants
|
||||||
|
- Separate out address sanitizing from warnings in configure
|
||||||
|
- Remove destructive aspects of make distclean
|
||||||
|
- Check for cc masquerading as gcc or clang in configure
|
||||||
|
- Fix crc32.c to compile local functions only if used
|
||||||
|
|
||||||
Changes in 1.2.11 (15 Jan 2017)
|
Changes in 1.2.11 (15 Jan 2017)
|
||||||
- Fix deflate stored bug when pulling last block from window
|
- Fix deflate stored bug when pulling last block from window
|
||||||
- Permit immediate deflateParams changes before any deflate input
|
- Permit immediate deflateParams changes before any deflate input
|
||||||
@@ -511,7 +574,7 @@ Changes in 1.2.3.5 (8 Jan 2010)
|
|||||||
- Don't use _vsnprintf on later versions of MSVC [Lowman]
|
- Don't use _vsnprintf on later versions of MSVC [Lowman]
|
||||||
- Add CMake build script and input file [Lowman]
|
- Add CMake build script and input file [Lowman]
|
||||||
- Update contrib/minizip to 1.1 [Svensson, Vollant]
|
- Update contrib/minizip to 1.1 [Svensson, Vollant]
|
||||||
- Moved nintendods directory from contrib to .
|
- Moved nintendods directory from contrib to root
|
||||||
- Replace gzio.c with a new set of routines with the same functionality
|
- Replace gzio.c with a new set of routines with the same functionality
|
||||||
- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
|
- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
|
||||||
- Update contrib/minizip to 1.1b
|
- Update contrib/minizip to 1.1b
|
||||||
@@ -685,7 +748,7 @@ Changes in 1.2.2.4 (11 July 2005)
|
|||||||
- Be more strict on incomplete code sets in inflate_table() and increase
|
- Be more strict on incomplete code sets in inflate_table() and increase
|
||||||
ENOUGH and MAXD -- this repairs a possible security vulnerability for
|
ENOUGH and MAXD -- this repairs a possible security vulnerability for
|
||||||
invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
|
invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
|
||||||
discovering the vulnerability and providing test cases.
|
discovering the vulnerability and providing test cases
|
||||||
- Add ia64 support to configure for HP-UX [Smith]
|
- Add ia64 support to configure for HP-UX [Smith]
|
||||||
- Add error return to gzread() for format or i/o error [Levin]
|
- Add error return to gzread() for format or i/o error [Levin]
|
||||||
- Use malloc.h for OS/2 [Necasek]
|
- Use malloc.h for OS/2 [Necasek]
|
||||||
@@ -721,7 +784,7 @@ Changes in 1.2.2.2 (30 December 2004)
|
|||||||
- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
|
- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
|
||||||
- Add updated make_vms.com [Coghlan], update README
|
- Add updated make_vms.com [Coghlan], update README
|
||||||
- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
|
- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
|
||||||
fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
|
fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html
|
||||||
- Add FAQ entry and comments in deflate.c on uninitialized memory access
|
- Add FAQ entry and comments in deflate.c on uninitialized memory access
|
||||||
- Add Solaris 9 make options in configure [Gilbert]
|
- Add Solaris 9 make options in configure [Gilbert]
|
||||||
- Allow strerror() usage in gzio.c for STDC
|
- Allow strerror() usage in gzio.c for STDC
|
||||||
@@ -792,7 +855,7 @@ Changes in 1.2.1.1 (9 January 2004)
|
|||||||
- Fix a big fat bug in inftrees.c that prevented decoding valid
|
- Fix a big fat bug in inftrees.c that prevented decoding valid
|
||||||
dynamic blocks with only literals and no distance codes --
|
dynamic blocks with only literals and no distance codes --
|
||||||
Thanks to "Hot Emu" for the bug report and sample file
|
Thanks to "Hot Emu" for the bug report and sample file
|
||||||
- Add a note to puff.c on no distance codes case.
|
- Add a note to puff.c on no distance codes case
|
||||||
|
|
||||||
Changes in 1.2.1 (17 November 2003)
|
Changes in 1.2.1 (17 November 2003)
|
||||||
- Remove a tab in contrib/gzappend/gzappend.c
|
- Remove a tab in contrib/gzappend/gzappend.c
|
||||||
@@ -1036,14 +1099,14 @@ Changes in 1.2.0 (9 March 2003)
|
|||||||
- Add contrib/puff/ simple inflate for deflate format description
|
- Add contrib/puff/ simple inflate for deflate format description
|
||||||
|
|
||||||
Changes in 1.1.4 (11 March 2002)
|
Changes in 1.1.4 (11 March 2002)
|
||||||
- ZFREE was repeated on same allocation on some error conditions.
|
- ZFREE was repeated on same allocation on some error conditions
|
||||||
This creates a security problem described in
|
This creates a security problem described in
|
||||||
http://www.zlib.org/advisory-2002-03-11.txt
|
http://www.zlib.org/advisory-2002-03-11.txt
|
||||||
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
|
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
|
||||||
- Avoid accesses before window for invalid distances with inflate window
|
- Avoid accesses before window for invalid distances with inflate window
|
||||||
less than 32K.
|
less than 32K
|
||||||
- force windowBits > 8 to avoid a bug in the encoder for a window size
|
- force windowBits > 8 to avoid a bug in the encoder for a window size
|
||||||
of 256 bytes. (A complete fix will be available in 1.1.5).
|
of 256 bytes. (A complete fix will be available in 1.1.5)
|
||||||
|
|
||||||
Changes in 1.1.3 (9 July 1998)
|
Changes in 1.1.3 (9 July 1998)
|
||||||
- fix "an inflate input buffer bug that shows up on rare but persistent
|
- fix "an inflate input buffer bug that shows up on rare but persistent
|
||||||
@@ -1117,7 +1180,7 @@ Changes in 1.1.1 (27 Feb 98)
|
|||||||
- remove block truncation heuristic which had very marginal effect for zlib
|
- remove block truncation heuristic which had very marginal effect for zlib
|
||||||
(smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
|
(smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
|
||||||
compression ratio on some files. This also allows inlining _tr_tally for
|
compression ratio on some files. This also allows inlining _tr_tally for
|
||||||
matches in deflate_slow.
|
matches in deflate_slow
|
||||||
- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
|
- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
|
||||||
|
|
||||||
Changes in 1.1.0 (24 Feb 98)
|
Changes in 1.1.0 (24 Feb 98)
|
||||||
@@ -1162,7 +1225,7 @@ Changes in 1.0.8 (27 Jan 1998)
|
|||||||
- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
|
- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
|
||||||
- use constant arrays for the static trees in trees.c instead of computing
|
- use constant arrays for the static trees in trees.c instead of computing
|
||||||
them at run time (thanks to Ken Raeburn for this suggestion). To create
|
them at run time (thanks to Ken Raeburn for this suggestion). To create
|
||||||
trees.h, compile with GEN_TREES_H and run "make test".
|
trees.h, compile with GEN_TREES_H and run "make test"
|
||||||
- check return code of example in "make test" and display result
|
- check return code of example in "make test" and display result
|
||||||
- pass minigzip command line options to file_compress
|
- pass minigzip command line options to file_compress
|
||||||
- simplifying code of inflateSync to avoid gcc 2.8 bug
|
- simplifying code of inflateSync to avoid gcc 2.8 bug
|
||||||
@@ -1201,12 +1264,12 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
|
- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
|
||||||
gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
|
gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
|
||||||
- Fix a deflate bug occurring only with compression level 0 (thanks to
|
- Fix a deflate bug occurring only with compression level 0 (thanks to
|
||||||
Andy Buckler for finding this one).
|
Andy Buckler for finding this one)
|
||||||
- In minigzip, pass transparently also the first byte for .Z files.
|
- In minigzip, pass transparently also the first byte for .Z files
|
||||||
- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
|
- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
|
||||||
- check Z_FINISH in inflate (thanks to Marc Schluper)
|
- check Z_FINISH in inflate (thanks to Marc Schluper)
|
||||||
- Implement deflateCopy (thanks to Adam Costello)
|
- Implement deflateCopy (thanks to Adam Costello)
|
||||||
- make static libraries by default in configure, add --shared option.
|
- make static libraries by default in configure, add --shared option
|
||||||
- move MSDOS or Windows specific files to directory msdos
|
- move MSDOS or Windows specific files to directory msdos
|
||||||
- suppress the notion of partial flush to simplify the interface
|
- suppress the notion of partial flush to simplify the interface
|
||||||
(but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
|
(but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
|
||||||
@@ -1218,7 +1281,7 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
- added Makefile.nt (thanks to Stephen Williams)
|
- added Makefile.nt (thanks to Stephen Williams)
|
||||||
- added the unsupported "contrib" directory:
|
- added the unsupported "contrib" directory:
|
||||||
contrib/asm386/ by Gilles Vollant <info@winimage.com>
|
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>
|
contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
|
||||||
A C++ I/O streams interface to the zlib gz* functions
|
A C++ I/O streams interface to the zlib gz* functions
|
||||||
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
|
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
|
||||||
@@ -1226,7 +1289,7 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
|
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>
|
contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
|
||||||
How to use compress(), uncompress() and the gz* functions from VB.
|
How to use compress(), uncompress() and the gz* functions from VB
|
||||||
- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
|
- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
|
||||||
level) in minigzip (thanks to Tom Lane)
|
level) in minigzip (thanks to Tom Lane)
|
||||||
|
|
||||||
@@ -1235,8 +1298,8 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
|
- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
|
||||||
- add undocumented function zError to convert error code to string
|
- add undocumented function zError to convert error code to string
|
||||||
(for Tim Smithers)
|
(for Tim Smithers)
|
||||||
- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
|
- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code
|
||||||
- Use default memcpy for Symantec MSDOS compiler.
|
- Use default memcpy for Symantec MSDOS compiler
|
||||||
- Add EXPORT keyword for check_func (needed for Windows DLL)
|
- Add EXPORT keyword for check_func (needed for Windows DLL)
|
||||||
- add current directory to LD_LIBRARY_PATH for "make test"
|
- add current directory to LD_LIBRARY_PATH for "make test"
|
||||||
- create also a link for libz.so.1
|
- create also a link for libz.so.1
|
||||||
@@ -1249,7 +1312,7 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
- allow compilation with ANSI keywords only enabled for TurboC in large model
|
- allow compilation with ANSI keywords only enabled for TurboC in large model
|
||||||
- avoid "versionString"[0] (Borland bug)
|
- avoid "versionString"[0] (Borland bug)
|
||||||
- add NEED_DUMMY_RETURN for Borland
|
- add NEED_DUMMY_RETURN for Borland
|
||||||
- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
|
- use variable z_verbose for tracing in debug mode (L. Peter Deutsch)
|
||||||
- allow compilation with CC
|
- 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)
|
- limit external names to 8 chars for MVS (Thomas Lund)
|
||||||
@@ -1259,7 +1322,7 @@ Changes in 1.0.6 (19 Jan 1998)
|
|||||||
- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
|
- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
|
||||||
- added makelcc.bat for lcc-win32 (Tom St Denis)
|
- added makelcc.bat for lcc-win32 (Tom St Denis)
|
||||||
- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
|
- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
|
||||||
- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
|
- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion
|
||||||
- check for unistd.h in configure (for off_t)
|
- check for unistd.h in configure (for off_t)
|
||||||
- remove useless check parameter in inflate_blocks_free
|
- remove useless check parameter in inflate_blocks_free
|
||||||
- avoid useless assignment of s->check to itself in inflate_blocks_new
|
- avoid useless assignment of s->check to itself in inflate_blocks_new
|
||||||
@@ -1280,7 +1343,7 @@ Changes in 1.0.5 (3 Jan 98)
|
|||||||
Changes in 1.0.4 (24 Jul 96)
|
Changes in 1.0.4 (24 Jul 96)
|
||||||
- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
|
- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
|
||||||
bit, so the decompressor could decompress all the correct data but went
|
bit, so the decompressor could decompress all the correct data but went
|
||||||
on to attempt decompressing extra garbage data. This affected minigzip too.
|
on to attempt decompressing extra garbage data. This affected minigzip too
|
||||||
- zlibVersion and gzerror return const char* (needed for DLL)
|
- zlibVersion and gzerror return const char* (needed for DLL)
|
||||||
- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
|
- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
|
||||||
- use z_error only for DEBUG (avoid problem with DLLs)
|
- use z_error only for DEBUG (avoid problem with DLLs)
|
||||||
@@ -1310,7 +1373,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
|
|||||||
- fix array overlay in deflate.c which sometimes caused bad compressed data
|
- fix array overlay in deflate.c which sometimes caused bad compressed data
|
||||||
- fix inflate bug with empty stored block
|
- fix inflate bug with empty stored block
|
||||||
- fix MSDOS medium model which was broken in 0.99
|
- fix MSDOS medium model which was broken in 0.99
|
||||||
- fix deflateParams() which could generate bad compressed data.
|
- fix deflateParams() which could generate bad compressed data
|
||||||
- Bytef is define'd instead of typedef'ed (work around Borland bug)
|
- Bytef is define'd instead of typedef'ed (work around Borland bug)
|
||||||
- added an INDEX file
|
- added an INDEX file
|
||||||
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
|
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
|
||||||
@@ -1331,7 +1394,7 @@ Changes in 0.99 (27 Jan 96)
|
|||||||
- allow preset dictionary shared between compressor and decompressor
|
- allow preset dictionary shared between compressor and decompressor
|
||||||
- allow compression level 0 (no compression)
|
- allow compression level 0 (no compression)
|
||||||
- add deflateParams in zlib.h: allow dynamic change of compression level
|
- add deflateParams in zlib.h: allow dynamic change of compression level
|
||||||
and compression strategy.
|
and compression strategy
|
||||||
- test large buffers and deflateParams in example.c
|
- test large buffers and deflateParams in example.c
|
||||||
- add optional "configure" to build zlib as a shared library
|
- add optional "configure" to build zlib as a shared library
|
||||||
- suppress Makefile.qnx, use configure instead
|
- suppress Makefile.qnx, use configure instead
|
||||||
@@ -1373,30 +1436,30 @@ Changes in 0.99 (27 Jan 96)
|
|||||||
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
|
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
|
||||||
- use Z_BINARY instead of BINARY
|
- use Z_BINARY instead of BINARY
|
||||||
- document that gzclose after gzdopen will close the file
|
- document that gzclose after gzdopen will close the file
|
||||||
- allow "a" as mode in gzopen.
|
- allow "a" as mode in gzopen
|
||||||
- fix error checking in gzread
|
- fix error checking in gzread
|
||||||
- allow skipping .gz extra-field on pipes
|
- allow skipping .gz extra-field on pipes
|
||||||
- added reference to Perl interface in README
|
- added reference to Perl interface in README
|
||||||
- put the crc table in FAR data (I dislike more and more the medium model :)
|
- put the crc table in FAR data (I dislike more and more the medium model :)
|
||||||
- added get_crc_table
|
- added get_crc_table
|
||||||
- added a dimension to all arrays (Borland C can't count).
|
- added a dimension to all arrays (Borland C can't count)
|
||||||
- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
|
- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
|
||||||
- guard against multiple inclusion of *.h (for precompiled header on Mac)
|
- guard against multiple inclusion of *.h (for precompiled header on Mac)
|
||||||
- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
|
- Watcom C pretends to be Microsoft C small model even in 32 bit mode
|
||||||
- don't use unsized arrays to avoid silly warnings by Visual C++:
|
- don't use unsized arrays to avoid silly warnings by Visual C++:
|
||||||
warning C4746: 'inflate_mask' : unsized array treated as '__far'
|
warning C4746: 'inflate_mask' : unsized array treated as '__far'
|
||||||
(what's wrong with far data in far model?).
|
(what's wrong with far data in far model?)
|
||||||
- define enum out of inflate_blocks_state to allow compilation with C++
|
- define enum out of inflate_blocks_state to allow compilation with C++
|
||||||
|
|
||||||
Changes in 0.95 (16 Aug 95)
|
Changes in 0.95 (16 Aug 95)
|
||||||
- fix MSDOS small and medium model (now easier to adapt to any compiler)
|
- fix MSDOS small and medium model (now easier to adapt to any compiler)
|
||||||
- inlined send_bits
|
- inlined send_bits
|
||||||
- fix the final (:-) bug for deflate with flush (output was correct but
|
- fix the final (:-) bug for deflate with flush (output was correct but
|
||||||
not completely flushed in rare occasions).
|
not completely flushed in rare occasions)
|
||||||
- default window size is same for compression and decompression
|
- default window size is same for compression and decompression
|
||||||
(it's now sufficient to set MAX_WBITS in zconf.h).
|
(it's now sufficient to set MAX_WBITS in zconf.h)
|
||||||
- voidp -> voidpf and voidnp -> voidp (for consistency with other
|
- voidp -> voidpf and voidnp -> voidp (for consistency with other
|
||||||
typedefs and because voidnp was not near in large model).
|
typedefs and because voidnp was not near in large model)
|
||||||
|
|
||||||
Changes in 0.94 (13 Aug 95)
|
Changes in 0.94 (13 Aug 95)
|
||||||
- support MSDOS medium model
|
- support MSDOS medium model
|
||||||
@@ -1405,12 +1468,12 @@ Changes in 0.94 (13 Aug 95)
|
|||||||
- added support for VMS
|
- added support for VMS
|
||||||
- allow a compression level in gzopen()
|
- allow a compression level in gzopen()
|
||||||
- gzflush now calls fflush
|
- gzflush now calls fflush
|
||||||
- For deflate with flush, flush even if no more input is provided.
|
- For deflate with flush, flush even if no more input is provided
|
||||||
- rename libgz.a as libz.a
|
- rename libgz.a as libz.a
|
||||||
- avoid complex expression in infcodes.c triggering Turbo C bug
|
- avoid complex expression in infcodes.c triggering Turbo C bug
|
||||||
- work around a problem with gcc on Alpha (in INSERT_STRING)
|
- work around a problem with gcc on Alpha (in INSERT_STRING)
|
||||||
- don't use inline functions (problem with some gcc versions)
|
- don't use inline functions (problem with some gcc versions)
|
||||||
- allow renaming of Byte, uInt, etc... with #define.
|
- allow renaming of Byte, uInt, etc... with #define
|
||||||
- avoid warning about (unused) pointer before start of array in deflate.c
|
- avoid warning about (unused) pointer before start of array in deflate.c
|
||||||
- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
|
- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
|
||||||
- avoid reserved word 'new' in trees.c
|
- avoid reserved word 'new' in trees.c
|
||||||
@@ -1429,7 +1492,7 @@ Changes in 0.92 (3 May 95)
|
|||||||
- no memcpy on Pyramid
|
- no memcpy on Pyramid
|
||||||
- suppressed inftest.c
|
- suppressed inftest.c
|
||||||
- optimized fill_window, put longest_match inline for gcc
|
- optimized fill_window, put longest_match inline for gcc
|
||||||
- optimized inflate on stored blocks.
|
- optimized inflate on stored blocks
|
||||||
- untabify all sources to simplify patches
|
- untabify all sources to simplify patches
|
||||||
|
|
||||||
Changes in 0.91 (2 May 95)
|
Changes in 0.91 (2 May 95)
|
||||||
@@ -1447,7 +1510,7 @@ Changes in 0.9 (1 May 95)
|
|||||||
- let again gzread copy uncompressed data unchanged (was working in 0.71)
|
- let again gzread copy uncompressed data unchanged (was working in 0.71)
|
||||||
- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
|
- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
|
||||||
- added a test of inflateSync in example.c
|
- added a test of inflateSync in example.c
|
||||||
- moved MAX_WBITS to zconf.h because users might want to change that.
|
- moved MAX_WBITS to zconf.h because users might want to change that
|
||||||
- document explicitly that zalloc(64K) on MSDOS must return a normalized
|
- document explicitly that zalloc(64K) on MSDOS must return a normalized
|
||||||
pointer (zero offset)
|
pointer (zero offset)
|
||||||
- added Makefiles for Microsoft C, Turbo C, Borland C++
|
- added Makefiles for Microsoft C, Turbo C, Borland C++
|
||||||
@@ -1456,7 +1519,7 @@ Changes in 0.9 (1 May 95)
|
|||||||
Changes in 0.8 (29 April 95)
|
Changes in 0.8 (29 April 95)
|
||||||
- added fast inflate (inffast.c)
|
- added fast inflate (inffast.c)
|
||||||
- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
|
- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
|
||||||
is incompatible with previous versions of zlib which returned Z_OK.
|
is incompatible with previous versions of zlib which returned Z_OK
|
||||||
- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
|
- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
|
||||||
(actually that was not a compiler bug, see 0.81 above)
|
(actually that was not a compiler bug, see 0.81 above)
|
||||||
- gzread no longer reads one extra byte in certain cases
|
- gzread no longer reads one extra byte in certain cases
|
||||||
@@ -1466,50 +1529,50 @@ Changes in 0.8 (29 April 95)
|
|||||||
|
|
||||||
Changes in 0.71 (14 April 95)
|
Changes in 0.71 (14 April 95)
|
||||||
- Fixed more MSDOS compilation problems :( There is still a bug with
|
- Fixed more MSDOS compilation problems :( There is still a bug with
|
||||||
TurboC large model.
|
TurboC large model
|
||||||
|
|
||||||
Changes in 0.7 (14 April 95)
|
Changes in 0.7 (14 April 95)
|
||||||
- Added full inflate support.
|
- Added full inflate support
|
||||||
- Simplified the crc32() interface. The pre- and post-conditioning
|
- Simplified the crc32() interface. The pre- and post-conditioning
|
||||||
(one's complement) is now done inside crc32(). WARNING: this is
|
(one's complement) is now done inside crc32(). WARNING: this is
|
||||||
incompatible with previous versions; see zlib.h for the new usage.
|
incompatible with previous versions; see zlib.h for the new usage
|
||||||
|
|
||||||
Changes in 0.61 (12 April 95)
|
Changes in 0.61 (12 April 95)
|
||||||
- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
|
- workaround for a bug in TurboC. example and minigzip now work on MSDOS
|
||||||
|
|
||||||
Changes in 0.6 (11 April 95)
|
Changes in 0.6 (11 April 95)
|
||||||
- added minigzip.c
|
- added minigzip.c
|
||||||
- added gzdopen to reopen a file descriptor as gzFile
|
- added gzdopen to reopen a file descriptor as gzFile
|
||||||
- added transparent reading of non-gziped files in gzread.
|
- added transparent reading of non-gziped files in gzread
|
||||||
- fixed bug in gzread (don't read crc as data)
|
- fixed bug in gzread (don't read crc as data)
|
||||||
- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
|
- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose)
|
||||||
- don't allocate big arrays in the stack (for MSDOS)
|
- don't allocate big arrays in the stack (for MSDOS)
|
||||||
- fix some MSDOS compilation problems
|
- fix some MSDOS compilation problems
|
||||||
|
|
||||||
Changes in 0.5:
|
Changes in 0.5:
|
||||||
- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
|
- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
|
||||||
not yet Z_FULL_FLUSH.
|
not yet Z_FULL_FLUSH
|
||||||
- support decompression but only in a single step (forced Z_FINISH)
|
- support decompression but only in a single step (forced Z_FINISH)
|
||||||
- added opaque object for zalloc and zfree.
|
- added opaque object for zalloc and zfree
|
||||||
- added deflateReset and inflateReset
|
- added deflateReset and inflateReset
|
||||||
- added a variable zlib_version for consistency checking.
|
- added a variable zlib_version for consistency checking
|
||||||
- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
|
- renamed the 'filter' parameter of deflateInit2 as 'strategy'
|
||||||
Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
|
Added Z_FILTERED and Z_HUFFMAN_ONLY constants
|
||||||
|
|
||||||
Changes in 0.4:
|
Changes in 0.4:
|
||||||
- avoid "zip" everywhere, use zlib instead of ziplib.
|
- avoid "zip" everywhere, use zlib instead of ziplib
|
||||||
- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
|
- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
|
||||||
if compression method == 8.
|
if compression method == 8
|
||||||
- added adler32 and crc32
|
- added adler32 and crc32
|
||||||
- renamed deflateOptions as deflateInit2, call one or the other but not both
|
- renamed deflateOptions as deflateInit2, call one or the other but not both
|
||||||
- added the method parameter for deflateInit2.
|
- added the method parameter for deflateInit2
|
||||||
- added inflateInit2
|
- added inflateInit2
|
||||||
- simplied considerably deflateInit and inflateInit by not supporting
|
- simplied considerably deflateInit and inflateInit by not supporting
|
||||||
user-provided history buffer. This is supported only in deflateInit2
|
user-provided history buffer. This is supported only in deflateInit2
|
||||||
and inflateInit2.
|
and inflateInit2
|
||||||
|
|
||||||
Changes in 0.3:
|
Changes in 0.3:
|
||||||
- prefix all macro names with Z_
|
- prefix all macro names with Z_
|
||||||
- use Z_FINISH instead of deflateEnd to finish compression.
|
- use Z_FINISH instead of deflateEnd to finish compression
|
||||||
- added Z_HUFFMAN_ONLY
|
- added Z_HUFFMAN_ONLY
|
||||||
- added gzerror()
|
- added gzerror()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ CPP=$(CC) -E
|
|||||||
|
|
||||||
STATICLIB=libz.a
|
STATICLIB=libz.a
|
||||||
SHAREDLIB=libz.so
|
SHAREDLIB=libz.so
|
||||||
SHAREDLIBV=libz.so.1.2.11
|
SHAREDLIBV=libz.so.1.2.12
|
||||||
SHAREDLIBM=libz.so.1
|
SHAREDLIBM=libz.so.1
|
||||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
||||||
|
|
||||||
@@ -91,8 +91,8 @@ teststatic: static
|
|||||||
echo ' *** zlib test OK ***'; \
|
echo ' *** zlib test OK ***'; \
|
||||||
else \
|
else \
|
||||||
echo ' *** zlib test FAILED ***'; false; \
|
echo ' *** zlib test FAILED ***'; false; \
|
||||||
fi; \
|
fi
|
||||||
rm -f $$TMPST
|
@rm -f tmpst_$$
|
||||||
|
|
||||||
testshared: shared
|
testshared: shared
|
||||||
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
|
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
|
||||||
@@ -104,8 +104,8 @@ testshared: shared
|
|||||||
echo ' *** zlib shared test OK ***'; \
|
echo ' *** zlib shared test OK ***'; \
|
||||||
else \
|
else \
|
||||||
echo ' *** zlib shared test FAILED ***'; false; \
|
echo ' *** zlib shared test FAILED ***'; false; \
|
||||||
fi; \
|
fi
|
||||||
rm -f $$TMPSH
|
@rm -f tmpsh_$$
|
||||||
|
|
||||||
test64: all64
|
test64: all64
|
||||||
@TMP64=tmp64_$$; \
|
@TMP64=tmp64_$$; \
|
||||||
@@ -113,8 +113,8 @@ test64: all64
|
|||||||
echo ' *** zlib 64-bit test OK ***'; \
|
echo ' *** zlib 64-bit test OK ***'; \
|
||||||
else \
|
else \
|
||||||
echo ' *** zlib 64-bit test FAILED ***'; false; \
|
echo ' *** zlib 64-bit test FAILED ***'; false; \
|
||||||
fi; \
|
fi
|
||||||
rm -f $$TMP64
|
@rm -f tmp64_$$
|
||||||
|
|
||||||
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
|
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
|
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
|
||||||
@@ -376,15 +376,13 @@ clean:
|
|||||||
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
|
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
|
||||||
|
|
||||||
maintainer-clean: distclean
|
maintainer-clean: distclean
|
||||||
distclean: clean zconf zconf.h.cmakein docs
|
distclean: clean zconf zconf.h.cmakein
|
||||||
rm -f Makefile zlib.pc configure.log
|
rm -f Makefile zlib.pc configure.log
|
||||||
-@rm -f .DS_Store
|
-@rm -f .DS_Store
|
||||||
@if [ -f Makefile.in ]; then \
|
@if [ -f Makefile.in ]; then \
|
||||||
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
|
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
|
||||||
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
|
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
|
||||||
touch -r $(SRCDIR)Makefile.in Makefile ; fi
|
touch -r $(SRCDIR)Makefile.in Makefile ; fi
|
||||||
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
|
|
||||||
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
|
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
etags $(SRCDIR)*.[ch]
|
etags $(SRCDIR)*.[ch]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ diff --git a/libz/configure b/libz/configure
|
|||||||
index b77a8a8..9e8c8ff 100755
|
index b77a8a8..9e8c8ff 100755
|
||||||
--- a/libz/configure
|
--- a/libz/configure
|
||||||
+++ b/libz/configure
|
+++ b/libz/configure
|
||||||
@@ -124,7 +124,8 @@ case "$1" in
|
@@ -142,7 +142,8 @@ case "$1" in
|
||||||
*)
|
*)
|
||||||
echo "unknown option: $1" | tee -a configure.log
|
echo "unknown option: $1" | tee -a configure.log
|
||||||
echo "$0 --help for help" | tee -a configure.log
|
echo "$0 --help for help" | tee -a configure.log
|
||||||
@@ -10,4 +10,4 @@ index b77a8a8..9e8c8ff 100755
|
|||||||
+ # leave 1;; # Hack for nmap compilation
|
+ # leave 1;; # Hack for nmap compilation
|
||||||
+ shift;;
|
+ shift;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
11
libz/README
11
libz/README
@@ -1,6 +1,6 @@
|
|||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.11 is a general purpose data compression library. All the code is
|
zlib 1.2.12 is a general purpose data compression library. All the code is
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
thread safe. The data format used by the zlib library is described by RFCs
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
(Request for Comments) 1950 to 1952 in the files
|
||||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||||
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
|||||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||||
|
|
||||||
The changes made in version 1.2.11 are documented in the file ChangeLog.
|
The changes made in version 1.2.12 are documented in the file ChangeLog.
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory contrib/ .
|
Unsupported third party contributions are provided in directory contrib/ .
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ Acknowledgments:
|
|||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
(C) 1995-2017 Jean-loup Gailly and Mark Adler
|
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -108,7 +108,10 @@ Copyright notice:
|
|||||||
If you use the zlib library in a product, we would appreciate *not* receiving
|
If you use the zlib library in a product, we would appreciate *not* receiving
|
||||||
lengthy legal documents to sign. The sources are provided for free but without
|
lengthy legal documents to sign. The sources are provided for free but without
|
||||||
warranty of any kind. The library has been entirely written by Jean-loup
|
warranty of any kind. The library has been entirely written by Jean-loup
|
||||||
Gailly and Mark Adler; it does not include third-party code.
|
Gailly and Mark Adler; it does not include third-party code. We make all
|
||||||
|
contributions to and distributions of this project solely in our personal
|
||||||
|
capacity, and are not conveying any rights to any intellectual property of
|
||||||
|
any third parties.
|
||||||
|
|
||||||
If you redistribute modified sources, we would appreciate that you include in
|
If you redistribute modified sources, we would appreciate that you include in
|
||||||
the file ChangeLog history information documenting your changes. Please read
|
the file ChangeLog history information documenting your changes. Please read
|
||||||
|
|||||||
48
libz/configure
vendored
Normal file → Executable file
48
libz/configure
vendored
Normal file → Executable file
@@ -87,6 +87,7 @@ build64=0
|
|||||||
gcc=0
|
gcc=0
|
||||||
warn=0
|
warn=0
|
||||||
debug=0
|
debug=0
|
||||||
|
sanitize=0
|
||||||
old_cc="$CC"
|
old_cc="$CC"
|
||||||
old_cflags="$CFLAGS"
|
old_cflags="$CFLAGS"
|
||||||
OBJC='$(OBJZ) $(OBJG)'
|
OBJC='$(OBJZ) $(OBJG)'
|
||||||
@@ -137,6 +138,7 @@ case "$1" in
|
|||||||
-c* | --const) zconst=1; shift ;;
|
-c* | --const) zconst=1; shift ;;
|
||||||
-w* | --warn) warn=1; shift ;;
|
-w* | --warn) warn=1; shift ;;
|
||||||
-d* | --debug) debug=1; shift ;;
|
-d* | --debug) debug=1; shift ;;
|
||||||
|
--sanitize) sanitize=1; shift ;;
|
||||||
*)
|
*)
|
||||||
echo "unknown option: $1" | tee -a configure.log
|
echo "unknown option: $1" | tee -a configure.log
|
||||||
echo "$0 --help for help" | tee -a configure.log
|
echo "$0 --help for help" | tee -a configure.log
|
||||||
@@ -166,8 +168,14 @@ extern int getchar();
|
|||||||
int hello() {return getchar();}
|
int hello() {return getchar();}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
|
if test -z "$CC"; then
|
||||||
cc=${CC-${CROSS_PREFIX}gcc}
|
echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
|
||||||
|
if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
|
||||||
|
cc=${CROSS_PREFIX}gcc
|
||||||
|
else
|
||||||
|
cc=${CROSS_PREFIX}cc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
cflags=${CFLAGS-"-O3"}
|
cflags=${CFLAGS-"-O3"}
|
||||||
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
||||||
case "$cc" in
|
case "$cc" in
|
||||||
@@ -200,6 +208,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
|||||||
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
|
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if test $sanitize -eq 1; then
|
||||||
|
CFLAGS="${CFLAGS} -fsanitize=address"
|
||||||
|
fi
|
||||||
if test $debug -eq 1; then
|
if test $debug -eq 1; then
|
||||||
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
|
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
|
||||||
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
|
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
|
||||||
@@ -368,8 +379,11 @@ else
|
|||||||
try()
|
try()
|
||||||
{
|
{
|
||||||
show $*
|
show $*
|
||||||
( $* ) >> configure.log 2>&1
|
got=`( $* ) 2>&1`
|
||||||
ret=$?
|
ret=$?
|
||||||
|
if test "$got" != ""; then
|
||||||
|
printf "%s\n" "$got" >> configure.log
|
||||||
|
fi
|
||||||
if test $ret -ne 0; then
|
if test $ret -ne 0; then
|
||||||
echo "(exit code "$ret")" >> configure.log
|
echo "(exit code "$ret")" >> configure.log
|
||||||
fi
|
fi
|
||||||
@@ -382,8 +396,11 @@ tryboth()
|
|||||||
show $*
|
show $*
|
||||||
got=`( $* ) 2>&1`
|
got=`( $* ) 2>&1`
|
||||||
ret=$?
|
ret=$?
|
||||||
printf %s "$got" >> configure.log
|
if test "$got" != ""; then
|
||||||
|
printf "%s\n" "$got" >> configure.log
|
||||||
|
fi
|
||||||
if test $ret -ne 0; then
|
if test $ret -ne 0; then
|
||||||
|
echo "(exit code "$ret")" >> configure.log
|
||||||
return $ret
|
return $ret
|
||||||
fi
|
fi
|
||||||
test "$got" = ""
|
test "$got" = ""
|
||||||
@@ -458,17 +475,11 @@ size_t dummy = 0;
|
|||||||
EOF
|
EOF
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
if try $CC -c $CFLAGS $test.c; then
|
||||||
echo "Checking for size_t... Yes." | tee -a configure.log
|
echo "Checking for size_t... Yes." | tee -a configure.log
|
||||||
need_sizet=0
|
|
||||||
else
|
else
|
||||||
echo "Checking for size_t... No." | tee -a configure.log
|
echo "Checking for size_t... No." | tee -a configure.log
|
||||||
need_sizet=1
|
# find a size_t integer type
|
||||||
fi
|
# check for long long
|
||||||
|
cat > $test.c << EOF
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# find the size_t integer type, if needed
|
|
||||||
if test $need_sizet -eq 1; then
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
long long dummy = 0;
|
long long dummy = 0;
|
||||||
EOF
|
EOF
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
if try $CC -c $CFLAGS $test.c; then
|
||||||
@@ -496,17 +507,13 @@ EOF
|
|||||||
if try $CC $CFLAGS -o $test $test.c; then
|
if try $CC $CFLAGS -o $test $test.c; then
|
||||||
sizet=`./$test`
|
sizet=`./$test`
|
||||||
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
|
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
|
||||||
|
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
|
||||||
|
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
|
||||||
else
|
else
|
||||||
echo "Failed to find a pointer-size integer type." | tee -a configure.log
|
echo "Checking for a pointer-size integer type... not found." | tee -a configure.log
|
||||||
leave 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $need_sizet -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
|
|
||||||
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
echo >> configure.log
|
||||||
|
|
||||||
# check for large file support, and if none, check for fseeko()
|
# check for large file support, and if none, check for fseeko()
|
||||||
@@ -850,7 +857,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
|
|||||||
echo STATICLIB = $STATICLIB >> configure.log
|
echo STATICLIB = $STATICLIB >> configure.log
|
||||||
echo TEST = $TEST >> configure.log
|
echo TEST = $TEST >> configure.log
|
||||||
echo VER = $VER >> configure.log
|
echo VER = $VER >> configure.log
|
||||||
echo Z_U4 = $Z_U4 >> configure.log
|
|
||||||
echo SRCDIR = $SRCDIR >> configure.log
|
echo SRCDIR = $SRCDIR >> configure.log
|
||||||
echo exec_prefix = $exec_prefix >> configure.log
|
echo exec_prefix = $exec_prefix >> configure.log
|
||||||
echo includedir = $includedir >> configure.log
|
echo includedir = $includedir >> configure.log
|
||||||
|
|||||||
@@ -8,14 +8,6 @@ ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
|
|||||||
Support for Ada
|
Support for Ada
|
||||||
See http://zlib-ada.sourceforge.net/
|
See http://zlib-ada.sourceforge.net/
|
||||||
|
|
||||||
amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
|
|
||||||
asm code for AMD64
|
|
||||||
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
|
|
||||||
|
|
||||||
asm686/ by Brian Raiter <breadbox@muppetlabs.com>
|
|
||||||
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
|
|
||||||
See http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
|
|
||||||
blast/ by Mark Adler <madler@alumni.caltech.edu>
|
blast/ by Mark Adler <madler@alumni.caltech.edu>
|
||||||
Decompressor for output of PKWare Data Compression Library (DCL)
|
Decompressor for output of PKWare Data Compression Library (DCL)
|
||||||
|
|
||||||
@@ -32,9 +24,6 @@ gcc_gvmat64/by Gilles Vollant <info@winimage.com>
|
|||||||
infback9/ by Mark Adler <madler@alumni.caltech.edu>
|
infback9/ by Mark Adler <madler@alumni.caltech.edu>
|
||||||
Unsupported diffs to infback to decode the deflate64 format
|
Unsupported diffs to infback to decode the deflate64 format
|
||||||
|
|
||||||
inflate86/ by Chris Anderson <christop@charm.net>
|
|
||||||
Tuned x86 gcc asm code to replace inflate_fast()
|
|
||||||
|
|
||||||
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
|
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
|
||||||
A C++ I/O streams interface to the zlib gz* functions
|
A C++ I/O streams interface to the zlib gz* functions
|
||||||
|
|
||||||
@@ -45,16 +34,6 @@ iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
|
|||||||
and Kevin Ruland <kevin@rodin.wustl.edu>
|
and Kevin Ruland <kevin@rodin.wustl.edu>
|
||||||
Yet another C++ I/O streams interface
|
Yet another C++ I/O streams interface
|
||||||
|
|
||||||
masmx64/ by Gilles Vollant <info@winimage.com>
|
|
||||||
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
|
|
||||||
replace longest_match() and inflate_fast(), also masm x86
|
|
||||||
64-bits translation of Chris Anderson inflate_fast()
|
|
||||||
|
|
||||||
masmx86/ by Gilles Vollant <info@winimage.com>
|
|
||||||
x86 asm code to replace longest_match() and inflate_fast(),
|
|
||||||
for Visual C++ and MASM (32 bits).
|
|
||||||
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
|
|
||||||
|
|
||||||
minizip/ by Gilles Vollant <info@winimage.com>
|
minizip/ by Gilles Vollant <info@winimage.com>
|
||||||
Mini zip and unzip based on zlib
|
Mini zip and unzip based on zlib
|
||||||
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
|
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
|
||||||
|
|||||||
@@ -1,452 +0,0 @@
|
|||||||
/*
|
|
||||||
* match.S -- optimized version of longest_match()
|
|
||||||
* based on the similar work by Gilles Vollant, and Brian Raiter, written 1998
|
|
||||||
*
|
|
||||||
* This is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the BSD License. Use by owners of Che Guevarra
|
|
||||||
* parafernalia is prohibited, where possible, and highly discouraged
|
|
||||||
* elsewhere.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NO_UNDERLINE
|
|
||||||
# define match_init _match_init
|
|
||||||
# define longest_match _longest_match
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define scanend ebx
|
|
||||||
#define scanendw bx
|
|
||||||
#define chainlenwmask edx /* high word: current chain len low word: s->wmask */
|
|
||||||
#define curmatch rsi
|
|
||||||
#define curmatchd esi
|
|
||||||
#define windowbestlen r8
|
|
||||||
#define scanalign r9
|
|
||||||
#define scanalignd r9d
|
|
||||||
#define window r10
|
|
||||||
#define bestlen r11
|
|
||||||
#define bestlend r11d
|
|
||||||
#define scanstart r12d
|
|
||||||
#define scanstartw r12w
|
|
||||||
#define scan r13
|
|
||||||
#define nicematch r14d
|
|
||||||
#define limit r15
|
|
||||||
#define limitd r15d
|
|
||||||
#define prev rcx
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The 258 is a "magic number, not a parameter -- changing it
|
|
||||||
* breaks the hell loose
|
|
||||||
*/
|
|
||||||
#define MAX_MATCH (258)
|
|
||||||
#define MIN_MATCH (3)
|
|
||||||
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
|
|
||||||
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
|
|
||||||
|
|
||||||
/* stack frame offsets */
|
|
||||||
#define LocalVarsSize (112)
|
|
||||||
#define _chainlenwmask ( 8-LocalVarsSize)(%rsp)
|
|
||||||
#define _windowbestlen (16-LocalVarsSize)(%rsp)
|
|
||||||
#define save_r14 (24-LocalVarsSize)(%rsp)
|
|
||||||
#define save_rsi (32-LocalVarsSize)(%rsp)
|
|
||||||
#define save_rbx (40-LocalVarsSize)(%rsp)
|
|
||||||
#define save_r12 (56-LocalVarsSize)(%rsp)
|
|
||||||
#define save_r13 (64-LocalVarsSize)(%rsp)
|
|
||||||
#define save_r15 (80-LocalVarsSize)(%rsp)
|
|
||||||
|
|
||||||
|
|
||||||
.globl match_init, longest_match
|
|
||||||
|
|
||||||
/*
|
|
||||||
* On AMD64 the first argument of a function (in our case -- the pointer to
|
|
||||||
* deflate_state structure) is passed in %rdi, hence our offsets below are
|
|
||||||
* all off of that.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* you can check the structure offset by running
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "deflate.h"
|
|
||||||
|
|
||||||
void print_depl()
|
|
||||||
{
|
|
||||||
deflate_state ds;
|
|
||||||
deflate_state *s=&ds;
|
|
||||||
printf("size pointer=%u\n",(int)sizeof(void*));
|
|
||||||
|
|
||||||
printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s)));
|
|
||||||
printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s)));
|
|
||||||
printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s)));
|
|
||||||
printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s)));
|
|
||||||
printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s)));
|
|
||||||
printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s)));
|
|
||||||
printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s)));
|
|
||||||
printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s)));
|
|
||||||
printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s)));
|
|
||||||
printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s)));
|
|
||||||
printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
|
|
||||||
printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s)));
|
|
||||||
printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s)));
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
to compile for XCode 3.2 on MacOSX x86_64
|
|
||||||
- run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S"
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE
|
|
||||||
#define dsWSize ( 68)(%rdi)
|
|
||||||
#define dsWMask ( 76)(%rdi)
|
|
||||||
#define dsWindow ( 80)(%rdi)
|
|
||||||
#define dsPrev ( 96)(%rdi)
|
|
||||||
#define dsMatchLen (144)(%rdi)
|
|
||||||
#define dsPrevMatch (148)(%rdi)
|
|
||||||
#define dsStrStart (156)(%rdi)
|
|
||||||
#define dsMatchStart (160)(%rdi)
|
|
||||||
#define dsLookahead (164)(%rdi)
|
|
||||||
#define dsPrevLen (168)(%rdi)
|
|
||||||
#define dsMaxChainLen (172)(%rdi)
|
|
||||||
#define dsGoodMatch (188)(%rdi)
|
|
||||||
#define dsNiceMatch (192)(%rdi)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifndef STRUCT_OFFSET
|
|
||||||
# define STRUCT_OFFSET (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsStrStart (148 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsLookahead (156 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi)
|
|
||||||
#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
|
|
||||||
|
|
||||||
longest_match:
|
|
||||||
/*
|
|
||||||
* Retrieve the function arguments. %curmatch will hold cur_match
|
|
||||||
* throughout the entire function (passed via rsi on amd64).
|
|
||||||
* rdi will hold the pointer to the deflate_state (first arg on amd64)
|
|
||||||
*/
|
|
||||||
mov %rsi, save_rsi
|
|
||||||
mov %rbx, save_rbx
|
|
||||||
mov %r12, save_r12
|
|
||||||
mov %r13, save_r13
|
|
||||||
mov %r14, save_r14
|
|
||||||
mov %r15, save_r15
|
|
||||||
|
|
||||||
/* uInt wmask = s->w_mask; */
|
|
||||||
/* unsigned chain_length = s->max_chain_length; */
|
|
||||||
/* if (s->prev_length >= s->good_match) { */
|
|
||||||
/* chain_length >>= 2; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
movl dsPrevLen, %eax
|
|
||||||
movl dsGoodMatch, %ebx
|
|
||||||
cmpl %ebx, %eax
|
|
||||||
movl dsWMask, %eax
|
|
||||||
movl dsMaxChainLen, %chainlenwmask
|
|
||||||
jl LastMatchGood
|
|
||||||
shrl $2, %chainlenwmask
|
|
||||||
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. */
|
|
||||||
|
|
||||||
decl %chainlenwmask
|
|
||||||
shll $16, %chainlenwmask
|
|
||||||
orl %eax, %chainlenwmask
|
|
||||||
|
|
||||||
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
|
|
||||||
|
|
||||||
movl dsNiceMatch, %eax
|
|
||||||
movl dsLookahead, %ebx
|
|
||||||
cmpl %eax, %ebx
|
|
||||||
jl LookaheadLess
|
|
||||||
movl %eax, %ebx
|
|
||||||
LookaheadLess: movl %ebx, %nicematch
|
|
||||||
|
|
||||||
/* register Bytef *scan = s->window + s->strstart; */
|
|
||||||
|
|
||||||
mov dsWindow, %window
|
|
||||||
movl dsStrStart, %limitd
|
|
||||||
lea (%limit, %window), %scan
|
|
||||||
|
|
||||||
/* Determine how many bytes the scan ptr is off from being */
|
|
||||||
/* dword-aligned. */
|
|
||||||
|
|
||||||
mov %scan, %scanalign
|
|
||||||
negl %scanalignd
|
|
||||||
andl $3, %scanalignd
|
|
||||||
|
|
||||||
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
|
|
||||||
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
|
|
||||||
|
|
||||||
movl dsWSize, %eax
|
|
||||||
subl $MIN_LOOKAHEAD, %eax
|
|
||||||
xorl %ecx, %ecx
|
|
||||||
subl %eax, %limitd
|
|
||||||
cmovng %ecx, %limitd
|
|
||||||
|
|
||||||
/* int best_len = s->prev_length; */
|
|
||||||
|
|
||||||
movl dsPrevLen, %bestlend
|
|
||||||
|
|
||||||
/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */
|
|
||||||
|
|
||||||
lea (%window, %bestlen), %windowbestlen
|
|
||||||
mov %windowbestlen, _windowbestlen
|
|
||||||
|
|
||||||
/* register ush scan_start = *(ushf*)scan; */
|
|
||||||
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
|
|
||||||
/* Posf *prev = s->prev; */
|
|
||||||
|
|
||||||
movzwl (%scan), %scanstart
|
|
||||||
movzwl -1(%scan, %bestlen), %scanend
|
|
||||||
mov dsPrev, %prev
|
|
||||||
|
|
||||||
/* Jump into the main loop. */
|
|
||||||
|
|
||||||
movl %chainlenwmask, _chainlenwmask
|
|
||||||
jmp LoopEntry
|
|
||||||
|
|
||||||
.balign 16
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
LookupLoop:
|
|
||||||
andl %chainlenwmask, %curmatchd
|
|
||||||
movzwl (%prev, %curmatch, 2), %curmatchd
|
|
||||||
cmpl %limitd, %curmatchd
|
|
||||||
jbe LeaveNow
|
|
||||||
subl $0x00010000, %chainlenwmask
|
|
||||||
js LeaveNow
|
|
||||||
LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw
|
|
||||||
jne LookupLoop
|
|
||||||
cmpw %scanstartw, (%window, %curmatch)
|
|
||||||
jne LookupLoop
|
|
||||||
|
|
||||||
/* Store the current value of chainlen. */
|
|
||||||
movl %chainlenwmask, _chainlenwmask
|
|
||||||
|
|
||||||
/* %scan is the string under scrutiny, and %prev 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 $(-MAX_MATCH_8), %rdx
|
|
||||||
lea (%curmatch, %window), %windowbestlen
|
|
||||||
lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen
|
|
||||||
lea MAX_MATCH_8(%scan, %scanalign), %prev
|
|
||||||
|
|
||||||
/* the prefetching below makes very little difference... */
|
|
||||||
prefetcht1 (%windowbestlen, %rdx)
|
|
||||||
prefetcht1 (%prev, %rdx)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test the strings for equality, 8 bytes at a time. At the end,
|
|
||||||
* adjust %rdx so that it is offset to the exact byte that mismatched.
|
|
||||||
*
|
|
||||||
* 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 -- unrolling it, for example, makes no difference.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */
|
|
||||||
|
|
||||||
LoopCmps:
|
|
||||||
#ifdef USE_SSE
|
|
||||||
/* Preload the SSE registers */
|
|
||||||
movdqu (%windowbestlen, %rdx), %xmm1
|
|
||||||
movdqu (%prev, %rdx), %xmm2
|
|
||||||
pcmpeqb %xmm2, %xmm1
|
|
||||||
movdqu 16(%windowbestlen, %rdx), %xmm3
|
|
||||||
movdqu 16(%prev, %rdx), %xmm4
|
|
||||||
pcmpeqb %xmm4, %xmm3
|
|
||||||
movdqu 32(%windowbestlen, %rdx), %xmm5
|
|
||||||
movdqu 32(%prev, %rdx), %xmm6
|
|
||||||
pcmpeqb %xmm6, %xmm5
|
|
||||||
movdqu 48(%windowbestlen, %rdx), %xmm7
|
|
||||||
movdqu 48(%prev, %rdx), %xmm8
|
|
||||||
pcmpeqb %xmm8, %xmm7
|
|
||||||
|
|
||||||
/* Check the comparisions' results */
|
|
||||||
pmovmskb %xmm1, %rax
|
|
||||||
notw %ax
|
|
||||||
bsfw %ax, %ax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
/* this is the only iteration of the loop with a possibility of having
|
|
||||||
incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40
|
|
||||||
and (0x40*4)+8=0x108 */
|
|
||||||
add $8, %rdx
|
|
||||||
jz LenMaximum
|
|
||||||
add $8, %rdx
|
|
||||||
|
|
||||||
|
|
||||||
pmovmskb %xmm3, %rax
|
|
||||||
notw %ax
|
|
||||||
bsfw %ax, %ax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
|
|
||||||
add $16, %rdx
|
|
||||||
|
|
||||||
|
|
||||||
pmovmskb %xmm5, %rax
|
|
||||||
notw %ax
|
|
||||||
bsfw %ax, %ax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
add $16, %rdx
|
|
||||||
|
|
||||||
|
|
||||||
pmovmskb %xmm7, %rax
|
|
||||||
notw %ax
|
|
||||||
bsfw %ax, %ax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
add $16, %rdx
|
|
||||||
|
|
||||||
jmp LoopCmps
|
|
||||||
LeaveLoopCmps: add %rax, %rdx
|
|
||||||
#else
|
|
||||||
mov (%windowbestlen, %rdx), %rax
|
|
||||||
xor (%prev, %rdx), %rax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
mov 8(%windowbestlen, %rdx), %rax
|
|
||||||
xor 8(%prev, %rdx), %rax
|
|
||||||
jnz LeaveLoopCmps8
|
|
||||||
|
|
||||||
mov 16(%windowbestlen, %rdx), %rax
|
|
||||||
xor 16(%prev, %rdx), %rax
|
|
||||||
jnz LeaveLoopCmps16
|
|
||||||
|
|
||||||
add $24, %rdx
|
|
||||||
jnz LoopCmps
|
|
||||||
jmp LenMaximum
|
|
||||||
# if 0
|
|
||||||
/*
|
|
||||||
* This three-liner is tantalizingly simple, but bsf is a slow instruction,
|
|
||||||
* and the complicated alternative down below is quite a bit faster. Sad...
|
|
||||||
*/
|
|
||||||
|
|
||||||
LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */
|
|
||||||
shrl $3, %eax /* divide by 8 to get the byte */
|
|
||||||
add %rax, %rdx
|
|
||||||
# else
|
|
||||||
LeaveLoopCmps16:
|
|
||||||
add $8, %rdx
|
|
||||||
LeaveLoopCmps8:
|
|
||||||
add $8, %rdx
|
|
||||||
LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */
|
|
||||||
jnz Check16
|
|
||||||
add $4, %rdx
|
|
||||||
shr $32, %rax
|
|
||||||
Check16: testw $0xFFFF, %ax
|
|
||||||
jnz LenLower
|
|
||||||
add $2, %rdx
|
|
||||||
shrl $16, %eax
|
|
||||||
LenLower: subb $1, %al
|
|
||||||
adc $0, %rdx
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 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 (%prev, %rdx), %rax
|
|
||||||
sub %scan, %rax
|
|
||||||
cmpl $MAX_MATCH, %eax
|
|
||||||
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. */
|
|
||||||
|
|
||||||
cmpl %bestlend, %eax
|
|
||||||
jg LongerMatch
|
|
||||||
mov _windowbestlen, %windowbestlen
|
|
||||||
mov dsPrev, %prev
|
|
||||||
movl _chainlenwmask, %edx
|
|
||||||
jmp LookupLoop
|
|
||||||
|
|
||||||
/* s->match_start = cur_match; */
|
|
||||||
/* best_len = len; */
|
|
||||||
/* if (len >= nice_match) break; */
|
|
||||||
/* scan_end = *(ushf*)(scan+best_len-1); */
|
|
||||||
|
|
||||||
LongerMatch:
|
|
||||||
movl %eax, %bestlend
|
|
||||||
movl %curmatchd, dsMatchStart
|
|
||||||
cmpl %nicematch, %eax
|
|
||||||
jge LeaveNow
|
|
||||||
|
|
||||||
lea (%window, %bestlen), %windowbestlen
|
|
||||||
mov %windowbestlen, _windowbestlen
|
|
||||||
|
|
||||||
movzwl -1(%scan, %rax), %scanend
|
|
||||||
mov dsPrev, %prev
|
|
||||||
movl _chainlenwmask, %chainlenwmask
|
|
||||||
jmp LookupLoop
|
|
||||||
|
|
||||||
/* Accept the current string, with the maximum possible length. */
|
|
||||||
|
|
||||||
LenMaximum:
|
|
||||||
movl $MAX_MATCH, %bestlend
|
|
||||||
movl %curmatchd, dsMatchStart
|
|
||||||
|
|
||||||
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
|
|
||||||
/* return s->lookahead; */
|
|
||||||
|
|
||||||
LeaveNow:
|
|
||||||
movl dsLookahead, %eax
|
|
||||||
cmpl %eax, %bestlend
|
|
||||||
cmovngl %bestlend, %eax
|
|
||||||
LookaheadRet:
|
|
||||||
|
|
||||||
/* Restore the registers and return from whence we came. */
|
|
||||||
|
|
||||||
mov save_rsi, %rsi
|
|
||||||
mov save_rbx, %rbx
|
|
||||||
mov save_r12, %r12
|
|
||||||
mov save_r13, %r13
|
|
||||||
mov save_r14, %r14
|
|
||||||
mov save_r15, %r15
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
match_init: ret
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
This is a patched version of zlib, modified to use
|
|
||||||
Pentium-Pro-optimized assembly code in the deflation algorithm. The
|
|
||||||
files changed/added by this patch are:
|
|
||||||
|
|
||||||
README.686
|
|
||||||
match.S
|
|
||||||
|
|
||||||
The speedup that this patch provides varies, depending on whether the
|
|
||||||
compiler used to build the original version of zlib falls afoul of the
|
|
||||||
PPro's speed traps. My own tests show a speedup of around 10-20% at
|
|
||||||
the default compression level, and 20-30% using -9, against a version
|
|
||||||
compiled using gcc 2.7.2.3. Your mileage may vary.
|
|
||||||
|
|
||||||
Note that this code has been tailored for the PPro/PII in particular,
|
|
||||||
and will not perform particuarly well on a Pentium.
|
|
||||||
|
|
||||||
If you are using an assembler other than GNU as, you will have to
|
|
||||||
translate match.S to use your assembler's syntax. (Have fun.)
|
|
||||||
|
|
||||||
Brian Raiter
|
|
||||||
breadbox@muppetlabs.com
|
|
||||||
April, 1998
|
|
||||||
|
|
||||||
|
|
||||||
Added for zlib 1.1.3:
|
|
||||||
|
|
||||||
The patches come from
|
|
||||||
http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
|
|
||||||
To compile zlib with this asm file, copy match.S to the zlib directory
|
|
||||||
then do:
|
|
||||||
|
|
||||||
CFLAGS="-O3 -DASMV" ./configure
|
|
||||||
make OBJA=match.o
|
|
||||||
|
|
||||||
|
|
||||||
Update:
|
|
||||||
|
|
||||||
I've been ignoring these assembly routines for years, believing that
|
|
||||||
gcc's generated code had caught up with it sometime around gcc 2.95
|
|
||||||
and the major rearchitecting of the Pentium 4. However, I recently
|
|
||||||
learned that, despite what I believed, this code still has some life
|
|
||||||
in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
|
|
||||||
faster than the code produced by gcc 4.1.
|
|
||||||
|
|
||||||
In acknowledgement of its continuing usefulness, I've altered the
|
|
||||||
license to match that of the rest of zlib. Share and Enjoy!
|
|
||||||
|
|
||||||
Brian Raiter
|
|
||||||
breadbox@muppetlabs.com
|
|
||||||
April, 2007
|
|
||||||
@@ -1,357 +0,0 @@
|
|||||||
/* match.S -- x86 assembly version of the zlib longest_match() function.
|
|
||||||
* Optimized for the Intel 686 chips (PPro and later).
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com>
|
|
||||||
*
|
|
||||||
* This software is provided 'as-is', without any express or implied
|
|
||||||
* warranty. In no event will the author 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NO_UNDERLINE
|
|
||||||
#define match_init _match_init
|
|
||||||
#define longest_match _longest_match
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_MATCH (258)
|
|
||||||
#define MIN_MATCH (3)
|
|
||||||
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
|
|
||||||
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
|
|
||||||
|
|
||||||
/* stack frame offsets */
|
|
||||||
|
|
||||||
#define chainlenwmask 0 /* high word: current chain len */
|
|
||||||
/* low word: s->wmask */
|
|
||||||
#define window 4 /* local copy of s->window */
|
|
||||||
#define windowbestlen 8 /* s->window + bestlen */
|
|
||||||
#define scanstart 16 /* first two bytes of string */
|
|
||||||
#define scanend 12 /* last two bytes of string */
|
|
||||||
#define scanalign 20 /* dword-misalignment of string */
|
|
||||||
#define nicematch 24 /* a good enough match size */
|
|
||||||
#define bestlen 28 /* size of best match so far */
|
|
||||||
#define scan 32 /* ptr to string wanting match */
|
|
||||||
|
|
||||||
#define LocalVarsSize (36)
|
|
||||||
/* saved ebx 36 */
|
|
||||||
/* saved edi 40 */
|
|
||||||
/* saved esi 44 */
|
|
||||||
/* saved ebp 48 */
|
|
||||||
/* return address 52 */
|
|
||||||
#define deflatestate 56 /* the function arguments */
|
|
||||||
#define curmatch 60
|
|
||||||
|
|
||||||
/* All the +zlib1222add offsets are due to the addition of fields
|
|
||||||
* in zlib in the deflate_state structure since the asm code was first written
|
|
||||||
* (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
|
|
||||||
* (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
|
|
||||||
* if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define zlib1222add (8)
|
|
||||||
|
|
||||||
#define dsWSize (36+zlib1222add)
|
|
||||||
#define dsWMask (44+zlib1222add)
|
|
||||||
#define dsWindow (48+zlib1222add)
|
|
||||||
#define dsPrev (56+zlib1222add)
|
|
||||||
#define dsMatchLen (88+zlib1222add)
|
|
||||||
#define dsPrevMatch (92+zlib1222add)
|
|
||||||
#define dsStrStart (100+zlib1222add)
|
|
||||||
#define dsMatchStart (104+zlib1222add)
|
|
||||||
#define dsLookahead (108+zlib1222add)
|
|
||||||
#define dsPrevLen (112+zlib1222add)
|
|
||||||
#define dsMaxChainLen (116+zlib1222add)
|
|
||||||
#define dsGoodMatch (132+zlib1222add)
|
|
||||||
#define dsNiceMatch (136+zlib1222add)
|
|
||||||
|
|
||||||
|
|
||||||
.file "match.S"
|
|
||||||
|
|
||||||
.globl match_init, longest_match
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
|
|
||||||
.cfi_sections .debug_frame
|
|
||||||
|
|
||||||
longest_match:
|
|
||||||
|
|
||||||
.cfi_startproc
|
|
||||||
/* Save registers that the compiler may be using, and adjust %esp to */
|
|
||||||
/* make room for our stack frame. */
|
|
||||||
|
|
||||||
pushl %ebp
|
|
||||||
.cfi_def_cfa_offset 8
|
|
||||||
.cfi_offset ebp, -8
|
|
||||||
pushl %edi
|
|
||||||
.cfi_def_cfa_offset 12
|
|
||||||
pushl %esi
|
|
||||||
.cfi_def_cfa_offset 16
|
|
||||||
pushl %ebx
|
|
||||||
.cfi_def_cfa_offset 20
|
|
||||||
subl $LocalVarsSize, %esp
|
|
||||||
.cfi_def_cfa_offset LocalVarsSize+20
|
|
||||||
|
|
||||||
/* Retrieve the function arguments. %ecx will hold cur_match */
|
|
||||||
/* throughout the entire function. %edx will hold the pointer to the */
|
|
||||||
/* deflate_state structure during the function's setup (before */
|
|
||||||
/* entering the main loop). */
|
|
||||||
|
|
||||||
movl deflatestate(%esp), %edx
|
|
||||||
movl curmatch(%esp), %ecx
|
|
||||||
|
|
||||||
/* uInt wmask = s->w_mask; */
|
|
||||||
/* unsigned chain_length = s->max_chain_length; */
|
|
||||||
/* if (s->prev_length >= s->good_match) { */
|
|
||||||
/* chain_length >>= 2; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
movl dsPrevLen(%edx), %eax
|
|
||||||
movl dsGoodMatch(%edx), %ebx
|
|
||||||
cmpl %ebx, %eax
|
|
||||||
movl dsWMask(%edx), %eax
|
|
||||||
movl dsMaxChainLen(%edx), %ebx
|
|
||||||
jl LastMatchGood
|
|
||||||
shrl $2, %ebx
|
|
||||||
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. */
|
|
||||||
|
|
||||||
decl %ebx
|
|
||||||
shll $16, %ebx
|
|
||||||
orl %eax, %ebx
|
|
||||||
movl %ebx, chainlenwmask(%esp)
|
|
||||||
|
|
||||||
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
|
|
||||||
|
|
||||||
movl dsNiceMatch(%edx), %eax
|
|
||||||
movl dsLookahead(%edx), %ebx
|
|
||||||
cmpl %eax, %ebx
|
|
||||||
jl LookaheadLess
|
|
||||||
movl %eax, %ebx
|
|
||||||
LookaheadLess: movl %ebx, nicematch(%esp)
|
|
||||||
|
|
||||||
/* register Bytef *scan = s->window + s->strstart; */
|
|
||||||
|
|
||||||
movl dsWindow(%edx), %esi
|
|
||||||
movl %esi, window(%esp)
|
|
||||||
movl dsStrStart(%edx), %ebp
|
|
||||||
lea (%esi,%ebp), %edi
|
|
||||||
movl %edi, scan(%esp)
|
|
||||||
|
|
||||||
/* Determine how many bytes the scan ptr is off from being */
|
|
||||||
/* dword-aligned. */
|
|
||||||
|
|
||||||
movl %edi, %eax
|
|
||||||
negl %eax
|
|
||||||
andl $3, %eax
|
|
||||||
movl %eax, scanalign(%esp)
|
|
||||||
|
|
||||||
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
|
|
||||||
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
|
|
||||||
|
|
||||||
movl dsWSize(%edx), %eax
|
|
||||||
subl $MIN_LOOKAHEAD, %eax
|
|
||||||
subl %eax, %ebp
|
|
||||||
jg LimitPositive
|
|
||||||
xorl %ebp, %ebp
|
|
||||||
LimitPositive:
|
|
||||||
|
|
||||||
/* int best_len = s->prev_length; */
|
|
||||||
|
|
||||||
movl dsPrevLen(%edx), %eax
|
|
||||||
movl %eax, bestlen(%esp)
|
|
||||||
|
|
||||||
/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
|
|
||||||
|
|
||||||
addl %eax, %esi
|
|
||||||
movl %esi, windowbestlen(%esp)
|
|
||||||
|
|
||||||
/* register ush scan_start = *(ushf*)scan; */
|
|
||||||
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
|
|
||||||
/* Posf *prev = s->prev; */
|
|
||||||
|
|
||||||
movzwl (%edi), %ebx
|
|
||||||
movl %ebx, scanstart(%esp)
|
|
||||||
movzwl -1(%edi,%eax), %ebx
|
|
||||||
movl %ebx, scanend(%esp)
|
|
||||||
movl dsPrev(%edx), %edi
|
|
||||||
|
|
||||||
/* Jump into the main loop. */
|
|
||||||
|
|
||||||
movl chainlenwmask(%esp), %edx
|
|
||||||
jmp LoopEntry
|
|
||||||
|
|
||||||
.balign 16
|
|
||||||
|
|
||||||
/* 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:
|
|
||||||
andl %edx, %ecx
|
|
||||||
movzwl (%edi,%ecx,2), %ecx
|
|
||||||
cmpl %ebp, %ecx
|
|
||||||
jbe LeaveNow
|
|
||||||
subl $0x00010000, %edx
|
|
||||||
js LeaveNow
|
|
||||||
LoopEntry: movzwl -1(%esi,%ecx), %eax
|
|
||||||
cmpl %ebx, %eax
|
|
||||||
jnz LookupLoop
|
|
||||||
movl window(%esp), %eax
|
|
||||||
movzwl (%eax,%ecx), %eax
|
|
||||||
cmpl scanstart(%esp), %eax
|
|
||||||
jnz LookupLoop
|
|
||||||
|
|
||||||
/* Store the current value of chainlen. */
|
|
||||||
|
|
||||||
movl %edx, chainlenwmask(%esp)
|
|
||||||
|
|
||||||
/* 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). */
|
|
||||||
|
|
||||||
movl window(%esp), %esi
|
|
||||||
movl scan(%esp), %edi
|
|
||||||
addl %ecx, %esi
|
|
||||||
movl scanalign(%esp), %eax
|
|
||||||
movl $(-MAX_MATCH_8), %edx
|
|
||||||
lea MAX_MATCH_8(%edi,%eax), %edi
|
|
||||||
lea MAX_MATCH_8(%esi,%eax), %esi
|
|
||||||
|
|
||||||
/* 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:
|
|
||||||
movl (%esi,%edx), %eax
|
|
||||||
xorl (%edi,%edx), %eax
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
movl 4(%esi,%edx), %eax
|
|
||||||
xorl 4(%edi,%edx), %eax
|
|
||||||
jnz LeaveLoopCmps4
|
|
||||||
addl $8, %edx
|
|
||||||
jnz LoopCmps
|
|
||||||
jmp LenMaximum
|
|
||||||
LeaveLoopCmps4: addl $4, %edx
|
|
||||||
LeaveLoopCmps: testl $0x0000FFFF, %eax
|
|
||||||
jnz LenLower
|
|
||||||
addl $2, %edx
|
|
||||||
shrl $16, %eax
|
|
||||||
LenLower: subb $1, %al
|
|
||||||
adcl $0, %edx
|
|
||||||
|
|
||||||
/* 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 (%edi,%edx), %eax
|
|
||||||
movl scan(%esp), %edi
|
|
||||||
subl %edi, %eax
|
|
||||||
cmpl $MAX_MATCH, %eax
|
|
||||||
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. */
|
|
||||||
|
|
||||||
movl deflatestate(%esp), %edx
|
|
||||||
movl bestlen(%esp), %ebx
|
|
||||||
cmpl %ebx, %eax
|
|
||||||
jg LongerMatch
|
|
||||||
movl windowbestlen(%esp), %esi
|
|
||||||
movl dsPrev(%edx), %edi
|
|
||||||
movl scanend(%esp), %ebx
|
|
||||||
movl chainlenwmask(%esp), %edx
|
|
||||||
jmp LookupLoop
|
|
||||||
|
|
||||||
/* s->match_start = cur_match; */
|
|
||||||
/* best_len = len; */
|
|
||||||
/* if (len >= nice_match) break; */
|
|
||||||
/* scan_end = *(ushf*)(scan+best_len-1); */
|
|
||||||
|
|
||||||
LongerMatch: movl nicematch(%esp), %ebx
|
|
||||||
movl %eax, bestlen(%esp)
|
|
||||||
movl %ecx, dsMatchStart(%edx)
|
|
||||||
cmpl %ebx, %eax
|
|
||||||
jge LeaveNow
|
|
||||||
movl window(%esp), %esi
|
|
||||||
addl %eax, %esi
|
|
||||||
movl %esi, windowbestlen(%esp)
|
|
||||||
movzwl -1(%edi,%eax), %ebx
|
|
||||||
movl dsPrev(%edx), %edi
|
|
||||||
movl %ebx, scanend(%esp)
|
|
||||||
movl chainlenwmask(%esp), %edx
|
|
||||||
jmp LookupLoop
|
|
||||||
|
|
||||||
/* Accept the current string, with the maximum possible length. */
|
|
||||||
|
|
||||||
LenMaximum: movl deflatestate(%esp), %edx
|
|
||||||
movl $MAX_MATCH, bestlen(%esp)
|
|
||||||
movl %ecx, dsMatchStart(%edx)
|
|
||||||
|
|
||||||
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
|
|
||||||
/* return s->lookahead; */
|
|
||||||
|
|
||||||
LeaveNow:
|
|
||||||
movl deflatestate(%esp), %edx
|
|
||||||
movl bestlen(%esp), %ebx
|
|
||||||
movl dsLookahead(%edx), %eax
|
|
||||||
cmpl %eax, %ebx
|
|
||||||
jg LookaheadRet
|
|
||||||
movl %ebx, %eax
|
|
||||||
LookaheadRet:
|
|
||||||
|
|
||||||
/* Restore the stack and return from whence we came. */
|
|
||||||
|
|
||||||
addl $LocalVarsSize, %esp
|
|
||||||
.cfi_def_cfa_offset 20
|
|
||||||
popl %ebx
|
|
||||||
.cfi_def_cfa_offset 16
|
|
||||||
popl %esi
|
|
||||||
.cfi_def_cfa_offset 12
|
|
||||||
popl %edi
|
|
||||||
.cfi_def_cfa_offset 8
|
|
||||||
popl %ebp
|
|
||||||
.cfi_def_cfa_offset 4
|
|
||||||
.cfi_endproc
|
|
||||||
match_init: ret
|
|
||||||
@@ -57,7 +57,7 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
|
|||||||
* use by the application to pass an input descriptor to infun(), if desired.
|
* use by the application to pass an input descriptor to infun(), if desired.
|
||||||
*
|
*
|
||||||
* If left and in are not NULL and *left is not zero when blast() is called,
|
* If left and in are not NULL and *left is not zero when blast() is called,
|
||||||
* then the *left bytes are *in are consumed for input before infun() is used.
|
* then the *left bytes at *in are consumed for input before infun() is used.
|
||||||
*
|
*
|
||||||
* The output function is invoked: err = outfun(how, buf, len), where the bytes
|
* The output function is invoked: err = outfun(how, buf, len), where the bytes
|
||||||
* to be written are buf[0..len-1]. If err is not zero, then blast() returns
|
* to be written are buf[0..len-1]. If err is not zero, then blast() returns
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
|
|||||||
const OutBuf: Pointer; BufSize: Integer);
|
const OutBuf: Pointer; BufSize: Integer);
|
||||||
|
|
||||||
const
|
const
|
||||||
zlib_version = '1.2.11';
|
zlib_version = '1.2.12';
|
||||||
|
|
||||||
type
|
type
|
||||||
EZlibError = class(Exception);
|
EZlibError = class(Exception);
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<project name="DotZLib" default="build" basedir="./DotZLib">
|
|
||||||
<description>A .Net wrapper library around ZLib1.dll</description>
|
|
||||||
|
|
||||||
<property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />
|
|
||||||
<property name="build.root" value="bin" />
|
|
||||||
|
|
||||||
<property name="debug" value="true" />
|
|
||||||
<property name="nunit" value="true" />
|
|
||||||
|
|
||||||
<property name="build.folder" value="${build.root}/debug/" if="${debug}" />
|
|
||||||
<property name="build.folder" value="${build.root}/release/" unless="${debug}" />
|
|
||||||
|
|
||||||
<target name="clean" description="Remove all generated files">
|
|
||||||
<delete dir="${build.root}" failonerror="false" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" description="compiles the source code">
|
|
||||||
|
|
||||||
<mkdir dir="${build.folder}" />
|
|
||||||
<csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">
|
|
||||||
<references basedir="${nunit.location}">
|
|
||||||
<includes if="${nunit}" name="nunit.framework.dll" />
|
|
||||||
</references>
|
|
||||||
<sources>
|
|
||||||
<includes name="*.cs" />
|
|
||||||
<excludes name="UnitTests.cs" unless="${nunit}" />
|
|
||||||
</sources>
|
|
||||||
<arg value="/d:nunit" if="${nunit}" />
|
|
||||||
</csc>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
|
||||||
Debug = Debug
|
|
||||||
Release = Release
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
|
||||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET
|
|
||||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET
|
|
||||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET
|
|
||||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
//
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
//
|
|
||||||
[assembly: AssemblyTitle("DotZLib")]
|
|
||||||
[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("Henrik Ravn")]
|
|
||||||
[assembly: AssemblyProduct("")]
|
|
||||||
[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
//
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.*")]
|
|
||||||
|
|
||||||
//
|
|
||||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
|
||||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
|
||||||
//
|
|
||||||
// Use the attributes below to control which key is used for signing.
|
|
||||||
//
|
|
||||||
// Notes:
|
|
||||||
// (*) If no key is specified, the assembly is not signed.
|
|
||||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
|
||||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
|
||||||
// a key.
|
|
||||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
|
||||||
// following processing occurs:
|
|
||||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
|
||||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
|
||||||
// in the KeyFile is installed into the CSP and used.
|
|
||||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
|
||||||
// When specifying the KeyFile, the location of the KeyFile should be
|
|
||||||
// relative to the project output directory which is
|
|
||||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
|
||||||
// located in the project directory, you would specify the AssemblyKeyFile
|
|
||||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
|
||||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
|
||||||
// documentation for more information on this.
|
|
||||||
//
|
|
||||||
[assembly: AssemblyDelaySign(false)]
|
|
||||||
[assembly: AssemblyKeyFile("")]
|
|
||||||
[assembly: AssemblyKeyName("")]
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
#region ChecksumGeneratorBase
|
|
||||||
/// <summary>
|
|
||||||
/// Implements the common functionality needed for all <see cref="ChecksumGenerator"/>s
|
|
||||||
/// </summary>
|
|
||||||
/// <example></example>
|
|
||||||
public abstract class ChecksumGeneratorBase : ChecksumGenerator
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The value of the current checksum
|
|
||||||
/// </summary>
|
|
||||||
protected uint _current;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the checksum generator base - the current checksum is
|
|
||||||
/// set to zero
|
|
||||||
/// </summary>
|
|
||||||
public ChecksumGeneratorBase()
|
|
||||||
{
|
|
||||||
_current = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the checksum generator basewith a specified value
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
|
||||||
public ChecksumGeneratorBase(uint initialValue)
|
|
||||||
{
|
|
||||||
_current = initialValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resets the current checksum to zero
|
|
||||||
/// </summary>
|
|
||||||
public void Reset() { _current = 0; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the current checksum value
|
|
||||||
/// </summary>
|
|
||||||
public uint Value { get { return _current; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with part of an array of bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
|
||||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
|
||||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
|
||||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
|
||||||
/// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
|
|
||||||
/// This is therefore the only method a derived class has to implement</remarks>
|
|
||||||
public abstract void Update(byte[] data, int offset, int count);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with an array of bytes.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
public void Update(byte[] data)
|
|
||||||
{
|
|
||||||
Update(data, 0, data.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with the data from a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The string to update the checksum with</param>
|
|
||||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
|
||||||
public void Update(string data)
|
|
||||||
{
|
|
||||||
Update(Encoding.UTF8.GetBytes(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The string to update the checksum with</param>
|
|
||||||
/// <param name="encoding">The encoding to use</param>
|
|
||||||
public void Update(string data, Encoding encoding)
|
|
||||||
{
|
|
||||||
Update(encoding.GetBytes(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region CRC32
|
|
||||||
/// <summary>
|
|
||||||
/// Implements a CRC32 checksum generator
|
|
||||||
/// </summary>
|
|
||||||
public sealed class CRC32Checksum : ChecksumGeneratorBase
|
|
||||||
{
|
|
||||||
#region DLL imports
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern uint crc32(uint crc, int data, uint length);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the CRC32 checksum generator
|
|
||||||
/// </summary>
|
|
||||||
public CRC32Checksum() : base() {}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the CRC32 checksum generator with a specified value
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
|
||||||
public CRC32Checksum(uint initialValue) : base(initialValue) {}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with part of an array of bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
|
||||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
|
||||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
|
||||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
|
||||||
public override void Update(byte[] data, int offset, int count)
|
|
||||||
{
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
|
||||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
hData.Free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Adler
|
|
||||||
/// <summary>
|
|
||||||
/// Implements a checksum generator that computes the Adler checksum on data
|
|
||||||
/// </summary>
|
|
||||||
public sealed class AdlerChecksum : ChecksumGeneratorBase
|
|
||||||
{
|
|
||||||
#region DLL imports
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern uint adler32(uint adler, int data, uint length);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the Adler checksum generator
|
|
||||||
/// </summary>
|
|
||||||
public AdlerChecksum() : base() {}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the Adler checksum generator with a specified value
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
|
||||||
public AdlerChecksum(uint initialValue) : base(initialValue) {}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with part of an array of bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
|
||||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
|
||||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
|
||||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
|
||||||
public override void Update(byte[] data, int offset, int count)
|
|
||||||
{
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
|
||||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
hData.Free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This class implements a circular buffer
|
|
||||||
/// </summary>
|
|
||||||
internal class CircularBuffer
|
|
||||||
{
|
|
||||||
#region Private data
|
|
||||||
private int _capacity;
|
|
||||||
private int _head;
|
|
||||||
private int _tail;
|
|
||||||
private int _size;
|
|
||||||
private byte[] _buffer;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public CircularBuffer(int capacity)
|
|
||||||
{
|
|
||||||
Debug.Assert( capacity > 0 );
|
|
||||||
_buffer = new byte[capacity];
|
|
||||||
_capacity = capacity;
|
|
||||||
_head = 0;
|
|
||||||
_tail = 0;
|
|
||||||
_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Size { get { return _size; } }
|
|
||||||
|
|
||||||
public int Put(byte[] source, int offset, int count)
|
|
||||||
{
|
|
||||||
Debug.Assert( count > 0 );
|
|
||||||
int trueCount = Math.Min(count, _capacity - Size);
|
|
||||||
for (int i = 0; i < trueCount; ++i)
|
|
||||||
_buffer[(_tail+i) % _capacity] = source[offset+i];
|
|
||||||
_tail += trueCount;
|
|
||||||
_tail %= _capacity;
|
|
||||||
_size += trueCount;
|
|
||||||
return trueCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Put(byte b)
|
|
||||||
{
|
|
||||||
if (Size == _capacity) // no room
|
|
||||||
return false;
|
|
||||||
_buffer[_tail++] = b;
|
|
||||||
_tail %= _capacity;
|
|
||||||
++_size;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Get(byte[] destination, int offset, int count)
|
|
||||||
{
|
|
||||||
int trueCount = Math.Min(count,Size);
|
|
||||||
for (int i = 0; i < trueCount; ++i)
|
|
||||||
destination[offset + i] = _buffer[(_head+i) % _capacity];
|
|
||||||
_head += trueCount;
|
|
||||||
_head %= _capacity;
|
|
||||||
_size -= trueCount;
|
|
||||||
return trueCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Get()
|
|
||||||
{
|
|
||||||
if (Size == 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
int result = (int)_buffer[_head++ % _capacity];
|
|
||||||
--_size;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Implements the common functionality needed for all <see cref="Codec"/>s
|
|
||||||
/// </summary>
|
|
||||||
public abstract class CodecBase : Codec, IDisposable
|
|
||||||
{
|
|
||||||
|
|
||||||
#region Data members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Instance of the internal zlib buffer structure that is
|
|
||||||
/// passed to all functions in the zlib dll
|
|
||||||
/// </summary>
|
|
||||||
internal ZStream _ztream = new ZStream();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if the object instance has been disposed, false otherwise
|
|
||||||
/// </summary>
|
|
||||||
protected bool _isDisposed = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The size of the internal buffers
|
|
||||||
/// </summary>
|
|
||||||
protected const int kBufferSize = 16384;
|
|
||||||
|
|
||||||
private byte[] _outBuffer = new byte[kBufferSize];
|
|
||||||
private byte[] _inBuffer = new byte[kBufferSize];
|
|
||||||
|
|
||||||
private GCHandle _hInput;
|
|
||||||
private GCHandle _hOutput;
|
|
||||||
|
|
||||||
private uint _checksum = 0;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <c>CodeBase</c> class.
|
|
||||||
/// </summary>
|
|
||||||
public CodecBase()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned);
|
|
||||||
_hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
CleanUp(false);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region Codec Members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occurs when more processed data are available.
|
|
||||||
/// </summary>
|
|
||||||
public event DataAvailableHandler DataAvailable;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fires the <see cref="DataAvailable"/> event
|
|
||||||
/// </summary>
|
|
||||||
protected void OnDataAvailable()
|
|
||||||
{
|
|
||||||
if (_ztream.total_out > 0)
|
|
||||||
{
|
|
||||||
if (DataAvailable != null)
|
|
||||||
DataAvailable( _outBuffer, 0, (int)_ztream.total_out);
|
|
||||||
resetOutput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
public void Add(byte[] data)
|
|
||||||
{
|
|
||||||
Add(data,0,data.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
|
||||||
/// <param name="count">The number of bytes to add</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
/// <remarks>This must be implemented by a derived class</remarks>
|
|
||||||
public abstract void Add(byte[] data, int offset, int count);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finishes up any pending data that needs to be processed and handled.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>This must be implemented by a derived class</remarks>
|
|
||||||
public abstract void Finish();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the checksum of the data that has been added so far
|
|
||||||
/// </summary>
|
|
||||||
public uint Checksum { get { return _checksum; } }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Destructor & IDisposable stuff
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Destroys this instance
|
|
||||||
/// </summary>
|
|
||||||
~CodecBase()
|
|
||||||
{
|
|
||||||
CleanUp(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases any unmanaged resources and calls the <see cref="CleanUp()"/> method of the derived class
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
CleanUp(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs any codec specific cleanup
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>This must be implemented by a derived class</remarks>
|
|
||||||
protected abstract void CleanUp();
|
|
||||||
|
|
||||||
// performs the release of the handles and calls the dereived CleanUp()
|
|
||||||
private void CleanUp(bool isDisposing)
|
|
||||||
{
|
|
||||||
if (!_isDisposed)
|
|
||||||
{
|
|
||||||
CleanUp();
|
|
||||||
if (_hInput.IsAllocated)
|
|
||||||
_hInput.Free();
|
|
||||||
if (_hOutput.IsAllocated)
|
|
||||||
_hOutput.Free();
|
|
||||||
|
|
||||||
_isDisposed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Helper methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies a number of bytes to the internal codec buffer - ready for proccesing
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The byte array that contains the data to copy</param>
|
|
||||||
/// <param name="startIndex">The index of the first byte to copy</param>
|
|
||||||
/// <param name="count">The number of bytes to copy from <c>data</c></param>
|
|
||||||
protected void copyInput(byte[] data, int startIndex, int count)
|
|
||||||
{
|
|
||||||
Array.Copy(data, startIndex, _inBuffer,0, count);
|
|
||||||
_ztream.next_in = _hInput.AddrOfPinnedObject();
|
|
||||||
_ztream.total_in = 0;
|
|
||||||
_ztream.avail_in = (uint)count;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resets the internal output buffers to a known state - ready for processing
|
|
||||||
/// </summary>
|
|
||||||
protected void resetOutput()
|
|
||||||
{
|
|
||||||
_ztream.total_out = 0;
|
|
||||||
_ztream.avail_out = kBufferSize;
|
|
||||||
_ztream.next_out = _hOutput.AddrOfPinnedObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the running checksum property
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newSum">The new checksum value</param>
|
|
||||||
protected void setChecksum(uint newSum)
|
|
||||||
{
|
|
||||||
_checksum = newSum;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Implements a data compressor, using the deflate algorithm in the ZLib dll
|
|
||||||
/// </summary>
|
|
||||||
public sealed class Deflater : CodecBase
|
|
||||||
{
|
|
||||||
#region Dll imports
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
|
||||||
private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int deflate(ref ZStream sz, int flush);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int deflateReset(ref ZStream sz);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int deflateEnd(ref ZStream sz);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs an new instance of the <c>Deflater</c>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level">The compression level to use for this <c>Deflater</c></param>
|
|
||||||
public Deflater(CompressLevel level) : base()
|
|
||||||
{
|
|
||||||
int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream));
|
|
||||||
if (retval != 0)
|
|
||||||
throw new ZLibException(retval, "Could not initialize deflater");
|
|
||||||
|
|
||||||
resetOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
|
||||||
/// <param name="count">The number of bytes to add</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
public override void Add(byte[] data, int offset, int count)
|
|
||||||
{
|
|
||||||
if (data == null) throw new ArgumentNullException();
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
|
||||||
|
|
||||||
int total = count;
|
|
||||||
int inputIndex = offset;
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
while (err >= 0 && inputIndex < total)
|
|
||||||
{
|
|
||||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
|
||||||
while (err >= 0 && _ztream.avail_in > 0)
|
|
||||||
{
|
|
||||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
|
||||||
if (err == 0)
|
|
||||||
while (_ztream.avail_out == 0)
|
|
||||||
{
|
|
||||||
OnDataAvailable();
|
|
||||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
|
||||||
}
|
|
||||||
inputIndex += (int)_ztream.total_in;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setChecksum( _ztream.adler );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finishes up any pending data that needs to be processed and handled.
|
|
||||||
/// </summary>
|
|
||||||
public override void Finish()
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
err = deflate(ref _ztream, (int)FlushTypes.Finish);
|
|
||||||
OnDataAvailable();
|
|
||||||
}
|
|
||||||
while (err == 0);
|
|
||||||
setChecksum( _ztream.adler );
|
|
||||||
deflateReset(ref _ztream);
|
|
||||||
resetOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Closes the internal zlib deflate stream
|
|
||||||
/// </summary>
|
|
||||||
protected override void CleanUp() { deflateEnd(ref _ztream); }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,288 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
|
|
||||||
#region Internal types
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines constants for the various flush types used with zlib
|
|
||||||
/// </summary>
|
|
||||||
internal enum FlushTypes
|
|
||||||
{
|
|
||||||
None, Partial, Sync, Full, Finish, Block
|
|
||||||
}
|
|
||||||
|
|
||||||
#region ZStream structure
|
|
||||||
// internal mapping of the zlib zstream structure for marshalling
|
|
||||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]
|
|
||||||
internal struct ZStream
|
|
||||||
{
|
|
||||||
public IntPtr next_in;
|
|
||||||
public uint avail_in;
|
|
||||||
public uint total_in;
|
|
||||||
|
|
||||||
public IntPtr next_out;
|
|
||||||
public uint avail_out;
|
|
||||||
public uint total_out;
|
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.LPStr)]
|
|
||||||
string msg;
|
|
||||||
uint state;
|
|
||||||
|
|
||||||
uint zalloc;
|
|
||||||
uint zfree;
|
|
||||||
uint opaque;
|
|
||||||
|
|
||||||
int data_type;
|
|
||||||
public uint adler;
|
|
||||||
uint reserved;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public enums
|
|
||||||
/// <summary>
|
|
||||||
/// Defines constants for the available compression levels in zlib
|
|
||||||
/// </summary>
|
|
||||||
public enum CompressLevel : int
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The default compression level with a reasonable compromise between compression and speed
|
|
||||||
/// </summary>
|
|
||||||
Default = -1,
|
|
||||||
/// <summary>
|
|
||||||
/// No compression at all. The data are passed straight through.
|
|
||||||
/// </summary>
|
|
||||||
None = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// The maximum compression rate available.
|
|
||||||
/// </summary>
|
|
||||||
Best = 9,
|
|
||||||
/// <summary>
|
|
||||||
/// The fastest available compression level.
|
|
||||||
/// </summary>
|
|
||||||
Fastest = 1
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Exception classes
|
|
||||||
/// <summary>
|
|
||||||
/// The exception that is thrown when an error occurs on the zlib dll
|
|
||||||
/// </summary>
|
|
||||||
public class ZLibException : ApplicationException
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
|
||||||
/// error message and error code
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
|
||||||
/// <param name="msg">A message that (hopefully) describes the error</param>
|
|
||||||
public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
|
||||||
/// error code
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
|
||||||
public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Interfaces
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Declares methods and properties that enables a running checksum to be calculated
|
|
||||||
/// </summary>
|
|
||||||
public interface ChecksumGenerator
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the current value of the checksum
|
|
||||||
/// </summary>
|
|
||||||
uint Value { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clears the current checksum to 0
|
|
||||||
/// </summary>
|
|
||||||
void Reset();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with an array of bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
void Update(byte[] data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with part of an array of bytes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The data to update the checksum with</param>
|
|
||||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
|
||||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
|
||||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
|
||||||
/// <exception cref="ArgumentNullException"><c>data</c> is a null reference</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
|
||||||
void Update(byte[] data, int offset, int count);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with the data from a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The string to update the checksum with</param>
|
|
||||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
|
||||||
void Update(string data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The string to update the checksum with</param>
|
|
||||||
/// <param name="encoding">The encoding to use</param>
|
|
||||||
void Update(string data, Encoding encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the method that will be called from a codec when new data
|
|
||||||
/// are available.
|
|
||||||
/// </summary>
|
|
||||||
/// <paramref name="data">The byte array containing the processed data</paramref>
|
|
||||||
/// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>
|
|
||||||
/// <paramref name="count">The number of processed bytes available</paramref>
|
|
||||||
/// <remarks>On return from this method, the data may be overwritten, so grab it while you can.
|
|
||||||
/// You cannot assume that startIndex will be zero.
|
|
||||||
/// </remarks>
|
|
||||||
public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Declares methods and events for implementing compressors/decompressors
|
|
||||||
/// </summary>
|
|
||||||
public interface Codec
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Occurs when more processed data are available.
|
|
||||||
/// </summary>
|
|
||||||
event DataAvailableHandler DataAvailable;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
void Add(byte[] data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
|
||||||
/// <param name="count">The number of bytes to add</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
void Add(byte[] data, int offset, int count);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finishes up any pending data that needs to be processed and handled.
|
|
||||||
/// </summary>
|
|
||||||
void Finish();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the checksum of the data that has been added so far
|
|
||||||
/// </summary>
|
|
||||||
uint Checksum { get; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Classes
|
|
||||||
/// <summary>
|
|
||||||
/// Encapsulates general information about the ZLib library
|
|
||||||
/// </summary>
|
|
||||||
public class Info
|
|
||||||
{
|
|
||||||
#region DLL imports
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern uint zlibCompileFlags();
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern string zlibVersion();
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private stuff
|
|
||||||
private uint _flags;
|
|
||||||
|
|
||||||
// helper function that unpacks a bitsize mask
|
|
||||||
private static int bitSize(uint bits)
|
|
||||||
{
|
|
||||||
switch (bits)
|
|
||||||
{
|
|
||||||
case 0: return 16;
|
|
||||||
case 1: return 32;
|
|
||||||
case 2: return 64;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs an instance of the <c>Info</c> class.
|
|
||||||
/// </summary>
|
|
||||||
public Info()
|
|
||||||
{
|
|
||||||
_flags = zlibCompileFlags();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if the library is compiled with debug info
|
|
||||||
/// </summary>
|
|
||||||
public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if the library is compiled with assembly optimizations
|
|
||||||
/// </summary>
|
|
||||||
public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the unsigned int that was compiled into Zlib
|
|
||||||
/// </summary>
|
|
||||||
public int SizeOfUInt { get { return bitSize(_flags & 3); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the unsigned long that was compiled into Zlib
|
|
||||||
/// </summary>
|
|
||||||
public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the pointers that were compiled into Zlib
|
|
||||||
/// </summary>
|
|
||||||
public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the z_off_t type that was compiled into Zlib
|
|
||||||
/// </summary>
|
|
||||||
public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the version of ZLib as a string, e.g. "1.2.1"
|
|
||||||
/// </summary>
|
|
||||||
public static string Version { get { return zlibVersion(); } }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
<VisualStudioProject>
|
|
||||||
<CSHARP
|
|
||||||
ProjectType = "Local"
|
|
||||||
ProductVersion = "7.10.3077"
|
|
||||||
SchemaVersion = "2.0"
|
|
||||||
ProjectGuid = "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
|
||||||
>
|
|
||||||
<Build>
|
|
||||||
<Settings
|
|
||||||
ApplicationIcon = ""
|
|
||||||
AssemblyKeyContainerName = ""
|
|
||||||
AssemblyName = "DotZLib"
|
|
||||||
AssemblyOriginatorKeyFile = ""
|
|
||||||
DefaultClientScript = "JScript"
|
|
||||||
DefaultHTMLPageLayout = "Grid"
|
|
||||||
DefaultTargetSchema = "IE50"
|
|
||||||
DelaySign = "false"
|
|
||||||
OutputType = "Library"
|
|
||||||
PreBuildEvent = ""
|
|
||||||
PostBuildEvent = ""
|
|
||||||
RootNamespace = "DotZLib"
|
|
||||||
RunPostBuildEvent = "OnBuildSuccess"
|
|
||||||
StartupObject = ""
|
|
||||||
>
|
|
||||||
<Config
|
|
||||||
Name = "Debug"
|
|
||||||
AllowUnsafeBlocks = "false"
|
|
||||||
BaseAddress = "285212672"
|
|
||||||
CheckForOverflowUnderflow = "false"
|
|
||||||
ConfigurationOverrideFile = ""
|
|
||||||
DefineConstants = "DEBUG;TRACE"
|
|
||||||
DocumentationFile = "docs\DotZLib.xml"
|
|
||||||
DebugSymbols = "true"
|
|
||||||
FileAlignment = "4096"
|
|
||||||
IncrementalBuild = "false"
|
|
||||||
NoStdLib = "false"
|
|
||||||
NoWarn = "1591"
|
|
||||||
Optimize = "false"
|
|
||||||
OutputPath = "bin\Debug\"
|
|
||||||
RegisterForComInterop = "false"
|
|
||||||
RemoveIntegerChecks = "false"
|
|
||||||
TreatWarningsAsErrors = "false"
|
|
||||||
WarningLevel = "4"
|
|
||||||
/>
|
|
||||||
<Config
|
|
||||||
Name = "Release"
|
|
||||||
AllowUnsafeBlocks = "false"
|
|
||||||
BaseAddress = "285212672"
|
|
||||||
CheckForOverflowUnderflow = "false"
|
|
||||||
ConfigurationOverrideFile = ""
|
|
||||||
DefineConstants = "TRACE"
|
|
||||||
DocumentationFile = "docs\DotZLib.xml"
|
|
||||||
DebugSymbols = "false"
|
|
||||||
FileAlignment = "4096"
|
|
||||||
IncrementalBuild = "false"
|
|
||||||
NoStdLib = "false"
|
|
||||||
NoWarn = ""
|
|
||||||
Optimize = "true"
|
|
||||||
OutputPath = "bin\Release\"
|
|
||||||
RegisterForComInterop = "false"
|
|
||||||
RemoveIntegerChecks = "false"
|
|
||||||
TreatWarningsAsErrors = "false"
|
|
||||||
WarningLevel = "4"
|
|
||||||
/>
|
|
||||||
</Settings>
|
|
||||||
<References>
|
|
||||||
<Reference
|
|
||||||
Name = "System"
|
|
||||||
AssemblyName = "System"
|
|
||||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
|
||||||
/>
|
|
||||||
<Reference
|
|
||||||
Name = "System.Data"
|
|
||||||
AssemblyName = "System.Data"
|
|
||||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
|
||||||
/>
|
|
||||||
<Reference
|
|
||||||
Name = "System.XML"
|
|
||||||
AssemblyName = "System.Xml"
|
|
||||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
|
||||||
/>
|
|
||||||
<Reference
|
|
||||||
Name = "nunit.framework"
|
|
||||||
AssemblyName = "nunit.framework"
|
|
||||||
HintPath = "E:\apps\NUnit V2.1\\bin\nunit.framework.dll"
|
|
||||||
AssemblyFolderKey = "hklm\dn\nunit.framework"
|
|
||||||
/>
|
|
||||||
</References>
|
|
||||||
</Build>
|
|
||||||
<Files>
|
|
||||||
<Include>
|
|
||||||
<File
|
|
||||||
RelPath = "AssemblyInfo.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "ChecksumImpl.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "CircularBuffer.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "CodecBase.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "Deflater.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "DotZLib.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "GZipStream.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "Inflater.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "UnitTests.cs"
|
|
||||||
SubType = "Code"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
</Include>
|
|
||||||
</Files>
|
|
||||||
</CSHARP>
|
|
||||||
</VisualStudioProject>
|
|
||||||
|
|
||||||
@@ -1,301 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Implements a compressed <see cref="Stream"/>, in GZip (.gz) format.
|
|
||||||
/// </summary>
|
|
||||||
public class GZipStream : Stream, IDisposable
|
|
||||||
{
|
|
||||||
#region Dll Imports
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
|
||||||
private static extern IntPtr gzopen(string name, string mode);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int gzclose(IntPtr gzFile);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int gzwrite(IntPtr gzFile, int data, int length);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int gzread(IntPtr gzFile, int data, int length);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int gzgetc(IntPtr gzFile);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int gzputc(IntPtr gzFile, int c);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private data
|
|
||||||
private IntPtr _gzFile;
|
|
||||||
private bool _isDisposed = false;
|
|
||||||
private bool _isWriting;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new file as a writeable GZipStream
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fileName">The name of the compressed file to create</param>
|
|
||||||
/// <param name="level">The compression level to use when adding data</param>
|
|
||||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
|
||||||
public GZipStream(string fileName, CompressLevel level)
|
|
||||||
{
|
|
||||||
_isWriting = true;
|
|
||||||
_gzFile = gzopen(fileName, String.Format("wb{0}", (int)level));
|
|
||||||
if (_gzFile == IntPtr.Zero)
|
|
||||||
throw new ZLibException(-1, "Could not open " + fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens an existing file as a readable GZipStream
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fileName">The name of the file to open</param>
|
|
||||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
|
||||||
public GZipStream(string fileName)
|
|
||||||
{
|
|
||||||
_isWriting = false;
|
|
||||||
_gzFile = gzopen(fileName, "rb");
|
|
||||||
if (_gzFile == IntPtr.Zero)
|
|
||||||
throw new ZLibException(-1, "Could not open " + fileName);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Access properties
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true of this stream can be read from, false otherwise
|
|
||||||
/// </summary>
|
|
||||||
public override bool CanRead
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return !_isWriting;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns false.
|
|
||||||
/// </summary>
|
|
||||||
public override bool CanSeek
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this tsream is writeable, false otherwise
|
|
||||||
/// </summary>
|
|
||||||
public override bool CanWrite
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _isWriting;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Destructor & IDispose stuff
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Destroys this instance
|
|
||||||
/// </summary>
|
|
||||||
~GZipStream()
|
|
||||||
{
|
|
||||||
cleanUp(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Closes the external file handle
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
cleanUp(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Does the actual closing of the file handle.
|
|
||||||
private void cleanUp(bool isDisposing)
|
|
||||||
{
|
|
||||||
if (!_isDisposed)
|
|
||||||
{
|
|
||||||
gzclose(_gzFile);
|
|
||||||
_isDisposed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Basic reading and writing
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to read a number of bytes from the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buffer">The destination data buffer</param>
|
|
||||||
/// <param name="offset">The index of the first destination byte in <c>buffer</c></param>
|
|
||||||
/// <param name="count">The number of bytes requested</param>
|
|
||||||
/// <returns>The number of bytes read</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
|
||||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
|
||||||
/// <exception cref="NotSupportedException">If this stream is not readable.</exception>
|
|
||||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
if (!CanRead) throw new NotSupportedException();
|
|
||||||
if (buffer == null) throw new ArgumentNullException();
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
|
||||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
|
||||||
|
|
||||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
|
||||||
int result;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
|
||||||
if (result < 0)
|
|
||||||
throw new IOException();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
h.Free();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to read a single byte from the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The byte that was read, or -1 in case of error or End-Of-File</returns>
|
|
||||||
public override int ReadByte()
|
|
||||||
{
|
|
||||||
if (!CanRead) throw new NotSupportedException();
|
|
||||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
|
||||||
return gzgetc(_gzFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes a number of bytes to the stream
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buffer"></param>
|
|
||||||
/// <param name="offset"></param>
|
|
||||||
/// <param name="count"></param>
|
|
||||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
|
||||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
|
||||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
|
||||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
if (!CanWrite) throw new NotSupportedException();
|
|
||||||
if (buffer == null) throw new ArgumentNullException();
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
|
||||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
|
||||||
|
|
||||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
|
||||||
if (result < 0)
|
|
||||||
throw new IOException();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
h.Free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes a single byte to the stream
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">The byte to add to the stream.</param>
|
|
||||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
|
||||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
|
||||||
public override void WriteByte(byte value)
|
|
||||||
{
|
|
||||||
if (!CanWrite) throw new NotSupportedException();
|
|
||||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
|
||||||
|
|
||||||
int result = gzputc(_gzFile, (int)value);
|
|
||||||
if (result < 0)
|
|
||||||
throw new IOException();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Position & length stuff
|
|
||||||
/// <summary>
|
|
||||||
/// Not supported.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
|
||||||
public override void SetLength(long value)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Not suppported.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="offset"></param>
|
|
||||||
/// <param name="origin"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
|
||||||
public override long Seek(long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Flushes the <c>GZipStream</c>.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>In this implementation, this method does nothing. This is because excessive
|
|
||||||
/// flushing may degrade the achievable compression rates.</remarks>
|
|
||||||
public override void Flush()
|
|
||||||
{
|
|
||||||
// left empty on purpose
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>In this implementation this property is not supported</remarks>
|
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the size of the stream. Not suppported.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>In this implementation this property is not supported</remarks>
|
|
||||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
|
||||||
public override long Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
//
|
|
||||||
// <20> Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace DotZLib
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Implements a data decompressor, using the inflate algorithm in the ZLib dll
|
|
||||||
/// </summary>
|
|
||||||
public class Inflater : CodecBase
|
|
||||||
{
|
|
||||||
#region Dll imports
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
|
||||||
private static extern int inflateInit_(ref ZStream sz, string vs, int size);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int inflate(ref ZStream sz, int flush);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int inflateReset(ref ZStream sz);
|
|
||||||
|
|
||||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
|
||||||
private static extern int inflateEnd(ref ZStream sz);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs an new instance of the <c>Inflater</c>
|
|
||||||
/// </summary>
|
|
||||||
public Inflater() : base()
|
|
||||||
{
|
|
||||||
int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream));
|
|
||||||
if (retval != 0)
|
|
||||||
throw new ZLibException(retval, "Could not initialize inflater");
|
|
||||||
|
|
||||||
resetOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds more data to the codec to be processed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
|
||||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
|
||||||
/// <param name="count">The number of bytes to add</param>
|
|
||||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
|
||||||
public override void Add(byte[] data, int offset, int count)
|
|
||||||
{
|
|
||||||
if (data == null) throw new ArgumentNullException();
|
|
||||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
|
||||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
|
||||||
|
|
||||||
int total = count;
|
|
||||||
int inputIndex = offset;
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
while (err >= 0 && inputIndex < total)
|
|
||||||
{
|
|
||||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
|
||||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
|
||||||
if (err == 0)
|
|
||||||
while (_ztream.avail_out == 0)
|
|
||||||
{
|
|
||||||
OnDataAvailable();
|
|
||||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
inputIndex += (int)_ztream.total_in;
|
|
||||||
}
|
|
||||||
setChecksum( _ztream.adler );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finishes up any pending data that needs to be processed and handled.
|
|
||||||
/// </summary>
|
|
||||||
public override void Finish()
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
err = inflate(ref _ztream, (int)FlushTypes.Finish);
|
|
||||||
OnDataAvailable();
|
|
||||||
}
|
|
||||||
while (err == 0);
|
|
||||||
setChecksum( _ztream.adler );
|
|
||||||
inflateReset(ref _ztream);
|
|
||||||
resetOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Closes the internal zlib inflate stream
|
|
||||||
/// </summary>
|
|
||||||
protected override void CleanUp() { inflateEnd(ref _ztream); }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
//
|
|
||||||
// © Copyright Henrik Ravn 2004
|
|
||||||
//
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
// uncomment the define below to include unit tests
|
|
||||||
//#define nunit
|
|
||||||
#if nunit
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
// Unit tests for the DotZLib class library
|
|
||||||
// ----------------------------------------
|
|
||||||
//
|
|
||||||
// Use this with NUnit 2 from http://www.nunit.org
|
|
||||||
//
|
|
||||||
|
|
||||||
namespace DotZLibTests
|
|
||||||
{
|
|
||||||
using DotZLib;
|
|
||||||
|
|
||||||
// helper methods
|
|
||||||
internal class Utils
|
|
||||||
{
|
|
||||||
public static bool byteArrEqual( byte[] lhs, byte[] rhs )
|
|
||||||
{
|
|
||||||
if (lhs.Length != rhs.Length)
|
|
||||||
return false;
|
|
||||||
for (int i = lhs.Length-1; i >= 0; --i)
|
|
||||||
if (lhs[i] != rhs[i])
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[TestFixture]
|
|
||||||
public class CircBufferTests
|
|
||||||
{
|
|
||||||
#region Circular buffer tests
|
|
||||||
[Test]
|
|
||||||
public void SinglePutGet()
|
|
||||||
{
|
|
||||||
CircularBuffer buf = new CircularBuffer(10);
|
|
||||||
Assert.AreEqual( 0, buf.Size );
|
|
||||||
Assert.AreEqual( -1, buf.Get() );
|
|
||||||
|
|
||||||
Assert.IsTrue(buf.Put( 1 ));
|
|
||||||
Assert.AreEqual( 1, buf.Size );
|
|
||||||
Assert.AreEqual( 1, buf.Get() );
|
|
||||||
Assert.AreEqual( 0, buf.Size );
|
|
||||||
Assert.AreEqual( -1, buf.Get() );
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void BlockPutGet()
|
|
||||||
{
|
|
||||||
CircularBuffer buf = new CircularBuffer(10);
|
|
||||||
byte[] arr = {1,2,3,4,5,6,7,8,9,10};
|
|
||||||
Assert.AreEqual( 10, buf.Put(arr,0,10) );
|
|
||||||
Assert.AreEqual( 10, buf.Size );
|
|
||||||
Assert.IsFalse( buf.Put(11) );
|
|
||||||
Assert.AreEqual( 1, buf.Get() );
|
|
||||||
Assert.IsTrue( buf.Put(11) );
|
|
||||||
|
|
||||||
byte[] arr2 = (byte[])arr.Clone();
|
|
||||||
Assert.AreEqual( 9, buf.Get(arr2,1,9) );
|
|
||||||
Assert.IsTrue( Utils.byteArrEqual(arr,arr2) );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestFixture]
|
|
||||||
public class ChecksumTests
|
|
||||||
{
|
|
||||||
#region CRC32 Tests
|
|
||||||
[Test]
|
|
||||||
public void CRC32_Null()
|
|
||||||
{
|
|
||||||
CRC32Checksum crc32 = new CRC32Checksum();
|
|
||||||
Assert.AreEqual( 0, crc32.Value );
|
|
||||||
|
|
||||||
crc32 = new CRC32Checksum(1);
|
|
||||||
Assert.AreEqual( 1, crc32.Value );
|
|
||||||
|
|
||||||
crc32 = new CRC32Checksum(556);
|
|
||||||
Assert.AreEqual( 556, crc32.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void CRC32_Data()
|
|
||||||
{
|
|
||||||
CRC32Checksum crc32 = new CRC32Checksum();
|
|
||||||
byte[] data = { 1,2,3,4,5,6,7 };
|
|
||||||
crc32.Update(data);
|
|
||||||
Assert.AreEqual( 0x70e46888, crc32.Value );
|
|
||||||
|
|
||||||
crc32 = new CRC32Checksum();
|
|
||||||
crc32.Update("penguin");
|
|
||||||
Assert.AreEqual( 0x0e5c1a120, crc32.Value );
|
|
||||||
|
|
||||||
crc32 = new CRC32Checksum(1);
|
|
||||||
crc32.Update("penguin");
|
|
||||||
Assert.AreEqual(0x43b6aa94, crc32.Value);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Adler tests
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Adler_Null()
|
|
||||||
{
|
|
||||||
AdlerChecksum adler = new AdlerChecksum();
|
|
||||||
Assert.AreEqual(0, adler.Value);
|
|
||||||
|
|
||||||
adler = new AdlerChecksum(1);
|
|
||||||
Assert.AreEqual( 1, adler.Value );
|
|
||||||
|
|
||||||
adler = new AdlerChecksum(556);
|
|
||||||
Assert.AreEqual( 556, adler.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Adler_Data()
|
|
||||||
{
|
|
||||||
AdlerChecksum adler = new AdlerChecksum(1);
|
|
||||||
byte[] data = { 1,2,3,4,5,6,7 };
|
|
||||||
adler.Update(data);
|
|
||||||
Assert.AreEqual( 0x5b001d, adler.Value );
|
|
||||||
|
|
||||||
adler = new AdlerChecksum();
|
|
||||||
adler.Update("penguin");
|
|
||||||
Assert.AreEqual(0x0bcf02f6, adler.Value );
|
|
||||||
|
|
||||||
adler = new AdlerChecksum(1);
|
|
||||||
adler.Update("penguin");
|
|
||||||
Assert.AreEqual(0x0bd602f7, adler.Value);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestFixture]
|
|
||||||
public class InfoTests
|
|
||||||
{
|
|
||||||
#region Info tests
|
|
||||||
[Test]
|
|
||||||
public void Info_Version()
|
|
||||||
{
|
|
||||||
Info info = new Info();
|
|
||||||
Assert.AreEqual("1.2.11", Info.Version);
|
|
||||||
Assert.AreEqual(32, info.SizeOfUInt);
|
|
||||||
Assert.AreEqual(32, info.SizeOfULong);
|
|
||||||
Assert.AreEqual(32, info.SizeOfPointer);
|
|
||||||
Assert.AreEqual(32, info.SizeOfOffset);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestFixture]
|
|
||||||
public class DeflateInflateTests
|
|
||||||
{
|
|
||||||
#region Deflate tests
|
|
||||||
[Test]
|
|
||||||
public void Deflate_Init()
|
|
||||||
{
|
|
||||||
using (Deflater def = new Deflater(CompressLevel.Default))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList compressedData = new ArrayList();
|
|
||||||
private uint adler1;
|
|
||||||
|
|
||||||
private ArrayList uncompressedData = new ArrayList();
|
|
||||||
private uint adler2;
|
|
||||||
|
|
||||||
public void CDataAvail(byte[] data, int startIndex, int count)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
compressedData.Add(data[i+startIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Deflate_Compress()
|
|
||||||
{
|
|
||||||
compressedData.Clear();
|
|
||||||
|
|
||||||
byte[] testData = new byte[35000];
|
|
||||||
for (int i = 0; i < testData.Length; ++i)
|
|
||||||
testData[i] = 5;
|
|
||||||
|
|
||||||
using (Deflater def = new Deflater((CompressLevel)5))
|
|
||||||
{
|
|
||||||
def.DataAvailable += new DataAvailableHandler(CDataAvail);
|
|
||||||
def.Add(testData);
|
|
||||||
def.Finish();
|
|
||||||
adler1 = def.Checksum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Inflate tests
|
|
||||||
[Test]
|
|
||||||
public void Inflate_Init()
|
|
||||||
{
|
|
||||||
using (Inflater inf = new Inflater())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DDataAvail(byte[] data, int startIndex, int count)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
uncompressedData.Add(data[i+startIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Inflate_Expand()
|
|
||||||
{
|
|
||||||
uncompressedData.Clear();
|
|
||||||
|
|
||||||
using (Inflater inf = new Inflater())
|
|
||||||
{
|
|
||||||
inf.DataAvailable += new DataAvailableHandler(DDataAvail);
|
|
||||||
inf.Add((byte[])compressedData.ToArray(typeof(byte)));
|
|
||||||
inf.Finish();
|
|
||||||
adler2 = inf.Checksum;
|
|
||||||
}
|
|
||||||
Assert.AreEqual( adler1, adler2 );
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestFixture]
|
|
||||||
public class GZipStreamTests
|
|
||||||
{
|
|
||||||
#region GZipStream test
|
|
||||||
[Test]
|
|
||||||
public void GZipStream_WriteRead()
|
|
||||||
{
|
|
||||||
using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best))
|
|
||||||
{
|
|
||||||
BinaryWriter writer = new BinaryWriter(gzOut);
|
|
||||||
writer.Write("hi there");
|
|
||||||
writer.Write(Math.PI);
|
|
||||||
writer.Write(42);
|
|
||||||
}
|
|
||||||
|
|
||||||
using (GZipStream gzIn = new GZipStream("gzstream.gz"))
|
|
||||||
{
|
|
||||||
BinaryReader reader = new BinaryReader(gzIn);
|
|
||||||
string s = reader.ReadString();
|
|
||||||
Assert.AreEqual("hi there",s);
|
|
||||||
double d = reader.ReadDouble();
|
|
||||||
Assert.AreEqual(Math.PI, d);
|
|
||||||
int i = reader.ReadInt32();
|
|
||||||
Assert.AreEqual(42,i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
This directory contains a .Net wrapper class library for the ZLib1.dll
|
|
||||||
|
|
||||||
The wrapper includes support for inflating/deflating memory buffers,
|
|
||||||
.Net streaming wrappers for the gz streams part of zlib, and wrappers
|
|
||||||
for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
|
|
||||||
|
|
||||||
Directory structure:
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
LICENSE_1_0.txt - License file.
|
|
||||||
readme.txt - This file.
|
|
||||||
DotZLib.chm - Class library documentation
|
|
||||||
DotZLib.build - NAnt build file
|
|
||||||
DotZLib.sln - Microsoft Visual Studio 2003 solution file
|
|
||||||
|
|
||||||
DotZLib\*.cs - Source files for the class library
|
|
||||||
|
|
||||||
Unit tests:
|
|
||||||
-----------
|
|
||||||
The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
|
|
||||||
To include unit tests in the build, define nunit before building.
|
|
||||||
|
|
||||||
|
|
||||||
Build instructions:
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
1. Using Visual Studio.Net 2003:
|
|
||||||
Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
|
|
||||||
will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
|
|
||||||
you are building the release or debug version of the library. Check
|
|
||||||
DotZLib/UnitTests.cs for instructions on how to include unit tests in the
|
|
||||||
build.
|
|
||||||
|
|
||||||
2. Using NAnt:
|
|
||||||
Open a command prompt with access to the build environment and run nant
|
|
||||||
in the same directory as the DotZLib.build file.
|
|
||||||
You can define 2 properties on the nant command-line to control the build:
|
|
||||||
debug={true|false} to toggle between release/debug builds (default=true).
|
|
||||||
nunit={true|false} to include or esclude unit tests (default=true).
|
|
||||||
Also the target clean will remove binaries.
|
|
||||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
|
||||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
|
||||||
or debug version of the library.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
nant -D:debug=false -D:nunit=false
|
|
||||||
will build a release mode version of the library without unit tests.
|
|
||||||
nant
|
|
||||||
will build a debug version of the library with unit tests
|
|
||||||
nant clean
|
|
||||||
will remove all previously built files.
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------
|
|
||||||
Copyright (c) Henrik Ravn 2004
|
|
||||||
|
|
||||||
Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
|
||||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* inftree9.c -- generate Huffman trees for efficient decoding
|
/* inftree9.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2017 Mark Adler
|
* Copyright (C) 1995-2022 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate9_copyright[] =
|
const char inflate9_copyright[] =
|
||||||
" inflate9 1.2.11 Copyright 1995-2017 Mark Adler ";
|
" inflate9 1.2.12 Copyright 1995-2022 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
@@ -64,7 +64,7 @@ unsigned short FAR *work;
|
|||||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
||||||
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
||||||
133, 133, 133, 133, 144, 77, 202};
|
133, 133, 133, 133, 144, 199, 202};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
||||||
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
|||||||
ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
|
|
||||||
ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
|
|
||||||
@@ -1,553 +0,0 @@
|
|||||||
;uInt longest_match_x64(
|
|
||||||
; deflate_state *s,
|
|
||||||
; IPos cur_match); /* current match */
|
|
||||||
|
|
||||||
; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86_64
|
|
||||||
; (AMD64 on Athlon 64, Opteron, Phenom
|
|
||||||
; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7)
|
|
||||||
; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
|
|
||||||
;
|
|
||||||
; File written by Gilles Vollant, by converting to assembly the longest_match
|
|
||||||
; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
|
|
||||||
;
|
|
||||||
; and by taking inspiration on asm686 with masm, optimised assembly code
|
|
||||||
; from Brian Raiter, written 1998
|
|
||||||
;
|
|
||||||
; 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.
|
|
||||||
;
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; http://www.zlib.net
|
|
||||||
; http://www.winimage.com/zLibDll
|
|
||||||
; http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
;
|
|
||||||
; to compile this file for infozip Zip, I use option:
|
|
||||||
; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm
|
|
||||||
;
|
|
||||||
; to compile this file for zLib, I use option:
|
|
||||||
; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
|
|
||||||
; Be carrefull to adapt zlib1222add below to your version of zLib
|
|
||||||
; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change
|
|
||||||
; value of zlib1222add later)
|
|
||||||
;
|
|
||||||
; This file compile with Microsoft Macro Assembler (x64) for AMD64
|
|
||||||
;
|
|
||||||
; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
|
|
||||||
;
|
|
||||||
; (you can get Windows WDK with ml64 for AMD64 from
|
|
||||||
; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
;uInt longest_match(s, cur_match)
|
|
||||||
; deflate_state *s;
|
|
||||||
; IPos cur_match; /* current match */
|
|
||||||
.code
|
|
||||||
longest_match PROC
|
|
||||||
|
|
||||||
|
|
||||||
;LocalVarsSize equ 88
|
|
||||||
LocalVarsSize equ 72
|
|
||||||
|
|
||||||
; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
|
|
||||||
; free register : r14,r15
|
|
||||||
; register can be saved : rsp
|
|
||||||
|
|
||||||
chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len
|
|
||||||
; low word: s->wmask
|
|
||||||
;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10
|
|
||||||
;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11
|
|
||||||
;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w
|
|
||||||
;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx
|
|
||||||
;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13
|
|
||||||
;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d
|
|
||||||
;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9
|
|
||||||
IFDEF INFOZIP
|
|
||||||
ELSE
|
|
||||||
nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
save_rdi equ rsp + 24 - LocalVarsSize
|
|
||||||
save_rsi equ rsp + 32 - LocalVarsSize
|
|
||||||
save_rbx equ rsp + 40 - LocalVarsSize
|
|
||||||
save_rbp equ rsp + 48 - LocalVarsSize
|
|
||||||
save_r12 equ rsp + 56 - LocalVarsSize
|
|
||||||
save_r13 equ rsp + 64 - LocalVarsSize
|
|
||||||
;save_r14 equ rsp + 72 - LocalVarsSize
|
|
||||||
;save_r15 equ rsp + 80 - LocalVarsSize
|
|
||||||
|
|
||||||
|
|
||||||
; summary of register usage
|
|
||||||
; scanend ebx
|
|
||||||
; scanendw bx
|
|
||||||
; chainlenwmask edx
|
|
||||||
; curmatch rsi
|
|
||||||
; curmatchd esi
|
|
||||||
; windowbestlen r8
|
|
||||||
; scanalign r9
|
|
||||||
; scanalignd r9d
|
|
||||||
; window r10
|
|
||||||
; bestlen r11
|
|
||||||
; bestlend r11d
|
|
||||||
; scanstart r12d
|
|
||||||
; scanstartw r12w
|
|
||||||
; scan r13
|
|
||||||
; nicematch r14d
|
|
||||||
; limit r15
|
|
||||||
; limitd r15d
|
|
||||||
; prev rcx
|
|
||||||
|
|
||||||
; 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
|
|
||||||
|
|
||||||
|
|
||||||
MAX_MATCH equ 258
|
|
||||||
MIN_MATCH equ 3
|
|
||||||
MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
|
|
||||||
|
|
||||||
|
|
||||||
;;; 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.)
|
|
||||||
|
|
||||||
; all the +zlib1222add offsets are due to the addition of fields
|
|
||||||
; in zlib in the deflate_state structure since the asm code was first written
|
|
||||||
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
|
|
||||||
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
|
|
||||||
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
|
|
||||||
|
|
||||||
|
|
||||||
IFDEF INFOZIP
|
|
||||||
|
|
||||||
_DATA SEGMENT
|
|
||||||
COMM window_size:DWORD
|
|
||||||
; WMask ; 7fff
|
|
||||||
COMM window:BYTE:010040H
|
|
||||||
COMM prev:WORD:08000H
|
|
||||||
; MatchLen : unused
|
|
||||||
; PrevMatch : unused
|
|
||||||
COMM strstart:DWORD
|
|
||||||
COMM match_start:DWORD
|
|
||||||
; Lookahead : ignore
|
|
||||||
COMM prev_length:DWORD ; PrevLen
|
|
||||||
COMM max_chain_length:DWORD
|
|
||||||
COMM good_match:DWORD
|
|
||||||
COMM nice_match:DWORD
|
|
||||||
prev_ad equ OFFSET prev
|
|
||||||
window_ad equ OFFSET window
|
|
||||||
nicematch equ nice_match
|
|
||||||
_DATA ENDS
|
|
||||||
WMask equ 07fffh
|
|
||||||
|
|
||||||
ELSE
|
|
||||||
|
|
||||||
IFNDEF zlib1222add
|
|
||||||
zlib1222add equ 8
|
|
||||||
ENDIF
|
|
||||||
dsWSize equ 56+zlib1222add+(zlib1222add/2)
|
|
||||||
dsWMask equ 64+zlib1222add+(zlib1222add/2)
|
|
||||||
dsWindow equ 72+zlib1222add
|
|
||||||
dsPrev equ 88+zlib1222add
|
|
||||||
dsMatchLen equ 128+zlib1222add
|
|
||||||
dsPrevMatch equ 132+zlib1222add
|
|
||||||
dsStrStart equ 140+zlib1222add
|
|
||||||
dsMatchStart equ 144+zlib1222add
|
|
||||||
dsLookahead equ 148+zlib1222add
|
|
||||||
dsPrevLen equ 152+zlib1222add
|
|
||||||
dsMaxChainLen equ 156+zlib1222add
|
|
||||||
dsGoodMatch equ 172+zlib1222add
|
|
||||||
dsNiceMatch equ 176+zlib1222add
|
|
||||||
|
|
||||||
window_size equ [ rcx + dsWSize]
|
|
||||||
WMask equ [ rcx + dsWMask]
|
|
||||||
window_ad equ [ rcx + dsWindow]
|
|
||||||
prev_ad equ [ rcx + dsPrev]
|
|
||||||
strstart equ [ rcx + dsStrStart]
|
|
||||||
match_start equ [ rcx + dsMatchStart]
|
|
||||||
Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip
|
|
||||||
prev_length equ [ rcx + dsPrevLen]
|
|
||||||
max_chain_length equ [ rcx + dsMaxChainLen]
|
|
||||||
good_match equ [ rcx + dsGoodMatch]
|
|
||||||
nice_match equ [ rcx + dsNiceMatch]
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
; parameter 1 in r8(deflate state s), param 2 in rdx (cur match)
|
|
||||||
|
|
||||||
; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
|
|
||||||
; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
|
|
||||||
;
|
|
||||||
; All registers must be preserved across the call, except for
|
|
||||||
; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; Save registers that the compiler may be using, and adjust esp to
|
|
||||||
;;; make room for our stack frame.
|
|
||||||
|
|
||||||
|
|
||||||
;;; Retrieve the function arguments. r8d 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.
|
|
||||||
|
|
||||||
; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
|
|
||||||
|
|
||||||
; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
|
|
||||||
|
|
||||||
mov [save_rdi],rdi
|
|
||||||
mov [save_rsi],rsi
|
|
||||||
mov [save_rbx],rbx
|
|
||||||
mov [save_rbp],rbp
|
|
||||||
IFDEF INFOZIP
|
|
||||||
mov r8d,ecx
|
|
||||||
ELSE
|
|
||||||
mov r8d,edx
|
|
||||||
ENDIF
|
|
||||||
mov [save_r12],r12
|
|
||||||
mov [save_r13],r13
|
|
||||||
; mov [save_r14],r14
|
|
||||||
; mov [save_r15],r15
|
|
||||||
|
|
||||||
|
|
||||||
;;; uInt wmask = s->w_mask;
|
|
||||||
;;; unsigned chain_length = s->max_chain_length;
|
|
||||||
;;; if (s->prev_length >= s->good_match) {
|
|
||||||
;;; chain_length >>= 2;
|
|
||||||
;;; }
|
|
||||||
|
|
||||||
mov edi, prev_length
|
|
||||||
mov esi, good_match
|
|
||||||
mov eax, WMask
|
|
||||||
mov ebx, max_chain_length
|
|
||||||
cmp edi, esi
|
|
||||||
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
|
|
||||||
|
|
||||||
;;; on zlib only
|
|
||||||
;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
|
||||||
|
|
||||||
IFDEF INFOZIP
|
|
||||||
mov [chainlenwmask], ebx
|
|
||||||
; on infozip nice_match = [nice_match]
|
|
||||||
ELSE
|
|
||||||
mov eax, nice_match
|
|
||||||
mov [chainlenwmask], ebx
|
|
||||||
mov r10d, Lookahead
|
|
||||||
cmp r10d, eax
|
|
||||||
cmovnl r10d, eax
|
|
||||||
mov [nicematch],r10d
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
;;; register Bytef *scan = s->window + s->strstart;
|
|
||||||
mov r10, window_ad
|
|
||||||
mov ebp, strstart
|
|
||||||
lea r13, [r10 + rbp]
|
|
||||||
|
|
||||||
;;; Determine how many bytes the scan ptr is off from being
|
|
||||||
;;; dword-aligned.
|
|
||||||
|
|
||||||
mov r9,r13
|
|
||||||
neg r13
|
|
||||||
and r13,3
|
|
||||||
|
|
||||||
;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
|
|
||||||
;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
|
|
||||||
IFDEF INFOZIP
|
|
||||||
mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1))
|
|
||||||
ELSE
|
|
||||||
mov eax, window_size
|
|
||||||
sub eax, MIN_LOOKAHEAD
|
|
||||||
ENDIF
|
|
||||||
xor edi,edi
|
|
||||||
sub ebp, eax
|
|
||||||
|
|
||||||
mov r11d, prev_length
|
|
||||||
|
|
||||||
cmovng ebp,edi
|
|
||||||
|
|
||||||
;;; int best_len = s->prev_length;
|
|
||||||
|
|
||||||
|
|
||||||
;;; Store the sum of s->window + best_len in esi locally, and in esi.
|
|
||||||
|
|
||||||
lea rsi,[r10+r11]
|
|
||||||
|
|
||||||
;;; register ush scan_start = *(ushf*)scan;
|
|
||||||
;;; register ush scan_end = *(ushf*)(scan+best_len-1);
|
|
||||||
;;; Posf *prev = s->prev;
|
|
||||||
|
|
||||||
movzx r12d,word ptr [r9]
|
|
||||||
movzx ebx, word ptr [r9 + r11 - 1]
|
|
||||||
|
|
||||||
mov rdi, prev_ad
|
|
||||||
|
|
||||||
;;; Jump into the main loop.
|
|
||||||
|
|
||||||
mov edx, [chainlenwmask]
|
|
||||||
|
|
||||||
cmp bx,word ptr [rsi + r8 - 1]
|
|
||||||
jz LookupLoopIsZero
|
|
||||||
|
|
||||||
LookupLoop1:
|
|
||||||
and r8d, edx
|
|
||||||
|
|
||||||
movzx r8d, word ptr [rdi + r8*2]
|
|
||||||
cmp r8d, ebp
|
|
||||||
jbe LeaveNow
|
|
||||||
sub edx, 00010000h
|
|
||||||
js LeaveNow
|
|
||||||
|
|
||||||
LoopEntry1:
|
|
||||||
cmp bx,word ptr [rsi + r8 - 1]
|
|
||||||
jz LookupLoopIsZero
|
|
||||||
|
|
||||||
LookupLoop2:
|
|
||||||
and r8d, edx
|
|
||||||
|
|
||||||
movzx r8d, word ptr [rdi + r8*2]
|
|
||||||
cmp r8d, ebp
|
|
||||||
jbe LeaveNow
|
|
||||||
sub edx, 00010000h
|
|
||||||
js LeaveNow
|
|
||||||
|
|
||||||
LoopEntry2:
|
|
||||||
cmp bx,word ptr [rsi + r8 - 1]
|
|
||||||
jz LookupLoopIsZero
|
|
||||||
|
|
||||||
LookupLoop4:
|
|
||||||
and r8d, edx
|
|
||||||
|
|
||||||
movzx r8d, word ptr [rdi + r8*2]
|
|
||||||
cmp r8d, ebp
|
|
||||||
jbe LeaveNow
|
|
||||||
sub edx, 00010000h
|
|
||||||
js LeaveNow
|
|
||||||
|
|
||||||
LoopEntry4:
|
|
||||||
|
|
||||||
cmp bx,word ptr [rsi + r8 - 1]
|
|
||||||
jnz LookupLoop1
|
|
||||||
jmp LookupLoopIsZero
|
|
||||||
|
|
||||||
|
|
||||||
;;; 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
|
|
||||||
;;; r8d = curmatch
|
|
||||||
;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
|
|
||||||
;;; esi = windowbestlen - i.e., (window + bestlen)
|
|
||||||
;;; edi = prev
|
|
||||||
;;; ebp = limit
|
|
||||||
|
|
||||||
LookupLoop:
|
|
||||||
and r8d, edx
|
|
||||||
|
|
||||||
movzx r8d, word ptr [rdi + r8*2]
|
|
||||||
cmp r8d, ebp
|
|
||||||
jbe LeaveNow
|
|
||||||
sub edx, 00010000h
|
|
||||||
js LeaveNow
|
|
||||||
|
|
||||||
LoopEntry:
|
|
||||||
|
|
||||||
cmp bx,word ptr [rsi + r8 - 1]
|
|
||||||
jnz LookupLoop1
|
|
||||||
LookupLoopIsZero:
|
|
||||||
cmp r12w, word ptr [r10 + r8]
|
|
||||||
jnz LookupLoop1
|
|
||||||
|
|
||||||
|
|
||||||
;;; 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).
|
|
||||||
|
|
||||||
lea rsi,[r8+r10]
|
|
||||||
mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8)
|
|
||||||
lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8]
|
|
||||||
lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8]
|
|
||||||
|
|
||||||
prefetcht1 [rsi+rdx]
|
|
||||||
prefetcht1 [rdi+rdx]
|
|
||||||
|
|
||||||
|
|
||||||
;;; Test the strings for equality, 8 bytes at a time. At the end,
|
|
||||||
;;; adjust rdx 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. (rsi 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 rax, [rsi + rdx]
|
|
||||||
xor rax, [rdi + rdx]
|
|
||||||
jnz LeaveLoopCmps
|
|
||||||
|
|
||||||
mov rax, [rsi + rdx + 8]
|
|
||||||
xor rax, [rdi + rdx + 8]
|
|
||||||
jnz LeaveLoopCmps8
|
|
||||||
|
|
||||||
|
|
||||||
mov rax, [rsi + rdx + 8+8]
|
|
||||||
xor rax, [rdi + rdx + 8+8]
|
|
||||||
jnz LeaveLoopCmps16
|
|
||||||
|
|
||||||
add rdx,8+8+8
|
|
||||||
|
|
||||||
jnz short LoopCmps
|
|
||||||
jmp short LenMaximum
|
|
||||||
LeaveLoopCmps16: add rdx,8
|
|
||||||
LeaveLoopCmps8: add rdx,8
|
|
||||||
LeaveLoopCmps:
|
|
||||||
|
|
||||||
test eax, 0000FFFFh
|
|
||||||
jnz LenLower
|
|
||||||
|
|
||||||
test eax,0ffffffffh
|
|
||||||
|
|
||||||
jnz LenLower32
|
|
||||||
|
|
||||||
add rdx,4
|
|
||||||
shr rax,32
|
|
||||||
or ax,ax
|
|
||||||
jnz LenLower
|
|
||||||
|
|
||||||
LenLower32:
|
|
||||||
shr eax,16
|
|
||||||
add rdx,2
|
|
||||||
LenLower: sub al, 1
|
|
||||||
adc rdx, 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 rax, [rdi + rdx]
|
|
||||||
sub rax, r9
|
|
||||||
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.
|
|
||||||
;///////////////////////////////////
|
|
||||||
|
|
||||||
cmp eax, r11d
|
|
||||||
jg LongerMatch
|
|
||||||
|
|
||||||
lea rsi,[r10+r11]
|
|
||||||
|
|
||||||
mov rdi, prev_ad
|
|
||||||
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 r11d, eax
|
|
||||||
mov match_start, r8d
|
|
||||||
cmp eax, [nicematch]
|
|
||||||
jge LeaveNow
|
|
||||||
|
|
||||||
lea rsi,[r10+rax]
|
|
||||||
|
|
||||||
movzx ebx, word ptr [r9 + rax - 1]
|
|
||||||
mov rdi, prev_ad
|
|
||||||
mov edx, [chainlenwmask]
|
|
||||||
jmp LookupLoop
|
|
||||||
|
|
||||||
;;; Accept the current string, with the maximum possible length.
|
|
||||||
|
|
||||||
LenMaximum:
|
|
||||||
mov r11d,MAX_MATCH
|
|
||||||
mov match_start, r8d
|
|
||||||
|
|
||||||
;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
|
|
||||||
;;; return s->lookahead;
|
|
||||||
|
|
||||||
LeaveNow:
|
|
||||||
IFDEF INFOZIP
|
|
||||||
mov eax,r11d
|
|
||||||
ELSE
|
|
||||||
mov eax, Lookahead
|
|
||||||
cmp r11d, eax
|
|
||||||
cmovng eax, r11d
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
;;; Restore the stack and return from whence we came.
|
|
||||||
|
|
||||||
|
|
||||||
mov rsi,[save_rsi]
|
|
||||||
mov rdi,[save_rdi]
|
|
||||||
mov rbx,[save_rbx]
|
|
||||||
mov rbp,[save_rbp]
|
|
||||||
mov r12,[save_r12]
|
|
||||||
mov r13,[save_r13]
|
|
||||||
; mov r14,[save_r14]
|
|
||||||
; mov r15,[save_r15]
|
|
||||||
|
|
||||||
|
|
||||||
ret 0
|
|
||||||
; please don't remove this string !
|
|
||||||
; Your can freely use gvmat64 in any free or commercial app
|
|
||||||
; but it is far better don't remove the string in the binary!
|
|
||||||
db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
|
|
||||||
longest_match ENDP
|
|
||||||
|
|
||||||
match_init PROC
|
|
||||||
ret 0
|
|
||||||
match_init ENDP
|
|
||||||
|
|
||||||
|
|
||||||
END
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
|
|
||||||
* version for AMD64 on Windows using Microsoft C compiler
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
|
|
||||||
*
|
|
||||||
* inffas8664.c call function inffas8664fnc in inffasx64.asm
|
|
||||||
* inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
|
|
||||||
*
|
|
||||||
* Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
|
|
||||||
* slightly quicker on x86 systems because, instead of using rep movsb to copy
|
|
||||||
* data, it uses rep movsw, which moves data in 2-byte chunks instead of single
|
|
||||||
* bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
|
|
||||||
* from http://fedora.linux.duke.edu/fc1_x86_64
|
|
||||||
* which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
|
|
||||||
* 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
|
|
||||||
* when decompressing mozilla-source-1.3.tar.gz.
|
|
||||||
*
|
|
||||||
* 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 <stdio.h>
|
|
||||||
#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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct inffast_ar {
|
|
||||||
/* 64 32 x86 x86_64 */
|
|
||||||
/* ar offset register */
|
|
||||||
/* 0 0 */ void *esp; /* esp save */
|
|
||||||
/* 8 4 */ void *ebp; /* ebp save */
|
|
||||||
/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
|
|
||||||
/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
|
|
||||||
/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
|
|
||||||
/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
|
|
||||||
/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
|
|
||||||
/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
|
|
||||||
/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
|
|
||||||
/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
|
|
||||||
/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
|
|
||||||
/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
|
|
||||||
/* 92 48 */ unsigned wsize; /* window size */
|
|
||||||
/* 96 52 */ unsigned write; /* window write index */
|
|
||||||
/*100 56 */ unsigned lmask; /* r12 mask for lcode */
|
|
||||||
/*104 60 */ unsigned dmask; /* r13 mask for dcode */
|
|
||||||
/*108 64 */ unsigned len; /* r14 match length */
|
|
||||||
/*112 68 */ unsigned dist; /* r15 match distance */
|
|
||||||
/*116 72 */ unsigned status; /* set when state chng*/
|
|
||||||
} type_ar;
|
|
||||||
#ifdef ASMINF
|
|
||||||
|
|
||||||
void inflate_fast(strm, start)
|
|
||||||
z_streamp strm;
|
|
||||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
|
||||||
type_ar ar;
|
|
||||||
void inffas8664fnc(struct inffast_ar * par);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
|
|
||||||
#define PAD_AVAIL_IN 6
|
|
||||||
#define PAD_AVAIL_OUT 258
|
|
||||||
#else
|
|
||||||
#define PAD_AVAIL_IN 5
|
|
||||||
#define PAD_AVAIL_OUT 257
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* copy state to local variables */
|
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
|
||||||
|
|
||||||
ar.in = strm->next_in;
|
|
||||||
ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
|
|
||||||
ar.out = strm->next_out;
|
|
||||||
ar.beg = ar.out - (start - strm->avail_out);
|
|
||||||
ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
|
|
||||||
ar.wsize = state->wsize;
|
|
||||||
ar.write = state->wnext;
|
|
||||||
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 1/2 hold size boundary */
|
|
||||||
while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
|
|
||||||
ar.hold += (unsigned long)*ar.in++ << ar.bits;
|
|
||||||
ar.bits += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
inffas8664fnc(&ar);
|
|
||||||
|
|
||||||
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 ?
|
|
||||||
PAD_AVAIL_IN + (ar.last - ar.in) :
|
|
||||||
PAD_AVAIL_IN - (ar.in - ar.last));
|
|
||||||
strm->avail_out = (unsigned)(ar.out < ar.end ?
|
|
||||||
PAD_AVAIL_OUT + (ar.end - ar.out) :
|
|
||||||
PAD_AVAIL_OUT - (ar.out - ar.end));
|
|
||||||
state->hold = (unsigned long)ar.hold;
|
|
||||||
state->bits = ar.bits;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,396 +0,0 @@
|
|||||||
; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding
|
|
||||||
; version for AMD64 on Windows using Microsoft C compiler
|
|
||||||
;
|
|
||||||
; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
|
|
||||||
; inffasx64.asm is called by inffas8664.c, which contain more info.
|
|
||||||
|
|
||||||
|
|
||||||
; to compile this file, I use option
|
|
||||||
; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
|
|
||||||
; with Microsoft Macro Assembler (x64) for AMD64
|
|
||||||
;
|
|
||||||
|
|
||||||
; This file compile with Microsoft Macro Assembler (x64) for AMD64
|
|
||||||
;
|
|
||||||
; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
|
|
||||||
;
|
|
||||||
; (you can get Windows WDK with ml64 for AMD64 from
|
|
||||||
; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
.code
|
|
||||||
inffas8664fnc PROC
|
|
||||||
|
|
||||||
; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
|
|
||||||
; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
|
|
||||||
;
|
|
||||||
; All registers must be preserved across the call, except for
|
|
||||||
; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch.
|
|
||||||
|
|
||||||
|
|
||||||
mov [rsp-8],rsi
|
|
||||||
mov [rsp-16],rdi
|
|
||||||
mov [rsp-24],r12
|
|
||||||
mov [rsp-32],r13
|
|
||||||
mov [rsp-40],r14
|
|
||||||
mov [rsp-48],r15
|
|
||||||
mov [rsp-56],rbx
|
|
||||||
|
|
||||||
mov rax,rcx
|
|
||||||
|
|
||||||
mov [rax+8], rbp ; /* save regs rbp and rsp */
|
|
||||||
mov [rax], rsp
|
|
||||||
|
|
||||||
mov rsp, rax ; /* make rsp point to &ar */
|
|
||||||
|
|
||||||
mov rsi, [rsp+16] ; /* rsi = in */
|
|
||||||
mov rdi, [rsp+32] ; /* rdi = out */
|
|
||||||
mov r9, [rsp+24] ; /* r9 = last */
|
|
||||||
mov r10, [rsp+48] ; /* r10 = end */
|
|
||||||
mov rbp, [rsp+64] ; /* rbp = lcode */
|
|
||||||
mov r11, [rsp+72] ; /* r11 = dcode */
|
|
||||||
mov rdx, [rsp+80] ; /* rdx = hold */
|
|
||||||
mov ebx, [rsp+88] ; /* ebx = bits */
|
|
||||||
mov r12d, [rsp+100] ; /* r12d = lmask */
|
|
||||||
mov r13d, [rsp+104] ; /* r13d = dmask */
|
|
||||||
; /* r14d = len */
|
|
||||||
; /* r15d = dist */
|
|
||||||
|
|
||||||
|
|
||||||
cld
|
|
||||||
cmp r10, rdi
|
|
||||||
je L_one_time ; /* if only one decode left */
|
|
||||||
cmp r9, rsi
|
|
||||||
|
|
||||||
jne L_do_loop
|
|
||||||
|
|
||||||
|
|
||||||
L_one_time:
|
|
||||||
mov r8, r12 ; /* r8 = lmask */
|
|
||||||
cmp bl, 32
|
|
||||||
ja L_get_length_code_one_time
|
|
||||||
|
|
||||||
lodsd ; /* eax = *(uint *)in++ */
|
|
||||||
mov cl, bl ; /* cl = bits, needs it for shifting */
|
|
||||||
add bl, 32 ; /* bits += 32 */
|
|
||||||
shl rax, cl
|
|
||||||
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
|
|
||||||
jmp L_get_length_code_one_time
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_while_test:
|
|
||||||
cmp r10, rdi
|
|
||||||
jbe L_break_loop
|
|
||||||
cmp r9, rsi
|
|
||||||
jbe L_break_loop
|
|
||||||
|
|
||||||
L_do_loop:
|
|
||||||
mov r8, r12 ; /* r8 = lmask */
|
|
||||||
cmp bl, 32
|
|
||||||
ja L_get_length_code ; /* if (32 < bits) */
|
|
||||||
|
|
||||||
lodsd ; /* eax = *(uint *)in++ */
|
|
||||||
mov cl, bl ; /* cl = bits, needs it for shifting */
|
|
||||||
add bl, 32 ; /* bits += 32 */
|
|
||||||
shl rax, cl
|
|
||||||
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
|
|
||||||
|
|
||||||
L_get_length_code:
|
|
||||||
and r8, rdx ; /* r8 &= hold */
|
|
||||||
mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
|
|
||||||
|
|
||||||
mov cl, ah ; /* cl = this.bits */
|
|
||||||
sub bl, ah ; /* bits -= this.bits */
|
|
||||||
shr rdx, cl ; /* hold >>= this.bits */
|
|
||||||
|
|
||||||
test al, al
|
|
||||||
jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
|
|
||||||
|
|
||||||
mov r8, r12 ; /* r8 = lmask */
|
|
||||||
shr eax, 16 ; /* output this.val char */
|
|
||||||
stosb
|
|
||||||
|
|
||||||
L_get_length_code_one_time:
|
|
||||||
and r8, rdx ; /* r8 &= hold */
|
|
||||||
mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
|
|
||||||
|
|
||||||
L_dolen:
|
|
||||||
mov cl, ah ; /* cl = this.bits */
|
|
||||||
sub bl, ah ; /* bits -= this.bits */
|
|
||||||
shr rdx, 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
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_test_for_length_base:
|
|
||||||
mov r14d, eax ; /* len = this */
|
|
||||||
shr r14d, 16 ; /* len = this.val */
|
|
||||||
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) */
|
|
||||||
|
|
||||||
L_add_bits_to_len:
|
|
||||||
sub bl, cl
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
shl eax, cl
|
|
||||||
dec eax
|
|
||||||
and eax, edx ; /* eax &= hold */
|
|
||||||
shr rdx, cl
|
|
||||||
add r14d, eax ; /* len += hold & mask[op] */
|
|
||||||
|
|
||||||
L_decode_distance:
|
|
||||||
mov r8, r13 ; /* r8 = dmask */
|
|
||||||
cmp bl, 32
|
|
||||||
ja L_get_distance_code ; /* if (32 < bits) */
|
|
||||||
|
|
||||||
lodsd ; /* eax = *(uint *)in++ */
|
|
||||||
mov cl, bl ; /* cl = bits, needs it for shifting */
|
|
||||||
add bl, 32 ; /* bits += 32 */
|
|
||||||
shl rax, cl
|
|
||||||
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
|
|
||||||
|
|
||||||
L_get_distance_code:
|
|
||||||
and r8, rdx ; /* r8 &= hold */
|
|
||||||
mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */
|
|
||||||
|
|
||||||
L_dodist:
|
|
||||||
mov r15d, eax ; /* dist = this */
|
|
||||||
shr r15d, 16 ; /* dist = this.val */
|
|
||||||
mov cl, ah
|
|
||||||
sub bl, ah ; /* bits -= this.bits */
|
|
||||||
shr rdx, 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
|
|
||||||
|
|
||||||
L_add_bits_to_dist:
|
|
||||||
sub bl, cl
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
shl eax, cl
|
|
||||||
dec eax ; /* (1 << op) - 1 */
|
|
||||||
and eax, edx ; /* eax &= hold */
|
|
||||||
shr rdx, cl
|
|
||||||
add r15d, eax ; /* dist += hold & ((1 << op) - 1) */
|
|
||||||
|
|
||||||
L_check_window:
|
|
||||||
mov r8, rsi ; /* save in so from can use it's reg */
|
|
||||||
mov rax, rdi
|
|
||||||
sub rax, [rsp+40] ; /* nbytes = out - beg */
|
|
||||||
|
|
||||||
cmp eax, r15d
|
|
||||||
jb L_clip_window ; /* if (dist > nbytes) 4.2% */
|
|
||||||
|
|
||||||
mov ecx, r14d ; /* ecx = len */
|
|
||||||
mov rsi, rdi
|
|
||||||
sub rsi, r15 ; /* from = out - dist */
|
|
||||||
|
|
||||||
sar ecx, 1
|
|
||||||
jnc L_copy_two ; /* if len % 2 == 0 */
|
|
||||||
|
|
||||||
rep movsw
|
|
||||||
mov al, [rsi]
|
|
||||||
mov [rdi], al
|
|
||||||
inc rdi
|
|
||||||
|
|
||||||
mov rsi, r8 ; /* move in back to %rsi, toss from */
|
|
||||||
jmp L_while_test
|
|
||||||
|
|
||||||
L_copy_two:
|
|
||||||
rep movsw
|
|
||||||
mov rsi, r8 ; /* move in back to %rsi, toss from */
|
|
||||||
jmp L_while_test
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_check_dist_one:
|
|
||||||
cmp r15d, 1 ; /* if dist 1, is a memset */
|
|
||||||
jne L_check_window
|
|
||||||
cmp [rsp+40], rdi ; /* if out == beg, outside window */
|
|
||||||
je L_check_window
|
|
||||||
|
|
||||||
mov ecx, r14d ; /* ecx = len */
|
|
||||||
mov al, [rdi-1]
|
|
||||||
mov ah, al
|
|
||||||
|
|
||||||
sar ecx, 1
|
|
||||||
jnc L_set_two
|
|
||||||
mov [rdi], al
|
|
||||||
inc rdi
|
|
||||||
|
|
||||||
L_set_two:
|
|
||||||
rep stosw
|
|
||||||
jmp L_while_test
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_test_for_second_level_length:
|
|
||||||
test al, 64
|
|
||||||
jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */
|
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
shl eax, cl
|
|
||||||
dec eax
|
|
||||||
and eax, edx ; /* eax &= hold */
|
|
||||||
add eax, r14d ; /* eax += len */
|
|
||||||
mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/
|
|
||||||
jmp L_dolen
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_test_for_second_level_dist:
|
|
||||||
test al, 64
|
|
||||||
jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */
|
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
shl eax, cl
|
|
||||||
dec eax
|
|
||||||
and eax, edx ; /* eax &= hold */
|
|
||||||
add eax, r15d ; /* eax += dist */
|
|
||||||
mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/
|
|
||||||
jmp L_dodist
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_clip_window:
|
|
||||||
mov ecx, eax ; /* ecx = nbytes */
|
|
||||||
mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */
|
|
||||||
neg ecx ; /* nbytes = -nbytes */
|
|
||||||
|
|
||||||
cmp eax, r15d
|
|
||||||
jb L_invalid_distance_too_far ; /* if (dist > wsize) */
|
|
||||||
|
|
||||||
add ecx, r15d ; /* nbytes = dist - nbytes */
|
|
||||||
cmp dword ptr [rsp+96], 0
|
|
||||||
jne L_wrap_around_window ; /* if (write != 0) */
|
|
||||||
|
|
||||||
mov rsi, [rsp+56] ; /* from = window */
|
|
||||||
sub eax, ecx ; /* eax -= nbytes */
|
|
||||||
add rsi, rax ; /* from += wsize - nbytes */
|
|
||||||
|
|
||||||
mov eax, r14d ; /* eax = len */
|
|
||||||
cmp r14d, ecx
|
|
||||||
jbe L_do_copy ; /* if (nbytes >= len) */
|
|
||||||
|
|
||||||
sub eax, ecx ; /* eax -= nbytes */
|
|
||||||
rep movsb
|
|
||||||
mov rsi, rdi
|
|
||||||
sub rsi, r15 ; /* from = &out[ -dist ] */
|
|
||||||
jmp L_do_copy
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_wrap_around_window:
|
|
||||||
mov eax, [rsp+96] ; /* eax = write */
|
|
||||||
cmp ecx, eax
|
|
||||||
jbe L_contiguous_in_window ; /* if (write >= nbytes) */
|
|
||||||
|
|
||||||
mov esi, [rsp+92] ; /* from = wsize */
|
|
||||||
add rsi, [rsp+56] ; /* from += window */
|
|
||||||
add rsi, rax ; /* from += write */
|
|
||||||
sub rsi, rcx ; /* from -= nbytes */
|
|
||||||
sub ecx, eax ; /* nbytes -= write */
|
|
||||||
|
|
||||||
mov eax, r14d ; /* eax = len */
|
|
||||||
cmp eax, ecx
|
|
||||||
jbe L_do_copy ; /* if (nbytes >= len) */
|
|
||||||
|
|
||||||
sub eax, ecx ; /* len -= nbytes */
|
|
||||||
rep movsb
|
|
||||||
mov rsi, [rsp+56] ; /* from = window */
|
|
||||||
mov ecx, [rsp+96] ; /* nbytes = write */
|
|
||||||
cmp eax, ecx
|
|
||||||
jbe L_do_copy ; /* if (nbytes >= len) */
|
|
||||||
|
|
||||||
sub eax, ecx ; /* len -= nbytes */
|
|
||||||
rep movsb
|
|
||||||
mov rsi, rdi
|
|
||||||
sub rsi, r15 ; /* from = out - dist */
|
|
||||||
jmp L_do_copy
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_contiguous_in_window:
|
|
||||||
mov rsi, [rsp+56] ; /* rsi = window */
|
|
||||||
add rsi, rax
|
|
||||||
sub rsi, rcx ; /* from += write - nbytes */
|
|
||||||
|
|
||||||
mov eax, r14d ; /* eax = len */
|
|
||||||
cmp eax, ecx
|
|
||||||
jbe L_do_copy ; /* if (nbytes >= len) */
|
|
||||||
|
|
||||||
sub eax, ecx ; /* len -= nbytes */
|
|
||||||
rep movsb
|
|
||||||
mov rsi, rdi
|
|
||||||
sub rsi, r15 ; /* from = out - dist */
|
|
||||||
jmp L_do_copy ; /* if (nbytes >= len) */
|
|
||||||
|
|
||||||
ALIGN 4
|
|
||||||
L_do_copy:
|
|
||||||
mov ecx, eax ; /* ecx = len */
|
|
||||||
rep movsb
|
|
||||||
|
|
||||||
mov rsi, r8 ; /* move in back to %esi, toss from */
|
|
||||||
jmp L_while_test
|
|
||||||
|
|
||||||
L_test_for_end_of_block:
|
|
||||||
test al, 32
|
|
||||||
jz L_invalid_literal_length_code
|
|
||||||
mov dword ptr [rsp+116], 1
|
|
||||||
jmp L_break_loop_with_status
|
|
||||||
|
|
||||||
L_invalid_literal_length_code:
|
|
||||||
mov dword ptr [rsp+116], 2
|
|
||||||
jmp L_break_loop_with_status
|
|
||||||
|
|
||||||
L_invalid_distance_code:
|
|
||||||
mov dword ptr [rsp+116], 3
|
|
||||||
jmp L_break_loop_with_status
|
|
||||||
|
|
||||||
L_invalid_distance_too_far:
|
|
||||||
mov dword ptr [rsp+116], 4
|
|
||||||
jmp L_break_loop_with_status
|
|
||||||
|
|
||||||
L_break_loop:
|
|
||||||
mov dword ptr [rsp+116], 0
|
|
||||||
|
|
||||||
L_break_loop_with_status:
|
|
||||||
; /* put in, out, bits, and hold back into ar and pop esp */
|
|
||||||
mov [rsp+16], rsi ; /* in */
|
|
||||||
mov [rsp+32], rdi ; /* out */
|
|
||||||
mov [rsp+88], ebx ; /* bits */
|
|
||||||
mov [rsp+80], rdx ; /* hold */
|
|
||||||
|
|
||||||
mov rax, [rsp] ; /* restore rbp and rsp */
|
|
||||||
mov rbp, [rsp+8]
|
|
||||||
mov rsp, rax
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mov rsi,[rsp-8]
|
|
||||||
mov rdi,[rsp-16]
|
|
||||||
mov r12,[rsp-24]
|
|
||||||
mov r13,[rsp-32]
|
|
||||||
mov r14,[rsp-40]
|
|
||||||
mov r15,[rsp-48]
|
|
||||||
mov rbx,[rsp-56]
|
|
||||||
|
|
||||||
ret 0
|
|
||||||
; :
|
|
||||||
; : "m" (ar)
|
|
||||||
; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
|
|
||||||
; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
|
|
||||||
; );
|
|
||||||
|
|
||||||
inffas8664fnc ENDP
|
|
||||||
;_TEXT ENDS
|
|
||||||
END
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
Summary
|
|
||||||
-------
|
|
||||||
This directory contains ASM implementations of the functions
|
|
||||||
longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t),
|
|
||||||
for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits.
|
|
||||||
|
|
||||||
gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits
|
|
||||||
assembly optimized version from Jean-loup Gailly original longest_match function
|
|
||||||
|
|
||||||
inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing
|
|
||||||
original function from Mark Adler
|
|
||||||
|
|
||||||
Use instructions
|
|
||||||
----------------
|
|
||||||
Assemble the .asm files using MASM and put the object files into the zlib source
|
|
||||||
directory. You can also get object files here:
|
|
||||||
|
|
||||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
|
||||||
|
|
||||||
define ASMV and ASMINF in your project. Include inffas8664.c in your source tree,
|
|
||||||
and inffasx64.obj and gvmat64.obj as object to link.
|
|
||||||
|
|
||||||
|
|
||||||
Build instructions
|
|
||||||
------------------
|
|
||||||
run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe)
|
|
||||||
|
|
||||||
ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK
|
|
||||||
|
|
||||||
You can get Windows 2003 server DDK with ml64 and cl for AMD64 from
|
|
||||||
http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
ml /coff /Zi /c /Flmatch686.lst match686.asm
|
|
||||||
ml /coff /Zi /c /Flinffas32.lst inffas32.asm
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,479 +0,0 @@
|
|||||||
; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86
|
|
||||||
; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
|
|
||||||
; File written by Gilles Vollant, by converting match686.S from Brian Raiter
|
|
||||||
; for MASM. This is as assembly version of longest_match
|
|
||||||
; from Jean-loup Gailly in deflate.c
|
|
||||||
;
|
|
||||||
; http://www.zlib.net
|
|
||||||
; http://www.winimage.com/zLibDll
|
|
||||||
; http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
;
|
|
||||||
; For Visual C++ 4.x and higher and ML 6.x and higher
|
|
||||||
; ml.exe is distributed in
|
|
||||||
; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
|
|
||||||
;
|
|
||||||
; this file contain two implementation of longest_match
|
|
||||||
;
|
|
||||||
; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro
|
|
||||||
; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom)
|
|
||||||
;
|
|
||||||
; for using an assembly version of longest_match, you need define ASMV in project
|
|
||||||
;
|
|
||||||
; compile the asm file running
|
|
||||||
; ml /coff /Zi /c /Flmatch686.lst match686.asm
|
|
||||||
; and do not include match686.obj in your project
|
|
||||||
;
|
|
||||||
; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for
|
|
||||||
; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor
|
|
||||||
; with autoselect (with cpu detection code)
|
|
||||||
; if you want support the old pentium optimization, you can still use these version
|
|
||||||
;
|
|
||||||
; this file is not optimized for old pentium, but it compatible with all x86 32 bits
|
|
||||||
; processor (starting 80386)
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2
|
|
||||||
|
|
||||||
;uInt longest_match(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 +zlib1222add offsets are due to the addition of fields
|
|
||||||
; in zlib in the deflate_state structure since the asm code was first written
|
|
||||||
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
|
|
||||||
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
|
|
||||||
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
|
|
||||||
|
|
||||||
zlib1222add equ 8
|
|
||||||
|
|
||||||
; Note : these value are good with a 8 bytes boundary pack structure
|
|
||||||
dep_chain_length equ 74h+zlib1222add
|
|
||||||
dep_window equ 30h+zlib1222add
|
|
||||||
dep_strstart equ 64h+zlib1222add
|
|
||||||
dep_prev_length equ 70h+zlib1222add
|
|
||||||
dep_nice_match equ 88h+zlib1222add
|
|
||||||
dep_w_size equ 24h+zlib1222add
|
|
||||||
dep_prev equ 38h+zlib1222add
|
|
||||||
dep_w_mask equ 2ch+zlib1222add
|
|
||||||
dep_good_match equ 84h+zlib1222add
|
|
||||||
dep_match_start equ 68h+zlib1222add
|
|
||||||
dep_lookahead equ 6ch+zlib1222add
|
|
||||||
|
|
||||||
|
|
||||||
_TEXT segment
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
public longest_match
|
|
||||||
public match_init
|
|
||||||
ELSE
|
|
||||||
public _longest_match
|
|
||||||
public _match_init
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
MAX_MATCH equ 258
|
|
||||||
MIN_MATCH equ 3
|
|
||||||
MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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+zlib1222add
|
|
||||||
dsWMask equ 44+zlib1222add
|
|
||||||
dsWindow equ 48+zlib1222add
|
|
||||||
dsPrev equ 56+zlib1222add
|
|
||||||
dsMatchLen equ 88+zlib1222add
|
|
||||||
dsPrevMatch equ 92+zlib1222add
|
|
||||||
dsStrStart equ 100+zlib1222add
|
|
||||||
dsMatchStart equ 104+zlib1222add
|
|
||||||
dsLookahead equ 108+zlib1222add
|
|
||||||
dsPrevLen equ 112+zlib1222add
|
|
||||||
dsMaxChainLen equ 116+zlib1222add
|
|
||||||
dsGoodMatch equ 132+zlib1222add
|
|
||||||
dsNiceMatch equ 136+zlib1222add
|
|
||||||
|
|
||||||
|
|
||||||
;;; match686.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 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.
|
|
||||||
;;
|
|
||||||
|
|
||||||
;GLOBAL _longest_match, _match_init
|
|
||||||
|
|
||||||
|
|
||||||
;SECTION .text
|
|
||||||
|
|
||||||
;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
|
|
||||||
|
|
||||||
;_longest_match:
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
longest_match proc near
|
|
||||||
ELSE
|
|
||||||
_longest_match proc near
|
|
||||||
ENDIF
|
|
||||||
.FPO (9, 4, 0, 0, 1, 0)
|
|
||||||
|
|
||||||
;;; Save registers that the compiler may be using, and adjust esp to
|
|
||||||
;;; make room for our stack frame.
|
|
||||||
|
|
||||||
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 can freely use match686 in any free or commercial app if you don't remove the string in the binary!
|
|
||||||
db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
|
|
||||||
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
longest_match endp
|
|
||||||
ELSE
|
|
||||||
_longest_match endp
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
match_init proc near
|
|
||||||
ret
|
|
||||||
match_init endp
|
|
||||||
ELSE
|
|
||||||
_match_init proc near
|
|
||||||
ret
|
|
||||||
_match_init endp
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
|
|
||||||
_TEXT ends
|
|
||||||
end
|
|
||||||
@@ -1,624 +0,0 @@
|
|||||||
Microsoft (R) Macro Assembler Version 12.00.31101.0 05/22/17 22:38:55
|
|
||||||
match686.asm Page 1 - 1
|
|
||||||
|
|
||||||
|
|
||||||
; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86
|
|
||||||
; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
|
|
||||||
; File written by Gilles Vollant, by converting match686.S from Brian Raiter
|
|
||||||
; for MASM. This is as assembly version of longest_match
|
|
||||||
; from Jean-loup Gailly in deflate.c
|
|
||||||
;
|
|
||||||
; http://www.zlib.net
|
|
||||||
; http://www.winimage.com/zLibDll
|
|
||||||
; http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
;
|
|
||||||
; For Visual C++ 4.x and higher and ML 6.x and higher
|
|
||||||
; ml.exe is distributed in
|
|
||||||
; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
|
|
||||||
;
|
|
||||||
; this file contain two implementation of longest_match
|
|
||||||
;
|
|
||||||
; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro
|
|
||||||
; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom)
|
|
||||||
;
|
|
||||||
; for using an assembly version of longest_match, you need define ASMV in project
|
|
||||||
;
|
|
||||||
; compile the asm file running
|
|
||||||
; ml /coff /Zi /c /Flmatch686.lst match686.asm
|
|
||||||
; and do not include match686.obj in your project
|
|
||||||
;
|
|
||||||
; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for
|
|
||||||
; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor
|
|
||||||
; with autoselect (with cpu detection code)
|
|
||||||
; if you want support the old pentium optimization, you can still use these version
|
|
||||||
;
|
|
||||||
; this file is not optimized for old pentium, but it compatible with all x86 32 bits
|
|
||||||
; processor (starting 80386)
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2
|
|
||||||
|
|
||||||
;uInt longest_match(s, cur_match)
|
|
||||||
; deflate_state *s;
|
|
||||||
; IPos cur_match; /* current match */
|
|
||||||
|
|
||||||
= 0000004C NbStack equ 76
|
|
||||||
= dword ptr[esp+NbStack-0] cur_match equ dword ptr[esp+NbStack-0]
|
|
||||||
= dword ptr[esp+NbStack-4] str_s equ dword ptr[esp+NbStack-4]
|
|
||||||
; 5 dword on top (ret,ebp,esi,edi,ebx)
|
|
||||||
= dword ptr[esp+NbStack-8] adrret equ dword ptr[esp+NbStack-8]
|
|
||||||
= dword ptr[esp+NbStack-12 pushebp equ dword ptr[esp+NbStack-12]
|
|
||||||
]
|
|
||||||
= dword ptr[esp+NbStack-16 pushedi equ dword ptr[esp+NbStack-16]
|
|
||||||
]
|
|
||||||
= dword ptr[esp+NbStack-20 pushesi equ dword ptr[esp+NbStack-20]
|
|
||||||
]
|
|
||||||
= dword ptr[esp+NbStack-24 pushebx equ dword ptr[esp+NbStack-24]
|
|
||||||
]
|
|
||||||
|
|
||||||
= dword ptr [esp+NbStack-2 chain_length equ dword ptr [esp+NbStack-28]
|
|
||||||
8]
|
|
||||||
= dword ptr [esp+NbStack-3 limit equ dword ptr [esp+NbStack-32]
|
|
||||||
2]
|
|
||||||
= dword ptr [esp+NbStack-3 best_len equ dword ptr [esp+NbStack-36]
|
|
||||||
6]
|
|
||||||
= dword ptr [esp+NbStack-4 window equ dword ptr [esp+NbStack-40]
|
|
||||||
0]
|
|
||||||
= dword ptr [esp+NbStack-4 prev equ dword ptr [esp+NbStack-44]
|
|
||||||
4]
|
|
||||||
= word ptr [esp+NbStack-48 scan_start equ word ptr [esp+NbStack-48]
|
|
||||||
]
|
|
||||||
= dword ptr [esp+NbStack-5 wmask equ dword ptr [esp+NbStack-52]
|
|
||||||
2]
|
|
||||||
= dword ptr [esp+NbStack-5 match_start_ptr equ dword ptr [esp+NbStack-56]
|
|
||||||
6]
|
|
||||||
= dword ptr [esp+NbStack-6 nice_match equ dword ptr [esp+NbStack-60]
|
|
||||||
0]
|
|
||||||
= dword ptr [esp+NbStack-6 scan equ dword ptr [esp+NbStack-64]
|
|
||||||
4]
|
|
||||||
|
|
||||||
= dword ptr [esp+NbStack-6 windowlen equ dword ptr [esp+NbStack-68]
|
|
||||||
8]
|
|
||||||
= dword ptr [esp+NbStack-7 match_start equ dword ptr [esp+NbStack-72]
|
|
||||||
2]
|
|
||||||
= dword ptr [esp+NbStack-7 strend equ dword ptr [esp+NbStack-76]
|
|
||||||
6]
|
|
||||||
= 00000034 NbStackAdd equ (NbStack-24)
|
|
||||||
|
|
||||||
.386p
|
|
||||||
|
|
||||||
name gvmatch
|
|
||||||
.MODEL FLAT
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; all the +zlib1222add offsets are due to the addition of fields
|
|
||||||
; in zlib in the deflate_state structure since the asm code was first written
|
|
||||||
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
|
|
||||||
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
|
|
||||||
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
|
|
||||||
|
|
||||||
= 00000008 zlib1222add equ 8
|
|
||||||
|
|
||||||
; Note : these value are good with a 8 bytes boundary pack structure
|
|
||||||
= 0000007C dep_chain_length equ 74h+zlib1222add
|
|
||||||
= 00000038 dep_window equ 30h+zlib1222add
|
|
||||||
= 0000006C dep_strstart equ 64h+zlib1222add
|
|
||||||
= 00000078 dep_prev_length equ 70h+zlib1222add
|
|
||||||
= 00000090 dep_nice_match equ 88h+zlib1222add
|
|
||||||
= 0000002C dep_w_size equ 24h+zlib1222add
|
|
||||||
= 00000040 dep_prev equ 38h+zlib1222add
|
|
||||||
= 00000034 dep_w_mask equ 2ch+zlib1222add
|
|
||||||
= 0000008C dep_good_match equ 84h+zlib1222add
|
|
||||||
= 00000070 dep_match_start equ 68h+zlib1222add
|
|
||||||
= 00000074 dep_lookahead equ 6ch+zlib1222add
|
|
||||||
|
|
||||||
|
|
||||||
00000000 _TEXT segment
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
ELSE
|
|
||||||
public _longest_match
|
|
||||||
public _match_init
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
= 00000102 MAX_MATCH equ 258
|
|
||||||
= 00000003 MIN_MATCH equ 3
|
|
||||||
= 00000106 MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= 00000102 MAX_MATCH equ 258
|
|
||||||
= 00000003 MIN_MATCH equ 3
|
|
||||||
= 00000106 MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1)
|
|
||||||
= 00000100 MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h)
|
|
||||||
|
|
||||||
|
|
||||||
;;; stack frame offsets
|
|
||||||
|
|
||||||
= esp + 0 chainlenwmask equ esp + 0 ; high word: current chain len
|
|
||||||
; low word: s->wmask
|
|
||||||
= esp + 4 window equ esp + 4 ; local copy of s->window
|
|
||||||
= esp + 8 windowbestlen equ esp + 8 ; s->window + bestlen
|
|
||||||
= esp + 16 scanstart equ esp + 16 ; first two bytes of string
|
|
||||||
= esp + 12 scanend equ esp + 12 ; last two bytes of string
|
|
||||||
= esp + 20 scanalign equ esp + 20 ; dword-misalignment of string
|
|
||||||
= esp + 24 nicematch equ esp + 24 ; a good enough match size
|
|
||||||
= esp + 28 bestlen equ esp + 28 ; size of best match so far
|
|
||||||
= esp + 32 scan equ esp + 32 ; ptr to string wanting match
|
|
||||||
|
|
||||||
= 00000024 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
|
|
||||||
= esp + 56 deflatestate equ esp + 56 ; the function arguments
|
|
||||||
= esp + 60 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.)
|
|
||||||
|
|
||||||
= 0000002C dsWSize equ 36+zlib1222add
|
|
||||||
= 00000034 dsWMask equ 44+zlib1222add
|
|
||||||
= 00000038 dsWindow equ 48+zlib1222add
|
|
||||||
= 00000040 dsPrev equ 56+zlib1222add
|
|
||||||
= 00000060 dsMatchLen equ 88+zlib1222add
|
|
||||||
= 00000064 dsPrevMatch equ 92+zlib1222add
|
|
||||||
= 0000006C dsStrStart equ 100+zlib1222add
|
|
||||||
= 00000070 dsMatchStart equ 104+zlib1222add
|
|
||||||
= 00000074 dsLookahead equ 108+zlib1222add
|
|
||||||
= 00000078 dsPrevLen equ 112+zlib1222add
|
|
||||||
= 0000007C dsMaxChainLen equ 116+zlib1222add
|
|
||||||
= 0000008C dsGoodMatch equ 132+zlib1222add
|
|
||||||
= 00000090 dsNiceMatch equ 136+zlib1222add
|
|
||||||
|
|
||||||
|
|
||||||
;;; match686.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 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.
|
|
||||||
;;
|
|
||||||
|
|
||||||
;GLOBAL _longest_match, _match_init
|
|
||||||
|
|
||||||
|
|
||||||
;SECTION .text
|
|
||||||
|
|
||||||
;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
|
|
||||||
|
|
||||||
;_longest_match:
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
ELSE
|
|
||||||
00000000 _longest_match proc near
|
|
||||||
ENDIF
|
|
||||||
00000000 .FPO (9, 4, 0, 0, 1, 0)
|
|
||||||
|
|
||||||
;;; Save registers that the compiler may be using, and adjust esp to
|
|
||||||
;;; make room for our stack frame.
|
|
||||||
|
|
||||||
00000000 55 push ebp
|
|
||||||
00000001 57 push edi
|
|
||||||
00000002 56 push esi
|
|
||||||
00000003 53 push ebx
|
|
||||||
00000004 83 EC 24 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.
|
|
||||||
|
|
||||||
00000007 8B 54 24 38 mov edx, [deflatestate]
|
|
||||||
0000000B 8B 4C 24 3C 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;
|
|
||||||
;;; }
|
|
||||||
|
|
||||||
0000000F 8B 42 78 mov eax, [edx + dsPrevLen]
|
|
||||||
00000012 8B 9A 0000008C mov ebx, [edx + dsGoodMatch]
|
|
||||||
00000018 3B C3 cmp eax, ebx
|
|
||||||
0000001A 8B 42 34 mov eax, [edx + dsWMask]
|
|
||||||
0000001D 8B 5A 7C mov ebx, [edx + dsMaxChainLen]
|
|
||||||
00000020 7C 03 jl LastMatchGood
|
|
||||||
00000022 C1 EB 02 shr ebx, 2
|
|
||||||
00000025 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.
|
|
||||||
|
|
||||||
00000025 4B dec ebx
|
|
||||||
00000026 C1 E3 10 shl ebx, 16
|
|
||||||
00000029 0B D8 or ebx, eax
|
|
||||||
0000002B 89 1C 24 mov [chainlenwmask], ebx
|
|
||||||
|
|
||||||
;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
|
||||||
|
|
||||||
0000002E 8B 82 00000090 mov eax, [edx + dsNiceMatch]
|
|
||||||
00000034 8B 5A 74 mov ebx, [edx + dsLookahead]
|
|
||||||
00000037 3B D8 cmp ebx, eax
|
|
||||||
00000039 7C 02 jl LookaheadLess
|
|
||||||
0000003B 8B D8 mov ebx, eax
|
|
||||||
0000003D 89 5C 24 18 LookaheadLess: mov [nicematch], ebx
|
|
||||||
|
|
||||||
;;; register Bytef *scan = s->window + s->strstart;
|
|
||||||
|
|
||||||
00000041 8B 72 38 mov esi, [edx + dsWindow]
|
|
||||||
00000044 89 74 24 04 mov [window], esi
|
|
||||||
00000048 8B 6A 6C mov ebp, [edx + dsStrStart]
|
|
||||||
0000004B 8D 7C 35 00 lea edi, [esi + ebp]
|
|
||||||
0000004F 89 7C 24 20 mov [scan], edi
|
|
||||||
|
|
||||||
;;; Determine how many bytes the scan ptr is off from being
|
|
||||||
;;; dword-aligned.
|
|
||||||
|
|
||||||
00000053 8B C7 mov eax, edi
|
|
||||||
00000055 F7 D8 neg eax
|
|
||||||
00000057 83 E0 03 and eax, 3
|
|
||||||
0000005A 89 44 24 14 mov [scanalign], eax
|
|
||||||
|
|
||||||
;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
|
|
||||||
;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
|
|
||||||
|
|
||||||
0000005E 8B 42 2C mov eax, [edx + dsWSize]
|
|
||||||
00000061 2D 00000106 sub eax, MIN_LOOKAHEAD
|
|
||||||
00000066 2B E8 sub ebp, eax
|
|
||||||
00000068 7F 02 jg LimitPositive
|
|
||||||
0000006A 33 ED xor ebp, ebp
|
|
||||||
0000006C LimitPositive:
|
|
||||||
|
|
||||||
;;; int best_len = s->prev_length;
|
|
||||||
|
|
||||||
0000006C 8B 42 78 mov eax, [edx + dsPrevLen]
|
|
||||||
0000006F 89 44 24 1C mov [bestlen], eax
|
|
||||||
|
|
||||||
;;; Store the sum of s->window + best_len in esi locally, and in esi.
|
|
||||||
|
|
||||||
00000073 03 F0 add esi, eax
|
|
||||||
00000075 89 74 24 08 mov [windowbestlen], esi
|
|
||||||
|
|
||||||
;;; register ush scan_start = *(ushf*)scan;
|
|
||||||
;;; register ush scan_end = *(ushf*)(scan+best_len-1);
|
|
||||||
;;; Posf *prev = s->prev;
|
|
||||||
|
|
||||||
00000079 0F B7 1F movzx ebx, word ptr [edi]
|
|
||||||
0000007C 89 5C 24 10 mov [scanstart], ebx
|
|
||||||
00000080 0F B7 5C 38 FF movzx ebx, word ptr [edi + eax - 1]
|
|
||||||
00000085 89 5C 24 0C mov [scanend], ebx
|
|
||||||
00000089 8B 7A 40 mov edi, [edx + dsPrev]
|
|
||||||
|
|
||||||
;;; Jump into the main loop.
|
|
||||||
|
|
||||||
0000008C 8B 14 24 mov edx, [chainlenwmask]
|
|
||||||
0000008F EB 1D 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
|
|
||||||
|
|
||||||
00000094 LookupLoop:
|
|
||||||
00000094 23 CA and ecx, edx
|
|
||||||
00000096 0F B7 0C 4F movzx ecx, word ptr [edi + ecx*2]
|
|
||||||
0000009A 3B CD cmp ecx, ebp
|
|
||||||
0000009C 0F 86 000000E0 jbe LeaveNow
|
|
||||||
000000A2 81 EA 00010000 sub edx, 00010000h
|
|
||||||
000000A8 0F 88 000000D4 js LeaveNow
|
|
||||||
000000AE 0F B7 44 31 FF LoopEntry: movzx eax, word ptr [esi + ecx - 1]
|
|
||||||
000000B3 3B C3 cmp eax, ebx
|
|
||||||
000000B5 75 DD jnz LookupLoop
|
|
||||||
000000B7 8B 44 24 04 mov eax, [window]
|
|
||||||
000000BB 0F B7 04 01 movzx eax, word ptr [eax + ecx]
|
|
||||||
000000BF 3B 44 24 10 cmp eax, [scanstart]
|
|
||||||
000000C3 75 CF jnz LookupLoop
|
|
||||||
|
|
||||||
;;; Store the current value of chainlen.
|
|
||||||
|
|
||||||
000000C5 89 14 24 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).
|
|
||||||
|
|
||||||
000000C8 8B 74 24 04 mov esi, [window]
|
|
||||||
000000CC 8B 7C 24 20 mov edi, [scan]
|
|
||||||
000000D0 03 F1 add esi, ecx
|
|
||||||
000000D2 8B 44 24 14 mov eax, [scanalign]
|
|
||||||
000000D6 BA FFFFFEF8 mov edx, 0fffffef8h; -(MAX_MATCH_8)
|
|
||||||
000000DB 8D BC 38 lea edi, [edi + eax + 0108h] ;MAX_MATCH_8]
|
|
||||||
00000108
|
|
||||||
000000E2 8D B4 30 lea esi, [esi + eax + 0108h] ;MAX_MATCH_8]
|
|
||||||
00000108
|
|
||||||
|
|
||||||
;;; 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.
|
|
||||||
|
|
||||||
000000E9 LoopCmps:
|
|
||||||
000000E9 8B 04 32 mov eax, [esi + edx]
|
|
||||||
000000EC 33 04 3A xor eax, [edi + edx]
|
|
||||||
000000EF 75 14 jnz LeaveLoopCmps
|
|
||||||
000000F1 8B 44 32 04 mov eax, [esi + edx + 4]
|
|
||||||
000000F5 33 44 3A 04 xor eax, [edi + edx + 4]
|
|
||||||
000000F9 75 07 jnz LeaveLoopCmps4
|
|
||||||
000000FB 83 C2 08 add edx, 8
|
|
||||||
000000FE 75 E9 jnz LoopCmps
|
|
||||||
00000100 EB 71 jmp short LenMaximum
|
|
||||||
00000102 83 C2 04 LeaveLoopCmps4: add edx, 4
|
|
||||||
00000105 A9 0000FFFF LeaveLoopCmps: test eax, 0000FFFFh
|
|
||||||
0000010A 75 06 jnz LenLower
|
|
||||||
0000010C 83 C2 02 add edx, 2
|
|
||||||
0000010F C1 E8 10 shr eax, 16
|
|
||||||
00000112 2C 01 LenLower: sub al, 1
|
|
||||||
00000114 83 D2 00 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.
|
|
||||||
|
|
||||||
00000117 8D 04 3A lea eax, [edi + edx]
|
|
||||||
0000011A 8B 7C 24 20 mov edi, [scan]
|
|
||||||
0000011E 2B C7 sub eax, edi
|
|
||||||
00000120 3D 00000102 cmp eax, MAX_MATCH
|
|
||||||
00000125 7D 4C 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.
|
|
||||||
|
|
||||||
00000127 8B 54 24 38 mov edx, [deflatestate]
|
|
||||||
0000012B 8B 5C 24 1C mov ebx, [bestlen]
|
|
||||||
0000012F 3B C3 cmp eax, ebx
|
|
||||||
00000131 7F 13 jg LongerMatch
|
|
||||||
00000133 8B 74 24 08 mov esi, [windowbestlen]
|
|
||||||
00000137 8B 7A 40 mov edi, [edx + dsPrev]
|
|
||||||
0000013A 8B 5C 24 0C mov ebx, [scanend]
|
|
||||||
0000013E 8B 14 24 mov edx, [chainlenwmask]
|
|
||||||
00000141 E9 FFFFFF4E jmp LookupLoop
|
|
||||||
|
|
||||||
;;; s->match_start = cur_match;
|
|
||||||
;;; best_len = len;
|
|
||||||
;;; if (len >= nice_match) break;
|
|
||||||
;;; scan_end = *(ushf*)(scan+best_len-1);
|
|
||||||
|
|
||||||
00000146 8B 5C 24 18 LongerMatch: mov ebx, [nicematch]
|
|
||||||
0000014A 89 44 24 1C mov [bestlen], eax
|
|
||||||
0000014E 89 4A 70 mov [edx + dsMatchStart], ecx
|
|
||||||
00000151 3B C3 cmp eax, ebx
|
|
||||||
00000153 7D 2D jge LeaveNow
|
|
||||||
00000155 8B 74 24 04 mov esi, [window]
|
|
||||||
00000159 03 F0 add esi, eax
|
|
||||||
0000015B 89 74 24 08 mov [windowbestlen], esi
|
|
||||||
0000015F 0F B7 5C 38 FF movzx ebx, word ptr [edi + eax - 1]
|
|
||||||
00000164 8B 7A 40 mov edi, [edx + dsPrev]
|
|
||||||
00000167 89 5C 24 0C mov [scanend], ebx
|
|
||||||
0000016B 8B 14 24 mov edx, [chainlenwmask]
|
|
||||||
0000016E E9 FFFFFF21 jmp LookupLoop
|
|
||||||
|
|
||||||
;;; Accept the current string, with the maximum possible length.
|
|
||||||
|
|
||||||
00000173 8B 54 24 38 LenMaximum: mov edx, [deflatestate]
|
|
||||||
00000177 C7 44 24 1C mov dword ptr [bestlen], MAX_MATCH
|
|
||||||
00000102
|
|
||||||
0000017F 89 4A 70 mov [edx + dsMatchStart], ecx
|
|
||||||
|
|
||||||
;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
|
|
||||||
;;; return s->lookahead;
|
|
||||||
|
|
||||||
00000182 LeaveNow:
|
|
||||||
00000182 8B 54 24 38 mov edx, [deflatestate]
|
|
||||||
00000186 8B 5C 24 1C mov ebx, [bestlen]
|
|
||||||
0000018A 8B 42 74 mov eax, [edx + dsLookahead]
|
|
||||||
0000018D 3B D8 cmp ebx, eax
|
|
||||||
0000018F 7F 02 jg LookaheadRet
|
|
||||||
00000191 8B C3 mov eax, ebx
|
|
||||||
00000193 LookaheadRet:
|
|
||||||
|
|
||||||
;;; Restore the stack and return from whence we came.
|
|
||||||
|
|
||||||
00000193 83 C4 24 add esp, LocalVarsSize
|
|
||||||
00000196 5B pop ebx
|
|
||||||
00000197 5E pop esi
|
|
||||||
00000198 5F pop edi
|
|
||||||
00000199 5D pop ebp
|
|
||||||
|
|
||||||
0000019A C3 ret
|
|
||||||
; please don't remove this string !
|
|
||||||
; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary!
|
|
||||||
0000019B 0D 0A 61 73 6D db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
|
|
||||||
36 38 36 20 77
|
|
||||||
69 74 68 20 6D
|
|
||||||
61 73 6D 2C 20
|
|
||||||
6F 70 74 69 6D
|
|
||||||
69 73 65 64 20
|
|
||||||
61 73 73 65 6D
|
|
||||||
62 6C 79 20 63
|
|
||||||
6F 64 65 20 66
|
|
||||||
72 6F 6D 20 42
|
|
||||||
72 69 61 6E 20
|
|
||||||
52 61 69 74 65
|
|
||||||
72 2C 20 77 72
|
|
||||||
69 74 74 65 6E
|
|
||||||
20 31 39 39 38
|
|
||||||
0D 0A
|
|
||||||
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
ELSE
|
|
||||||
000001E8 _longest_match endp
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
IFDEF NOUNDERLINE
|
|
||||||
ELSE
|
|
||||||
000001E8 _match_init proc near
|
|
||||||
000001E8 C3 ret
|
|
||||||
000001E9 _match_init endp
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
|
|
||||||
000001E9 _TEXT ends
|
|
||||||
end
|
|
||||||
Microsoft (R) Macro Assembler Version 12.00.31101.0 05/22/17 22:38:55
|
|
||||||
match686.asm Symbols 2 - 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Segments and Groups:
|
|
||||||
|
|
||||||
N a m e Size Length Align Combine Class
|
|
||||||
|
|
||||||
FLAT . . . . . . . . . . . . . . GROUP
|
|
||||||
_DATA . . . . . . . . . . . . . 32 Bit 00000000 Para Public 'DATA'
|
|
||||||
_TEXT . . . . . . . . . . . . . 32 Bit 000001E9 Para Public 'CODE'
|
|
||||||
|
|
||||||
|
|
||||||
Procedures, parameters, and locals:
|
|
||||||
|
|
||||||
N a m e Type Value Attr
|
|
||||||
|
|
||||||
_longest_match . . . . . . . . . P Near 00000000 _TEXT Length= 000001E8 Public
|
|
||||||
LastMatchGood . . . . . . . . L Near 00000025 _TEXT
|
|
||||||
LookaheadLess . . . . . . . . L Near 0000003D _TEXT
|
|
||||||
LimitPositive . . . . . . . . L Near 0000006C _TEXT
|
|
||||||
LookupLoop . . . . . . . . . . L Near 00000094 _TEXT
|
|
||||||
LoopEntry . . . . . . . . . . L Near 000000AE _TEXT
|
|
||||||
LoopCmps . . . . . . . . . . . L Near 000000E9 _TEXT
|
|
||||||
LeaveLoopCmps4 . . . . . . . . L Near 00000102 _TEXT
|
|
||||||
LeaveLoopCmps . . . . . . . . L Near 00000105 _TEXT
|
|
||||||
LenLower . . . . . . . . . . . L Near 00000112 _TEXT
|
|
||||||
LongerMatch . . . . . . . . . L Near 00000146 _TEXT
|
|
||||||
LenMaximum . . . . . . . . . . L Near 00000173 _TEXT
|
|
||||||
LeaveNow . . . . . . . . . . . L Near 00000182 _TEXT
|
|
||||||
LookaheadRet . . . . . . . . . L Near 00000193 _TEXT
|
|
||||||
_match_init . . . . . . . . . . P Near 000001E8 _TEXT Length= 00000001 Public
|
|
||||||
|
|
||||||
|
|
||||||
Symbols:
|
|
||||||
|
|
||||||
N a m e Type Value Attr
|
|
||||||
|
|
||||||
@CodeSize . . . . . . . . . . . Number 00000000h
|
|
||||||
@DataSize . . . . . . . . . . . Number 00000000h
|
|
||||||
@Interface . . . . . . . . . . . Number 00000000h
|
|
||||||
@Model . . . . . . . . . . . . . Number 00000007h
|
|
||||||
@code . . . . . . . . . . . . . Text _TEXT
|
|
||||||
@data . . . . . . . . . . . . . Text FLAT
|
|
||||||
@fardata? . . . . . . . . . . . Text FLAT
|
|
||||||
@fardata . . . . . . . . . . . . Text FLAT
|
|
||||||
@stack . . . . . . . . . . . . . Text FLAT
|
|
||||||
LocalVarsSize . . . . . . . . . Number 00000024h
|
|
||||||
MAX_MATCH_8_ . . . . . . . . . . Number 00000100h
|
|
||||||
MAX_MATCH . . . . . . . . . . . Number 00000102h
|
|
||||||
MIN_LOOKAHEAD . . . . . . . . . Number 00000106h
|
|
||||||
MIN_MATCH . . . . . . . . . . . Number 00000003h
|
|
||||||
NbStackAdd . . . . . . . . . . . Number 00000034h
|
|
||||||
NbStack . . . . . . . . . . . . Number 0000004Ch
|
|
||||||
adrret . . . . . . . . . . . . . Text dword ptr[esp+NbStack-8]
|
|
||||||
best_len . . . . . . . . . . . . Text dword ptr [esp+NbStack-36]
|
|
||||||
bestlen . . . . . . . . . . . . Text esp + 28
|
|
||||||
chain_length . . . . . . . . . . Text dword ptr [esp+NbStack-28]
|
|
||||||
chainlenwmask . . . . . . . . . Text esp + 0
|
|
||||||
cur_match . . . . . . . . . . . Text dword ptr[esp+NbStack-0]
|
|
||||||
curmatch . . . . . . . . . . . . Text esp + 60
|
|
||||||
deflatestate . . . . . . . . . . Text esp + 56
|
|
||||||
dep_chain_length . . . . . . . . Number 0000007Ch
|
|
||||||
dep_good_match . . . . . . . . . Number 0000008Ch
|
|
||||||
dep_lookahead . . . . . . . . . Number 00000074h
|
|
||||||
dep_match_start . . . . . . . . Number 00000070h
|
|
||||||
dep_nice_match . . . . . . . . . Number 00000090h
|
|
||||||
dep_prev_length . . . . . . . . Number 00000078h
|
|
||||||
dep_prev . . . . . . . . . . . . Number 00000040h
|
|
||||||
dep_strstart . . . . . . . . . . Number 0000006Ch
|
|
||||||
dep_w_mask . . . . . . . . . . . Number 00000034h
|
|
||||||
dep_w_size . . . . . . . . . . . Number 0000002Ch
|
|
||||||
dep_window . . . . . . . . . . . Number 00000038h
|
|
||||||
dsGoodMatch . . . . . . . . . . Number 0000008Ch
|
|
||||||
dsLookahead . . . . . . . . . . Number 00000074h
|
|
||||||
dsMatchLen . . . . . . . . . . . Number 00000060h
|
|
||||||
dsMatchStart . . . . . . . . . . Number 00000070h
|
|
||||||
dsMaxChainLen . . . . . . . . . Number 0000007Ch
|
|
||||||
dsNiceMatch . . . . . . . . . . Number 00000090h
|
|
||||||
dsPrevLen . . . . . . . . . . . Number 00000078h
|
|
||||||
dsPrevMatch . . . . . . . . . . Number 00000064h
|
|
||||||
dsPrev . . . . . . . . . . . . . Number 00000040h
|
|
||||||
dsStrStart . . . . . . . . . . . Number 0000006Ch
|
|
||||||
dsWMask . . . . . . . . . . . . Number 00000034h
|
|
||||||
dsWSize . . . . . . . . . . . . Number 0000002Ch
|
|
||||||
dsWindow . . . . . . . . . . . . Number 00000038h
|
|
||||||
limit . . . . . . . . . . . . . Text dword ptr [esp+NbStack-32]
|
|
||||||
match_start_ptr . . . . . . . . Text dword ptr [esp+NbStack-56]
|
|
||||||
match_start . . . . . . . . . . Text dword ptr [esp+NbStack-72]
|
|
||||||
nice_match . . . . . . . . . . . Text dword ptr [esp+NbStack-60]
|
|
||||||
nicematch . . . . . . . . . . . Text esp + 24
|
|
||||||
prev . . . . . . . . . . . . . . Text dword ptr [esp+NbStack-44]
|
|
||||||
pushebp . . . . . . . . . . . . Text dword ptr[esp+NbStack-12]
|
|
||||||
pushebx . . . . . . . . . . . . Text dword ptr[esp+NbStack-24]
|
|
||||||
pushedi . . . . . . . . . . . . Text dword ptr[esp+NbStack-16]
|
|
||||||
pushesi . . . . . . . . . . . . Text dword ptr[esp+NbStack-20]
|
|
||||||
scan_start . . . . . . . . . . . Text word ptr [esp+NbStack-48]
|
|
||||||
scanalign . . . . . . . . . . . Text esp + 20
|
|
||||||
scanend . . . . . . . . . . . . Text esp + 12
|
|
||||||
scanstart . . . . . . . . . . . Text esp + 16
|
|
||||||
scan . . . . . . . . . . . . . . Text esp + 32
|
|
||||||
str_s . . . . . . . . . . . . . Text dword ptr[esp+NbStack-4]
|
|
||||||
strend . . . . . . . . . . . . . Text dword ptr [esp+NbStack-76]
|
|
||||||
windowbestlen . . . . . . . . . Text esp + 8
|
|
||||||
windowlen . . . . . . . . . . . Text dword ptr [esp+NbStack-68]
|
|
||||||
window . . . . . . . . . . . . . Text esp + 4
|
|
||||||
wmask . . . . . . . . . . . . . Text dword ptr [esp+NbStack-52]
|
|
||||||
zlib1222add . . . . . . . . . . Number 00000008h
|
|
||||||
|
|
||||||
0 Warnings
|
|
||||||
0 Errors
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
Summary
|
|
||||||
-------
|
|
||||||
This directory contains ASM implementations of the functions
|
|
||||||
longest_match() and inflate_fast().
|
|
||||||
|
|
||||||
|
|
||||||
Use instructions
|
|
||||||
----------------
|
|
||||||
Assemble using MASM, and copy the object files into the zlib source
|
|
||||||
directory, then run the appropriate makefile, as suggested below. You can
|
|
||||||
donwload MASM from here:
|
|
||||||
|
|
||||||
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
|
|
||||||
|
|
||||||
You can also get objects files here:
|
|
||||||
|
|
||||||
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
|
|
||||||
|
|
||||||
Build instructions
|
|
||||||
------------------
|
|
||||||
* With Microsoft C and MASM:
|
|
||||||
nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj"
|
|
||||||
|
|
||||||
* With Borland C and TASM:
|
|
||||||
make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- Autoconf -*-
|
# -*- Autoconf -*-
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com])
|
AC_INIT([minizip], [1.2.12], [bugzilla.redhat.com])
|
||||||
AC_CONFIG_SRCDIR([minizip.c])
|
AC_CONFIG_SRCDIR([minizip.c])
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign])
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
|
|||||||
* unpredictable manner on 16-bit systems; not a problem
|
* unpredictable manner on 16-bit systems; not a problem
|
||||||
* with any known compiler so far, though */
|
* with any known compiler so far, though */
|
||||||
|
|
||||||
|
(void)pcrc_32_tab;
|
||||||
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
|
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
|
||||||
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
||||||
}
|
}
|
||||||
@@ -77,24 +78,24 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr
|
|||||||
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
|
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
|
||||||
|
|
||||||
#define zencode(pkeys,pcrc_32_tab,c,t) \
|
#define zencode(pkeys,pcrc_32_tab,c,t) \
|
||||||
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
|
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
|
||||||
|
|
||||||
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
||||||
|
|
||||||
#define RAND_HEAD_LEN 12
|
#define RAND_HEAD_LEN 12
|
||||||
/* "last resort" source for second part of crypt seed pattern */
|
/* "last resort" source for second part of crypt seed pattern */
|
||||||
# ifndef ZCR_SEED2
|
# ifndef ZCR_SEED2
|
||||||
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
# define ZCR_SEED2 3141592654L /* use PI as default pattern */
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
static int crypthead(const char* passwd, /* password string */
|
static unsigned crypthead(const char* passwd, /* password string */
|
||||||
unsigned char* buf, /* where to write header */
|
unsigned char* buf, /* where to write header */
|
||||||
int bufSize,
|
int bufSize,
|
||||||
unsigned long* pkeys,
|
unsigned long* pkeys,
|
||||||
const z_crc_t* pcrc_32_tab,
|
const z_crc_t* pcrc_32_tab,
|
||||||
unsigned long crcForCrypting)
|
unsigned long crcForCrypting)
|
||||||
{
|
{
|
||||||
int n; /* index in random header */
|
unsigned n; /* index in random header */
|
||||||
int t; /* temporary */
|
int t; /* temporary */
|
||||||
int c; /* random byte */
|
int c; /* random byte */
|
||||||
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
|
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
|
|||||||
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
|
uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
|
||||||
if ((tell_uLong) == MAXU32)
|
if ((tell_uLong) == MAXU32)
|
||||||
return (ZPOS64_T)-1;
|
return (ZPOS64_T)-1;
|
||||||
else
|
else
|
||||||
@@ -94,6 +94,7 @@ static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
|
|||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
|
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||||
@@ -112,6 +113,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
|
|||||||
|
|
||||||
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
|
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||||
@@ -131,6 +133,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
|
|||||||
|
|
||||||
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
|
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
uLong ret;
|
uLong ret;
|
||||||
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -138,6 +141,7 @@ static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf,
|
|||||||
|
|
||||||
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
|
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
uLong ret;
|
uLong ret;
|
||||||
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -145,6 +149,7 @@ static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const voi
|
|||||||
|
|
||||||
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
long ret;
|
long ret;
|
||||||
ret = ftell((FILE *)stream);
|
ret = ftell((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -153,13 +158,15 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
|||||||
|
|
||||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
ZPOS64_T ret;
|
ZPOS64_T ret;
|
||||||
ret = FTELLO_FUNC((FILE *)stream);
|
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
|
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
switch (origin)
|
switch (origin)
|
||||||
@@ -176,13 +183,14 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
|
|||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (fseek((FILE *)stream, offset, fseek_origin) != 0)
|
if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
switch (origin)
|
switch (origin)
|
||||||
@@ -200,7 +208,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
|||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
|
if(FSEEKO_FUNC((FILE *)stream, (long)offset, fseek_origin) != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -209,6 +217,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
|||||||
|
|
||||||
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
int ret;
|
int ret;
|
||||||
ret = fclose((FILE *)stream);
|
ret = fclose((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -216,6 +225,7 @@ static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
|||||||
|
|
||||||
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
|
||||||
{
|
{
|
||||||
|
(void)opaque;
|
||||||
int ret;
|
int ret;
|
||||||
ret = ferror((FILE *)stream);
|
ret = ferror((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -91,8 +91,7 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
|||||||
typedef uint64_t ZPOS64_T;
|
typedef uint64_t ZPOS64_T;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
|
||||||
#define MAXU32 0xffffffff
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
typedef unsigned __int64 ZPOS64_T;
|
typedef unsigned __int64 ZPOS64_T;
|
||||||
@@ -102,7 +101,10 @@ typedef unsigned long long int ZPOS64_T;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
||||||
|
#ifndef MAXU32
|
||||||
|
#define MAXU32 (0xffffffff)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
@@ -80,7 +81,7 @@
|
|||||||
filename : the filename of the file where date/time must be modified
|
filename : the filename of the file where date/time must be modified
|
||||||
dosdate : the new date at the MSDos format (4 bytes)
|
dosdate : the new date at the MSDos format (4 bytes)
|
||||||
tmu_date : the SAME new date at the tm_unz format */
|
tmu_date : the SAME new date at the tm_unz format */
|
||||||
void change_file_date(filename,dosdate,tmu_date)
|
static void change_file_date(filename,dosdate,tmu_date)
|
||||||
const char *filename;
|
const char *filename;
|
||||||
uLong dosdate;
|
uLong dosdate;
|
||||||
tm_unz tmu_date;
|
tm_unz tmu_date;
|
||||||
@@ -97,7 +98,8 @@ void change_file_date(filename,dosdate,tmu_date)
|
|||||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
#else
|
#else
|
||||||
#ifdef unix || __APPLE__
|
#if defined(unix) || defined(__APPLE__)
|
||||||
|
(void)dosdate;
|
||||||
struct utimbuf ut;
|
struct utimbuf ut;
|
||||||
struct tm newdate;
|
struct tm newdate;
|
||||||
newdate.tm_sec = tmu_date.tm_sec;
|
newdate.tm_sec = tmu_date.tm_sec;
|
||||||
@@ -121,7 +123,7 @@ void change_file_date(filename,dosdate,tmu_date)
|
|||||||
/* mymkdir and change_file_date are not 100 % portable
|
/* mymkdir and change_file_date are not 100 % portable
|
||||||
As I don't know well Unix, I wait feedback for the unix portion */
|
As I don't know well Unix, I wait feedback for the unix portion */
|
||||||
|
|
||||||
int mymkdir(dirname)
|
static int mymkdir(dirname)
|
||||||
const char* dirname;
|
const char* dirname;
|
||||||
{
|
{
|
||||||
int ret=0;
|
int ret=0;
|
||||||
@@ -135,14 +137,14 @@ int mymkdir(dirname)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int makedir (newdir)
|
static int makedir (newdir)
|
||||||
char *newdir;
|
const char *newdir;
|
||||||
{
|
{
|
||||||
char *buffer ;
|
char *buffer ;
|
||||||
char *p;
|
char *p;
|
||||||
int len = (int)strlen(newdir);
|
size_t len = strlen(newdir);
|
||||||
|
|
||||||
if (len <= 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
buffer = (char*)malloc(len+1);
|
buffer = (char*)malloc(len+1);
|
||||||
@@ -185,13 +187,13 @@ int makedir (newdir)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_banner()
|
static void do_banner()
|
||||||
{
|
{
|
||||||
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
|
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
|
||||||
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_help()
|
static void do_help()
|
||||||
{
|
{
|
||||||
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
|
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
|
||||||
" -e Extract without pathname (junk paths)\n" \
|
" -e Extract without pathname (junk paths)\n" \
|
||||||
@@ -203,7 +205,7 @@ void do_help()
|
|||||||
" -p extract crypted file using password\n\n");
|
" -p extract crypted file using password\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display64BitsSize(ZPOS64_T n, int size_char)
|
static void Display64BitsSize(ZPOS64_T n, int size_char)
|
||||||
{
|
{
|
||||||
/* to avoid compatibility problem , we do here the conversion */
|
/* to avoid compatibility problem , we do here the conversion */
|
||||||
char number[21];
|
char number[21];
|
||||||
@@ -231,7 +233,7 @@ void Display64BitsSize(ZPOS64_T n, int size_char)
|
|||||||
printf("%s",&number[pos_string]);
|
printf("%s",&number[pos_string]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_list(uf)
|
static int do_list(uf)
|
||||||
unzFile uf;
|
unzFile uf;
|
||||||
{
|
{
|
||||||
uLong i;
|
uLong i;
|
||||||
@@ -309,7 +311,7 @@ int do_list(uf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
||||||
unzFile uf;
|
unzFile uf;
|
||||||
const int* popt_extract_without_path;
|
const int* popt_extract_without_path;
|
||||||
int* popt_overwrite;
|
int* popt_overwrite;
|
||||||
@@ -324,7 +326,6 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
|||||||
uInt size_buf;
|
uInt size_buf;
|
||||||
|
|
||||||
unz_file_info64 file_info;
|
unz_file_info64 file_info;
|
||||||
uLong ratio=0;
|
|
||||||
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
|
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
@@ -439,7 +440,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err>0)
|
if (err>0)
|
||||||
if (fwrite(buf,err,1,fout)!=1)
|
if (fwrite(buf,(unsigned)err,1,fout)!=1)
|
||||||
{
|
{
|
||||||
printf("error in writing extracted file\n");
|
printf("error in writing extracted file\n");
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -472,7 +473,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
||||||
unzFile uf;
|
unzFile uf;
|
||||||
int opt_extract_without_path;
|
int opt_extract_without_path;
|
||||||
int opt_overwrite;
|
int opt_overwrite;
|
||||||
@@ -481,7 +482,6 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
|||||||
uLong i;
|
uLong i;
|
||||||
unz_global_info64 gi;
|
unz_global_info64 gi;
|
||||||
int err;
|
int err;
|
||||||
FILE* fout=NULL;
|
|
||||||
|
|
||||||
err = unzGetGlobalInfo64(uf,&gi);
|
err = unzGetGlobalInfo64(uf,&gi);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
@@ -508,14 +508,13 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
|
static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
|
||||||
unzFile uf;
|
unzFile uf;
|
||||||
const char* filename;
|
const char* filename;
|
||||||
int opt_extract_without_path;
|
int opt_extract_without_path;
|
||||||
int opt_overwrite;
|
int opt_overwrite;
|
||||||
const char* password;
|
const char* password;
|
||||||
{
|
{
|
||||||
int err = UNZ_OK;
|
|
||||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
||||||
{
|
{
|
||||||
printf("file %s not found in the zipfile\n",filename);
|
printf("file %s not found in the zipfile\n",filename);
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
#define MAXFILENAME (256)
|
#define MAXFILENAME (256)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
uLong filetime(f, tmzip, dt)
|
static int filetime(f, tmzip, dt)
|
||||||
char *f; /* name of file to get info on */
|
const char *f; /* name of file to get info on */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
uLong *dt; /* dostime */
|
uLong *dt; /* dostime */
|
||||||
{
|
{
|
||||||
@@ -94,12 +94,13 @@ uLong filetime(f, tmzip, dt)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef unix || __APPLE__
|
#if defined(unix) || defined(__APPLE__)
|
||||||
uLong filetime(f, tmzip, dt)
|
static int filetime(f, tmzip, dt)
|
||||||
char *f; /* name of file to get info on */
|
const char *f; /* name of file to get info on */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
uLong *dt; /* dostime */
|
uLong *dt; /* dostime */
|
||||||
{
|
{
|
||||||
|
(void)dt;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
struct stat s; /* results of stat() */
|
struct stat s; /* results of stat() */
|
||||||
struct tm* filedate;
|
struct tm* filedate;
|
||||||
@@ -108,7 +109,7 @@ uLong filetime(f, tmzip, dt)
|
|||||||
if (strcmp(f,"-")!=0)
|
if (strcmp(f,"-")!=0)
|
||||||
{
|
{
|
||||||
char name[MAXFILENAME+1];
|
char name[MAXFILENAME+1];
|
||||||
int len = strlen(f);
|
size_t len = strlen(f);
|
||||||
if (len > MAXFILENAME)
|
if (len > MAXFILENAME)
|
||||||
len = MAXFILENAME;
|
len = MAXFILENAME;
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ uLong filetime(f, tmzip, dt)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uLong filetime(f, tmzip, dt)
|
uLong filetime(f, tmzip, dt)
|
||||||
char *f; /* name of file to get info on */
|
const char *f; /* name of file to get info on */
|
||||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
uLong *dt; /* dostime */
|
uLong *dt; /* dostime */
|
||||||
{
|
{
|
||||||
@@ -150,7 +151,7 @@ uLong filetime(f, tmzip, dt)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int check_exist_file(filename)
|
static int check_exist_file(filename)
|
||||||
const char* filename;
|
const char* filename;
|
||||||
{
|
{
|
||||||
FILE* ftestexist;
|
FILE* ftestexist;
|
||||||
@@ -163,13 +164,13 @@ int check_exist_file(filename)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_banner()
|
static void do_banner()
|
||||||
{
|
{
|
||||||
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
|
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
|
||||||
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
|
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_help()
|
static void do_help()
|
||||||
{
|
{
|
||||||
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
||||||
" -o Overwrite existing file.zip\n" \
|
" -o Overwrite existing file.zip\n" \
|
||||||
@@ -182,7 +183,7 @@ void do_help()
|
|||||||
|
|
||||||
/* calculate the CRC32 of a file,
|
/* calculate the CRC32 of a file,
|
||||||
because to encrypt a file, we need known the CRC32 of the file before */
|
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)
|
static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
|
||||||
{
|
{
|
||||||
unsigned long calculate_crc=0;
|
unsigned long calculate_crc=0;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
@@ -199,7 +200,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
err = ZIP_OK;
|
err = ZIP_OK;
|
||||||
size_read = (int)fread(buf,1,size_buf,fin);
|
size_read = fread(buf,1,size_buf,fin);
|
||||||
if (size_read < size_buf)
|
if (size_read < size_buf)
|
||||||
if (feof(fin)==0)
|
if (feof(fin)==0)
|
||||||
{
|
{
|
||||||
@@ -208,7 +209,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (size_read>0)
|
if (size_read>0)
|
||||||
calculate_crc = crc32(calculate_crc,buf,size_read);
|
calculate_crc = crc32_z(calculate_crc,buf,size_read);
|
||||||
total_read += size_read;
|
total_read += size_read;
|
||||||
|
|
||||||
} while ((err == ZIP_OK) && (size_read>0));
|
} while ((err == ZIP_OK) && (size_read>0));
|
||||||
@@ -221,7 +222,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isLargeFile(const char* filename)
|
static int isLargeFile(const char* filename)
|
||||||
{
|
{
|
||||||
int largeFile = 0;
|
int largeFile = 0;
|
||||||
ZPOS64_T pos = 0;
|
ZPOS64_T pos = 0;
|
||||||
@@ -229,8 +230,8 @@ int isLargeFile(const char* filename)
|
|||||||
|
|
||||||
if(pFile != NULL)
|
if(pFile != NULL)
|
||||||
{
|
{
|
||||||
int n = FSEEKO_FUNC(pFile, 0, SEEK_END);
|
FSEEKO_FUNC(pFile, 0, SEEK_END);
|
||||||
pos = FTELLO_FUNC(pFile);
|
pos = (ZPOS64_T)FTELLO_FUNC(pFile);
|
||||||
|
|
||||||
printf("File : %s is %lld bytes\n", filename, pos);
|
printf("File : %s is %lld bytes\n", filename, pos);
|
||||||
|
|
||||||
@@ -255,7 +256,7 @@ int main(argc,argv)
|
|||||||
char filename_try[MAXFILENAME+16];
|
char filename_try[MAXFILENAME+16];
|
||||||
int zipok;
|
int zipok;
|
||||||
int err=0;
|
int err=0;
|
||||||
int size_buf=0;
|
size_t size_buf=0;
|
||||||
void* buf=NULL;
|
void* buf=NULL;
|
||||||
const char* password=NULL;
|
const char* password=NULL;
|
||||||
|
|
||||||
@@ -396,7 +397,7 @@ int main(argc,argv)
|
|||||||
(strlen(argv[i]) == 2)))
|
(strlen(argv[i]) == 2)))
|
||||||
{
|
{
|
||||||
FILE * fin;
|
FILE * fin;
|
||||||
int size_read;
|
size_t size_read;
|
||||||
const char* filenameinzip = argv[i];
|
const char* filenameinzip = argv[i];
|
||||||
const char *savefilenameinzip;
|
const char *savefilenameinzip;
|
||||||
zip_fileinfo zi;
|
zip_fileinfo zi;
|
||||||
@@ -472,7 +473,7 @@ int main(argc,argv)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
err = ZIP_OK;
|
err = ZIP_OK;
|
||||||
size_read = (int)fread(buf,1,size_buf,fin);
|
size_read = fread(buf,1,size_buf,fin);
|
||||||
if (size_read < size_buf)
|
if (size_read < size_buf)
|
||||||
if (feof(fin)==0)
|
if (feof(fin)==0)
|
||||||
{
|
{
|
||||||
@@ -482,7 +483,7 @@ int main(argc,argv)
|
|||||||
|
|
||||||
if (size_read>0)
|
if (size_read>0)
|
||||||
{
|
{
|
||||||
err = zipWriteInFileInZip (zf,buf,size_read);
|
err = zipWriteInFileInZip (zf,buf,(unsigned)size_read);
|
||||||
if (err<0)
|
if (err<0)
|
||||||
{
|
{
|
||||||
printf("error in writing %s in the zipfile\n",
|
printf("error in writing %s in the zipfile\n",
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
|||||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
||||||
{
|
{
|
||||||
uPosFound = uReadPos+i;
|
uPosFound = uReadPos+(unsigned)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|||||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||||
((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
||||||
{
|
{
|
||||||
uPosFound = uReadPos+i;
|
uPosFound = uReadPos+(unsigned)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,13 +853,13 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
|||||||
{
|
{
|
||||||
ZPOS64_T uDate;
|
ZPOS64_T uDate;
|
||||||
uDate = (ZPOS64_T)(ulDosDate>>16);
|
uDate = (ZPOS64_T)(ulDosDate>>16);
|
||||||
ptm->tm_mday = (uInt)(uDate&0x1f) ;
|
ptm->tm_mday = (int)(uDate&0x1f) ;
|
||||||
ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
|
ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
|
||||||
ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
|
ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
|
||||||
|
|
||||||
ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
|
ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800);
|
||||||
ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
|
ptm->tm_min = (int) ((ulDosDate&0x7E0)/0x20) ;
|
||||||
ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
|
ptm->tm_sec = (int) (2*(ulDosDate&0x1f)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -993,7 +993,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
{
|
{
|
||||||
if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -1018,7 +1018,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
{
|
{
|
||||||
if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -1090,7 +1090,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
{
|
{
|
||||||
if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -1767,7 +1767,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
|||||||
|
|
||||||
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
|
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
|
||||||
(pfile_in_zip_read_info->rest_read_compressed == 0))
|
(pfile_in_zip_read_info->rest_read_compressed == 0))
|
||||||
return (iRead==0) ? UNZ_EOF : iRead;
|
return (iRead==0) ? UNZ_EOF : (int)iRead;
|
||||||
|
|
||||||
if (pfile_in_zip_read_info->stream.avail_out <
|
if (pfile_in_zip_read_info->stream.avail_out <
|
||||||
pfile_in_zip_read_info->stream.avail_in)
|
pfile_in_zip_read_info->stream.avail_in)
|
||||||
@@ -1857,6 +1857,9 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
|||||||
err = Z_DATA_ERROR;
|
err = Z_DATA_ERROR;
|
||||||
|
|
||||||
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
|
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
|
||||||
|
/* Detect overflow, because z_stream.total_out is uLong (32 bits) */
|
||||||
|
if (uTotalOutAfter<uTotalOutBefore)
|
||||||
|
uTotalOutAfter += 1LL << 32; /* Add maximum value of uLong + 1 */
|
||||||
uOutThis = uTotalOutAfter-uTotalOutBefore;
|
uOutThis = uTotalOutAfter-uTotalOutBefore;
|
||||||
|
|
||||||
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
|
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
|
||||||
@@ -1871,14 +1874,14 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
|||||||
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
|
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
|
||||||
|
|
||||||
if (err==Z_STREAM_END)
|
if (err==Z_STREAM_END)
|
||||||
return (iRead==0) ? UNZ_EOF : iRead;
|
return (iRead==0) ? UNZ_EOF : (int)iRead;
|
||||||
if (err!=Z_OK)
|
if (err!=Z_OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err==Z_OK)
|
if (err==Z_OK)
|
||||||
return iRead;
|
return (int)iRead;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ typedef voidp unzFile;
|
|||||||
/* tm_unz contain date/time info */
|
/* tm_unz contain date/time info */
|
||||||
typedef struct tm_unz_s
|
typedef struct tm_unz_s
|
||||||
{
|
{
|
||||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
int tm_sec; /* seconds after the minute - [0,59] */
|
||||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
int tm_min; /* minutes after the hour - [0,59] */
|
||||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
int tm_hour; /* hours since midnight - [0,23] */
|
||||||
uInt tm_mday; /* day of the month - [1,31] */
|
int tm_mday; /* day of the month - [1,31] */
|
||||||
uInt tm_mon; /* months since January - [0,11] */
|
int tm_mon; /* months since January - [0,11] */
|
||||||
uInt tm_year; /* years - [1980..2044] */
|
int tm_year; /* years - [1980..2044] */
|
||||||
} tm_unz;
|
} tm_unz;
|
||||||
|
|
||||||
/* unz_global_info structure contain global data about the ZIPfile
|
/* unz_global_info structure contain global data about the ZIPfile
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ typedef struct
|
|||||||
#ifndef NOCRYPT
|
#ifndef NOCRYPT
|
||||||
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
|
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
|
||||||
const z_crc_t* pcrc_32_tab;
|
const z_crc_t* pcrc_32_tab;
|
||||||
int crypt_header_size;
|
unsigned crypt_header_size;
|
||||||
#endif
|
#endif
|
||||||
} curfile64_info;
|
} curfile64_info;
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
|
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
|
||||||
return ZIP_ERRNO;
|
return ZIP_ERRNO;
|
||||||
else
|
else
|
||||||
return ZIP_OK;
|
return ZIP_OK;
|
||||||
@@ -337,8 +337,8 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
|||||||
else if (year>=80)
|
else if (year>=80)
|
||||||
year-=80;
|
year-=80;
|
||||||
return
|
return
|
||||||
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
|
(uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
|
||||||
((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
(((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -522,12 +522,12 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
|||||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
||||||
{
|
{
|
||||||
uPosFound = uReadPos+i;
|
uPosFound = uReadPos+(unsigned)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
TRYFREE(buf);
|
||||||
return uPosFound;
|
return uPosFound;
|
||||||
@@ -586,7 +586,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|||||||
// Signature "0x07064b50" Zip64 end of central directory locater
|
// Signature "0x07064b50" Zip64 end of central directory locater
|
||||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
||||||
{
|
{
|
||||||
uPosFound = uReadPos+i;
|
uPosFound = uReadPos+(unsigned)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -637,7 +637,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
|||||||
return relativeOffset;
|
return relativeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
{
|
{
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
@@ -955,7 +955,7 @@ extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
|
|||||||
return zipOpen3(pathname,append,NULL,NULL);
|
return zipOpen3(pathname,append,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
||||||
{
|
{
|
||||||
/* write the local header */
|
/* write the local header */
|
||||||
int err;
|
int err;
|
||||||
@@ -1034,8 +1034,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
|
|||||||
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
|
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
|
||||||
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
|
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
|
||||||
|
|
||||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
|
||||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
|
||||||
|
|
||||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
|
||||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
|
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
|
||||||
@@ -1516,7 +1516,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
|||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
ZPOS64_T compressed_size;
|
ZPOS64_T compressed_size;
|
||||||
uLong invalidValue = 0xffffffff;
|
uLong invalidValue = 0xffffffff;
|
||||||
short datasize = 0;
|
unsigned datasize = 0;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
@@ -1752,7 +1752,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file)
|
|||||||
return zipCloseFileInZipRaw (file,0,0);
|
return zipCloseFileInZipRaw (file,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
||||||
{
|
{
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
||||||
@@ -1774,7 +1774,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
||||||
{
|
{
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
@@ -1813,7 +1813,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
|
|||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
||||||
{
|
{
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
@@ -1861,7 +1861,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
||||||
{
|
{
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
uInt size_global_comment = 0;
|
uInt size_global_comment = 0;
|
||||||
@@ -1962,7 +1962,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
|||||||
if(pData == NULL || *dataLen < 4)
|
if(pData == NULL || *dataLen < 4)
|
||||||
return ZIP_PARAMERROR;
|
return ZIP_PARAMERROR;
|
||||||
|
|
||||||
pNewHeader = (char*)ALLOC(*dataLen);
|
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
|
||||||
pTmp = pNewHeader;
|
pTmp = pNewHeader;
|
||||||
|
|
||||||
while(p < (pData + *dataLen))
|
while(p < (pData + *dataLen))
|
||||||
|
|||||||
@@ -88,12 +88,12 @@ typedef voidp zipFile;
|
|||||||
/* tm_zip contain date/time info */
|
/* tm_zip contain date/time info */
|
||||||
typedef struct tm_zip_s
|
typedef struct tm_zip_s
|
||||||
{
|
{
|
||||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
int tm_sec; /* seconds after the minute - [0,59] */
|
||||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
int tm_min; /* minutes after the hour - [0,59] */
|
||||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
int tm_hour; /* hours since midnight - [0,23] */
|
||||||
uInt tm_mday; /* day of the month - [1,31] */
|
int tm_mday; /* day of the month - [1,31] */
|
||||||
uInt tm_mon; /* months since January - [0,11] */
|
int tm_mon; /* months since January - [0,11] */
|
||||||
uInt tm_year; /* years - [1980..2044] */
|
int tm_year; /* years - [1980..2044] */
|
||||||
} tm_zip;
|
} tm_zip;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -144,6 +144,11 @@ extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
|
|||||||
zipcharpc* globalcomment,
|
zipcharpc* globalcomment,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
zlib_filefunc64_def* pzlib_filefunc_def));
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ unit zlibpas;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
ZLIB_VERSION = '1.2.11';
|
ZLIB_VERSION = '1.2.12';
|
||||||
ZLIB_VERNUM = $12a0;
|
ZLIB_VERNUM = $12a0;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Building instructions for the DLL versions of Zlib 1.2.11
|
Building instructions for the DLL versions of Zlib 1.2.12
|
||||||
========================================================
|
========================================================
|
||||||
|
|
||||||
This directory contains projects that build zlib and minizip using
|
This directory contains projects that build zlib and minizip using
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1, 2, 11, 0
|
FILEVERSION 1, 2, 12, 0
|
||||||
PRODUCTVERSION 1, 2, 11, 0
|
PRODUCTVERSION 1, 2, 12, 0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||||
VALUE "FileVersion", "1.2.11\0"
|
VALUE "FileVersion", "1.2.12\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -151,3 +151,8 @@ EXPORTS
|
|||||||
deflateGetDictionary @173
|
deflateGetDictionary @173
|
||||||
adler32_z @174
|
adler32_z @174
|
||||||
crc32_z @175
|
crc32_z @175
|
||||||
|
|
||||||
|
; zlib1 v1.2.12 added:
|
||||||
|
crc32_combine_gen @176
|
||||||
|
crc32_combine_gen64 @177
|
||||||
|
crc32_combine_op @178
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1, 2, 11, 0
|
FILEVERSION 1, 2, 12, 0
|
||||||
PRODUCTVERSION 1, 2, 11, 0
|
PRODUCTVERSION 1, 2, 12, 0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||||
VALUE "FileVersion", "1.2.11\0"
|
VALUE "FileVersion", "1.2.12\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -151,3 +151,8 @@ EXPORTS
|
|||||||
deflateGetDictionary @173
|
deflateGetDictionary @173
|
||||||
adler32_z @174
|
adler32_z @174
|
||||||
crc32_z @175
|
crc32_z @175
|
||||||
|
|
||||||
|
; zlib1 v1.2.12 added:
|
||||||
|
crc32_combine_gen @176
|
||||||
|
crc32_combine_gen64 @177
|
||||||
|
crc32_combine_op @178
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1, 2, 11, 0
|
FILEVERSION 1, 2, 12, 0
|
||||||
PRODUCTVERSION 1, 2, 11, 0
|
PRODUCTVERSION 1, 2, 12, 0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||||
VALUE "FileVersion", "1.2.11\0"
|
VALUE "FileVersion", "1.2.12\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -1,468 +1,467 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Itanium">
|
<ProjectConfiguration Include="Debug|Itanium">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Itanium</Platform>
|
<Platform>Itanium</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="ReleaseWithoutAsm|Itanium">
|
<ProjectConfiguration Include="ReleaseWithoutAsm|Itanium">
|
||||||
<Configuration>ReleaseWithoutAsm</Configuration>
|
<Configuration>ReleaseWithoutAsm</Configuration>
|
||||||
<Platform>Itanium</Platform>
|
<Platform>Itanium</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="ReleaseWithoutAsm|Win32">
|
<ProjectConfiguration Include="ReleaseWithoutAsm|Win32">
|
||||||
<Configuration>ReleaseWithoutAsm</Configuration>
|
<Configuration>ReleaseWithoutAsm</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="ReleaseWithoutAsm|x64">
|
<ProjectConfiguration Include="ReleaseWithoutAsm|x64">
|
||||||
<Configuration>ReleaseWithoutAsm</Configuration>
|
<Configuration>ReleaseWithoutAsm</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Itanium">
|
<ProjectConfiguration Include="Release|Itanium">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Itanium</Platform>
|
<Platform>Itanium</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}</ProjectGuid>
|
<ProjectGuid>{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}</ProjectGuid>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>10.0.30128.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.30128.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">x86\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">x86\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">x64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">x64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">ia64\ZlibStat$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">ia64\ZlibStat$(Configuration)\Tmp\</IntDir>
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ExceptionHandling>
|
<ExceptionHandling>
|
||||||
</ExceptionHandling>
|
</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<Culture>0x040c</Culture>
|
<Culture>0x040c</Culture>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<ExceptionHandling>
|
<ExceptionHandling>
|
||||||
</ExceptionHandling>
|
</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<Culture>0x040c</Culture>
|
<Culture>0x040c</Culture>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">
|
<ClCompile>
|
||||||
<ClCompile>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<StringPooling>true</StringPooling>
|
||||||
<StringPooling>true</StringPooling>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
<TargetEnvironment>X64</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<Optimization>Disabled</Optimization>
|
||||||
<Optimization>Disabled</Optimization>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>Itanium</TargetEnvironment>
|
||||||
<TargetEnvironment>Itanium</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<Optimization>Disabled</Optimization>
|
||||||
<Optimization>Disabled</Optimization>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
<TargetEnvironment>X64</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<StringPooling>true</StringPooling>
|
||||||
<StringPooling>true</StringPooling>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>Itanium</TargetEnvironment>
|
||||||
<TargetEnvironment>Itanium</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<StringPooling>true</StringPooling>
|
||||||
<StringPooling>true</StringPooling>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|x64'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
<TargetEnvironment>X64</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<StringPooling>true</StringPooling>
|
||||||
<StringPooling>true</StringPooling>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">
|
<Midl>
|
||||||
<Midl>
|
<TargetEnvironment>Itanium</TargetEnvironment>
|
||||||
<TargetEnvironment>Itanium</TargetEnvironment>
|
</Midl>
|
||||||
</Midl>
|
<ClCompile>
|
||||||
<ClCompile>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<StringPooling>true</StringPooling>
|
||||||
<StringPooling>true</StringPooling>
|
<ExceptionHandling>
|
||||||
<ExceptionHandling>
|
</ExceptionHandling>
|
||||||
</ExceptionHandling>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)zlibstat.pch</PrecompiledHeaderOutputFile>
|
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
||||||
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ResourceCompile>
|
||||||
<ResourceCompile>
|
<Culture>0x040c</Culture>
|
||||||
<Culture>0x040c</Culture>
|
</ResourceCompile>
|
||||||
</ResourceCompile>
|
<Lib>
|
||||||
<Lib>
|
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalOptions>/MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
|
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
||||||
<OutputFile>$(OutDir)zlibstat.lib</OutputFile>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
</Lib>
|
||||||
</Lib>
|
</ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<ClCompile Include="..\..\..\adler32.c" />
|
||||||
<ClCompile Include="..\..\..\adler32.c" />
|
<ClCompile Include="..\..\..\compress.c" />
|
||||||
<ClCompile Include="..\..\..\compress.c" />
|
<ClCompile Include="..\..\..\crc32.c" />
|
||||||
<ClCompile Include="..\..\..\crc32.c" />
|
<ClCompile Include="..\..\..\deflate.c" />
|
||||||
<ClCompile Include="..\..\..\deflate.c" />
|
<ClCompile Include="..\..\..\gzclose.c" />
|
||||||
<ClCompile Include="..\..\..\gzclose.c" />
|
<ClCompile Include="..\..\..\gzlib.c" />
|
||||||
<ClCompile Include="..\..\..\gzlib.c" />
|
<ClCompile Include="..\..\..\gzread.c" />
|
||||||
<ClCompile Include="..\..\..\gzread.c" />
|
<ClCompile Include="..\..\..\gzwrite.c" />
|
||||||
<ClCompile Include="..\..\..\gzwrite.c" />
|
<ClCompile Include="..\..\..\infback.c" />
|
||||||
<ClCompile Include="..\..\..\infback.c" />
|
<ClCompile Include="..\..\masmx64\inffas8664.c">
|
||||||
<ClCompile Include="..\..\masmx64\inffas8664.c">
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
</ClCompile>
|
||||||
</ClCompile>
|
<ClCompile Include="..\..\..\inffast.c" />
|
||||||
<ClCompile Include="..\..\..\inffast.c" />
|
<ClCompile Include="..\..\..\inflate.c" />
|
||||||
<ClCompile Include="..\..\..\inflate.c" />
|
<ClCompile Include="..\..\..\inftrees.c" />
|
||||||
<ClCompile Include="..\..\..\inftrees.c" />
|
<ClCompile Include="..\..\minizip\ioapi.c" />
|
||||||
<ClCompile Include="..\..\minizip\ioapi.c" />
|
<ClCompile Include="..\..\..\trees.c" />
|
||||||
<ClCompile Include="..\..\..\trees.c" />
|
<ClCompile Include="..\..\..\uncompr.c" />
|
||||||
<ClCompile Include="..\..\..\uncompr.c" />
|
<ClCompile Include="..\..\minizip\unzip.c" />
|
||||||
<ClCompile Include="..\..\minizip\unzip.c" />
|
<ClCompile Include="..\..\minizip\zip.c" />
|
||||||
<ClCompile Include="..\..\minizip\zip.c" />
|
<ClCompile Include="..\..\..\zutil.c" />
|
||||||
<ClCompile Include="..\..\..\zutil.c" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<ResourceCompile Include="zlib.rc" />
|
||||||
<ResourceCompile Include="zlib.rc" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<None Include="zlibvc.def" />
|
||||||
<None Include="zlibvc.def" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<ImportGroup Label="ExtensionTargets">
|
</ImportGroup>
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -151,3 +151,8 @@ EXPORTS
|
|||||||
deflateGetDictionary @173
|
deflateGetDictionary @173
|
||||||
adler32_z @174
|
adler32_z @174
|
||||||
crc32_z @175
|
crc32_z @175
|
||||||
|
|
||||||
|
; zlib1 v1.2.12 added:
|
||||||
|
crc32_combine_gen @176
|
||||||
|
crc32_combine_gen64 @177
|
||||||
|
crc32_combine_op @178
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1, 2, 11, 0
|
FILEVERSION 1, 2, 12, 0
|
||||||
PRODUCTVERSION 1, 2, 11, 0
|
PRODUCTVERSION 1, 2, 12, 0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||||
VALUE "FileVersion", "1.2.11\0"
|
VALUE "FileVersion", "1.2.12\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -151,3 +151,8 @@ EXPORTS
|
|||||||
deflateGetDictionary @173
|
deflateGetDictionary @173
|
||||||
adler32_z @174
|
adler32_z @174
|
||||||
crc32_z @175
|
crc32_z @175
|
||||||
|
|
||||||
|
; zlib1 v1.2.12 added:
|
||||||
|
crc32_combine_gen @176
|
||||||
|
crc32_combine_gen64 @177
|
||||||
|
crc32_combine_op @178
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#define IDR_VERSION1 1
|
#define IDR_VERSION1 1
|
||||||
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||||
FILEVERSION 1, 2, 11, 0
|
FILEVERSION 1, 2, 12, 0
|
||||||
PRODUCTVERSION 1, 2, 11, 0
|
PRODUCTVERSION 1, 2, 12, 0
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
FILEOS VOS_DOS_WINDOWS32
|
||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
|
||||||
VALUE "FileVersion", "1.2.11\0"
|
VALUE "FileVersion", "1.2.12\0"
|
||||||
VALUE "InternalName", "zlib\0"
|
VALUE "InternalName", "zlib\0"
|
||||||
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
VALUE "OriginalFilename", "zlibwapi.dll\0"
|
||||||
VALUE "ProductName", "ZLib.DLL\0"
|
VALUE "ProductName", "ZLib.DLL\0"
|
||||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||||
VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
|
VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -151,3 +151,8 @@ EXPORTS
|
|||||||
deflateGetDictionary @173
|
deflateGetDictionary @173
|
||||||
adler32_z @174
|
adler32_z @174
|
||||||
crc32_z @175
|
crc32_z @175
|
||||||
|
|
||||||
|
; zlib1 v1.2.12 added:
|
||||||
|
crc32_combine_gen @176
|
||||||
|
crc32_combine_gen64 @177
|
||||||
|
crc32_combine_op @178
|
||||||
|
|||||||
1294
libz/crc32.c
1294
libz/crc32.c
File diff suppressed because it is too large
Load Diff
9877
libz/crc32.h
9877
libz/crc32.h
File diff suppressed because it is too large
Load Diff
108
libz/deflate.c
108
libz/deflate.c
@@ -1,5 +1,5 @@
|
|||||||
/* deflate.c -- compress data using the deflation algorithm
|
/* deflate.c -- compress data using the deflation algorithm
|
||||||
* Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
* Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
const char deflate_copyright[] =
|
const char deflate_copyright[] =
|
||||||
" deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
|
" deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
@@ -190,8 +190,11 @@ local const config configuration_table[10] = {
|
|||||||
* prev[] will be initialized on the fly.
|
* prev[] will be initialized on the fly.
|
||||||
*/
|
*/
|
||||||
#define CLEAR_HASH(s) \
|
#define CLEAR_HASH(s) \
|
||||||
s->head[s->hash_size-1] = NIL; \
|
do { \
|
||||||
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
|
s->head[s->hash_size-1] = NIL; \
|
||||||
|
zmemzero((Bytef *)s->head, \
|
||||||
|
(unsigned)(s->hash_size-1)*sizeof(*s->head)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Slide the hash table when sliding the window down (could be avoided with 32
|
* Slide the hash table when sliding the window down (could be avoided with 32
|
||||||
@@ -252,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|||||||
int wrap = 1;
|
int wrap = 1;
|
||||||
static const char my_version[] = ZLIB_VERSION;
|
static const char my_version[] = ZLIB_VERSION;
|
||||||
|
|
||||||
ushf *overlay;
|
|
||||||
/* We overlay pending_buf and d_buf+l_buf. This works since the average
|
|
||||||
* output size for (length,distance) codes is <= 24 bits.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != my_version[0] ||
|
if (version == Z_NULL || version[0] != my_version[0] ||
|
||||||
stream_size != sizeof(z_stream)) {
|
stream_size != sizeof(z_stream)) {
|
||||||
return Z_VERSION_ERROR;
|
return Z_VERSION_ERROR;
|
||||||
@@ -326,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|||||||
|
|
||||||
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
||||||
|
|
||||||
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
/* We overlay pending_buf and sym_buf. This works since the average size
|
||||||
s->pending_buf = (uchf *) overlay;
|
* for length/distance pairs over any compressed block is assured to be 31
|
||||||
s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
|
* bits or less.
|
||||||
|
*
|
||||||
|
* Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
||||||
|
* extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
||||||
|
* 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
||||||
|
* possible fixed-codes length/distance pair is then 31 bits total.
|
||||||
|
*
|
||||||
|
* sym_buf starts one-fourth of the way into pending_buf. So there are
|
||||||
|
* three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
||||||
|
* in sym_buf is three bytes -- two for the distance and one for the
|
||||||
|
* literal/length. As each symbol is consumed, the pointer to the next
|
||||||
|
* sym_buf value to read moves forward three bytes. From that symbol, up to
|
||||||
|
* 31 bits are written to pending_buf. The closest the written pending_buf
|
||||||
|
* bits gets to the next sym_buf symbol to read is just before the last
|
||||||
|
* code is written. At that time, 31*(n-2) bits have been written, just
|
||||||
|
* after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
||||||
|
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
||||||
|
* symbols are written.) The closest the writing gets to what is unread is
|
||||||
|
* then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
||||||
|
* can range from 128 to 32768.
|
||||||
|
*
|
||||||
|
* Therefore, at a minimum, there are 142 bits of space between what is
|
||||||
|
* written and what is read in the overlain buffers, so the symbols cannot
|
||||||
|
* be overwritten by the compressed data. That space is actually 139 bits,
|
||||||
|
* due to the three-bit fixed-code block header.
|
||||||
|
*
|
||||||
|
* That covers the case where either Z_FIXED is specified, forcing fixed
|
||||||
|
* codes, or when the use of fixed codes is chosen, because that choice
|
||||||
|
* results in a smaller compressed block than dynamic codes. That latter
|
||||||
|
* condition then assures that the above analysis also covers all dynamic
|
||||||
|
* blocks. A dynamic-code block will only be chosen to be emitted if it has
|
||||||
|
* fewer bits than a fixed-code block would for the same set of symbols.
|
||||||
|
* Therefore its average symbol length is assured to be less than 31. So
|
||||||
|
* the compressed data for a dynamic block also cannot overwrite the
|
||||||
|
* symbols from which it is being constructed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
|
||||||
|
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
||||||
|
|
||||||
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
||||||
s->pending_buf == Z_NULL) {
|
s->pending_buf == Z_NULL) {
|
||||||
@@ -337,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|||||||
deflateEnd (strm);
|
deflateEnd (strm);
|
||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
}
|
}
|
||||||
s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
s->sym_buf = s->pending_buf + s->lit_bufsize;
|
||||||
s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
s->sym_end = (s->lit_bufsize - 1) * 3;
|
||||||
|
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
||||||
|
* on 16 bit machines and because stored blocks are restricted to
|
||||||
|
* 64K-1 bytes.
|
||||||
|
*/
|
||||||
|
|
||||||
s->level = level;
|
s->level = level;
|
||||||
s->strategy = strategy;
|
s->strategy = strategy;
|
||||||
@@ -488,13 +528,13 @@ int ZEXPORT deflateResetKeep (strm)
|
|||||||
#ifdef GZIP
|
#ifdef GZIP
|
||||||
s->wrap == 2 ? GZIP_STATE :
|
s->wrap == 2 ? GZIP_STATE :
|
||||||
#endif
|
#endif
|
||||||
s->wrap ? INIT_STATE : BUSY_STATE;
|
INIT_STATE;
|
||||||
strm->adler =
|
strm->adler =
|
||||||
#ifdef GZIP
|
#ifdef GZIP
|
||||||
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
|
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
|
||||||
#endif
|
#endif
|
||||||
adler32(0L, Z_NULL, 0);
|
adler32(0L, Z_NULL, 0);
|
||||||
s->last_flush = Z_NO_FLUSH;
|
s->last_flush = -2;
|
||||||
|
|
||||||
_tr_init(s);
|
_tr_init(s);
|
||||||
|
|
||||||
@@ -549,7 +589,8 @@ int ZEXPORT deflatePrime (strm, bits, value)
|
|||||||
|
|
||||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
s = strm->state;
|
s = strm->state;
|
||||||
if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
|
if (bits < 0 || bits > 16 ||
|
||||||
|
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
||||||
return Z_BUF_ERROR;
|
return Z_BUF_ERROR;
|
||||||
do {
|
do {
|
||||||
put = Buf_size - s->bi_valid;
|
put = Buf_size - s->bi_valid;
|
||||||
@@ -587,12 +628,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
|||||||
func = configuration_table[s->level].func;
|
func = configuration_table[s->level].func;
|
||||||
|
|
||||||
if ((strategy != s->strategy || func != configuration_table[level].func) &&
|
if ((strategy != s->strategy || func != configuration_table[level].func) &&
|
||||||
s->high_water) {
|
s->last_flush != -2) {
|
||||||
/* Flush the last buffer: */
|
/* Flush the last buffer: */
|
||||||
int err = deflate(strm, Z_BLOCK);
|
int err = deflate(strm, Z_BLOCK);
|
||||||
if (err == Z_STREAM_ERROR)
|
if (err == Z_STREAM_ERROR)
|
||||||
return err;
|
return err;
|
||||||
if (strm->avail_out == 0)
|
if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
|
||||||
return Z_BUF_ERROR;
|
return Z_BUF_ERROR;
|
||||||
}
|
}
|
||||||
if (s->level != level) {
|
if (s->level != level) {
|
||||||
@@ -811,6 +852,8 @@ int ZEXPORT deflate (strm, flush)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write the header */
|
/* Write the header */
|
||||||
|
if (s->status == INIT_STATE && s->wrap == 0)
|
||||||
|
s->status = BUSY_STATE;
|
||||||
if (s->status == INIT_STATE) {
|
if (s->status == INIT_STATE) {
|
||||||
/* zlib header */
|
/* zlib header */
|
||||||
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
|
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
|
||||||
@@ -1108,7 +1151,6 @@ int ZEXPORT deflateCopy (dest, source)
|
|||||||
#else
|
#else
|
||||||
deflate_state *ds;
|
deflate_state *ds;
|
||||||
deflate_state *ss;
|
deflate_state *ss;
|
||||||
ushf *overlay;
|
|
||||||
|
|
||||||
|
|
||||||
if (deflateStateCheck(source) || dest == Z_NULL) {
|
if (deflateStateCheck(source) || dest == Z_NULL) {
|
||||||
@@ -1128,8 +1170,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|||||||
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
||||||
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
||||||
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
||||||
overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
|
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
|
||||||
ds->pending_buf = (uchf *) overlay;
|
|
||||||
|
|
||||||
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
||||||
ds->pending_buf == Z_NULL) {
|
ds->pending_buf == Z_NULL) {
|
||||||
@@ -1143,8 +1184,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|||||||
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
||||||
|
|
||||||
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
||||||
ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
|
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
||||||
ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
|
|
||||||
|
|
||||||
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
||||||
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
||||||
@@ -1513,6 +1553,8 @@ local void fill_window(s)
|
|||||||
s->match_start -= wsize;
|
s->match_start -= wsize;
|
||||||
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
||||||
s->block_start -= (long) wsize;
|
s->block_start -= (long) wsize;
|
||||||
|
if (s->insert > s->strstart)
|
||||||
|
s->insert = s->strstart;
|
||||||
slide_hash(s);
|
slide_hash(s);
|
||||||
more += wsize;
|
more += wsize;
|
||||||
}
|
}
|
||||||
@@ -1742,6 +1784,7 @@ local block_state deflate_stored(s, flush)
|
|||||||
s->matches = 2; /* clear hash */
|
s->matches = 2; /* clear hash */
|
||||||
zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
||||||
s->strstart = s->w_size;
|
s->strstart = s->w_size;
|
||||||
|
s->insert = s->strstart;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (s->window_size - s->strstart <= used) {
|
if (s->window_size - s->strstart <= used) {
|
||||||
@@ -1750,12 +1793,14 @@ local block_state deflate_stored(s, flush)
|
|||||||
zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
||||||
if (s->matches < 2)
|
if (s->matches < 2)
|
||||||
s->matches++; /* add a pending slide_hash() */
|
s->matches++; /* add a pending slide_hash() */
|
||||||
|
if (s->insert > s->strstart)
|
||||||
|
s->insert = s->strstart;
|
||||||
}
|
}
|
||||||
zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
||||||
s->strstart += used;
|
s->strstart += used;
|
||||||
|
s->insert += MIN(used, s->w_size - s->insert);
|
||||||
}
|
}
|
||||||
s->block_start = s->strstart;
|
s->block_start = s->strstart;
|
||||||
s->insert += MIN(used, s->w_size - s->insert);
|
|
||||||
}
|
}
|
||||||
if (s->high_water < s->strstart)
|
if (s->high_water < s->strstart)
|
||||||
s->high_water = s->strstart;
|
s->high_water = s->strstart;
|
||||||
@@ -1770,7 +1815,7 @@ local block_state deflate_stored(s, flush)
|
|||||||
return block_done;
|
return block_done;
|
||||||
|
|
||||||
/* Fill the window with any remaining input. */
|
/* Fill the window with any remaining input. */
|
||||||
have = s->window_size - s->strstart - 1;
|
have = s->window_size - s->strstart;
|
||||||
if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
|
if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
|
||||||
/* Slide the window down. */
|
/* Slide the window down. */
|
||||||
s->block_start -= s->w_size;
|
s->block_start -= s->w_size;
|
||||||
@@ -1779,12 +1824,15 @@ local block_state deflate_stored(s, flush)
|
|||||||
if (s->matches < 2)
|
if (s->matches < 2)
|
||||||
s->matches++; /* add a pending slide_hash() */
|
s->matches++; /* add a pending slide_hash() */
|
||||||
have += s->w_size; /* more space now */
|
have += s->w_size; /* more space now */
|
||||||
|
if (s->insert > s->strstart)
|
||||||
|
s->insert = s->strstart;
|
||||||
}
|
}
|
||||||
if (have > s->strm->avail_in)
|
if (have > s->strm->avail_in)
|
||||||
have = s->strm->avail_in;
|
have = s->strm->avail_in;
|
||||||
if (have) {
|
if (have) {
|
||||||
read_buf(s->strm, s->window + s->strstart, have);
|
read_buf(s->strm, s->window + s->strstart, have);
|
||||||
s->strstart += have;
|
s->strstart += have;
|
||||||
|
s->insert += MIN(have, s->w_size - s->insert);
|
||||||
}
|
}
|
||||||
if (s->high_water < s->strstart)
|
if (s->high_water < s->strstart)
|
||||||
s->high_water = s->strstart;
|
s->high_water = s->strstart;
|
||||||
@@ -1912,7 +1960,7 @@ local block_state deflate_fast(s, flush)
|
|||||||
FLUSH_BLOCK(s, 1);
|
FLUSH_BLOCK(s, 1);
|
||||||
return finish_done;
|
return finish_done;
|
||||||
}
|
}
|
||||||
if (s->last_lit)
|
if (s->sym_next)
|
||||||
FLUSH_BLOCK(s, 0);
|
FLUSH_BLOCK(s, 0);
|
||||||
return block_done;
|
return block_done;
|
||||||
}
|
}
|
||||||
@@ -2043,7 +2091,7 @@ local block_state deflate_slow(s, flush)
|
|||||||
FLUSH_BLOCK(s, 1);
|
FLUSH_BLOCK(s, 1);
|
||||||
return finish_done;
|
return finish_done;
|
||||||
}
|
}
|
||||||
if (s->last_lit)
|
if (s->sym_next)
|
||||||
FLUSH_BLOCK(s, 0);
|
FLUSH_BLOCK(s, 0);
|
||||||
return block_done;
|
return block_done;
|
||||||
}
|
}
|
||||||
@@ -2118,7 +2166,7 @@ local block_state deflate_rle(s, flush)
|
|||||||
FLUSH_BLOCK(s, 1);
|
FLUSH_BLOCK(s, 1);
|
||||||
return finish_done;
|
return finish_done;
|
||||||
}
|
}
|
||||||
if (s->last_lit)
|
if (s->sym_next)
|
||||||
FLUSH_BLOCK(s, 0);
|
FLUSH_BLOCK(s, 0);
|
||||||
return block_done;
|
return block_done;
|
||||||
}
|
}
|
||||||
@@ -2157,7 +2205,7 @@ local block_state deflate_huff(s, flush)
|
|||||||
FLUSH_BLOCK(s, 1);
|
FLUSH_BLOCK(s, 1);
|
||||||
return finish_done;
|
return finish_done;
|
||||||
}
|
}
|
||||||
if (s->last_lit)
|
if (s->sym_next)
|
||||||
FLUSH_BLOCK(s, 0);
|
FLUSH_BLOCK(s, 0);
|
||||||
return block_done;
|
return block_done;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* deflate.h -- internal compression state
|
/* deflate.h -- internal compression state
|
||||||
* Copyright (C) 1995-2016 Jean-loup Gailly
|
* Copyright (C) 1995-2018 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ typedef struct internal_state {
|
|||||||
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uchf *l_buf; /* buffer for literals or lengths */
|
uchf *sym_buf; /* buffer for distances and literals/lengths */
|
||||||
|
|
||||||
uInt lit_bufsize;
|
uInt lit_bufsize;
|
||||||
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
||||||
@@ -239,13 +239,8 @@ typedef struct internal_state {
|
|||||||
* - I can't count above 4
|
* - I can't count above 4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uInt last_lit; /* running index in l_buf */
|
uInt sym_next; /* running index in sym_buf */
|
||||||
|
uInt sym_end; /* symbol table full when sym_next reaches this */
|
||||||
ushf *d_buf;
|
|
||||||
/* Buffer for distances. To simplify the code, d_buf and l_buf have
|
|
||||||
* the same number of elements. To use different lengths, an extra flag
|
|
||||||
* array would be necessary.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ulg opt_len; /* bit length of current block with optimal trees */
|
ulg opt_len; /* bit length of current block with optimal trees */
|
||||||
ulg static_len; /* bit length of current block with static trees */
|
ulg static_len; /* bit length of current block with static trees */
|
||||||
@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
|||||||
|
|
||||||
# define _tr_tally_lit(s, c, flush) \
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
{ uch cc = (c); \
|
{ uch cc = (c); \
|
||||||
s->d_buf[s->last_lit] = 0; \
|
s->sym_buf[s->sym_next++] = 0; \
|
||||||
s->l_buf[s->last_lit++] = cc; \
|
s->sym_buf[s->sym_next++] = 0; \
|
||||||
|
s->sym_buf[s->sym_next++] = cc; \
|
||||||
s->dyn_ltree[cc].Freq++; \
|
s->dyn_ltree[cc].Freq++; \
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
flush = (s->sym_next == s->sym_end); \
|
||||||
}
|
}
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
{ uch len = (uch)(length); \
|
{ uch len = (uch)(length); \
|
||||||
ush dist = (ush)(distance); \
|
ush dist = (ush)(distance); \
|
||||||
s->d_buf[s->last_lit] = dist; \
|
s->sym_buf[s->sym_next++] = dist; \
|
||||||
s->l_buf[s->last_lit++] = len; \
|
s->sym_buf[s->sym_next++] = dist >> 8; \
|
||||||
|
s->sym_buf[s->sym_next++] = len; \
|
||||||
dist--; \
|
dist--; \
|
||||||
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
flush = (s->sym_next == s->sym_end); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* gzguts.h -- zlib internal header definitions for gz* operations
|
/* gzguts.h -- zlib internal header definitions for gz* operations
|
||||||
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
|
* Copyright (C) 2004-2019 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32)
|
||||||
# define WIDECHAR
|
# define WIDECHAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -190,6 +190,7 @@ typedef struct {
|
|||||||
/* just for writing */
|
/* just for writing */
|
||||||
int level; /* compression level */
|
int level; /* compression level */
|
||||||
int strategy; /* compression strategy */
|
int strategy; /* compression strategy */
|
||||||
|
int reset; /* true if a reset is pending after a Z_FINISH */
|
||||||
/* seek request */
|
/* seek request */
|
||||||
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
||||||
int seek; /* true if seek request pending */
|
int seek; /* true if seek request pending */
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
||||||
* Copyright (C) 2004-2017 Mark Adler
|
* Copyright (C) 2004-2019 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
|
#if defined(_WIN32) && !defined(__BORLANDC__)
|
||||||
# define LSEEK _lseeki64
|
# define LSEEK _lseeki64
|
||||||
#else
|
#else
|
||||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||||
@@ -81,6 +81,8 @@ local void gz_reset(state)
|
|||||||
state->past = 0; /* have not read past end yet */
|
state->past = 0; /* have not read past end yet */
|
||||||
state->how = LOOK; /* look for gzip header */
|
state->how = LOOK; /* look for gzip header */
|
||||||
}
|
}
|
||||||
|
else /* for writing ... */
|
||||||
|
state->reset = 0; /* no deflateReset pending */
|
||||||
state->seek = 0; /* no seek request pending */
|
state->seek = 0; /* no seek request pending */
|
||||||
gz_error(state, Z_OK, NULL); /* clear error */
|
gz_error(state, Z_OK, NULL); /* clear error */
|
||||||
state->x.pos = 0; /* no uncompressed data yet */
|
state->x.pos = 0; /* no uncompressed data yet */
|
||||||
@@ -397,7 +399,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
|||||||
/* if within raw area while reading, just go there */
|
/* if within raw area while reading, just go there */
|
||||||
if (state->mode == GZ_READ && state->how == COPY &&
|
if (state->mode == GZ_READ && state->how == COPY &&
|
||||||
state->x.pos + offset >= 0) {
|
state->x.pos + offset >= 0) {
|
||||||
ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
|
ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return -1;
|
return -1;
|
||||||
state->x.have = 0;
|
state->x.have = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* gzread.c -- zlib functions for reading gzip files
|
/* gzread.c -- zlib functions for reading gzip files
|
||||||
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
|
* Copyright (C) 2004-2017 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -314,9 +314,9 @@ local z_size_t gz_read(state, buf, len)
|
|||||||
got = 0;
|
got = 0;
|
||||||
do {
|
do {
|
||||||
/* set n to the maximum amount of len that fits in an unsigned int */
|
/* set n to the maximum amount of len that fits in an unsigned int */
|
||||||
n = -1;
|
n = (unsigned)-1;
|
||||||
if (n > len)
|
if (n > len)
|
||||||
n = len;
|
n = (unsigned)len;
|
||||||
|
|
||||||
/* first just try copying data from the output buffer */
|
/* first just try copying data from the output buffer */
|
||||||
if (state->x.have) {
|
if (state->x.have) {
|
||||||
@@ -397,7 +397,7 @@ int ZEXPORT gzread(file, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read len or fewer bytes to buf */
|
/* read len or fewer bytes to buf */
|
||||||
len = gz_read(state, buf, len);
|
len = (unsigned)gz_read(state, buf, len);
|
||||||
|
|
||||||
/* check for an error */
|
/* check for an error */
|
||||||
if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
|
if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
|
||||||
@@ -447,7 +447,6 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
|||||||
int ZEXPORT gzgetc(file)
|
int ZEXPORT gzgetc(file)
|
||||||
gzFile file;
|
gzFile file;
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -469,8 +468,7 @@ int ZEXPORT gzgetc(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* nothing there -- try gz_read() */
|
/* nothing there -- try gz_read() */
|
||||||
ret = gz_read(state, buf, 1);
|
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
||||||
return ret < 1 ? -1 : buf[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT gzgetc_(file)
|
int ZEXPORT gzgetc_(file)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* gzwrite.c -- zlib functions for writing gzip files
|
/* gzwrite.c -- zlib functions for writing gzip files
|
||||||
* Copyright (C) 2004-2017 Mark Adler
|
* Copyright (C) 2004-2019 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -97,6 +97,15 @@ local int gz_comp(state, flush)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check for a pending reset */
|
||||||
|
if (state->reset) {
|
||||||
|
/* don't start a new gzip member unless there is data to write */
|
||||||
|
if (strm->avail_in == 0)
|
||||||
|
return 0;
|
||||||
|
deflateReset(strm);
|
||||||
|
state->reset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* run deflate() on provided input until it produces no more output */
|
/* run deflate() on provided input until it produces no more output */
|
||||||
ret = Z_OK;
|
ret = Z_OK;
|
||||||
do {
|
do {
|
||||||
@@ -134,7 +143,7 @@ local int gz_comp(state, flush)
|
|||||||
|
|
||||||
/* if that completed a deflate stream, allow another to start */
|
/* if that completed a deflate stream, allow another to start */
|
||||||
if (flush == Z_FINISH)
|
if (flush == Z_FINISH)
|
||||||
deflateReset(strm);
|
state->reset = 1;
|
||||||
|
|
||||||
/* all done, no errors */
|
/* all done, no errors */
|
||||||
return 0;
|
return 0;
|
||||||
@@ -209,7 +218,7 @@ local z_size_t gz_write(state, buf, len)
|
|||||||
state->in);
|
state->in);
|
||||||
copy = state->size - have;
|
copy = state->size - have;
|
||||||
if (copy > len)
|
if (copy > len)
|
||||||
copy = len;
|
copy = (unsigned)len;
|
||||||
memcpy(state->in + have, buf, copy);
|
memcpy(state->in + have, buf, copy);
|
||||||
state->strm.avail_in += copy;
|
state->strm.avail_in += copy;
|
||||||
state->x.pos += copy;
|
state->x.pos += copy;
|
||||||
@@ -229,7 +238,7 @@ local z_size_t gz_write(state, buf, len)
|
|||||||
do {
|
do {
|
||||||
unsigned n = (unsigned)-1;
|
unsigned n = (unsigned)-1;
|
||||||
if (n > len)
|
if (n > len)
|
||||||
n = len;
|
n = (unsigned)len;
|
||||||
state->strm.avail_in = n;
|
state->strm.avail_in = n;
|
||||||
state->x.pos += n;
|
state->x.pos += n;
|
||||||
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
@@ -349,12 +358,11 @@ int ZEXPORT gzputc(file, c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzputs(file, str)
|
int ZEXPORT gzputs(file, s)
|
||||||
gzFile file;
|
gzFile file;
|
||||||
const char *str;
|
const char *s;
|
||||||
{
|
{
|
||||||
int ret;
|
z_size_t len, put;
|
||||||
z_size_t len;
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -367,9 +375,13 @@ int ZEXPORT gzputs(file, str)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* write string */
|
/* write string */
|
||||||
len = strlen(str);
|
len = strlen(s);
|
||||||
ret = gz_write(state, str, len);
|
if ((int)len < 0 || (unsigned)len != len) {
|
||||||
return ret == 0 && len != 0 ? -1 : ret;
|
gz_error(state, Z_STREAM_ERROR, "string length does not fit in int");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
put = gz_write(state, s, len);
|
||||||
|
return put < len ? -1 : (int)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||||
@@ -441,7 +453,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
|||||||
strm->avail_in = state->size;
|
strm->avail_in = state->size;
|
||||||
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
return state->err;
|
return state->err;
|
||||||
memcpy(state->in, state->in + state->size, left);
|
memmove(state->in, state->in + state->size, left);
|
||||||
strm->next_in = state->in;
|
strm->next_in = state->in;
|
||||||
strm->avail_in = left;
|
strm->avail_in = left;
|
||||||
}
|
}
|
||||||
@@ -540,7 +552,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
|||||||
strm->avail_in = state->size;
|
strm->avail_in = state->size;
|
||||||
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
return state->err;
|
return state->err;
|
||||||
memcpy(state->in, state->in + state->size, left);
|
memmove(state->in, state->in + state->size, left);
|
||||||
strm->next_in = state->in;
|
strm->next_in = state->in;
|
||||||
strm->avail_in = left;
|
strm->avail_in = left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* infback.c -- inflate using a call-back interface
|
/* infback.c -- inflate using a call-back interface
|
||||||
* Copyright (C) 1995-2016 Mark Adler
|
* Copyright (C) 1995-2022 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -477,6 +477,7 @@ void FAR *out_desc;
|
|||||||
}
|
}
|
||||||
Tracev((stderr, "inflate: codes ok\n"));
|
Tracev((stderr, "inflate: codes ok\n"));
|
||||||
state->mode = LEN;
|
state->mode = LEN;
|
||||||
|
/* fallthrough */
|
||||||
|
|
||||||
case LEN:
|
case LEN:
|
||||||
/* use inflate_fast() if we have enough input and output */
|
/* use inflate_fast() if we have enough input and output */
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||||||
code const FAR *dcode; /* local strm->distcode */
|
code const FAR *dcode; /* local strm->distcode */
|
||||||
unsigned lmask; /* mask for first level of length codes */
|
unsigned lmask; /* mask for first level of length codes */
|
||||||
unsigned dmask; /* mask for first level of distance codes */
|
unsigned dmask; /* mask for first level of distance codes */
|
||||||
code here; /* retrieved table entry */
|
code const *here; /* retrieved table entry */
|
||||||
unsigned op; /* code bits, operation, extra bits, or */
|
unsigned op; /* code bits, operation, extra bits, or */
|
||||||
/* window position, window bytes to copy */
|
/* window position, window bytes to copy */
|
||||||
unsigned len; /* match length, unused bytes */
|
unsigned len; /* match length, unused bytes */
|
||||||
@@ -107,20 +107,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||||||
hold += (unsigned long)(*in++) << bits;
|
hold += (unsigned long)(*in++) << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
here = lcode[hold & lmask];
|
here = lcode + (hold & lmask);
|
||||||
dolen:
|
dolen:
|
||||||
op = (unsigned)(here.bits);
|
op = (unsigned)(here->bits);
|
||||||
hold >>= op;
|
hold >>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = (unsigned)(here.op);
|
op = (unsigned)(here->op);
|
||||||
if (op == 0) { /* literal */
|
if (op == 0) { /* literal */
|
||||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
|
||||||
"inflate: literal '%c'\n" :
|
"inflate: literal '%c'\n" :
|
||||||
"inflate: literal 0x%02x\n", here.val));
|
"inflate: literal 0x%02x\n", here->val));
|
||||||
*out++ = (unsigned char)(here.val);
|
*out++ = (unsigned char)(here->val);
|
||||||
}
|
}
|
||||||
else if (op & 16) { /* length base */
|
else if (op & 16) { /* length base */
|
||||||
len = (unsigned)(here.val);
|
len = (unsigned)(here->val);
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (op) {
|
if (op) {
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
@@ -138,14 +138,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||||||
hold += (unsigned long)(*in++) << bits;
|
hold += (unsigned long)(*in++) << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
here = dcode[hold & dmask];
|
here = dcode + (hold & dmask);
|
||||||
dodist:
|
dodist:
|
||||||
op = (unsigned)(here.bits);
|
op = (unsigned)(here->bits);
|
||||||
hold >>= op;
|
hold >>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = (unsigned)(here.op);
|
op = (unsigned)(here->op);
|
||||||
if (op & 16) { /* distance base */
|
if (op & 16) { /* distance base */
|
||||||
dist = (unsigned)(here.val);
|
dist = (unsigned)(here->val);
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
hold += (unsigned long)(*in++) << bits;
|
hold += (unsigned long)(*in++) << bits;
|
||||||
@@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((op & 64) == 0) { /* 2nd level distance code */
|
else if ((op & 64) == 0) { /* 2nd level distance code */
|
||||||
here = dcode[here.val + (hold & ((1U << op) - 1))];
|
here = dcode + here->val + (hold & ((1U << op) - 1));
|
||||||
goto dodist;
|
goto dodist;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -274,7 +274,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((op & 64) == 0) { /* 2nd level length code */
|
else if ((op & 64) == 0) { /* 2nd level length code */
|
||||||
here = lcode[here.val + (hold & ((1U << op) - 1))];
|
here = lcode + here->val + (hold & ((1U << op) - 1));
|
||||||
goto dolen;
|
goto dolen;
|
||||||
}
|
}
|
||||||
else if (op & 32) { /* end-of-block */
|
else if (op & 32) { /* end-of-block */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* inflate.c -- zlib decompression
|
/* inflate.c -- zlib decompression
|
||||||
* Copyright (C) 1995-2016 Mark Adler
|
* Copyright (C) 1995-2022 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -130,6 +130,7 @@ z_streamp strm;
|
|||||||
state->mode = HEAD;
|
state->mode = HEAD;
|
||||||
state->last = 0;
|
state->last = 0;
|
||||||
state->havedict = 0;
|
state->havedict = 0;
|
||||||
|
state->flags = -1;
|
||||||
state->dmax = 32768U;
|
state->dmax = 32768U;
|
||||||
state->head = Z_NULL;
|
state->head = Z_NULL;
|
||||||
state->hold = 0;
|
state->hold = 0;
|
||||||
@@ -447,10 +448,10 @@ unsigned copy;
|
|||||||
|
|
||||||
/* check function to use adler32() for zlib or crc32() for gzip */
|
/* check function to use adler32() for zlib or crc32() for gzip */
|
||||||
#ifdef GUNZIP
|
#ifdef GUNZIP
|
||||||
# define UPDATE(check, buf, len) \
|
# define UPDATE_CHECK(check, buf, len) \
|
||||||
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
|
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
|
||||||
#else
|
#else
|
||||||
# define UPDATE(check, buf, len) adler32(check, buf, len)
|
# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* check macros for header crc */
|
/* check macros for header crc */
|
||||||
@@ -670,7 +671,6 @@ int flush;
|
|||||||
state->mode = FLAGS;
|
state->mode = FLAGS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->flags = 0; /* expect zlib header */
|
|
||||||
if (state->head != Z_NULL)
|
if (state->head != Z_NULL)
|
||||||
state->head->done = -1;
|
state->head->done = -1;
|
||||||
if (!(state->wrap & 1) || /* check if zlib header allowed */
|
if (!(state->wrap & 1) || /* check if zlib header allowed */
|
||||||
@@ -697,6 +697,7 @@ int flush;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->dmax = 1U << len;
|
state->dmax = 1U << len;
|
||||||
|
state->flags = 0; /* indicate zlib header */
|
||||||
Tracev((stderr, "inflate: zlib header ok\n"));
|
Tracev((stderr, "inflate: zlib header ok\n"));
|
||||||
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
||||||
state->mode = hold & 0x200 ? DICTID : TYPE;
|
state->mode = hold & 0x200 ? DICTID : TYPE;
|
||||||
@@ -722,6 +723,7 @@ int flush;
|
|||||||
CRC2(state->check, hold);
|
CRC2(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = TIME;
|
state->mode = TIME;
|
||||||
|
/* fallthrough */
|
||||||
case TIME:
|
case TIME:
|
||||||
NEEDBITS(32);
|
NEEDBITS(32);
|
||||||
if (state->head != Z_NULL)
|
if (state->head != Z_NULL)
|
||||||
@@ -730,6 +732,7 @@ int flush;
|
|||||||
CRC4(state->check, hold);
|
CRC4(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = OS;
|
state->mode = OS;
|
||||||
|
/* fallthrough */
|
||||||
case OS:
|
case OS:
|
||||||
NEEDBITS(16);
|
NEEDBITS(16);
|
||||||
if (state->head != Z_NULL) {
|
if (state->head != Z_NULL) {
|
||||||
@@ -740,6 +743,7 @@ int flush;
|
|||||||
CRC2(state->check, hold);
|
CRC2(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = EXLEN;
|
state->mode = EXLEN;
|
||||||
|
/* fallthrough */
|
||||||
case EXLEN:
|
case EXLEN:
|
||||||
if (state->flags & 0x0400) {
|
if (state->flags & 0x0400) {
|
||||||
NEEDBITS(16);
|
NEEDBITS(16);
|
||||||
@@ -753,6 +757,7 @@ int flush;
|
|||||||
else if (state->head != Z_NULL)
|
else if (state->head != Z_NULL)
|
||||||
state->head->extra = Z_NULL;
|
state->head->extra = Z_NULL;
|
||||||
state->mode = EXTRA;
|
state->mode = EXTRA;
|
||||||
|
/* fallthrough */
|
||||||
case EXTRA:
|
case EXTRA:
|
||||||
if (state->flags & 0x0400) {
|
if (state->flags & 0x0400) {
|
||||||
copy = state->length;
|
copy = state->length;
|
||||||
@@ -775,6 +780,7 @@ int flush;
|
|||||||
}
|
}
|
||||||
state->length = 0;
|
state->length = 0;
|
||||||
state->mode = NAME;
|
state->mode = NAME;
|
||||||
|
/* fallthrough */
|
||||||
case NAME:
|
case NAME:
|
||||||
if (state->flags & 0x0800) {
|
if (state->flags & 0x0800) {
|
||||||
if (have == 0) goto inf_leave;
|
if (have == 0) goto inf_leave;
|
||||||
@@ -796,6 +802,7 @@ int flush;
|
|||||||
state->head->name = Z_NULL;
|
state->head->name = Z_NULL;
|
||||||
state->length = 0;
|
state->length = 0;
|
||||||
state->mode = COMMENT;
|
state->mode = COMMENT;
|
||||||
|
/* fallthrough */
|
||||||
case COMMENT:
|
case COMMENT:
|
||||||
if (state->flags & 0x1000) {
|
if (state->flags & 0x1000) {
|
||||||
if (have == 0) goto inf_leave;
|
if (have == 0) goto inf_leave;
|
||||||
@@ -816,6 +823,7 @@ int flush;
|
|||||||
else if (state->head != Z_NULL)
|
else if (state->head != Z_NULL)
|
||||||
state->head->comment = Z_NULL;
|
state->head->comment = Z_NULL;
|
||||||
state->mode = HCRC;
|
state->mode = HCRC;
|
||||||
|
/* fallthrough */
|
||||||
case HCRC:
|
case HCRC:
|
||||||
if (state->flags & 0x0200) {
|
if (state->flags & 0x0200) {
|
||||||
NEEDBITS(16);
|
NEEDBITS(16);
|
||||||
@@ -839,6 +847,7 @@ int flush;
|
|||||||
strm->adler = state->check = ZSWAP32(hold);
|
strm->adler = state->check = ZSWAP32(hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = DICT;
|
state->mode = DICT;
|
||||||
|
/* fallthrough */
|
||||||
case DICT:
|
case DICT:
|
||||||
if (state->havedict == 0) {
|
if (state->havedict == 0) {
|
||||||
RESTORE();
|
RESTORE();
|
||||||
@@ -846,8 +855,10 @@ int flush;
|
|||||||
}
|
}
|
||||||
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
|
/* fallthrough */
|
||||||
case TYPE:
|
case TYPE:
|
||||||
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
|
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
|
||||||
|
/* fallthrough */
|
||||||
case TYPEDO:
|
case TYPEDO:
|
||||||
if (state->last) {
|
if (state->last) {
|
||||||
BYTEBITS();
|
BYTEBITS();
|
||||||
@@ -898,8 +909,10 @@ int flush;
|
|||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = COPY_;
|
state->mode = COPY_;
|
||||||
if (flush == Z_TREES) goto inf_leave;
|
if (flush == Z_TREES) goto inf_leave;
|
||||||
|
/* fallthrough */
|
||||||
case COPY_:
|
case COPY_:
|
||||||
state->mode = COPY;
|
state->mode = COPY;
|
||||||
|
/* fallthrough */
|
||||||
case COPY:
|
case COPY:
|
||||||
copy = state->length;
|
copy = state->length;
|
||||||
if (copy) {
|
if (copy) {
|
||||||
@@ -935,6 +948,7 @@ int flush;
|
|||||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||||
state->have = 0;
|
state->have = 0;
|
||||||
state->mode = LENLENS;
|
state->mode = LENLENS;
|
||||||
|
/* fallthrough */
|
||||||
case LENLENS:
|
case LENLENS:
|
||||||
while (state->have < state->ncode) {
|
while (state->have < state->ncode) {
|
||||||
NEEDBITS(3);
|
NEEDBITS(3);
|
||||||
@@ -956,6 +970,7 @@ int flush;
|
|||||||
Tracev((stderr, "inflate: code lengths ok\n"));
|
Tracev((stderr, "inflate: code lengths ok\n"));
|
||||||
state->have = 0;
|
state->have = 0;
|
||||||
state->mode = CODELENS;
|
state->mode = CODELENS;
|
||||||
|
/* fallthrough */
|
||||||
case CODELENS:
|
case CODELENS:
|
||||||
while (state->have < state->nlen + state->ndist) {
|
while (state->have < state->nlen + state->ndist) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -1039,8 +1054,10 @@ int flush;
|
|||||||
Tracev((stderr, "inflate: codes ok\n"));
|
Tracev((stderr, "inflate: codes ok\n"));
|
||||||
state->mode = LEN_;
|
state->mode = LEN_;
|
||||||
if (flush == Z_TREES) goto inf_leave;
|
if (flush == Z_TREES) goto inf_leave;
|
||||||
|
/* fallthrough */
|
||||||
case LEN_:
|
case LEN_:
|
||||||
state->mode = LEN;
|
state->mode = LEN;
|
||||||
|
/* fallthrough */
|
||||||
case LEN:
|
case LEN:
|
||||||
if (have >= 6 && left >= 258) {
|
if (have >= 6 && left >= 258) {
|
||||||
RESTORE();
|
RESTORE();
|
||||||
@@ -1090,6 +1107,7 @@ int flush;
|
|||||||
}
|
}
|
||||||
state->extra = (unsigned)(here.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
state->mode = LENEXT;
|
state->mode = LENEXT;
|
||||||
|
/* fallthrough */
|
||||||
case LENEXT:
|
case LENEXT:
|
||||||
if (state->extra) {
|
if (state->extra) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
@@ -1100,6 +1118,7 @@ int flush;
|
|||||||
Tracevv((stderr, "inflate: length %u\n", state->length));
|
Tracevv((stderr, "inflate: length %u\n", state->length));
|
||||||
state->was = state->length;
|
state->was = state->length;
|
||||||
state->mode = DIST;
|
state->mode = DIST;
|
||||||
|
/* fallthrough */
|
||||||
case DIST:
|
case DIST:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
here = state->distcode[BITS(state->distbits)];
|
here = state->distcode[BITS(state->distbits)];
|
||||||
@@ -1127,6 +1146,7 @@ int flush;
|
|||||||
state->offset = (unsigned)here.val;
|
state->offset = (unsigned)here.val;
|
||||||
state->extra = (unsigned)(here.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
state->mode = DISTEXT;
|
state->mode = DISTEXT;
|
||||||
|
/* fallthrough */
|
||||||
case DISTEXT:
|
case DISTEXT:
|
||||||
if (state->extra) {
|
if (state->extra) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
@@ -1143,6 +1163,7 @@ int flush;
|
|||||||
#endif
|
#endif
|
||||||
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
||||||
state->mode = MATCH;
|
state->mode = MATCH;
|
||||||
|
/* fallthrough */
|
||||||
case MATCH:
|
case MATCH:
|
||||||
if (left == 0) goto inf_leave;
|
if (left == 0) goto inf_leave;
|
||||||
copy = out - left;
|
copy = out - left;
|
||||||
@@ -1202,7 +1223,7 @@ int flush;
|
|||||||
state->total += out;
|
state->total += out;
|
||||||
if ((state->wrap & 4) && out)
|
if ((state->wrap & 4) && out)
|
||||||
strm->adler = state->check =
|
strm->adler = state->check =
|
||||||
UPDATE(state->check, put - out, out);
|
UPDATE_CHECK(state->check, put - out, out);
|
||||||
out = left;
|
out = left;
|
||||||
if ((state->wrap & 4) && (
|
if ((state->wrap & 4) && (
|
||||||
#ifdef GUNZIP
|
#ifdef GUNZIP
|
||||||
@@ -1218,10 +1239,11 @@ int flush;
|
|||||||
}
|
}
|
||||||
#ifdef GUNZIP
|
#ifdef GUNZIP
|
||||||
state->mode = LENGTH;
|
state->mode = LENGTH;
|
||||||
|
/* fallthrough */
|
||||||
case LENGTH:
|
case LENGTH:
|
||||||
if (state->wrap && state->flags) {
|
if (state->wrap && state->flags) {
|
||||||
NEEDBITS(32);
|
NEEDBITS(32);
|
||||||
if (hold != (state->total & 0xffffffffUL)) {
|
if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
|
||||||
strm->msg = (char *)"incorrect length check";
|
strm->msg = (char *)"incorrect length check";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
@@ -1231,6 +1253,7 @@ int flush;
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
state->mode = DONE;
|
state->mode = DONE;
|
||||||
|
/* fallthrough */
|
||||||
case DONE:
|
case DONE:
|
||||||
ret = Z_STREAM_END;
|
ret = Z_STREAM_END;
|
||||||
goto inf_leave;
|
goto inf_leave;
|
||||||
@@ -1240,6 +1263,7 @@ int flush;
|
|||||||
case MEM:
|
case MEM:
|
||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
case SYNC:
|
case SYNC:
|
||||||
|
/* fallthrough */
|
||||||
default:
|
default:
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1265,7 +1289,7 @@ int flush;
|
|||||||
state->total += out;
|
state->total += out;
|
||||||
if ((state->wrap & 4) && out)
|
if ((state->wrap & 4) && out)
|
||||||
strm->adler = state->check =
|
strm->adler = state->check =
|
||||||
UPDATE(state->check, strm->next_out - out, out);
|
UPDATE_CHECK(state->check, strm->next_out - out, out);
|
||||||
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
||||||
(state->mode == TYPE ? 128 : 0) +
|
(state->mode == TYPE ? 128 : 0) +
|
||||||
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
||||||
@@ -1401,6 +1425,7 @@ int ZEXPORT inflateSync(strm)
|
|||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
{
|
{
|
||||||
unsigned len; /* number of bytes to look at or looked at */
|
unsigned len; /* number of bytes to look at or looked at */
|
||||||
|
int flags; /* temporary to save header status */
|
||||||
unsigned long in, out; /* temporary to save total_in and total_out */
|
unsigned long in, out; /* temporary to save total_in and total_out */
|
||||||
unsigned char buf[4]; /* to restore bit buffer to byte string */
|
unsigned char buf[4]; /* to restore bit buffer to byte string */
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
@@ -1433,9 +1458,15 @@ z_streamp strm;
|
|||||||
|
|
||||||
/* return no joy or set up to restart inflate() on a new block */
|
/* return no joy or set up to restart inflate() on a new block */
|
||||||
if (state->have != 4) return Z_DATA_ERROR;
|
if (state->have != 4) return Z_DATA_ERROR;
|
||||||
|
if (state->flags == -1)
|
||||||
|
state->wrap = 0; /* if no header yet, treat as raw */
|
||||||
|
else
|
||||||
|
state->wrap &= ~4; /* no point in computing a check value now */
|
||||||
|
flags = state->flags;
|
||||||
in = strm->total_in; out = strm->total_out;
|
in = strm->total_in; out = strm->total_out;
|
||||||
inflateReset(strm);
|
inflateReset(strm);
|
||||||
strm->total_in = in; strm->total_out = out;
|
strm->total_in = in; strm->total_out = out;
|
||||||
|
state->flags = flags;
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
@@ -1531,7 +1562,7 @@ int check;
|
|||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
if (check)
|
if (check && state->wrap)
|
||||||
state->wrap |= 4;
|
state->wrap |= 4;
|
||||||
else
|
else
|
||||||
state->wrap &= ~4;
|
state->wrap &= ~4;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* inflate.h -- internal inflate state definition
|
/* inflate.h -- internal inflate state definition
|
||||||
* Copyright (C) 1995-2016 Mark Adler
|
* Copyright (C) 1995-2019 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -86,7 +86,8 @@ struct inflate_state {
|
|||||||
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
||||||
bit 2 true to validate check value */
|
bit 2 true to validate check value */
|
||||||
int havedict; /* true if dictionary provided */
|
int havedict; /* true if dictionary provided */
|
||||||
int flags; /* gzip header method and flags (0 if zlib) */
|
int flags; /* gzip header method and flags, 0 if zlib, or
|
||||||
|
-1 if raw or no header yet */
|
||||||
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
||||||
unsigned long check; /* protected copy of check value */
|
unsigned long check; /* protected copy of check value */
|
||||||
unsigned long total; /* protected copy of output count */
|
unsigned long total; /* protected copy of output count */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2017 Mark Adler
|
* Copyright (C) 1995-2022 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate_copyright[] =
|
const char inflate_copyright[] =
|
||||||
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
|
" inflate 1.2.12 Copyright 1995-2022 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
@@ -62,7 +62,7 @@ unsigned short FAR *work;
|
|||||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
ZLIB version 1.2.11 for OS/400 installation instructions
|
ZLIB version 1.2.12 for OS/400 installation instructions
|
||||||
|
|
||||||
1) Download and unpack the zlib tarball to some IFS directory.
|
1) Download and unpack the zlib tarball to some IFS directory.
|
||||||
(i.e.: /path/to/the/zlib/ifs/source/directory)
|
(i.e.: /path/to/the/zlib/ifs/source/directory)
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
<QPG:Files>
|
<QPG:Files>
|
||||||
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
|
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||||
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
|
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||||
<QPG:Add file="../libz.so.1.2.11" install="/opt/lib/" user="root:bin" permission="644"/>
|
<QPG:Add file="../libz.so.1.2.12" install="/opt/lib/" user="root:bin" permission="644"/>
|
||||||
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.11"/>
|
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.12"/>
|
||||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.11"/>
|
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.12"/>
|
||||||
<QPG:Add file="../libz.so.1.2.11" install="/opt/lib/" component="slib"/>
|
<QPG:Add file="../libz.so.1.2.12" install="/opt/lib/" component="slib"/>
|
||||||
</QPG:Files>
|
</QPG:Files>
|
||||||
|
|
||||||
<QPG:PackageFilter>
|
<QPG:PackageFilter>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</QPM:ProductDescription>
|
</QPM:ProductDescription>
|
||||||
|
|
||||||
<QPM:ReleaseDescription>
|
<QPM:ReleaseDescription>
|
||||||
<QPM:ReleaseVersion>1.2.11</QPM:ReleaseVersion>
|
<QPM:ReleaseVersion>1.2.12</QPM:ReleaseVersion>
|
||||||
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
||||||
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
||||||
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
||||||
|
|||||||
@@ -440,9 +440,8 @@ void test_sync(compr, comprLen, uncompr, uncomprLen)
|
|||||||
CHECK_ERR(err, "inflateSync");
|
CHECK_ERR(err, "inflateSync");
|
||||||
|
|
||||||
err = inflate(&d_stream, Z_FINISH);
|
err = inflate(&d_stream, Z_FINISH);
|
||||||
if (err != Z_DATA_ERROR) {
|
if (err != Z_STREAM_END) {
|
||||||
fprintf(stderr, "inflate should report DATA_ERROR\n");
|
fprintf(stderr, "inflate should report Z_STREAM_END\n");
|
||||||
/* Because of incorrect adler32 */
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
err = inflateEnd(&d_stream);
|
err = inflateEnd(&d_stream);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<package name="zlib" version="1.2.11">
|
<package name="zlib" version="1.2.12">
|
||||||
<library name="zlib" dlversion="1.2.11" dlname="z">
|
<library name="zlib" dlversion="1.2.12" dlname="z">
|
||||||
<property name="description"> zip compression library </property>
|
<property name="description"> zip compression library </property>
|
||||||
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
|
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
|
||||||
|
|
||||||
|
|||||||
75
libz/trees.c
75
libz/trees.c
@@ -1,5 +1,5 @@
|
|||||||
/* trees.c -- output deflated data using Huffman coding
|
/* trees.c -- output deflated data using Huffman coding
|
||||||
* Copyright (C) 1995-2017 Jean-loup Gailly
|
* Copyright (C) 1995-2021 Jean-loup Gailly
|
||||||
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
@@ -149,7 +149,7 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
|
|||||||
local void compress_block OF((deflate_state *s, const ct_data *ltree,
|
local void compress_block OF((deflate_state *s, const ct_data *ltree,
|
||||||
const ct_data *dtree));
|
const ct_data *dtree));
|
||||||
local int detect_data_type OF((deflate_state *s));
|
local int detect_data_type OF((deflate_state *s));
|
||||||
local unsigned bi_reverse OF((unsigned value, int length));
|
local unsigned bi_reverse OF((unsigned code, int len));
|
||||||
local void bi_windup OF((deflate_state *s));
|
local void bi_windup OF((deflate_state *s));
|
||||||
local void bi_flush OF((deflate_state *s));
|
local void bi_flush OF((deflate_state *s));
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ local void init_block(s)
|
|||||||
|
|
||||||
s->dyn_ltree[END_BLOCK].Freq = 1;
|
s->dyn_ltree[END_BLOCK].Freq = 1;
|
||||||
s->opt_len = s->static_len = 0L;
|
s->opt_len = s->static_len = 0L;
|
||||||
s->last_lit = s->matches = 0;
|
s->sym_next = s->matches = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SMALLEST 1
|
#define SMALLEST 1
|
||||||
@@ -870,7 +870,8 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
|||||||
bi_windup(s); /* align on byte boundary */
|
bi_windup(s); /* align on byte boundary */
|
||||||
put_short(s, (ush)stored_len);
|
put_short(s, (ush)stored_len);
|
||||||
put_short(s, (ush)~stored_len);
|
put_short(s, (ush)~stored_len);
|
||||||
zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
|
if (stored_len)
|
||||||
|
zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
|
||||||
s->pending += stored_len;
|
s->pending += stored_len;
|
||||||
#ifdef ZLIB_DEBUG
|
#ifdef ZLIB_DEBUG
|
||||||
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
||||||
@@ -947,7 +948,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|||||||
|
|
||||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||||
s->last_lit));
|
s->sym_next / 3));
|
||||||
|
|
||||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||||
|
|
||||||
@@ -1016,8 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|||||||
unsigned dist; /* distance of matched string */
|
unsigned dist; /* distance of matched string */
|
||||||
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
||||||
{
|
{
|
||||||
s->d_buf[s->last_lit] = (ush)dist;
|
s->sym_buf[s->sym_next++] = dist;
|
||||||
s->l_buf[s->last_lit++] = (uch)lc;
|
s->sym_buf[s->sym_next++] = dist >> 8;
|
||||||
|
s->sym_buf[s->sym_next++] = lc;
|
||||||
if (dist == 0) {
|
if (dist == 0) {
|
||||||
/* lc is the unmatched char */
|
/* lc is the unmatched char */
|
||||||
s->dyn_ltree[lc].Freq++;
|
s->dyn_ltree[lc].Freq++;
|
||||||
@@ -1032,30 +1034,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|||||||
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
||||||
s->dyn_dtree[d_code(dist)].Freq++;
|
s->dyn_dtree[d_code(dist)].Freq++;
|
||||||
}
|
}
|
||||||
|
return (s->sym_next == s->sym_end);
|
||||||
#ifdef TRUNCATE_BLOCK
|
|
||||||
/* Try to guess if it is profitable to stop the current block here */
|
|
||||||
if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
|
|
||||||
/* Compute an upper bound for the compressed length */
|
|
||||||
ulg out_length = (ulg)s->last_lit*8L;
|
|
||||||
ulg in_length = (ulg)((long)s->strstart - s->block_start);
|
|
||||||
int dcode;
|
|
||||||
for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
||||||
out_length += (ulg)s->dyn_dtree[dcode].Freq *
|
|
||||||
(5L+extra_dbits[dcode]);
|
|
||||||
}
|
|
||||||
out_length >>= 3;
|
|
||||||
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
||||||
s->last_lit, in_length, out_length,
|
|
||||||
100L - out_length*100L/in_length));
|
|
||||||
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return (s->last_lit == s->lit_bufsize-1);
|
|
||||||
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
||||||
* on 16 bit machines and because stored blocks are restricted to
|
|
||||||
* 64K-1 bytes.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
@@ -1068,13 +1047,14 @@ local void compress_block(s, ltree, dtree)
|
|||||||
{
|
{
|
||||||
unsigned dist; /* distance of matched string */
|
unsigned dist; /* distance of matched string */
|
||||||
int lc; /* match length or unmatched char (if dist == 0) */
|
int lc; /* match length or unmatched char (if dist == 0) */
|
||||||
unsigned lx = 0; /* running index in l_buf */
|
unsigned sx = 0; /* running index in sym_buf */
|
||||||
unsigned code; /* the code to send */
|
unsigned code; /* the code to send */
|
||||||
int extra; /* number of extra bits to send */
|
int extra; /* number of extra bits to send */
|
||||||
|
|
||||||
if (s->last_lit != 0) do {
|
if (s->sym_next != 0) do {
|
||||||
dist = s->d_buf[lx];
|
dist = s->sym_buf[sx++] & 0xff;
|
||||||
lc = s->l_buf[lx++];
|
dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
|
||||||
|
lc = s->sym_buf[sx++];
|
||||||
if (dist == 0) {
|
if (dist == 0) {
|
||||||
send_code(s, lc, ltree); /* send a literal byte */
|
send_code(s, lc, ltree); /* send a literal byte */
|
||||||
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
||||||
@@ -1099,11 +1079,10 @@ local void compress_block(s, ltree, dtree)
|
|||||||
}
|
}
|
||||||
} /* literal or match pair ? */
|
} /* literal or match pair ? */
|
||||||
|
|
||||||
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
/* Check that the overlay between pending_buf and sym_buf is ok: */
|
||||||
Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
||||||
"pendingBuf overflow");
|
|
||||||
|
|
||||||
} while (lx < s->last_lit);
|
} while (sx < s->sym_next);
|
||||||
|
|
||||||
send_code(s, END_BLOCK, ltree);
|
send_code(s, END_BLOCK, ltree);
|
||||||
}
|
}
|
||||||
@@ -1112,9 +1091,9 @@ local void compress_block(s, ltree, dtree)
|
|||||||
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||||
* - TEXT if the two conditions below are satisfied:
|
* - TEXT if the two conditions below are satisfied:
|
||||||
* a) There are no non-portable control characters belonging to the
|
* a) There are no non-portable control characters belonging to the
|
||||||
* "black list" (0..6, 14..25, 28..31).
|
* "block list" (0..6, 14..25, 28..31).
|
||||||
* b) There is at least one printable character belonging to the
|
* b) There is at least one printable character belonging to the
|
||||||
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
* "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
||||||
* - BINARY otherwise.
|
* - BINARY otherwise.
|
||||||
* - The following partially-portable control characters form a
|
* - The following partially-portable control characters form a
|
||||||
* "gray list" that is ignored in this detection algorithm:
|
* "gray list" that is ignored in this detection algorithm:
|
||||||
@@ -1124,19 +1103,19 @@ local void compress_block(s, ltree, dtree)
|
|||||||
local int detect_data_type(s)
|
local int detect_data_type(s)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
{
|
{
|
||||||
/* black_mask is the bit mask of black-listed bytes
|
/* block_mask is the bit mask of block-listed bytes
|
||||||
* set bits 0..6, 14..25, and 28..31
|
* set bits 0..6, 14..25, and 28..31
|
||||||
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
||||||
*/
|
*/
|
||||||
unsigned long black_mask = 0xf3ffc07fUL;
|
unsigned long block_mask = 0xf3ffc07fUL;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* Check for non-textual ("black-listed") bytes. */
|
/* Check for non-textual ("block-listed") bytes. */
|
||||||
for (n = 0; n <= 31; n++, black_mask >>= 1)
|
for (n = 0; n <= 31; n++, block_mask >>= 1)
|
||||||
if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
||||||
return Z_BINARY;
|
return Z_BINARY;
|
||||||
|
|
||||||
/* Check for textual ("white-listed") bytes. */
|
/* Check for textual ("allow-listed") bytes. */
|
||||||
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
||||||
|| s->dyn_ltree[13].Freq != 0)
|
|| s->dyn_ltree[13].Freq != 0)
|
||||||
return Z_TEXT;
|
return Z_TEXT;
|
||||||
@@ -1144,7 +1123,7 @@ local int detect_data_type(s)
|
|||||||
if (s->dyn_ltree[n].Freq != 0)
|
if (s->dyn_ltree[n].Freq != 0)
|
||||||
return Z_TEXT;
|
return Z_TEXT;
|
||||||
|
|
||||||
/* There are no "black-listed" or "white-listed" bytes:
|
/* There are no "block-listed" or "allow-listed" bytes:
|
||||||
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
||||||
*/
|
*/
|
||||||
return Z_BINARY;
|
return Z_BINARY;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# make -f win32/Makefile.bor
|
# make -f win32/Makefile.bor
|
||||||
# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj
|
|
||||||
|
|
||||||
# ------------ Borland C++ ------------
|
# ------------ Borland C++ ------------
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,6 @@
|
|||||||
#
|
#
|
||||||
# make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc
|
# make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc
|
||||||
#
|
#
|
||||||
# To use the asm code, type:
|
|
||||||
# cp contrib/asm?86/match.S ./match.S
|
|
||||||
# make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc
|
|
||||||
#
|
|
||||||
# To install libz.a, zconf.h and zlib.h in the system directories, type:
|
# To install libz.a, zconf.h and zlib.h in the system directories, type:
|
||||||
#
|
#
|
||||||
# make install -fwin32/Makefile.gcc
|
# make install -fwin32/Makefile.gcc
|
||||||
@@ -38,7 +34,6 @@ IMPLIB = libz.dll.a
|
|||||||
#
|
#
|
||||||
SHARED_MODE=0
|
SHARED_MODE=0
|
||||||
|
|
||||||
#LOC = -DASMV
|
|
||||||
#LOC = -DZLIB_DEBUG -g
|
#LOC = -DZLIB_DEBUG -g
|
||||||
|
|
||||||
PREFIX =
|
PREFIX =
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
# Usage:
|
# Usage:
|
||||||
# nmake -f win32/Makefile.msc (standard build)
|
# nmake -f win32/Makefile.msc (standard build)
|
||||||
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
|
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
|
||||||
# nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
|
|
||||||
# OBJA="inffas32.obj match686.obj" (use ASM code, x86)
|
|
||||||
# nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \
|
|
||||||
# OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64)
|
|
||||||
|
|
||||||
# The toplevel directory of the source tree.
|
# The toplevel directory of the source tree.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.11 is a general purpose data compression library. All the code is
|
zlib 1.2.12 is a general purpose data compression library. All the code is
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
thread safe. The data format used by the zlib library is described by RFCs
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
(Request for Comments) 1950 to 1952 in the files
|
||||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
|
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
|
||||||
@@ -22,7 +22,7 @@ before asking for help.
|
|||||||
|
|
||||||
Manifest:
|
Manifest:
|
||||||
|
|
||||||
The package zlib-1.2.11-win32-x86.zip will contain the following files:
|
The package zlib-1.2.12-win32-x86.zip will contain the following files:
|
||||||
|
|
||||||
README-WIN32.txt This document
|
README-WIN32.txt This document
|
||||||
ChangeLog Changes since previous zlib packages
|
ChangeLog Changes since previous zlib packages
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ EXPORTS
|
|||||||
gzoffset64
|
gzoffset64
|
||||||
adler32_combine64
|
adler32_combine64
|
||||||
crc32_combine64
|
crc32_combine64
|
||||||
|
crc32_combine_gen64
|
||||||
; checksum functions
|
; checksum functions
|
||||||
adler32
|
adler32
|
||||||
adler32_z
|
adler32_z
|
||||||
@@ -76,6 +77,8 @@ EXPORTS
|
|||||||
crc32_z
|
crc32_z
|
||||||
adler32_combine
|
adler32_combine
|
||||||
crc32_combine
|
crc32_combine
|
||||||
|
crc32_combine_gen
|
||||||
|
crc32_combine_op
|
||||||
; various hacks, don't look :)
|
; various hacks, don't look :)
|
||||||
deflateInit_
|
deflateInit_
|
||||||
deflateInit2_
|
deflateInit2_
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH ZLIB 3 "15 Jan 2017"
|
.TH ZLIB 3 "27 Mar 2022"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zlib \- compression/decompression library
|
zlib \- compression/decompression library
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -105,9 +105,9 @@ before asking for help.
|
|||||||
Send questions and/or comments to zlib@gzip.org,
|
Send questions and/or comments to zlib@gzip.org,
|
||||||
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
||||||
.SH AUTHORS AND LICENSE
|
.SH AUTHORS AND LICENSE
|
||||||
Version 1.2.11
|
Version 1.2.12
|
||||||
.LP
|
.LP
|
||||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||||
.LP
|
.LP
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
223
libz/zlib.h
223
libz/zlib.h
@@ -1,7 +1,7 @@
|
|||||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||||
version 1.2.11, January 15th, 2017
|
version 1.2.12, March 11th, 2022
|
||||||
|
|
||||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -37,11 +37,11 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZLIB_VERSION "1.2.11"
|
#define ZLIB_VERSION "1.2.12"
|
||||||
#define ZLIB_VERNUM 0x12b0
|
#define ZLIB_VERNUM 0x12c0
|
||||||
#define ZLIB_VER_MAJOR 1
|
#define ZLIB_VER_MAJOR 1
|
||||||
#define ZLIB_VER_MINOR 2
|
#define ZLIB_VER_MINOR 2
|
||||||
#define ZLIB_VER_REVISION 11
|
#define ZLIB_VER_REVISION 12
|
||||||
#define ZLIB_VER_SUBREVISION 0
|
#define ZLIB_VER_SUBREVISION 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -543,8 +543,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
|||||||
int strategy));
|
int strategy));
|
||||||
|
|
||||||
This is another version of deflateInit with more compression options. The
|
This is another version of deflateInit with more compression options. The
|
||||||
fields next_in, zalloc, zfree and opaque must be initialized before by the
|
fields zalloc, zfree and opaque must be initialized before by the caller.
|
||||||
caller.
|
|
||||||
|
|
||||||
The method parameter is the compression method. It must be Z_DEFLATED in
|
The method parameter is the compression method. It must be Z_DEFLATED in
|
||||||
this version of the library.
|
this version of the library.
|
||||||
@@ -712,11 +711,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
|||||||
used to switch between compression and straight copy of the input data, or
|
used to switch between compression and straight copy of the input data, or
|
||||||
to switch to a different kind of input data requiring a different strategy.
|
to switch to a different kind of input data requiring a different strategy.
|
||||||
If the compression approach (which is a function of the level) or the
|
If the compression approach (which is a function of the level) or the
|
||||||
strategy is changed, and if any input has been consumed in a previous
|
strategy is changed, and if there have been any deflate() calls since the
|
||||||
deflate() call, then the input available so far is compressed with the old
|
state was initialized or reset, then the input available so far is
|
||||||
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
|
compressed with the old level and strategy using deflate(strm, Z_BLOCK).
|
||||||
for the compression levels 0, 1..3, and 4..9 respectively. The new level
|
There are three approaches for the compression levels 0, 1..3, and 4..9
|
||||||
and strategy will take effect at the next call of deflate().
|
respectively. The new level and strategy will take effect at the next call
|
||||||
|
of deflate().
|
||||||
|
|
||||||
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
|
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
|
||||||
not have enough output space to complete, then the parameter change will not
|
not have enough output space to complete, then the parameter change will not
|
||||||
@@ -865,9 +865,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
|||||||
detection, or add 16 to decode only the gzip format (the zlib format will
|
detection, or add 16 to decode only the gzip format (the zlib format will
|
||||||
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
|
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
|
||||||
CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
|
CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
|
||||||
below), inflate() will not automatically decode concatenated gzip streams.
|
below), inflate() will *not* automatically decode concatenated gzip members.
|
||||||
inflate() will return Z_STREAM_END at the end of the gzip stream. The state
|
inflate() will return Z_STREAM_END at the end of the gzip member. The state
|
||||||
would need to be reset to continue decoding a subsequent gzip stream.
|
would need to be reset to continue decoding a subsequent gzip member. This
|
||||||
|
*must* be done if there is more data after a gzip member, in order for the
|
||||||
|
decompression to be compliant with the gzip standard (RFC 1952).
|
||||||
|
|
||||||
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||||
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
||||||
@@ -1302,14 +1304,14 @@ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
|
|||||||
/*
|
/*
|
||||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||||
|
|
||||||
Opens a gzip (.gz) file for reading or writing. The mode parameter is as
|
Open the gzip (.gz) file at path for reading and decompressing, or
|
||||||
in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
|
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
|
||||||
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
|
but can also include a compression level ("wb9") or a strategy: 'f' for
|
||||||
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
|
filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h",
|
||||||
for fixed code compression as in "wb9F". (See the description of
|
'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
|
||||||
deflateInit2 for more information about the strategy parameter.) 'T' will
|
as in "wb9F". (See the description of deflateInit2 for more information
|
||||||
request transparent writing or appending with no compression and not using
|
about the strategy parameter.) 'T' will request transparent writing or
|
||||||
the gzip format.
|
appending with no compression and not using the gzip format.
|
||||||
|
|
||||||
"a" can be used instead of "w" to request that the gzip stream that will
|
"a" can be used instead of "w" to request that the gzip stream that will
|
||||||
be written be appended to the file. "+" will result in an error, since
|
be written be appended to the file. "+" will result in an error, since
|
||||||
@@ -1339,9 +1341,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
|||||||
|
|
||||||
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||||
/*
|
/*
|
||||||
gzdopen associates a gzFile with the file descriptor fd. File descriptors
|
Associate a gzFile with the file descriptor fd. File descriptors are
|
||||||
are obtained from calls like open, dup, creat, pipe or fileno (if the file
|
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
||||||
has been previously opened with fopen). The mode parameter is as in gzopen.
|
been previously opened with fopen). The mode parameter is as in gzopen.
|
||||||
|
|
||||||
The next call of gzclose on the returned gzFile will also close the file
|
The next call of gzclose on the returned gzFile will also close the file
|
||||||
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
|
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
|
||||||
@@ -1362,13 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
|
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
|
||||||
/*
|
/*
|
||||||
Set the internal buffer size used by this library's functions. The
|
Set the internal buffer size used by this library's functions for file to
|
||||||
default buffer size is 8192 bytes. This function must be called after
|
size. The default buffer size is 8192 bytes. This function must be called
|
||||||
gzopen() or gzdopen(), and before any other calls that read or write the
|
after gzopen() or gzdopen(), and before any other calls that read or write
|
||||||
file. The buffer memory allocation is always deferred to the first read or
|
the file. The buffer memory allocation is always deferred to the first read
|
||||||
write. Three times that size in buffer space is allocated. A larger buffer
|
or write. Three times that size in buffer space is allocated. A larger
|
||||||
size of, for example, 64K or 128K bytes will noticeably increase the speed
|
buffer size of, for example, 64K or 128K bytes will noticeably increase the
|
||||||
of decompression (reading).
|
speed of decompression (reading).
|
||||||
|
|
||||||
The new buffer size also affects the maximum length for gzprintf().
|
The new buffer size also affects the maximum length for gzprintf().
|
||||||
|
|
||||||
@@ -1378,9 +1380,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
||||||
/*
|
/*
|
||||||
Dynamically update the compression level or strategy. See the description
|
Dynamically update the compression level and strategy for file. See the
|
||||||
of deflateInit2 for the meaning of these parameters. Previously provided
|
description of deflateInit2 for the meaning of these parameters. Previously
|
||||||
data is flushed before the parameter change.
|
provided data is flushed before applying the parameter changes.
|
||||||
|
|
||||||
gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
|
gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
|
||||||
opened for writing, Z_ERRNO if there is an error writing the flushed data,
|
opened for writing, Z_ERRNO if there is an error writing the flushed data,
|
||||||
@@ -1389,7 +1391,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
||||||
/*
|
/*
|
||||||
Reads the given number of uncompressed bytes from the compressed file. If
|
Read and decompress up to len uncompressed bytes from file into buf. If
|
||||||
the input file is not in gzip format, gzread copies the given number of
|
the input file is not in gzip format, gzread copies the given number of
|
||||||
bytes into the buffer directly from the file.
|
bytes into the buffer directly from the file.
|
||||||
|
|
||||||
@@ -1420,11 +1422,11 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
|||||||
ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
|
ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
|
||||||
gzFile file));
|
gzFile file));
|
||||||
/*
|
/*
|
||||||
Read up to nitems items of size size from file to buf, otherwise operating
|
Read and decompress up to nitems items of size size from file into buf,
|
||||||
as gzread() does. This duplicates the interface of stdio's fread(), with
|
otherwise operating as gzread() does. This duplicates the interface of
|
||||||
size_t request and return types. If the library defines size_t, then
|
stdio's fread(), with size_t request and return types. If the library
|
||||||
z_size_t is identical to size_t. If not, then z_size_t is an unsigned
|
defines size_t, then z_size_t is identical to size_t. If not, then z_size_t
|
||||||
integer type that can contain a pointer.
|
is an unsigned integer type that can contain a pointer.
|
||||||
|
|
||||||
gzfread() returns the number of full items read of size size, or zero if
|
gzfread() returns the number of full items read of size size, or zero if
|
||||||
the end of the file was reached and a full item could not be read, or if
|
the end of the file was reached and a full item could not be read, or if
|
||||||
@@ -1443,18 +1445,16 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
|
|||||||
file, reseting and retrying on end-of-file, when size is not 1.
|
file, reseting and retrying on end-of-file, when size is not 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
|
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
|
||||||
voidpc buf, unsigned len));
|
|
||||||
/*
|
/*
|
||||||
Writes the given number of uncompressed bytes into the compressed file.
|
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
||||||
gzwrite returns the number of uncompressed bytes written or 0 in case of
|
returns the number of uncompressed bytes written or 0 in case of error.
|
||||||
error.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
|
ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
|
||||||
z_size_t nitems, gzFile file));
|
z_size_t nitems, gzFile file));
|
||||||
/*
|
/*
|
||||||
gzfwrite() writes nitems items of size size from buf to file, duplicating
|
Compress and write nitems items of size size from buf to file, duplicating
|
||||||
the interface of stdio's fwrite(), with size_t request and return types. If
|
the interface of stdio's fwrite(), with size_t request and return types. If
|
||||||
the library defines size_t, then z_size_t is identical to size_t. If not,
|
the library defines size_t, then z_size_t is identical to size_t. If not,
|
||||||
then z_size_t is an unsigned integer type that can contain a pointer.
|
then z_size_t is an unsigned integer type that can contain a pointer.
|
||||||
@@ -1467,22 +1467,22 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
|
ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
|
||||||
/*
|
/*
|
||||||
Converts, formats, and writes the arguments to the compressed file under
|
Convert, format, compress, and write the arguments (...) to file under
|
||||||
control of the format string, as in fprintf. gzprintf returns the number of
|
control of the string format, as in fprintf. gzprintf returns the number of
|
||||||
uncompressed bytes actually written, or a negative zlib error code in case
|
uncompressed bytes actually written, or a negative zlib error code in case
|
||||||
of error. The number of uncompressed bytes written is limited to 8191, or
|
of error. The number of uncompressed bytes written is limited to 8191, or
|
||||||
one less than the buffer size given to gzbuffer(). The caller should assure
|
one less than the buffer size given to gzbuffer(). The caller should assure
|
||||||
that this limit is not exceeded. If it is exceeded, then gzprintf() will
|
that this limit is not exceeded. If it is exceeded, then gzprintf() will
|
||||||
return an error (0) with nothing written. In this case, there may also be a
|
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
|
buffer overflow with unpredictable consequences, which is possible only if
|
||||||
zlib was compiled with the insecure functions sprintf() or vsprintf()
|
zlib was compiled with the insecure functions sprintf() or vsprintf(),
|
||||||
because the secure snprintf() or vsnprintf() functions were not available.
|
because the secure snprintf() or vsnprintf() functions were not available.
|
||||||
This can be determined using zlibCompileFlags().
|
This can be determined using zlibCompileFlags().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
||||||
/*
|
/*
|
||||||
Writes the given null-terminated string to the compressed file, excluding
|
Compress and write the given null-terminated string s to file, excluding
|
||||||
the terminating null character.
|
the terminating null character.
|
||||||
|
|
||||||
gzputs returns the number of characters written, or -1 in case of error.
|
gzputs returns the number of characters written, or -1 in case of error.
|
||||||
@@ -1490,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
|||||||
|
|
||||||
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||||
/*
|
/*
|
||||||
Reads bytes from the compressed file until len-1 characters are read, or a
|
Read and decompress bytes from file into buf, until len-1 characters are
|
||||||
newline character is read and transferred to buf, or an end-of-file
|
read, or until a newline character is read and transferred to buf, or an
|
||||||
condition is encountered. If any characters are read or if len == 1, the
|
end-of-file condition is encountered. If any characters are read or if len
|
||||||
string is terminated with a null character. If no characters are read due
|
is one, the string is terminated with a null character. If no characters
|
||||||
to an end-of-file or len < 1, then the buffer is left untouched.
|
are read due to an end-of-file or len is less than one, then the buffer is
|
||||||
|
left untouched.
|
||||||
|
|
||||||
gzgets returns buf which is a null-terminated string, or it returns NULL
|
gzgets returns buf which is a null-terminated string, or it returns NULL
|
||||||
for end-of-file or in case of error. If there was an error, the contents at
|
for end-of-file or in case of error. If there was an error, the contents at
|
||||||
@@ -1503,13 +1504,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
|
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
|
||||||
/*
|
/*
|
||||||
Writes c, converted to an unsigned char, into the compressed file. gzputc
|
Compress and write c, converted to an unsigned char, into file. gzputc
|
||||||
returns the value that was written, or -1 in case of error.
|
returns the value that was written, or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Reads one byte from the compressed file. gzgetc returns this byte or -1
|
Read and decompress one byte from file. gzgetc returns this byte or -1
|
||||||
in case of end of file or error. This is implemented as a macro for speed.
|
in case of end of file or error. This is implemented as a macro for speed.
|
||||||
As such, it does not do all of the checking the other functions do. I.e.
|
As such, it does not do all of the checking the other functions do. I.e.
|
||||||
it does not check to see if file is NULL, nor whether the structure file
|
it does not check to see if file is NULL, nor whether the structure file
|
||||||
@@ -1518,8 +1519,8 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
|
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
|
||||||
/*
|
/*
|
||||||
Push one character back onto the stream to be read as the first character
|
Push c back onto the stream for file to be read as the first character on
|
||||||
on the next read. At least one character of push-back is allowed.
|
the next read. At least one character of push-back is always allowed.
|
||||||
gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
|
gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
|
||||||
fail if c is -1, and may fail if a character has been pushed but not read
|
fail if c is -1, and may fail if a character has been pushed but not read
|
||||||
yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
|
yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
|
||||||
@@ -1530,9 +1531,9 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
||||||
/*
|
/*
|
||||||
Flushes all pending output into the compressed file. The parameter flush
|
Flush all pending output to file. The parameter flush is as in the
|
||||||
is as in the deflate() function. The return value is the zlib error number
|
deflate() function. The return value is the zlib error number (see function
|
||||||
(see function gzerror below). gzflush is only permitted when writing.
|
gzerror below). gzflush is only permitted when writing.
|
||||||
|
|
||||||
If the flush parameter is Z_FINISH, the remaining data is written and the
|
If the flush parameter is Z_FINISH, the remaining data is written and the
|
||||||
gzip stream is completed in the output. If gzwrite() is called again, a new
|
gzip stream is completed in the output. If gzwrite() is called again, a new
|
||||||
@@ -1547,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
|||||||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
||||||
z_off_t offset, int whence));
|
z_off_t offset, int whence));
|
||||||
|
|
||||||
Sets the starting position for the next gzread or gzwrite on the given
|
Set the starting position to offset relative to whence for the next gzread
|
||||||
compressed file. The offset represents a number of bytes in the
|
or gzwrite on file. The offset represents a number of bytes in the
|
||||||
uncompressed data stream. The whence parameter is defined as in lseek(2);
|
uncompressed data stream. The whence parameter is defined as in lseek(2);
|
||||||
the value SEEK_END is not supported.
|
the value SEEK_END is not supported.
|
||||||
|
|
||||||
@@ -1565,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
|
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Rewinds the given file. This function is supported only for reading.
|
Rewind file. This function is supported only for reading.
|
||||||
|
|
||||||
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
|
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
||||||
|
|
||||||
Returns the starting position for the next gzread or gzwrite on the given
|
Return the starting position for the next gzread or gzwrite on file.
|
||||||
compressed file. This position represents a number of bytes in the
|
This position represents a number of bytes in the uncompressed data stream,
|
||||||
uncompressed data stream, and is zero when starting, even if appending or
|
and is zero when starting, even if appending or reading a gzip stream from
|
||||||
reading a gzip stream from the middle of a file using gzdopen().
|
the middle of a file using gzdopen().
|
||||||
|
|
||||||
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
|
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
|
||||||
*/
|
*/
|
||||||
@@ -1584,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
|||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
|
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
|
||||||
|
|
||||||
Returns the current offset in the file being read or written. This offset
|
Return the current compressed (actual) read or write offset of file. This
|
||||||
includes the count of bytes that precede the gzip stream, for example when
|
offset includes the count of bytes that precede the gzip stream, for example
|
||||||
appending or when using gzdopen() for reading. When reading, the offset
|
when appending or when using gzdopen() for reading. When reading, the
|
||||||
does not include as yet unused buffered input. This information can be used
|
offset does not include as yet unused buffered input. This information can
|
||||||
for a progress indicator. On error, gzoffset() returns -1.
|
be used for a progress indicator. On error, gzoffset() returns -1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Returns true (1) if the end-of-file indicator has been set while reading,
|
Return true (1) if the end-of-file indicator for file has been set while
|
||||||
false (0) otherwise. Note that the end-of-file indicator is set only if the
|
reading, false (0) otherwise. Note that the end-of-file indicator is set
|
||||||
read tried to go past the end of the input, but came up short. Therefore,
|
only if the read tried to go past the end of the input, but came up short.
|
||||||
just like feof(), gzeof() may return false even if there is no more data to
|
Therefore, just like feof(), gzeof() may return false even if there is no
|
||||||
read, in the event that the last read request was for the exact number of
|
more data to read, in the event that the last read request was for the exact
|
||||||
bytes remaining in the input file. This will happen if the input file size
|
number of bytes remaining in the input file. This will happen if the input
|
||||||
is an exact multiple of the buffer size.
|
file size is an exact multiple of the buffer size.
|
||||||
|
|
||||||
If gzeof() returns true, then the read functions will return no more data,
|
If gzeof() returns true, then the read functions will return no more data,
|
||||||
unless the end-of-file indicator is reset by gzclearerr() and the input file
|
unless the end-of-file indicator is reset by gzclearerr() and the input file
|
||||||
@@ -1608,7 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Returns true (1) if file is being copied directly while reading, or false
|
Return true (1) if file is being copied directly while reading, or false
|
||||||
(0) if file is a gzip stream being decompressed.
|
(0) if file is a gzip stream being decompressed.
|
||||||
|
|
||||||
If the input file is empty, gzdirect() will return true, since the input
|
If the input file is empty, gzdirect() will return true, since the input
|
||||||
@@ -1629,8 +1630,8 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Flushes all pending output if necessary, closes the compressed file and
|
Flush all pending output for file, if necessary, close file and
|
||||||
deallocates the (de)compression state. Note that once file is closed, you
|
deallocate the (de)compression state. Note that once file is closed, you
|
||||||
cannot call gzerror with file, since its structures have been deallocated.
|
cannot call gzerror with file, since its structures have been deallocated.
|
||||||
gzclose must not be called more than once on the same file, just as free
|
gzclose must not be called more than once on the same file, just as free
|
||||||
must not be called more than once on the same allocation.
|
must not be called more than once on the same allocation.
|
||||||
@@ -1654,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
|
|||||||
|
|
||||||
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
||||||
/*
|
/*
|
||||||
Returns the error message for the last error which occurred on the given
|
Return the error message for the last error which occurred on file.
|
||||||
compressed file. errnum is set to zlib error number. If an error occurred
|
errnum is set to zlib error number. If an error occurred in the file system
|
||||||
in the file system and not in the compression library, errnum is set to
|
and not in the compression library, errnum is set to Z_ERRNO and the
|
||||||
Z_ERRNO and the application may consult errno to get the exact error code.
|
application may consult errno to get the exact error code.
|
||||||
|
|
||||||
The application must not modify the returned string. Future calls to
|
The application must not modify the returned string. Future calls to
|
||||||
this function may invalidate the previously returned string. If file is
|
this function may invalidate the previously returned string. If file is
|
||||||
@@ -1670,7 +1671,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
|||||||
|
|
||||||
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
|
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Clears the error and end-of-file flags for file. This is analogous to the
|
Clear 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
|
clearerr() function in stdio. This is useful for continuing to read a gzip
|
||||||
file that is being written concurrently.
|
file that is being written concurrently.
|
||||||
*/
|
*/
|
||||||
@@ -1688,8 +1689,9 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
|
|||||||
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||||
/*
|
/*
|
||||||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||||
return the updated checksum. If buf is Z_NULL, this function returns the
|
return the updated checksum. An Adler-32 value is in the range of a 32-bit
|
||||||
required initial value for the checksum.
|
unsigned integer. If buf is Z_NULL, this function returns the required
|
||||||
|
initial value for the checksum.
|
||||||
|
|
||||||
An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
|
An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
|
||||||
much faster.
|
much faster.
|
||||||
@@ -1722,12 +1724,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
|
|||||||
negative, the result has no meaning or utility.
|
negative, the result has no meaning or utility.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||||
/*
|
/*
|
||||||
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
||||||
updated CRC-32. If buf is Z_NULL, this function returns the required
|
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
|
||||||
initial value for the crc. Pre- and post-conditioning (one's complement) is
|
If buf is Z_NULL, this function returns the required initial value for the
|
||||||
performed within this function so it shouldn't be done by the application.
|
crc. Pre- and post-conditioning (one's complement) is performed within this
|
||||||
|
function so it shouldn't be done by the application.
|
||||||
|
|
||||||
Usage example:
|
Usage example:
|
||||||
|
|
||||||
@@ -1739,7 +1742,7 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
|||||||
if (crc != original_crc) error();
|
if (crc != original_crc) error();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
|
ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
|
||||||
z_size_t len));
|
z_size_t len));
|
||||||
/*
|
/*
|
||||||
Same as crc32(), but with a size_t length.
|
Same as crc32(), but with a size_t length.
|
||||||
@@ -1755,6 +1758,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
|
|||||||
len2.
|
len2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
|
||||||
|
|
||||||
|
Return the operator corresponding to length len2, to be used with
|
||||||
|
crc32_combine_op().
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
|
||||||
|
/*
|
||||||
|
Give the same result as crc32_combine(), using op in place of len2. op is
|
||||||
|
is generated from len2 by crc32_combine_gen(). This will be faster than
|
||||||
|
crc32_combine() if the generated op is used more than once.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* various hacks, don't look :) */
|
/* various hacks, don't look :) */
|
||||||
|
|
||||||
@@ -1842,6 +1859,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
|||||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
|
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
|
||||||
@@ -1852,6 +1870,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
|||||||
# define z_gzoffset z_gzoffset64
|
# define z_gzoffset z_gzoffset64
|
||||||
# define z_adler32_combine z_adler32_combine64
|
# define z_adler32_combine z_adler32_combine64
|
||||||
# define z_crc32_combine z_crc32_combine64
|
# define z_crc32_combine z_crc32_combine64
|
||||||
|
# define z_crc32_combine_gen z_crc32_combine_gen64
|
||||||
# else
|
# else
|
||||||
# define gzopen gzopen64
|
# define gzopen gzopen64
|
||||||
# define gzseek gzseek64
|
# define gzseek gzseek64
|
||||||
@@ -1859,6 +1878,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
|||||||
# define gzoffset gzoffset64
|
# define gzoffset gzoffset64
|
||||||
# define adler32_combine adler32_combine64
|
# define adler32_combine adler32_combine64
|
||||||
# define crc32_combine crc32_combine64
|
# define crc32_combine crc32_combine64
|
||||||
|
# define crc32_combine_gen crc32_combine_gen64
|
||||||
# endif
|
# endif
|
||||||
# ifndef Z_LARGE64
|
# ifndef Z_LARGE64
|
||||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||||
@@ -1867,6 +1887,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
|||||||
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
|
||||||
@@ -1875,12 +1896,14 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
|||||||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* Z_SOLO */
|
#else /* Z_SOLO */
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
|
||||||
|
|
||||||
#endif /* !Z_SOLO */
|
#endif /* !Z_SOLO */
|
||||||
|
|
||||||
@@ -1893,7 +1916,7 @@ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
|
|||||||
ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
|
ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
|
||||||
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
|
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
|
||||||
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
|
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
|
||||||
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
|
#if defined(_WIN32) && !defined(Z_SOLO)
|
||||||
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
|
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
|
||||||
const char *mode));
|
const char *mode));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -92,3 +92,9 @@ ZLIB_1.2.9 {
|
|||||||
adler32_z;
|
adler32_z;
|
||||||
crc32_z;
|
crc32_z;
|
||||||
} ZLIB_1.2.7.1;
|
} ZLIB_1.2.7.1;
|
||||||
|
|
||||||
|
ZLIB_1.2.12 {
|
||||||
|
crc32_combine_gen;
|
||||||
|
crc32_combine_gen64;
|
||||||
|
crc32_combine_op;
|
||||||
|
} ZLIB_1.2.9;
|
||||||
|
|||||||
0
libz/zlib2ansi
Normal file → Executable file
0
libz/zlib2ansi
Normal file → Executable file
@@ -136,8 +136,8 @@ const char * ZEXPORT zError(err)
|
|||||||
return ERR_MSG(err);
|
return ERR_MSG(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
||||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
/* The older Microsoft C Run-Time Library for Windows CE doesn't have
|
||||||
* errno. We define it as a global variable to simplify porting.
|
* errno. We define it as a global variable to simplify porting.
|
||||||
* Its value is always 0 and should not be used.
|
* Its value is always 0 and should not be used.
|
||||||
*/
|
*/
|
||||||
|
|||||||
21
libz/zutil.h
21
libz/zutil.h
@@ -1,5 +1,5 @@
|
|||||||
/* zutil.h -- internal interface and configuration of the compression library
|
/* zutil.h -- internal interface and configuration of the compression library
|
||||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,10 +29,6 @@
|
|||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_SOLO
|
|
||||||
typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef local
|
#ifndef local
|
||||||
# define local static
|
# define local static
|
||||||
#endif
|
#endif
|
||||||
@@ -46,6 +42,17 @@ typedef unsigned short ush;
|
|||||||
typedef ush FAR ushf;
|
typedef ush FAR ushf;
|
||||||
typedef unsigned long ulg;
|
typedef unsigned long ulg;
|
||||||
|
|
||||||
|
#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
|
||||||
|
# include <limits.h>
|
||||||
|
# if (ULONG_MAX == 0xffffffffffffffff)
|
||||||
|
# define Z_U8 unsigned long
|
||||||
|
# elif (ULLONG_MAX == 0xffffffffffffffff)
|
||||||
|
# define Z_U8 unsigned long long
|
||||||
|
# elif (UINT_MAX == 0xffffffffffffffff)
|
||||||
|
# define Z_U8 unsigned
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
/* (size given to avoid silly warnings with Visual C++) */
|
/* (size given to avoid silly warnings with Visual C++) */
|
||||||
|
|
||||||
@@ -170,10 +177,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
||||||
# if defined(_WIN32_WCE)
|
# if defined(_WIN32_WCE)
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
# ifndef _PTRDIFF_T_DEFINED
|
|
||||||
typedef int ptrdiff_t;
|
|
||||||
# define _PTRDIFF_T_DEFINED
|
|
||||||
# endif
|
|
||||||
# else
|
# else
|
||||||
# define fdopen(fd,type) _fdopen(fd,type)
|
# define fdopen(fd,type) _fdopen(fd,type)
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
Reference in New Issue
Block a user