Compare commits

..

2 Commits

Author SHA1 Message Date
Mark Adler
086e982175 zlib 1.2.0.4 2011-09-09 23:22:30 -07:00
Mark Adler
85e7d7d9ba zlib 1.2.0.3 2011-09-09 23:22:21 -07:00
31 changed files with 447 additions and 474 deletions

View File

@@ -1,5 +1,22 @@
ChangeLog file for zlib
Changes in 1.2.0.4 (10 August 2003)
- Minor FAQ updates
- Be more strict when checking inflateInit2's windowBits parameter
- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
- Add gzip wrapper option to deflateInit2 using windowBits
- Add updated QNX rule in configure and qnx directory [Bonnefoy]
- Make inflate distance-too-far checks more rigorous
- Clean up FAR usage in inflate
- Add casting to sizeof() in gzio.c and minigzip.c
Changes in 1.2.0.3 (19 July 2003)
- Fix silly error in gzungetc() implementation [Vollant]
- Update contrib/minizip and contrib/vstudio [Vollant]
- Fix printf format in example.c
- Correct cdecl support in zconf.in.h [Anisimkov]
- Minor FAQ updates
Changes in 1.2.0.2 (13 July 2003)
- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
- Attempt to avoid warnings in crc32.c for pointer-int conversion
@@ -31,8 +48,8 @@ Changes in 1.2.0.2 (13 July 2003)
- Report 2 only for level == 6
- Only deal with 64K limit when necessary at compile time [Truta]
- Allow TOO_FAR check to be turned off at compile time [Truta]
- Added gzclearerr() function [Souza]
- Added gzungetc() function
- Add gzclearerr() function [Souza]
- Add gzungetc() function
Changes in 1.2.0.1 (17 March 2003)
- Add Z_RLE strategy for run-length encoding [Truta]

66
FAQ
View File

@@ -20,7 +20,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
3. Where can I get a Visual Basic interface to zlib?
See
* http://www.winimage.com/zLibDll/cmp-z-it.zip
* http://www.winimage.com/zLibDll/
* http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
* contrib/visual-basic.txt in the zlib distribution
@@ -122,8 +122,16 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
18. Well that's nice, but how do I make a gzip file in memory?
Read RFC 1952 for the gzip header and trailer format, and roll your own
gzip formatted data using raw deflate and crc32().
You can request that deflate write the gzip format instead of the zlib
format using deflateInit2(). You can also request that inflate decode
the gzip format using inflateInit2(). Read zlib.h for more details.
Note that you cannot specify special gzip header contents (e.g. a file
name or modification date), nor will inflate tell you what was in the
gzip header. If you need to customize the header or see what's in it,
you can use the raw deflate and inflate operations and the crc32()
function and roll your own gzip encoding and decoding. Read the gzip
RFC 1952 for details of the header and trailer format.
19. Is zlib thread-safe?
@@ -147,11 +155,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
22. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?
You need to append something the ZLIB_VERSION string in zlib.h. For
example, if the version of the base zlib you are altering is "1.2.3", then
you could change the string to "1.2.3-fred-mods-v3". You should not change
it to "1.2.4" or "1.2.3.1" since the zlib authors would like to reserve
those forms of the version for their own use.
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.
For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
@@ -161,8 +172,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
Note that distributing a compiled zlib library along with zlib.h and
zconf.h is also a source distribution, and so you should change
ZLIB_VERSION and note the origin and nature of the changes in zlib.h as you
would for a full source distribution.
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
in zlib.h as you would for a full source distribution.
23. Will zlib work on a big-endian or little-endian architecture, and can I
exchange compressed data between them?
@@ -212,12 +223,20 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
30. Can zlib work with greater than 4 GB of data?
Yes. inflate() and deflate() will process any amount of data correctly.
However the strm.total_in and strm_total_out counters may be limited to
4 GB. The application can easily set up its own counters updated after each
call of inflate() or deflate() to count beyond 4 GB. compress() and
uncompress() may be limited to 4 GB, since they operate in a single call
using unsigned long lengths. gzseek() and gztell() may be limited to 4 GB
depending on how zlib is compiled.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
type, but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
single call. gzseek() and gztell() may be limited to 4 GB depending on how
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
The word "may" appears several times above since there is a 4 GB limit
only if the compiler's "long" type is 32 bits. If the compiler's "long"
type is 64 bits, then the limit is 16 exabytes.
31. Does zlib have any security vulnerabilities?
@@ -228,7 +247,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
normally be the case, then there is no vulnerability. The ./configure
script will display warnings if an insecure variation of sprintf() will
be used by gzprintf(). Also the zlibCompileFlags() functions will return
be used by gzprintf(). Also the zlibCompileFlags() function will return
information on what variant of sprintf() is used by gzprintf().
If you don't have snprintf() or vsnprintf() and would like one, you can
@@ -242,7 +261,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
32. Is there a Java version of zlib?
Probably what you want is to use zlib in Java. zlib is already included
as part of the Java SDK in the java.util.zip class. If you really want
as part of the Java SDK in the java.util.zip package. If you really want
a version of zlib written in the Java language, look on the zlib home
page for links: http://www.zlib.org/
@@ -262,9 +281,10 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
35. How can I encrypt/decrypt zip files with zlib?
zlib doesn't support encryption. PKZIP encryption is very weak and can be
broken with freely available programs. To get strong encryption, use gpg
which already includes zlib compression.
zlib doesn't support encryption. The original PKZIP encryption is very weak
and can be broken with freely available programs. To get strong encryption,
use gpg ( http://www.gnupg.org/ ) which already includes zlib compression.
For PKZIP compatible "encryption", look at http://www.info-zip.org/
36. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
@@ -280,6 +300,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
for), using the "gzip" transfer encoding is probably more reliable due to
an unfortunate choice of name on the part of the HTTP 1.1 authors.
Bottom line: use the gzip format for HTTP 1.1 encoding.
37. Does zlib support the new "Deflate64" format introduced by PKWare?
No. PKWare has apparently decided to keep that format proprietary, since
@@ -290,4 +312,4 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
38. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?
No. Go away.
No. Go away. Shoo.

