Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
- Loading branch information
Showing
27 changed files
with
10,103 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
X = adler32.c \ | ||
compress.c \ | ||
crc32.c \ | ||
crc32.h \ | ||
deflate.c \ | ||
deflate.h \ | ||
gzio.c \ | ||
infback.c \ | ||
inffast.c \ | ||
inffast.h \ | ||
inffixed.h \ | ||
inflate.c \ | ||
inflate.h \ | ||
inftrees.c \ | ||
inftrees.h \ | ||
trees.c \ | ||
trees.h \ | ||
uncompr.c \ | ||
zconf.h \ | ||
zlib.h \ | ||
zutil.c \ | ||
zutil.h | ||
|
||
if BUILD_ZLIB | ||
noinst_LTLIBRARIES = libz.la | ||
libz_la_SOURCES = $(X) | ||
endif | ||
|
||
EXTRA_DIST = $(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* adler32.c -- compute the Adler-32 checksum of a data stream | ||
* Copyright (C) 1995-2003 Mark Adler | ||
* For conditions of distribution and use, see copyright notice in zlib.h | ||
*/ | ||
|
||
/* @(#) $Id: adler32.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */ | ||
|
||
#define ZLIB_INTERNAL | ||
#include "zlib.h" | ||
|
||
#define BASE 65521UL /* largest prime smaller than 65536 */ | ||
#define NMAX 5552 | ||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ | ||
|
||
#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} | ||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); | ||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); | ||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); | ||
#define DO16(buf) DO8(buf,0); DO8(buf,8); | ||
|
||
#ifdef NO_DIVIDE | ||
# define MOD(a) \ | ||
do { \ | ||
if (a >= (BASE << 16)) a -= (BASE << 16); \ | ||
if (a >= (BASE << 15)) a -= (BASE << 15); \ | ||
if (a >= (BASE << 14)) a -= (BASE << 14); \ | ||
if (a >= (BASE << 13)) a -= (BASE << 13); \ | ||
if (a >= (BASE << 12)) a -= (BASE << 12); \ | ||
if (a >= (BASE << 11)) a -= (BASE << 11); \ | ||
if (a >= (BASE << 10)) a -= (BASE << 10); \ | ||
if (a >= (BASE << 9)) a -= (BASE << 9); \ | ||
if (a >= (BASE << 8)) a -= (BASE << 8); \ | ||
if (a >= (BASE << 7)) a -= (BASE << 7); \ | ||
if (a >= (BASE << 6)) a -= (BASE << 6); \ | ||
if (a >= (BASE << 5)) a -= (BASE << 5); \ | ||
if (a >= (BASE << 4)) a -= (BASE << 4); \ | ||
if (a >= (BASE << 3)) a -= (BASE << 3); \ | ||
if (a >= (BASE << 2)) a -= (BASE << 2); \ | ||
if (a >= (BASE << 1)) a -= (BASE << 1); \ | ||
if (a >= BASE) a -= BASE; \ | ||
} while (0) | ||
#else | ||
# define MOD(a) a %= BASE | ||
#endif | ||
|
||
/* ========================================================================= */ | ||
uLong ZEXPORT adler32(adler, buf, len) | ||
uLong adler; | ||
const Bytef *buf; | ||
uInt len; | ||
{ | ||
unsigned long s1 = adler & 0xffff; | ||
unsigned long s2 = (adler >> 16) & 0xffff; | ||
int k; | ||
|
||
if (buf == Z_NULL) return 1L; | ||
|
||
while (len > 0) { | ||
k = len < NMAX ? (int)len : NMAX; | ||
len -= k; | ||
while (k >= 16) { | ||
DO16(buf); | ||
buf += 16; | ||
k -= 16; | ||
} | ||
if (k != 0) do { | ||
s1 += *buf++; | ||
s2 += s1; | ||
} while (--k); | ||
MOD(s1); | ||
MOD(s2); | ||
} | ||
return (s2 << 16) | s1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* compress.c -- compress a memory buffer | ||
* Copyright (C) 1995-2002 Jean-loup Gailly. | ||
* For conditions of distribution and use, see copyright notice in zlib.h | ||
*/ | ||
|
||
/* @(#) $Id: compress.c,v 1.1 2003/12/07 05:29:20 icculus Exp $ */ | ||
|
||
#define ZLIB_INTERNAL | ||
#include "zlib.h" | ||
|
||
/* =========================================================================== | ||
Compresses the source buffer into the destination buffer. The level | ||
parameter has the same meaning as in deflateInit. sourceLen is the byte | ||
length of the source buffer. Upon entry, destLen is the total size of the | ||
destination buffer, which must be at least 0.1% larger than sourceLen plus | ||
12 bytes. Upon exit, destLen is the actual size of the compressed buffer. | ||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
memory, Z_BUF_ERROR if there was not enough room in the output buffer, | ||
Z_STREAM_ERROR if the level parameter is invalid. | ||
*/ | ||
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) | ||
Bytef *dest; | ||
uLongf *destLen; | ||
const Bytef *source; | ||
uLong sourceLen; | ||
int level; | ||
{ | ||
z_stream stream; | ||
int err; | ||
|
||
stream.next_in = (Bytef*)source; | ||
stream.avail_in = (uInt)sourceLen; | ||
#ifdef MAXSEG_64K | ||
/* Check for source > 64K on 16-bit machine: */ | ||
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; | ||
#endif | ||
stream.next_out = dest; | ||
stream.avail_out = (uInt)*destLen; | ||
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; | ||
|
||
stream.zalloc = (alloc_func)0; | ||
stream.zfree = (free_func)0; | ||
stream.opaque = (voidpf)0; | ||
|
||
err = deflateInit(&stream, level); | ||
if (err != Z_OK) return err; | ||
|
||
err = deflate(&stream, Z_FINISH); | ||
if (err != Z_STREAM_END) { | ||
deflateEnd(&stream); | ||
return err == Z_OK ? Z_BUF_ERROR : err; | ||
} | ||
*destLen = stream.total_out; | ||
|
||
err = deflateEnd(&stream); | ||
return err; | ||
} | ||
|
||
/* =========================================================================== | ||
*/ | ||
int ZEXPORT compress (dest, destLen, source, sourceLen) | ||
Bytef *dest; | ||
uLongf *destLen; | ||
const Bytef *source; | ||
uLong sourceLen; | ||
{ | ||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); | ||
} | ||
|
||
/* =========================================================================== | ||
If the default memLevel or windowBits for deflateInit() is changed, then | ||
this function needs to be updated. | ||
*/ | ||
uLong ZEXPORT compressBound (sourceLen) | ||
uLong sourceLen; | ||
{ | ||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; | ||
} |
Oops, something went wrong.