View File

@@ -24,7 +24,7 @@ LDFLAGS=libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
VER=1.2.0.2
VER=1.2.0.4
LIBS=libz.a
SHAREDLIB=libz.so

View File

@@ -24,7 +24,7 @@ LDFLAGS=libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
VER=1.2.0.2
VER=1.2.0.4
LIBS=libz.a
SHAREDLIB=libz.so

4
README
View File

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

2
configure vendored
View File

@@ -78,6 +78,8 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
CFLAGS="$cflags"
case `(uname -s || echo unknown) 2>/dev/null` in
Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
QNX*) #This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 (alain.bonnefoy@icbt.com)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};;
HP-UX*) LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
shared_ext='.sl'
SHAREDLIB='libz.sl';;

View File

@@ -828,7 +828,11 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
unz_s* s;
int err;
/* We remember the 'current' position in the file so that we can jump
* back there if we fail.
*/
unz_file_info cur_file_infoSaved;
unz_file_info_internal cur_file_info_internalSaved;
uLong num_fileSaved;
uLong pos_in_central_dirSaved;
@@ -843,25 +847,36 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
if (!s->current_file_ok)
return UNZ_END_OF_LIST_OF_FILE;
/* Save the current state */
num_fileSaved = s->num_file;
pos_in_central_dirSaved = s->pos_in_central_dir;
cur_file_infoSaved = s->cur_file_info;
cur_file_info_internalSaved = s->cur_file_info_internal;
err = unzGoToFirstFile(file);
while (err == UNZ_OK)
{
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
unzGetCurrentFileInfo(file,NULL,
szCurrentFileName,sizeof(szCurrentFileName)-1,
NULL,0,NULL,0);
if (unzStringFileNameCompare(szCurrentFileName,
szFileName,iCaseSensitivity)==0)
return UNZ_OK;
err = unzGoToNextFile(file);
err = unzGetCurrentFileInfo(file,NULL,
szCurrentFileName,sizeof(szCurrentFileName)-1,
NULL,0,NULL,0);
if (err == UNZ_OK)
{
if (unzStringFileNameCompare(szCurrentFileName,
szFileName,iCaseSensitivity)==0)
return UNZ_OK;
err = unzGoToNextFile(file);
}
}
/* We failed, so restore the state of the 'current file' to where we
* were.
*/
s->num_file = num_fileSaved ;
s->pos_in_central_dir = pos_in_central_dirSaved ;
s->cur_file_info = cur_file_infoSaved;
s->cur_file_info_internal = cur_file_info_internalSaved;
return err;
}

View File

@@ -1,326 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef _ZCONF_H
#define _ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#if defined(MSDOS) && !defined(__32BIT__)
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
# ifndef STDC
# define STDC
# endif
#endif
#if defined __HOS_AIX__
# ifndef STDC
# define STDC
# endif
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Old Borland C incorrectly complains about missing returns: */
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x460)
# define NEED_DUMMY_RETURN
#endif
#if defined(__TURBOC__) && !defined(__BORLANDC__)
# define NEED_DUMMY_RETURN
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/*
* Microsoft Visual Studio define _vsnprintf but not vsnprintf
*/
#if !defined(STDC99) && !(defined(__TURBOC__) && __TURBOC__ >= 0x550) && !defined(VSNPRINTF_DEFINED)
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(__TURBOC__)
# define vsnprintf _vsnprintf
# endif
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
#endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR _far
# endif
#endif
#if defined(WIN32) && (!defined(ZLIB_WIN32_NODLL)) && (!defined(ZLIB_DLL))
# define ZLIB_DLL
#endif
/* Compile with -DZLIB_DLL for Windows DLL support */
#if defined(ZLIB_DLL)
# if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32)
# ifndef WINAPIV
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
# endif
# ifdef WIN32
# define ZEXPORT WINAPI
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORT WINAPI _export
# define ZEXPORTVA FAR _cdecl _export
# endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTVA __declspec(dllexport) WINAPIV
# else
# if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export
# define ZEXPORTVA _export
# endif
# endif
# endif
#endif
#if defined (__BEOS__)
# if defined (ZLIB_DLL)
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* _ZCONF_H */

View File

@@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
@@ -63,7 +63,7 @@
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"

View File

@@ -22,8 +22,8 @@ CPPUSEPCHFLAG =
FIRSTC = ADLER32.C
FIRSTCPP =
RC = rc
CFLAGS_D_WDLL = /nologo /G2 /W3 /Zi /ALw /Od /D "_DEBUG" /D "WINDOWS" /D "ZLIB_DLL" /FR /GD /Fd"ZLIB.PDB"
CFLAGS_R_WDLL = /nologo /W3 /ALw /O1 /D "NDEBUG" /D "WINDOWS" /D "ZLIB_DLL" /FR /GD
CFLAGS_D_WDLL = /nologo /G2 /W3 /Zi /ALw /Od /D "_DEBUG" /D "WINDOWS" /D "ZLIB_DLL" /D "ZLIB_INTERNAL" /FR /GD /Fd"ZLIB.PDB"
CFLAGS_R_WDLL = /nologo /W3 /ALw /O1 /D "NDEBUG" /D "WINDOWS" /D "ZLIB_DLL" /D "ZLIB_INTERNAL" /FR /GD
LFLAGS_D_WDLL = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /CO /NOE /ALIGN:16 /MAP:FULL
LFLAGS_R_WDLL = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /NOE /ALIGN:16 /MAP:FULL
LIBS_D_WDLL = oldnames libw commdlg shell olecli olesvr ldllcew
@@ -74,7 +74,8 @@ COMPRESS_DEP = c:\zlib\zlib.h \
c:\zlib\zconf.h
CRC32_DEP = c:\zlib\zlib.h \
CRC32_DEP = c:\zlib\zutil.h \
c:\zlib\zlib.h \
c:\zlib\zconf.h \
c:\zlib\crc32.h
@@ -128,13 +129,15 @@ ZLIB16_RCDEP =
ZIP_DEP = c:\zlib\zlib.h \
c:\zlib\zconf.h \
c:\zlib\zip.h \
c:\zlib\ioapi.h
c:\zlib\ioapi.h \
c:\zlib\crypt.h
UNZIP_DEP = c:\zlib\zlib.h \
c:\zlib\zconf.h \
c:\zlib\unzip.h \
c:\zlib\ioapi.h
c:\zlib\ioapi.h \
c:\zlib\crypt.h
INFBACK_DEP = c:\zlib\zutil.h \

View File

@@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
@@ -63,7 +63,7 @@
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"

View File

@@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
@@ -63,7 +63,7 @@
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;ZLIB_DLL;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"

View File

@@ -20,7 +20,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32"
PreprocessorDefinitions="WIN32;ZLIB_DLL"
ExceptionHandling="FALSE"
RuntimeLibrary="5"
PrecompiledHeaderFile=".\zlibstatDebug/zlibstat.pch"
@@ -61,7 +61,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32"
PreprocessorDefinitions="WIN32;ZLIB_DLL"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="4"
@@ -102,7 +102,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,ASMV"
PreprocessorDefinitions="WIN32;ZLIB_DLL,ASMV"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="4"
@@ -144,7 +144,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32"
PreprocessorDefinitions="WIN32;ZLIB_DLL"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="4"

View File

@@ -20,7 +20,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32,ASMV"
PreprocessorDefinitions="WIN32,ZLIB_DLL,ASMV"
ExceptionHandling="FALSE"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\DebugDll/zlibvc.pch"
@@ -76,7 +76,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32"
PreprocessorDefinitions="WIN32,ZLIB_DLL"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
@@ -138,7 +138,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,ASMV"
PreprocessorDefinitions="WIN32,ZLIB_DLL,ASMV"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
@@ -200,7 +200,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32"
PreprocessorDefinitions="WIN32,ZLIB_DLL"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
@@ -260,7 +260,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,ASMV"
PreprocessorDefinitions="WIN32,ZLIB_DLL,ASMV"
StringPooling="TRUE"
ExceptionHandling="FALSE"
RuntimeLibrary="0"
@@ -379,9 +379,23 @@
</File>
<File
RelativePath=".\unzip.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="ZLIB_INTERNAL"/>
</FileConfiguration>
</File>
<File
RelativePath=".\zip.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="ZLIB_INTERNAL"/>
</FileConfiguration>
</File>
<File
RelativePath=".\zlib.rc">

View File

@@ -18,7 +18,7 @@
# endif /* !DYNAMIC_CRC_TABLE */
#endif /* MAKECRCH */
#include "zutil.h"
#include "zutil.h" /* for STDC and FAR definitions */
#define local static

147
deflate.c
View File

@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.2.0.2 Copyright 1995-2003 Jean-loup Gailly ";
" deflate 1.2.0.4 Copyright 1995-2003 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -132,12 +132,12 @@ typedef struct config_s {
local const config configuration_table[2] = {
/* good lazy nice chain */
/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* maximum speed, no lazy matches */
/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
#else
local const config configuration_table[10] = {
/* good lazy nice chain */
/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */
/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
/* 2 */ {4, 5, 16, 8, deflate_fast},
/* 3 */ {4, 6, 32, 32, deflate_fast},
@@ -146,7 +146,7 @@ local const config configuration_table[10] = {
/* 6 */ {8, 16, 128, 128, deflate_slow},
/* 7 */ {8, 32, 128, 256, deflate_slow},
/* 8 */ {32, 128, 258, 1024, deflate_slow},
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
#endif
/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
@@ -225,7 +225,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
int stream_size;
{
deflate_state *s;
int noheader = 0;
int wrap = 1;
static const char my_version[] = ZLIB_VERSION;
ushf *overlay;
@@ -252,10 +252,16 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
if (windowBits < 0) { /* undocumented feature: suppress zlib header */
noheader = 1;
if (windowBits < 0) { /* suppress zlib wrapper */
wrap = 0;
windowBits = -windowBits;
}
#ifdef GZIP
else if (windowBits > 15) {
wrap = 2; /* write gzip wrapper instead */
windowBits -= 16;
}
#endif
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_RLE) {
@@ -267,7 +273,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
strm->state = (struct internal_state FAR *)s;
s->strm = strm;
s->noheader = noheader;
s->wrap = wrap;
s->w_bits = windowBits;
s->w_size = 1 << s->w_bits;
s->w_mask = s->w_size - 1;
@@ -316,11 +322,12 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
IPos hash_head = 0;
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
(!strm->state->noheader && strm->state->status != INIT_STATE))
strm->state->wrap == 2 ||
(strm->state->wrap == 1 && strm->state->status != INIT_STATE))
return Z_STREAM_ERROR;
s = strm->state;
if (!s->noheader)
if (s->wrap)
strm->adler = adler32(strm->adler, dictionary, dictLength);
if (length < MIN_MATCH) return Z_OK;
@@ -364,11 +371,15 @@ int ZEXPORT deflateReset (strm)
s->pending = 0;
s->pending_out = s->pending_buf;
if (s->noheader < 0) {
s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
if (s->wrap < 0) {
s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
}
s->status = s->noheader ? BUSY_STATE : INIT_STATE;
strm->adler = 1;
s->status = s->wrap ? INIT_STATE : BUSY_STATE;
strm->adler =
#ifdef GZIP
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
#endif
adler32(0L, Z_NULL, 0);
s->last_flush = Z_NO_FLUSH;
_tr_init(s);
@@ -428,7 +439,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
* can emit on compressed data for some combinations of the parameters.
*
* This function could be more sophisticated to provide closer upper bounds
* for every combination of windowBits and memLevel, as well as noheader.
* for every combination of windowBits and memLevel, as well as wrap.
* But even the conservative upper bound of about 14% expansion does not
* seem onerous for output buffer allocation.
*/
@@ -519,33 +530,53 @@ int ZEXPORT deflate (strm, flush)
old_flush = s->last_flush;
s->last_flush = flush;
/* Write the zlib header */
/* Write the header */
if (s->status == INIT_STATE) {
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
uInt level_flags;
if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
level_flags = 0;
else if (s->level < 6)
level_flags = 1;
else if (s->level == 6)
level_flags = 2;
else
level_flags = 3;
header |= (level_flags << 6);
if (s->strstart != 0) header |= PRESET_DICT;
header += 31 - (header % 31);
s->status = BUSY_STATE;
putShortMSB(s, header);
/* Save the adler32 of the preset dictionary: */
if (s->strstart != 0) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
#ifdef GZIP
if (s->wrap == 2) {
put_byte(s, 31);
put_byte(s, 139);
put_byte(s, 8);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, s->level == 9 ? 2 :
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
4 : 0));
put_byte(s, 255);
s->status = BUSY_STATE;
strm->adler = crc32(0L, Z_NULL, 0);
}
else
#endif
{
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
uInt level_flags;
if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
level_flags = 0;
else if (s->level < 6)
level_flags = 1;
else if (s->level == 6)
level_flags = 2;
else
level_flags = 3;
header |= (level_flags << 6);
if (s->strstart != 0) header |= PRESET_DICT;
header += 31 - (header % 31);
s->status = BUSY_STATE;
putShortMSB(s, header);
/* Save the adler32 of the preset dictionary: */
if (s->strstart != 0) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
strm->adler = adler32(0L, Z_NULL, 0);
}
strm->adler = 1L;
}
/* Flush as much pending output as possible */
@@ -622,16 +653,31 @@ int ZEXPORT deflate (strm, flush)
Assert(strm->avail_out > 0, "bug2");
if (flush != Z_FINISH) return Z_OK;
if (s->noheader) return Z_STREAM_END;
if (s->wrap <= 0) return Z_STREAM_END;
/* Write the zlib trailer (adler32) */
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
/* Write the trailer */
#ifdef GZIP
if (s->wrap == 2) {
put_byte(s, (Byte)(strm->adler & 0xff));
put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
put_byte(s, (Byte)(strm->total_in & 0xff));
put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
}
else
#endif
{
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
flush_pending(strm);
/* If avail_out is zero, the application will call deflate again
* to flush the rest.
*/
s->noheader = -1; /* write the trailer only once! */
if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
return s->pending != 0 ? Z_OK : Z_STREAM_END;
}
@@ -740,9 +786,14 @@ local int read_buf(strm, buf, size)
strm->avail_in -= len;
if (!strm->state->noheader) {
if (strm->state->wrap == 1) {
strm->adler = adler32(strm->adler, strm->next_in, len);
}
#ifdef GZIP
else if (strm->state->wrap == 2) {
strm->adler = crc32(strm->adler, strm->next_in, len);
}
#endif
zmemcpy(buf, strm->next_in, len);
strm->next_in += len;
strm->total_in += len;
@@ -1044,7 +1095,7 @@ local void fill_window(s)
} else if (more == (unsigned)(-1)) {
/* Very unlikely, but possible on 16 bit machine if
* strstart == 0 && lookahead == 1 (input done one byte at time)
* strstart == 0 && lookahead == 1 (input done a byte at time)
*/
more--;
}
@@ -1271,7 +1322,7 @@ local block_state deflate_fast(s, flush)
#ifndef FASTEST
if (s->match_length <= s->max_insert_length &&
s->lookahead >= MIN_MATCH) {
s->match_length--; /* string at strstart already in hash table */
s->match_length--; /* string at strstart already in table */
do {
s->strstart++;
INSERT_STRING(s, s->strstart, hash_head);

View File

@@ -15,6 +15,14 @@
#include "zutil.h"
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer creation by deflate(). NO_GZIP would be used to avoid linking in
the crc code when it is not needed. For shared libraries, gzip encoding
should be left enabled. */
#ifndef NO_GZIP
# define GZIP
#endif
/* ===========================================================================
* Internal compression state.
*/
@@ -86,7 +94,7 @@ typedef struct internal_state {
ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
int pending; /* nb of bytes in the pending buffer */
int noheader; /* suppress zlib header and adler32 */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
Byte data_type; /* UNKNOWN, BINARY or ASCII */
Byte method; /* STORED (for zip only) or DEFLATED */
int last_flush; /* value of flush param for previous deflate call */

View File

@@ -528,7 +528,7 @@ int main(argc, argv)
fprintf(stderr, "warning: different zlib version\n");
}
printf("zlib version %s = 0x%04x, compile flags = 0x%x\n",
printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
compr = (Byte*)calloc((uInt)comprLen, 1);

7
gzio.c
View File

@@ -506,7 +506,8 @@ int ZEXPORT gzungetc(c, file)
s->back = c;
s->stream.total_out--;
s->last = (s->z_err == Z_STREAM_END);
if (s->z_eof) s->z_eof = 0;
if (s->last) s->z_err = Z_OK;
s->z_eof = 0;
return c;
}
@@ -607,7 +608,7 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
va_end(va);
# endif
#endif
if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
return 0;
return gzwrite(file, buf, (unsigned)len);
}
@@ -812,7 +813,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
if (s->outbuf == Z_NULL) return -1L;
}
if (offset && s->back != EOF) {
s->back == EOF;
s->back = EOF;
s->stream.total_out++;
offset--;
if (s->last) s->z_err = Z_STREAM_END;

View File

@@ -55,6 +55,7 @@ int stream_size;
state->wsize = 1U << windowBits;
state->window = window;
state->write = 0;
state->whave = 0;
return Z_OK;
}
@@ -201,6 +202,7 @@ struct inflate_state FAR *state;
if (left == 0) { \
put = state->window; \
left = state->wsize; \
state->whave = left; \
if (out(out_desc, put, left)) { \
ret = Z_BUF_ERROR; \
goto inf_leave; \
@@ -216,7 +218,7 @@ struct inflate_state FAR *state;
in() and out() are the call-back input and output functions. When
inflateBack() needs more input, it calls in(). When inflateBack() has
filled the window with output, or when it completes with data in the
window, it called out() to write out the data. The application must not
window, it calls out() to write out the data. The application must not
change the provided input until in() is called again or inflateBack()
returns. The application must not change the window/output buffer until
inflateBack() returns.
@@ -243,12 +245,13 @@ out_func out;
void FAR *out_desc;
{
struct inflate_state FAR *state;
unsigned char *next, *put; /* next input and output */
unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
unsigned bits; /* bits in bit buffer */
unsigned copy; /* number of stored or match bytes to copy */
unsigned char *from; /* where to copy match bytes from */
unsigned char FAR *from; /* where to copy match bytes from */
code this; /* current decoding table entry */
code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */
@@ -265,6 +268,7 @@ void FAR *out_desc;
strm->msg = Z_NULL;
state->mode = TYPE;
state->last = 0;
state->whave = 0;
next = strm->next_in;
have = next != Z_NULL ? strm->avail_in : 0;
hold = 0;
@@ -457,6 +461,8 @@ void FAR *out_desc;
/* use inflate_fast() if we have enough input and output */
if (have >= 6 && left >= 258) {
RESTORE();
if (state->whave < state->wsize)
state->whave = state->wsize - left;
inflate_fast(strm, state->wsize);
LOAD();
break;
@@ -547,7 +553,8 @@ void FAR *out_desc;
state->offset += BITS(state->extra);
DROPBITS(state->extra);
}
if (state->offset > state->wsize) {
if (state->offset > state->wsize - (state->whave < state->wsize ?
left : 0)) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;

View File

@@ -113,6 +113,7 @@ z_streamp strm;
state->last = 0;
state->havedict = 0;
state->wsize = 0;
state->whave = 0;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
@@ -150,7 +151,7 @@ int stream_size;
else {
state->wrap = (windowBits >> 4) + 1;
#ifdef GUNZIP
windowBits &= 15;
if (windowBits < 48) windowBits &= 15;
#endif
}
if (windowBits < 8 || windowBits > 15) {
@@ -320,6 +321,7 @@ unsigned out;
if (state->wsize == 0) {
state->wsize = 1U << state->wbits;
state->write = 0;
state->whave = 0;
}
/* copy state->wsize or less output bytes into the circular window */
@@ -327,6 +329,7 @@ unsigned out;
if (copy >= state->wsize) {
zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
state->write = 0;
state->whave = state->wsize;
}
else {
dist = state->wsize - state->write;
@@ -336,10 +339,12 @@ unsigned out;
if (copy) {
zmemcpy(state->window, strm->next_out - copy, copy);
state->write = copy;
state->whave = state->wsize;
}
else {
state->write += dist;
if (state->write == state->wsize) state->write = 0;
if (state->whave < state->wsize) state->whave += dist;
}
}
return 0;
@@ -531,13 +536,14 @@ z_streamp strm;
int flush;
{
struct inflate_state FAR *state;
unsigned char *next, *put; /* next input and output */
unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
unsigned bits; /* bits in bit buffer */
unsigned in, out; /* save starting available input and output */
unsigned copy; /* number of stored or match bytes to copy */
unsigned char *from; /* where to copy match bytes from */
unsigned char FAR *from; /* where to copy match bytes from */
code this; /* current decoding table entry */
code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */
@@ -956,8 +962,7 @@ int flush;
state->offset += BITS(state->extra);
DROPBITS(state->extra);
}
if (state->offset > (state->wsize ? state->wsize :
out - left)) {
if (state->offset > state->whave + out - left) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
@@ -1108,12 +1113,16 @@ uInt dictLength;
state->mode = MEM;
return Z_MEM_ERROR;
}
if (dictLength > state->wsize)
if (dictLength > state->wsize) {
zmemcpy(state->window, dictionary + dictLength - state->wsize,
state->wsize);
else
state->whave = state->wsize;
}
else {
zmemcpy(state->window + state->wsize - dictLength, dictionary,
dictLength);
state->whave = dictLength;
}
state->havedict = 1;
Tracev((stderr, "inflate: dictionary set\n"));
return Z_OK;
@@ -1131,7 +1140,7 @@ uInt dictLength;
zero for the first call.
*/
local unsigned syncsearch(have, buf, len)
unsigned *have;
unsigned FAR *have;
unsigned char FAR *buf;
unsigned len;
{

View File

@@ -8,11 +8,11 @@
subject to change. Applications should only use zlib.h.
*/
/* define NO_GUNZIP when compiling if you want to disable gzip header and
trailer decoding by inflate(). NO_GUNZIP would be used to avoid linking in
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
the crc code when it is not needed. For shared libraries, gzip decoding
should be left enabled. */
#ifndef NO_GUNZIP
#ifndef NO_GZIP
# define GUNZIP
#endif
@@ -88,6 +88,7 @@ struct inflate_state {
/* sliding window */
unsigned wbits; /* log base 2 of requested window size */
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned write; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if needed */
/* bit accumulator */

View File

@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
" inflate 1.2.0.2 Copyright 1995-2003 Mark Adler ";
" inflate 1.2.0.4 Copyright 1995-2003 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -33,8 +33,8 @@ int inflate_table(type, lens, codes, table, bits, work)
codetype type;
unsigned short FAR *lens;
unsigned codes;
code * FAR *table;
unsigned *bits;
code FAR * FAR *table;
unsigned FAR *bits;
unsigned short FAR *work;
{
unsigned len; /* a code's length in bits */
@@ -52,8 +52,8 @@ unsigned short FAR *work;
unsigned mask; /* mask for low root bits */
code this; /* table entry for duplication */
code FAR *next; /* next available space in table */
const unsigned short *base; /* base value table to use */
const unsigned short *extra; /* extra bits table to use */
const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */
int end; /* use base and extra for symbol > end */
unsigned short count[MAXBITS+1]; /* number of codes of each length */
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
@@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 67, 201};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 192};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

View File

@@ -51,5 +51,5 @@ typedef enum {
} codetype;
extern int inflate_table OF((codetype type, unsigned short FAR *lens,
unsigned codes, code * FAR *table, unsigned *bits,
unsigned short FAR *work));
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work));

View File

@@ -60,7 +60,7 @@
#ifndef GZ_SUFFIX
# define GZ_SUFFIX ".gz"
#endif
#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
#define SUFFIX_LEN ((int)sizeof(GZ_SUFFIX)-1)
#define BUFLEN 16384
#define MAX_NAME_LEN 1024

141
qnx/package.qpg Normal file
View File

@@ -0,0 +1,141 @@
<QPG:Generation>
<QPG:Options>
<QPG:User unattended="no" verbosity="2" listfiles="yes"/>
<QPG:Defaults type="qnx_package"/>
<QPG:Source></QPG:Source>
<QPG:Release number="+"/>
<QPG:Build></QPG:Build>
<QPG:FileSorting strip="yes"/>
<QPG:Package targets="combine"/>
<QPG:Repository generate="yes"/>
<QPG:FinalDir></QPG:FinalDir>
<QPG:Cleanup></QPG:Cleanup>
</QPG:Options>
<QPG:Responsible>
<QPG:Company></QPG:Company>
<QPG:Department></QPG:Department>
<QPG:Group></QPG:Group>
<QPG:Team></QPG:Team>
<QPG:Employee></QPG:Employee>
<QPG:EmailAddress></QPG:EmailAddress>
</QPG:Responsible>
<QPG:Values>
<QPG:Files>
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
<QPG:Add file="../libz.so.1.2.0.4" 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.0.4"/>
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.4"/>
<QPG:Add file="../libz.so.1.2.0.4" install="/opt/lib/" component="slib"/>
</QPG:Files>
<QPG:PackageFilter>
<QPM:PackageManifest>
<QPM:PackageDescription>
<QPM:PackageType>Library</QPM:PackageType>
<QPM:PackageReleaseNotes></QPM:PackageReleaseNotes>
<QPM:PackageReleaseUrgency>Medium</QPM:PackageReleaseUrgency>
<QPM:PackageRepository></QPM:PackageRepository>
<QPM:FileVersion>2.0</QPM:FileVersion>
</QPM:PackageDescription>
<QPM:ProductDescription>
<QPM:ProductName>zlib</QPM:ProductName>
<QPM:ProductIdentifier>zlib</QPM:ProductIdentifier>
<QPM:ProductEmail>alain.bonnefoy@icbt.com</QPM:ProductEmail>
<QPM:VendorName>Public</QPM:VendorName>
<QPM:VendorInstallName>public</QPM:VendorInstallName>
<QPM:VendorURL>www.gzip.org/zlib</QPM:VendorURL>
<QPM:VendorEmbedURL></QPM:VendorEmbedURL>
<QPM:VendorEmail></QPM:VendorEmail>
<QPM:AuthorName>Jean-Loup Gailly,Mark Adler</QPM:AuthorName>
<QPM:AuthorURL>www.gzip.org/zlib</QPM:AuthorURL>
<QPM:AuthorEmbedURL></QPM:AuthorEmbedURL>
<QPM:AuthorEmail>zlib@gzip.org</QPM:AuthorEmail>
<QPM:ProductIconSmall></QPM:ProductIconSmall>
<QPM:ProductIconLarge></QPM:ProductIconLarge>
<QPM:ProductDescriptionShort>A massively spiffy yet delicately unobtrusive compression library.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://www.gzip.org/zlib</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
</QPM:ProductDescription>
<QPM:ReleaseDescription>
<QPM:ReleaseVersion>1.2.0.4</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
<QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor>
<QPM:ExcludeCountries>
<QPM:Country></QPM:Country>
</QPM:ExcludeCountries>
<QPM:ReleaseCopyright>No License</QPM:ReleaseCopyright>
</QPM:ReleaseDescription>
<QPM:ContentDescription>
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
<QPM:ContentKeyword>zlib,compression</QPM:ContentKeyword>
<QPM:TargetOS>qnx6</QPM:TargetOS>
<QPM:HostOS>qnx6</QPM:HostOS>
<QPM:DisplayEnvironment xmlmultiple="true">None</QPM:DisplayEnvironment>
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
</QPM:ContentDescription>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
<QPM:ProductInstallationProcedure>
<QPM:Script xmlmultiple="true">
<QPM:ScriptName></QPM:ScriptName>
<QPM:ScriptType>Install</QPM:ScriptType>
<QPM:ScriptTiming>Post</QPM:ScriptTiming>
<QPM:ScriptBlocking>No</QPM:ScriptBlocking>
<QPM:ScriptResult>Ignore</QPM:ScriptResult>
<QPM:ShortDescription></QPM:ShortDescription>
<QPM:UseBinaries>No</QPM:UseBinaries>
<QPM:Priority>Optional</QPM:Priority>
</QPM:Script>
</QPM:ProductInstallationProcedure>
</QPM:PackageManifest>
<QPM:Launch>
</QPM:Launch>
</QPG:PackageFilter>
<QPG:PackageFilter type="core" component="none">
<QPM:PackageManifest>
<QPM:ProductInstallationProcedure>
<QPM:OrderDependency xmlmultiple="true">
<QPM:Order>InstallOver</QPM:Order>
<QPM:Product>zlib</QPM:Product>
</QPM:OrderDependency>
</QPM:ProductInstallationProcedure>
</QPM:PackageManifest>
<QPM:Launch>
</QPM:Launch>
</QPG:PackageFilter>
<QPG:PackageFilter type="core" component="dev">
<QPM:PackageManifest>
<QPM:ProductInstallationProcedure>
<QPM:OrderDependency xmlmultiple="true">
<QPM:Order>InstallOver</QPM:Order>
<QPM:Product>zlib-dev</QPM:Product>
</QPM:OrderDependency>
</QPM:ProductInstallationProcedure>
</QPM:PackageManifest>
<QPM:Launch>
</QPM:Launch>
</QPG:PackageFilter>
</QPG:Values>
</QPG:Generation>

View File

@@ -183,20 +183,21 @@
# define ZEXPORT WINAPI _export
# define ZEXPORTVA FAR _cdecl _export
# else
# define ZEXPORT WINAPI
# define ZEXPORT FAR _cdecl
# define ZEXPORTVA FAR _cdecl
# endif
# else
/* a fully Win32-compliant compiler */
# define ZEXPORT WINAPI
# define ZEXPORTVA CDECL
# ifdef ZLIB_DLL
# define ZEXPORT WINAPI
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# else
# define ZEXPORT CDECL
# define ZEXTERN extern
# endif
# endif

View File

@@ -183,20 +183,21 @@
# define ZEXPORT WINAPI _export
# define ZEXPORTVA FAR _cdecl _export
# else
# define ZEXPORT WINAPI
# define ZEXPORT FAR _cdecl
# define ZEXPORTVA FAR _cdecl
# endif
# else
/* a fully Win32-compliant compiler */
# define ZEXPORT WINAPI
# define ZEXPORTVA CDECL
# ifdef ZLIB_DLL
# define ZEXPORT WINAPI
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# else
# define ZEXPORT CDECL
# define ZEXTERN extern
# endif
# endif

4
zlib.3
View File

@@ -1,4 +1,4 @@
.TH ZLIB 3 "12 May 2003"
.TH ZLIB 3 "xx July 2003"
.SH NAME
zlib \- compression/decompression library
.SH SYNOPSIS
@@ -133,7 +133,7 @@ before asking for help.
Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS
Version 1.2.0.1
Version 1.2.0.4
Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org)
and Mark Adler (madler@alumni.caltech.edu).
.LP

20
zlib.h
View File

@@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.0.2, July 13th, 2003
version 1.2.0.4, August 10th, 2003
Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
@@ -37,8 +37,8 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.0.2"
#define ZLIB_VERNUM 0x1202
#define ZLIB_VERSION "1.2.0.4"
#define ZLIB_VERNUM 0x1204
/*
The 'zlib' compression library provides in-memory compression and
@@ -446,15 +446,21 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
this version of the library.
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
(the size of the history buffer). It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
determines the window size. deflate() will then generate raw deflate data
with no zlib header or trailer, and will not compute an adler32 check value.
windowBits can also be greater than 15 for optional gzip encoding. Add
16 to windowBits to write a simple gzip header and trailer around the
compressed data instead of a zlib wrapper. The gzip header will have no
file name, no extra data, no comment, no modification time (set to zero),
no header crc, and the operating system will be set to 255 (unknown).
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but
is slow and reduces compression ratio; memLevel=9 uses maximum memory
@@ -801,8 +807,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
Library content (indicates missing functionality):
16: NO_DEFLATE -- gz* functions cannot compress (to avoid linking deflate
code when not needed)
17: NO_GUNZIP -- inflate can't detect and decode gzip streams, to avoid
linking crc code
17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
and decode gzip streams (to avoid linking crc code)
18-19: 0 (reserved)
Operation variations (changes in library functionality):

View File

@@ -74,7 +74,7 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef NO_DEFLATE
flags += 1 << 16;
#endif
#ifdef NO_GUNZIP
#ifdef NO_GZIP
flags += 1 << 17;
#endif
#ifdef PKZIP_BUG_WORKAROUND