v0.55
This commit is contained in:
parent
ebe22eeace
commit
d20061a62a
16 changed files with 603 additions and 136 deletions
21
UnAlz.cpp
21
UnAlz.cpp
|
@ -113,6 +113,7 @@ static time_t dosTime2TimeT(UINT32 dostime) // from INFO-ZIP src
|
||||||
static const char* errorstrtable[]=
|
static const char* errorstrtable[]=
|
||||||
{
|
{
|
||||||
"no error", // ERR_NOERR
|
"no error", // ERR_NOERR
|
||||||
|
"general error", // ERR_GENERAL
|
||||||
"can't open archive file", // ERR_CANT_OPEN_FILE
|
"can't open archive file", // ERR_CANT_OPEN_FILE
|
||||||
"can't open dest file or path", // ERR_CANT_OPEN_DEST_FILE
|
"can't open dest file or path", // ERR_CANT_OPEN_DEST_FILE
|
||||||
// "can't create dest path", // ERR_CANT_CREATE_DEST_PATH
|
// "can't create dest path", // ERR_CANT_CREATE_DEST_PATH
|
||||||
|
@ -678,6 +679,15 @@ BOOL CUnAlz::ExtractCurrentFile(const char* szDestPathName, const char* szDestFi
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( szDestPathName==NULL||
|
||||||
|
strlen(szDestPathName) + (szDestFileName?strlen(szDestFileName):strlen(m_posCur->fileName))+1 > MAX_PATH
|
||||||
|
) // check buffer overflow
|
||||||
|
{
|
||||||
|
ASSERT(0);
|
||||||
|
m_nErr = ERR_GENERAL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// °æ·Î¸í
|
// °æ·Î¸í
|
||||||
strcpy(szDestPathFileName, szDestPathName);
|
strcpy(szDestPathFileName, szDestPathName);
|
||||||
|
@ -688,6 +698,17 @@ BOOL CUnAlz::ExtractCurrentFile(const char* szDestPathName, const char* szDestFi
|
||||||
if(szDestFileName) strcat(szDestPathFileName, szDestFileName);
|
if(szDestFileName) strcat(szDestPathFileName, szDestFileName);
|
||||||
else strcat(szDestPathFileName, m_posCur->fileName);
|
else strcat(szDestPathFileName, m_posCur->fileName);
|
||||||
|
|
||||||
|
// ../../ 형식의 보안 버그 확인
|
||||||
|
if( strstr(szDestPathFileName, "../")||
|
||||||
|
strstr(szDestPathFileName, "..\\"))
|
||||||
|
{
|
||||||
|
ASSERT(0);
|
||||||
|
m_nErr = ERR_GENERAL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
{
|
{
|
||||||
char* p = szDestPathFileName; // °æ·Î delimiter ¹Ù²Ù±â
|
char* p = szDestPathFileName; // °æ·Î delimiter ¹Ù²Ù±â
|
||||||
|
|
13
UnAlz.h
13
UnAlz.h
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
COPYRIGHT(C) 2004-2005 hardkoder , http://www.kipple.pe.kr
|
COPYRIGHT(C) 2004-2006 hardkoder@gmail , http://www.kipple.pe.kr
|
||||||
|
|
||||||
저작권 정보 : ( BSD License )
|
저작권 정보 : ( BSD License )
|
||||||
- 이 소스는 자유로이 사용/수정/재배포 가능합니다.
|
- 이 소스는 자유로이 사용/수정/재배포 가능합니다.
|
||||||
|
@ -71,10 +71,10 @@
|
||||||
2005/07/27 - main() 에 setlocale() 추가
|
2005/07/27 - main() 에 setlocale() 추가
|
||||||
- unalz 0.52
|
- unalz 0.52
|
||||||
2005/10/15 - NetBSD 에서 컴파일 되도록 수정 ( by minskim@bawi )
|
2005/10/15 - NetBSD 에서 컴파일 되도록 수정 ( by minskim@bawi )
|
||||||
|
2005/11/21 - buffer overflow 버그 수정 ( by Ulf Harnhammar )
|
||||||
- unalz 0.53
|
- unalz 0.53
|
||||||
2005/11/21 - 파일명 처리쪽에 있는 Buffer overflow 문제 수정 ( by Ulf Harnhammar <metaur@telia.com> )
|
2006/03/10 - .. 폴더 관련 보안 문제 수정 (by vuln@secunia )
|
||||||
- unalz 0.54
|
- unalz 0.55
|
||||||
|
|
||||||
|
|
||||||
기능 :
|
기능 :
|
||||||
- alz 파일의 압축 해제 (deflate/변형 bzip2/raw)
|
- alz 파일의 압축 해제 (deflate/변형 bzip2/raw)
|
||||||
|
@ -181,8 +181,8 @@ namespace UNALZ
|
||||||
# pragma pack(1)
|
# pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char UNALZ_VERSION[] = "CUnAlz0.53";
|
static const char UNALZ_VERSION[] = "CUnAlz0.55";
|
||||||
static const char UNALZ_COPYRIGHT[] = "Copyright(C) 2004-2005 by hardkoder ( http://www.kipple.pe.kr ) ";
|
static const char UNALZ_COPYRIGHT[] = "Copyright(C) 2004-2006 by hardkoder@gmail ( http://www.kipple.pe.kr ) ";
|
||||||
|
|
||||||
enum {ENCR_HEADER_LEN=12}; // xf86
|
enum {ENCR_HEADER_LEN=12}; // xf86
|
||||||
// 맨 파일 앞..
|
// 맨 파일 앞..
|
||||||
|
@ -408,6 +408,7 @@ public :
|
||||||
enum ERR ///< 에러 코드 - 정리 필요..
|
enum ERR ///< 에러 코드 - 정리 필요..
|
||||||
{
|
{
|
||||||
ERR_NOERR,
|
ERR_NOERR,
|
||||||
|
ERR_GENERAL, ///< GENERAL ERROR
|
||||||
ERR_CANT_OPEN_FILE, ///< 소스 파일 열기 실패
|
ERR_CANT_OPEN_FILE, ///< 소스 파일 열기 실패
|
||||||
ERR_CANT_OPEN_DEST_FILE, ///< 대상 파일 열기 실패
|
ERR_CANT_OPEN_DEST_FILE, ///< 대상 파일 열기 실패
|
||||||
// ERR_CANT_CREATE_DEST_PATH, ///< 대상 경로 만들기 실패
|
// ERR_CANT_CREATE_DEST_PATH, ///< 대상 경로 만들기 실패
|
||||||
|
|
5
main.cpp
5
main.cpp
|
@ -27,8 +27,9 @@ void Copyright()
|
||||||
// printf("unalz v0.51 (2005/07/24) \n");
|
// printf("unalz v0.51 (2005/07/24) \n");
|
||||||
// printf("unalz v0.52 (2005/07/27) \n");
|
// printf("unalz v0.52 (2005/07/27) \n");
|
||||||
// printf("unalz v0.53 (2005/10/15) \n");
|
// printf("unalz v0.53 (2005/10/15) \n");
|
||||||
printf("unalz v0.54 (2005/11/21) \n");
|
// printf("unalz v0.54 (2005/11/21) \n");
|
||||||
printf("Copyright(C) 2004-2005 by hardkoder (http://www.kipple.pe.kr) \n");
|
printf("unalz v0.55 (2006/03/10) \n");
|
||||||
|
printf("Copyright(C) 2004-2006 by hardkoder@gmail (http://www.kipple.pe.kr) \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ Project: "unalz"=.\unalz.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
|
begin source code control
|
||||||
|
"$/Home/unalz", VXBAAAAA
|
||||||
|
.
|
||||||
|
end source code control
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
|
|
111
zlib/adler32.c
111
zlib/adler32.c
|
@ -1,5 +1,5 @@
|
||||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2004 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -12,12 +12,13 @@
|
||||||
#define NMAX 5552
|
#define NMAX 5552
|
||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
/* 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 DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
|
||||||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
||||||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
||||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
||||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
||||||
|
|
||||||
|
/* use NO_DIVIDE if your processor does not do division in hardware */
|
||||||
#ifdef NO_DIVIDE
|
#ifdef NO_DIVIDE
|
||||||
# define MOD(a) \
|
# define MOD(a) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -39,8 +40,17 @@
|
||||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
||||||
if (a >= BASE) a -= BASE; \
|
if (a >= BASE) a -= BASE; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
# define MOD4(a) \
|
||||||
|
do { \
|
||||||
|
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
|
#else
|
||||||
# define MOD(a) a %= BASE
|
# define MOD(a) a %= BASE
|
||||||
|
# define MOD4(a) a %= BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
@ -49,26 +59,91 @@ uLong ZEXPORT adler32(adler, buf, len)
|
||||||
const Bytef *buf;
|
const Bytef *buf;
|
||||||
uInt len;
|
uInt len;
|
||||||
{
|
{
|
||||||
unsigned long s1 = adler & 0xffff;
|
unsigned long sum2;
|
||||||
unsigned long s2 = (adler >> 16) & 0xffff;
|
unsigned n;
|
||||||
int k;
|
|
||||||
|
|
||||||
if (buf == Z_NULL) return 1L;
|
/* split Adler-32 into component sums */
|
||||||
|
sum2 = (adler >> 16) & 0xffff;
|
||||||
|
adler &= 0xffff;
|
||||||
|
|
||||||
while (len > 0) {
|
/* in case user likes doing a byte at a time, keep it fast */
|
||||||
k = len < NMAX ? (int)len : NMAX;
|
if (len == 1) {
|
||||||
len -= k;
|
adler += buf[0];
|
||||||
while (k >= 16) {
|
if (adler >= BASE)
|
||||||
|
adler -= BASE;
|
||||||
|
sum2 += adler;
|
||||||
|
if (sum2 >= BASE)
|
||||||
|
sum2 -= BASE;
|
||||||
|
return adler | (sum2 << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
||||||
|
if (buf == Z_NULL)
|
||||||
|
return 1L;
|
||||||
|
|
||||||
|
/* in case short lengths are provided, keep it somewhat fast */
|
||||||
|
if (len < 16) {
|
||||||
|
while (len--) {
|
||||||
|
adler += *buf++;
|
||||||
|
sum2 += adler;
|
||||||
|
}
|
||||||
|
if (adler >= BASE)
|
||||||
|
adler -= BASE;
|
||||||
|
MOD4(sum2); /* only added so many BASE's */
|
||||||
|
return adler | (sum2 << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do length NMAX blocks -- requires just one modulo operation */
|
||||||
|
while (len >= NMAX) {
|
||||||
|
len -= NMAX;
|
||||||
|
n = NMAX / 16; /* NMAX is divisible by 16 */
|
||||||
|
do {
|
||||||
|
DO16(buf); /* 16 sums unrolled */
|
||||||
|
buf += 16;
|
||||||
|
} while (--n);
|
||||||
|
MOD(adler);
|
||||||
|
MOD(sum2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do remaining bytes (less than NMAX, still just one modulo) */
|
||||||
|
if (len) { /* avoid modulos if none remaining */
|
||||||
|
while (len >= 16) {
|
||||||
|
len -= 16;
|
||||||
DO16(buf);
|
DO16(buf);
|
||||||
buf += 16;
|
buf += 16;
|
||||||
k -= 16;
|
|
||||||
}
|
}
|
||||||
if (k != 0) do {
|
while (len--) {
|
||||||
s1 += *buf++;
|
adler += *buf++;
|
||||||
s2 += s1;
|
sum2 += adler;
|
||||||
} while (--k);
|
}
|
||||||
MOD(s1);
|
MOD(adler);
|
||||||
MOD(s2);
|
MOD(sum2);
|
||||||
}
|
}
|
||||||
return (s2 << 16) | s1;
|
|
||||||
|
/* return recombined sums */
|
||||||
|
return adler | (sum2 << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
||||||
|
uLong adler1;
|
||||||
|
uLong adler2;
|
||||||
|
z_off_t len2;
|
||||||
|
{
|
||||||
|
unsigned long sum1;
|
||||||
|
unsigned long sum2;
|
||||||
|
unsigned rem;
|
||||||
|
|
||||||
|
/* the derivation of this formula is left as an exercise for the reader */
|
||||||
|
rem = (unsigned)(len2 % BASE);
|
||||||
|
sum1 = adler1 & 0xffff;
|
||||||
|
sum2 = rem * sum1;
|
||||||
|
MOD(sum2);
|
||||||
|
sum1 += (adler2 & 0xffff) + BASE - 1;
|
||||||
|
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
||||||
|
if (sum1 > BASE) sum1 -= BASE;
|
||||||
|
if (sum1 > BASE) sum1 -= BASE;
|
||||||
|
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
|
||||||
|
if (sum2 > BASE) sum2 -= BASE;
|
||||||
|
return sum1 | (sum2 << 16);
|
||||||
}
|
}
|
||||||
|
|
102
zlib/crc32.c
102
zlib/crc32.c
|
@ -1,12 +1,12 @@
|
||||||
/* crc32.c -- compute the CRC-32 of a data stream
|
/* crc32.c -- compute the CRC-32 of a data stream
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2005 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
|
||||||
*
|
*
|
||||||
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
||||||
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
|
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
|
||||||
* tables for updating the shift register in one step with three exclusive-ors
|
* tables for updating the shift register in one step with three exclusive-ors
|
||||||
* instead of four steps with four exclusive-ors. This results about a factor
|
* instead of four steps with four exclusive-ors. This results in about a
|
||||||
* of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
|
* factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* @(#) $Id$ */
|
/* @(#) $Id$ */
|
||||||
|
@ -64,6 +64,11 @@
|
||||||
# define TBLS 1
|
# define TBLS 1
|
||||||
#endif /* BYFOUR */
|
#endif /* BYFOUR */
|
||||||
|
|
||||||
|
/* Local functions for crc concatenation */
|
||||||
|
local unsigned long gf2_matrix_times OF((unsigned long *mat,
|
||||||
|
unsigned long vec));
|
||||||
|
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
|
||||||
local volatile int crc_table_empty = 1;
|
local volatile int crc_table_empty = 1;
|
||||||
|
@ -72,7 +77,6 @@ local void make_crc_table OF((void));
|
||||||
#ifdef MAKECRCH
|
#ifdef MAKECRCH
|
||||||
local void write_table OF((FILE *, const unsigned long FAR *));
|
local void write_table OF((FILE *, const unsigned long FAR *));
|
||||||
#endif /* MAKECRCH */
|
#endif /* MAKECRCH */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
|
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
|
||||||
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
|
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
|
||||||
|
@ -270,7 +274,7 @@ local unsigned long crc32_little(crc, buf, len)
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf4 = (const u4 FAR *)buf;
|
buf4 = (const u4 FAR *)(const void FAR *)buf;
|
||||||
while (len >= 32) {
|
while (len >= 32) {
|
||||||
DOLIT32;
|
DOLIT32;
|
||||||
len -= 32;
|
len -= 32;
|
||||||
|
@ -310,7 +314,7 @@ local unsigned long crc32_big(crc, buf, len)
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf4 = (const u4 FAR *)buf;
|
buf4 = (const u4 FAR *)(const void FAR *)buf;
|
||||||
buf4--;
|
buf4--;
|
||||||
while (len >= 32) {
|
while (len >= 32) {
|
||||||
DOBIG32;
|
DOBIG32;
|
||||||
|
@ -331,3 +335,89 @@ local unsigned long crc32_big(crc, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* BYFOUR */
|
#endif /* BYFOUR */
|
||||||
|
|
||||||
|
#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
local unsigned long gf2_matrix_times(mat, vec)
|
||||||
|
unsigned long *mat;
|
||||||
|
unsigned long vec;
|
||||||
|
{
|
||||||
|
unsigned long sum;
|
||||||
|
|
||||||
|
sum = 0;
|
||||||
|
while (vec) {
|
||||||
|
if (vec & 1)
|
||||||
|
sum ^= *mat;
|
||||||
|
vec >>= 1;
|
||||||
|
mat++;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
local void gf2_matrix_square(square, mat)
|
||||||
|
unsigned long *square;
|
||||||
|
unsigned long *mat;
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
for (n = 0; n < GF2_DIM; n++)
|
||||||
|
square[n] = gf2_matrix_times(mat, mat[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
||||||
|
uLong crc1;
|
||||||
|
uLong crc2;
|
||||||
|
z_off_t len2;
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
unsigned long row;
|
||||||
|
unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
|
||||||
|
unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
|
||||||
|
|
||||||
|
/* degenerate case */
|
||||||
|
if (len2 == 0)
|
||||||
|
return crc1;
|
||||||
|
|
||||||
|
/* put operator for one zero bit in odd */
|
||||||
|
odd[0] = 0xedb88320L; /* CRC-32 polynomial */
|
||||||
|
row = 1;
|
||||||
|
for (n = 1; n < GF2_DIM; n++) {
|
||||||
|
odd[n] = row;
|
||||||
|
row <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* put operator for two zero bits in even */
|
||||||
|
gf2_matrix_square(even, odd);
|
||||||
|
|
||||||
|
/* put operator for four zero bits in odd */
|
||||||
|
gf2_matrix_square(odd, even);
|
||||||
|
|
||||||
|
/* apply len2 zeros to crc1 (first square will put the operator for one
|
||||||
|
zero byte, eight zero bits, in even) */
|
||||||
|
do {
|
||||||
|
/* apply zeros operator for this bit of len2 */
|
||||||
|
gf2_matrix_square(even, odd);
|
||||||
|
if (len2 & 1)
|
||||||
|
crc1 = gf2_matrix_times(even, crc1);
|
||||||
|
len2 >>= 1;
|
||||||
|
|
||||||
|
/* if no more bits set, then done */
|
||||||
|
if (len2 == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* another iteration of the loop with odd and even swapped */
|
||||||
|
gf2_matrix_square(odd, even);
|
||||||
|
if (len2 & 1)
|
||||||
|
crc1 = gf2_matrix_times(odd, crc1);
|
||||||
|
len2 >>= 1;
|
||||||
|
|
||||||
|
/* if no more bits set, then done */
|
||||||
|
} while (len2 != 0);
|
||||||
|
|
||||||
|
/* return combined crc */
|
||||||
|
crc1 ^= crc2;
|
||||||
|
return crc1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* infback.c -- inflate using a call-back interface
|
/* infback.c -- inflate using a call-back interface
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ local void fixedtables OF((struct inflate_state FAR *state));
|
||||||
window and output buffer that is 2**windowBits bytes.
|
window and output buffer that is 2**windowBits bytes.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
|
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
|
||||||
z_stream FAR *strm;
|
z_streamp strm;
|
||||||
int windowBits;
|
int windowBits;
|
||||||
unsigned char FAR *window;
|
unsigned char FAR *window;
|
||||||
const char *version;
|
const char *version;
|
||||||
|
@ -50,7 +50,8 @@ int stream_size;
|
||||||
sizeof(struct inflate_state));
|
sizeof(struct inflate_state));
|
||||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||||
Tracev((stderr, "inflate: allocated\n"));
|
Tracev((stderr, "inflate: allocated\n"));
|
||||||
strm->state = (voidpf)state;
|
strm->state = (struct internal_state FAR *)state;
|
||||||
|
state->dmax = 32768U;
|
||||||
state->wbits = windowBits;
|
state->wbits = windowBits;
|
||||||
state->wsize = 1U << windowBits;
|
state->wsize = 1U << windowBits;
|
||||||
state->window = window;
|
state->window = window;
|
||||||
|
@ -238,7 +239,7 @@ struct inflate_state FAR *state;
|
||||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
|
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
|
||||||
z_stream FAR *strm;
|
z_streamp strm;
|
||||||
in_func in;
|
in_func in;
|
||||||
void FAR *in_desc;
|
void FAR *in_desc;
|
||||||
out_func out;
|
out_func out;
|
||||||
|
@ -611,7 +612,7 @@ void FAR *out_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateBackEnd(strm)
|
int ZEXPORT inflateBackEnd(strm)
|
||||||
z_stream FAR *strm;
|
z_streamp strm;
|
||||||
{
|
{
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
|
|
|
@ -74,6 +74,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
unsigned char FAR *out; /* local strm->next_out */
|
unsigned char FAR *out; /* local strm->next_out */
|
||||||
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
|
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
|
||||||
unsigned char FAR *end; /* while out < end, enough space available */
|
unsigned char FAR *end; /* while out < end, enough space available */
|
||||||
|
#ifdef INFLATE_STRICT
|
||||||
|
unsigned dmax; /* maximum distance from zlib header */
|
||||||
|
#endif
|
||||||
unsigned wsize; /* window size or zero if not using window */
|
unsigned wsize; /* window size or zero if not using window */
|
||||||
unsigned whave; /* valid bytes in the window */
|
unsigned whave; /* valid bytes in the window */
|
||||||
unsigned write; /* window write index */
|
unsigned write; /* window write index */
|
||||||
|
@ -98,6 +101,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
out = strm->next_out - OFF;
|
out = strm->next_out - OFF;
|
||||||
beg = out - (start - strm->avail_out);
|
beg = out - (start - strm->avail_out);
|
||||||
end = out + (strm->avail_out - 257);
|
end = out + (strm->avail_out - 257);
|
||||||
|
#ifdef INFLATE_STRICT
|
||||||
|
dmax = state->dmax;
|
||||||
|
#endif
|
||||||
wsize = state->wsize;
|
wsize = state->wsize;
|
||||||
whave = state->whave;
|
whave = state->whave;
|
||||||
write = state->write;
|
write = state->write;
|
||||||
|
@ -167,6 +173,13 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dist += (unsigned)hold & ((1U << op) - 1);
|
dist += (unsigned)hold & ((1U << op) - 1);
|
||||||
|
#ifdef INFLATE_STRICT
|
||||||
|
if (dist > dmax) {
|
||||||
|
strm->msg = (char *)"invalid distance too far back";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
hold >>= op;
|
hold >>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
Tracevv((stderr, "inflate: distance %u\n", dist));
|
Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||||
|
|
126
zlib/inflate.c
126
zlib/inflate.c
|
@ -1,5 +1,5 @@
|
||||||
/* inflate.c -- zlib decompression
|
/* inflate.c -- zlib decompression
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -113,8 +113,11 @@ z_streamp strm;
|
||||||
state->mode = HEAD;
|
state->mode = HEAD;
|
||||||
state->last = 0;
|
state->last = 0;
|
||||||
state->havedict = 0;
|
state->havedict = 0;
|
||||||
|
state->dmax = 32768U;
|
||||||
|
state->head = Z_NULL;
|
||||||
state->wsize = 0;
|
state->wsize = 0;
|
||||||
state->whave = 0;
|
state->whave = 0;
|
||||||
|
state->write = 0;
|
||||||
state->hold = 0;
|
state->hold = 0;
|
||||||
state->bits = 0;
|
state->bits = 0;
|
||||||
state->lencode = state->distcode = state->next = state->codes;
|
state->lencode = state->distcode = state->next = state->codes;
|
||||||
|
@ -122,6 +125,22 @@ z_streamp strm;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZEXPORT inflatePrime(strm, bits, value)
|
||||||
|
z_streamp strm;
|
||||||
|
int bits;
|
||||||
|
int value;
|
||||||
|
{
|
||||||
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
|
||||||
|
value &= (1L << bits) - 1;
|
||||||
|
state->hold += value << state->bits;
|
||||||
|
state->bits += bits;
|
||||||
|
return Z_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
int windowBits;
|
int windowBits;
|
||||||
|
@ -144,7 +163,7 @@ int stream_size;
|
||||||
ZALLOC(strm, 1, sizeof(struct inflate_state));
|
ZALLOC(strm, 1, sizeof(struct inflate_state));
|
||||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||||
Tracev((stderr, "inflate: allocated\n"));
|
Tracev((stderr, "inflate: allocated\n"));
|
||||||
strm->state = (voidpf)state;
|
strm->state = (struct internal_state FAR *)state;
|
||||||
if (windowBits < 0) {
|
if (windowBits < 0) {
|
||||||
state->wrap = 0;
|
state->wrap = 0;
|
||||||
windowBits = -windowBits;
|
windowBits = -windowBits;
|
||||||
|
@ -582,6 +601,8 @@ int flush;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->flags = 0; /* expect zlib header */
|
state->flags = 0; /* expect zlib header */
|
||||||
|
if (state->head != Z_NULL)
|
||||||
|
state->head->done = -1;
|
||||||
if (!(state->wrap & 1) || /* check if zlib header allowed */
|
if (!(state->wrap & 1) || /* check if zlib header allowed */
|
||||||
#else
|
#else
|
||||||
if (
|
if (
|
||||||
|
@ -597,11 +618,13 @@ int flush;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DROPBITS(4);
|
DROPBITS(4);
|
||||||
if (BITS(4) + 8 > state->wbits) {
|
len = BITS(4) + 8;
|
||||||
|
if (len > state->wbits) {
|
||||||
strm->msg = (char *)"invalid window size";
|
strm->msg = (char *)"invalid window size";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
state->dmax = 1U << len;
|
||||||
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;
|
||||||
|
@ -621,16 +644,24 @@ int flush;
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (state->head != Z_NULL)
|
||||||
|
state->head->text = (int)((hold >> 8) & 1);
|
||||||
if (state->flags & 0x0200) CRC2(state->check, hold);
|
if (state->flags & 0x0200) CRC2(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = TIME;
|
state->mode = TIME;
|
||||||
case TIME:
|
case TIME:
|
||||||
NEEDBITS(32);
|
NEEDBITS(32);
|
||||||
|
if (state->head != Z_NULL)
|
||||||
|
state->head->time = hold;
|
||||||
if (state->flags & 0x0200) CRC4(state->check, hold);
|
if (state->flags & 0x0200) CRC4(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = OS;
|
state->mode = OS;
|
||||||
case OS:
|
case OS:
|
||||||
NEEDBITS(16);
|
NEEDBITS(16);
|
||||||
|
if (state->head != Z_NULL) {
|
||||||
|
state->head->xflags = (int)(hold & 0xff);
|
||||||
|
state->head->os = (int)(hold >> 8);
|
||||||
|
}
|
||||||
if (state->flags & 0x0200) CRC2(state->check, hold);
|
if (state->flags & 0x0200) CRC2(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
state->mode = EXLEN;
|
state->mode = EXLEN;
|
||||||
|
@ -638,15 +669,26 @@ int flush;
|
||||||
if (state->flags & 0x0400) {
|
if (state->flags & 0x0400) {
|
||||||
NEEDBITS(16);
|
NEEDBITS(16);
|
||||||
state->length = (unsigned)(hold);
|
state->length = (unsigned)(hold);
|
||||||
|
if (state->head != Z_NULL)
|
||||||
|
state->head->extra_len = (unsigned)hold;
|
||||||
if (state->flags & 0x0200) CRC2(state->check, hold);
|
if (state->flags & 0x0200) CRC2(state->check, hold);
|
||||||
INITBITS();
|
INITBITS();
|
||||||
}
|
}
|
||||||
|
else if (state->head != Z_NULL)
|
||||||
|
state->head->extra = Z_NULL;
|
||||||
state->mode = EXTRA;
|
state->mode = EXTRA;
|
||||||
case EXTRA:
|
case EXTRA:
|
||||||
if (state->flags & 0x0400) {
|
if (state->flags & 0x0400) {
|
||||||
copy = state->length;
|
copy = state->length;
|
||||||
if (copy > have) copy = have;
|
if (copy > have) copy = have;
|
||||||
if (copy) {
|
if (copy) {
|
||||||
|
if (state->head != Z_NULL &&
|
||||||
|
state->head->extra != Z_NULL) {
|
||||||
|
len = state->head->extra_len - state->length;
|
||||||
|
zmemcpy(state->head->extra + len, next,
|
||||||
|
len + copy > state->head->extra_max ?
|
||||||
|
state->head->extra_max - len : copy);
|
||||||
|
}
|
||||||
if (state->flags & 0x0200)
|
if (state->flags & 0x0200)
|
||||||
state->check = crc32(state->check, next, copy);
|
state->check = crc32(state->check, next, copy);
|
||||||
have -= copy;
|
have -= copy;
|
||||||
|
@ -655,6 +697,7 @@ int flush;
|
||||||
}
|
}
|
||||||
if (state->length) goto inf_leave;
|
if (state->length) goto inf_leave;
|
||||||
}
|
}
|
||||||
|
state->length = 0;
|
||||||
state->mode = NAME;
|
state->mode = NAME;
|
||||||
case NAME:
|
case NAME:
|
||||||
if (state->flags & 0x0800) {
|
if (state->flags & 0x0800) {
|
||||||
|
@ -662,13 +705,20 @@ int flush;
|
||||||
copy = 0;
|
copy = 0;
|
||||||
do {
|
do {
|
||||||
len = (unsigned)(next[copy++]);
|
len = (unsigned)(next[copy++]);
|
||||||
|
if (state->head != Z_NULL &&
|
||||||
|
state->head->name != Z_NULL &&
|
||||||
|
state->length < state->head->name_max)
|
||||||
|
state->head->name[state->length++] = len;
|
||||||
} while (len && copy < have);
|
} while (len && copy < have);
|
||||||
if (state->flags & 0x02000)
|
if (state->flags & 0x0200)
|
||||||
state->check = crc32(state->check, next, copy);
|
state->check = crc32(state->check, next, copy);
|
||||||
have -= copy;
|
have -= copy;
|
||||||
next += copy;
|
next += copy;
|
||||||
if (len) goto inf_leave;
|
if (len) goto inf_leave;
|
||||||
}
|
}
|
||||||
|
else if (state->head != Z_NULL)
|
||||||
|
state->head->name = Z_NULL;
|
||||||
|
state->length = 0;
|
||||||
state->mode = COMMENT;
|
state->mode = COMMENT;
|
||||||
case COMMENT:
|
case COMMENT:
|
||||||
if (state->flags & 0x1000) {
|
if (state->flags & 0x1000) {
|
||||||
|
@ -676,13 +726,19 @@ int flush;
|
||||||
copy = 0;
|
copy = 0;
|
||||||
do {
|
do {
|
||||||
len = (unsigned)(next[copy++]);
|
len = (unsigned)(next[copy++]);
|
||||||
|
if (state->head != Z_NULL &&
|
||||||
|
state->head->comment != Z_NULL &&
|
||||||
|
state->length < state->head->comm_max)
|
||||||
|
state->head->comment[state->length++] = len;
|
||||||
} while (len && copy < have);
|
} while (len && copy < have);
|
||||||
if (state->flags & 0x02000)
|
if (state->flags & 0x0200)
|
||||||
state->check = crc32(state->check, next, copy);
|
state->check = crc32(state->check, next, copy);
|
||||||
have -= copy;
|
have -= copy;
|
||||||
next += copy;
|
next += copy;
|
||||||
if (len) goto inf_leave;
|
if (len) goto inf_leave;
|
||||||
}
|
}
|
||||||
|
else if (state->head != Z_NULL)
|
||||||
|
state->head->comment = Z_NULL;
|
||||||
state->mode = HCRC;
|
state->mode = HCRC;
|
||||||
case HCRC:
|
case HCRC:
|
||||||
if (state->flags & 0x0200) {
|
if (state->flags & 0x0200) {
|
||||||
|
@ -694,6 +750,10 @@ int flush;
|
||||||
}
|
}
|
||||||
INITBITS();
|
INITBITS();
|
||||||
}
|
}
|
||||||
|
if (state->head != Z_NULL) {
|
||||||
|
state->head->hcrc = (int)((state->flags >> 9) & 1);
|
||||||
|
state->head->done = 1;
|
||||||
|
}
|
||||||
strm->adler = state->check = crc32(0L, Z_NULL, 0);
|
strm->adler = state->check = crc32(0L, Z_NULL, 0);
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
break;
|
break;
|
||||||
|
@ -969,6 +1029,13 @@ int flush;
|
||||||
state->offset += BITS(state->extra);
|
state->offset += BITS(state->extra);
|
||||||
DROPBITS(state->extra);
|
DROPBITS(state->extra);
|
||||||
}
|
}
|
||||||
|
#ifdef INFLATE_STRICT
|
||||||
|
if (state->offset > state->dmax) {
|
||||||
|
strm->msg = (char *)"invalid distance too far back";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (state->offset > state->whave + out - left) {
|
if (state->offset > state->whave + out - left) {
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
strm->msg = (char *)"invalid distance too far back";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
|
@ -1110,12 +1177,16 @@ uInt dictLength;
|
||||||
/* check state */
|
/* check state */
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
if (state->mode != DICT) return Z_STREAM_ERROR;
|
if (state->wrap != 0 && state->mode != DICT)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
/* check for correct dictionary id */
|
/* check for correct dictionary id */
|
||||||
id = adler32(0L, Z_NULL, 0);
|
if (state->mode == DICT) {
|
||||||
id = adler32(id, dictionary, dictLength);
|
id = adler32(0L, Z_NULL, 0);
|
||||||
if (id != state->check) return Z_DATA_ERROR;
|
id = adler32(id, dictionary, dictLength);
|
||||||
|
if (id != state->check)
|
||||||
|
return Z_DATA_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy dictionary to window */
|
/* copy dictionary to window */
|
||||||
if (updatewindow(strm, strm->avail_out)) {
|
if (updatewindow(strm, strm->avail_out)) {
|
||||||
|
@ -1137,6 +1208,23 @@ uInt dictLength;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZEXPORT inflateGetHeader(strm, head)
|
||||||
|
z_streamp strm;
|
||||||
|
gz_headerp head;
|
||||||
|
{
|
||||||
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
/* check state */
|
||||||
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* save header structure */
|
||||||
|
state->head = head;
|
||||||
|
head->done = 0;
|
||||||
|
return Z_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
|
Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
|
||||||
or when out of input. When called, *have is the number of pattern bytes
|
or when out of input. When called, *have is the number of pattern bytes
|
||||||
|
@ -1239,6 +1327,7 @@ z_streamp source;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
struct inflate_state FAR *copy;
|
struct inflate_state FAR *copy;
|
||||||
unsigned char FAR *window;
|
unsigned char FAR *window;
|
||||||
|
unsigned wsize;
|
||||||
|
|
||||||
/* check input */
|
/* check input */
|
||||||
if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
|
if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
|
||||||
|
@ -1261,14 +1350,19 @@ z_streamp source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy state */
|
/* copy state */
|
||||||
*dest = *source;
|
zmemcpy(dest, source, sizeof(z_stream));
|
||||||
*copy = *state;
|
zmemcpy(copy, state, sizeof(struct inflate_state));
|
||||||
copy->lencode = copy->codes + (state->lencode - state->codes);
|
if (state->lencode >= state->codes &&
|
||||||
copy->distcode = copy->codes + (state->distcode - state->codes);
|
state->lencode <= state->codes + ENOUGH - 1) {
|
||||||
|
copy->lencode = copy->codes + (state->lencode - state->codes);
|
||||||
|
copy->distcode = copy->codes + (state->distcode - state->codes);
|
||||||
|
}
|
||||||
copy->next = copy->codes + (state->next - state->codes);
|
copy->next = copy->codes + (state->next - state->codes);
|
||||||
if (window != Z_NULL)
|
if (window != Z_NULL) {
|
||||||
zmemcpy(window, state->window, 1U << state->wbits);
|
wsize = 1U << state->wbits;
|
||||||
|
zmemcpy(window, state->window, wsize);
|
||||||
|
}
|
||||||
copy->window = window;
|
copy->window = window;
|
||||||
dest->state = (voidpf)copy;
|
dest->state = (struct internal_state FAR *)copy;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inflate.h -- internal inflate state definition
|
/* inflate.h -- internal inflate state definition
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2004 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
||||||
/* Possible inflate modes between inflate() calls */
|
/* Possible inflate modes between inflate() calls */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HEAD, /* i: waiting for magic header */
|
HEAD, /* i: waiting for magic header */
|
||||||
#ifdef GUNZIP
|
|
||||||
FLAGS, /* i: waiting for method and flags (gzip) */
|
FLAGS, /* i: waiting for method and flags (gzip) */
|
||||||
TIME, /* i: waiting for modification time (gzip) */
|
TIME, /* i: waiting for modification time (gzip) */
|
||||||
OS, /* i: waiting for extra flags and operating system (gzip) */
|
OS, /* i: waiting for extra flags and operating system (gzip) */
|
||||||
|
@ -28,7 +27,6 @@ typedef enum {
|
||||||
NAME, /* i: waiting for end of file name (gzip) */
|
NAME, /* i: waiting for end of file name (gzip) */
|
||||||
COMMENT, /* i: waiting for end of comment (gzip) */
|
COMMENT, /* i: waiting for end of comment (gzip) */
|
||||||
HCRC, /* i: waiting for header crc (gzip) */
|
HCRC, /* i: waiting for header crc (gzip) */
|
||||||
#endif
|
|
||||||
DICTID, /* i: waiting for dictionary check value */
|
DICTID, /* i: waiting for dictionary check value */
|
||||||
DICT, /* waiting for inflateSetDictionary() call */
|
DICT, /* waiting for inflateSetDictionary() call */
|
||||||
TYPE, /* i: waiting for type bits, including last-flag bit */
|
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||||
|
@ -45,9 +43,7 @@ typedef enum {
|
||||||
MATCH, /* o: waiting for output space to copy string */
|
MATCH, /* o: waiting for output space to copy string */
|
||||||
LIT, /* o: waiting for output space to write literal */
|
LIT, /* o: waiting for output space to write literal */
|
||||||
CHECK, /* i: waiting for 32-bit check value */
|
CHECK, /* i: waiting for 32-bit check value */
|
||||||
#ifdef GUNZIP
|
|
||||||
LENGTH, /* i: waiting for 32-bit length (gzip) */
|
LENGTH, /* i: waiting for 32-bit length (gzip) */
|
||||||
#endif
|
|
||||||
DONE, /* finished check, done -- remain here until reset */
|
DONE, /* finished check, done -- remain here until reset */
|
||||||
BAD, /* got a data error -- remain here until reset */
|
BAD, /* got a data error -- remain here until reset */
|
||||||
MEM, /* got an inflate() memory error -- remain here until reset */
|
MEM, /* got an inflate() memory error -- remain here until reset */
|
||||||
|
@ -84,8 +80,10 @@ 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 */
|
||||||
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) */
|
||||||
|
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 */
|
||||||
|
gz_headerp head; /* where to save gzip header information */
|
||||||
/* sliding window */
|
/* sliding window */
|
||||||
unsigned wbits; /* log base 2 of requested window size */
|
unsigned wbits; /* log base 2 of requested window size */
|
||||||
unsigned wsize; /* window size or zero if not using window */
|
unsigned wsize; /* window size or zero if not using window */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
* Copyright (C) 1995-2005 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.2 Copyright 1995-2004 Mark Adler ";
|
" inflate 1.2.3 Copyright 1995-2005 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, 199, 198};
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
|
||||||
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,
|
||||||
|
@ -134,7 +134,7 @@ unsigned short FAR *work;
|
||||||
left -= count[len];
|
left -= count[len];
|
||||||
if (left < 0) return -1; /* over-subscribed */
|
if (left < 0) return -1; /* over-subscribed */
|
||||||
}
|
}
|
||||||
if (left > 0 && (type == CODES || (codes - count[0] != 1)))
|
if (left > 0 && (type == CODES || max != 1))
|
||||||
return -1; /* incomplete set */
|
return -1; /* incomplete set */
|
||||||
|
|
||||||
/* generate offsets into symbol table for each length for sorting */
|
/* generate offsets into symbol table for each length for sorting */
|
||||||
|
@ -232,6 +232,7 @@ unsigned short FAR *work;
|
||||||
/* replicate for those indices with low len bits equal to huff */
|
/* replicate for those indices with low len bits equal to huff */
|
||||||
incr = 1U << (len - drop);
|
incr = 1U << (len - drop);
|
||||||
fill = 1U << curr;
|
fill = 1U << curr;
|
||||||
|
min = fill; /* save offset to next table */
|
||||||
do {
|
do {
|
||||||
fill -= incr;
|
fill -= incr;
|
||||||
next[(huff >> drop) + fill] = this;
|
next[(huff >> drop) + fill] = this;
|
||||||
|
@ -262,7 +263,7 @@ unsigned short FAR *work;
|
||||||
drop = root;
|
drop = root;
|
||||||
|
|
||||||
/* increment past last table */
|
/* increment past last table */
|
||||||
next += 1U << curr;
|
next += min; /* here min is 1 << curr */
|
||||||
|
|
||||||
/* determine length of next table */
|
/* determine length of next table */
|
||||||
curr = len - drop;
|
curr = len - drop;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftrees.h -- header to use inftrees.c
|
/* inftrees.h -- header to use inftrees.c
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
||||||
exhaustive search was 1004 code structures (850 for length/literals
|
exhaustive search was 1444 code structures (852 for length/literals
|
||||||
and 154 for distances, the latter actually the result of an
|
and 592 for distances, the latter actually the result of an
|
||||||
exhaustive search). The true maximum is not known, but the value
|
exhaustive search). The true maximum is not known, but the value
|
||||||
below is more than safe. */
|
below is more than safe. */
|
||||||
#define ENOUGH 1440
|
#define ENOUGH 2048
|
||||||
#define MAXD 154
|
#define MAXD 592
|
||||||
|
|
||||||
/* Type of code to build for inftable() */
|
/* Type of code to build for inftable() */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
12
zlib/zconf.h
12
zlib/zconf.h
|
@ -1,5 +1,5 @@
|
||||||
/* zconf.h -- configuration of the zlib compression library
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
* Copyright (C) 1995-2004 Jean-loup Gailly.
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@
|
||||||
# define get_crc_table z_get_crc_table
|
# define get_crc_table z_get_crc_table
|
||||||
# define zError z_zError
|
# define zError z_zError
|
||||||
|
|
||||||
|
# define alloc_func z_alloc_func
|
||||||
|
# define free_func z_free_func
|
||||||
|
# define in_func z_in_func
|
||||||
|
# define out_func z_out_func
|
||||||
# define Byte z_Byte
|
# define Byte z_Byte
|
||||||
# define uInt z_uInt
|
# define uInt z_uInt
|
||||||
# define uLong z_uLong
|
# define uLong z_uLong
|
||||||
|
@ -64,8 +68,10 @@
|
||||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||||
# define WINDOWS
|
# define WINDOWS
|
||||||
#endif
|
#endif
|
||||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||||
# define WIN32
|
# ifndef WIN32
|
||||||
|
# define WIN32
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||||
|
|
229
zlib/zlib.h
229
zlib/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.2, October 3rd, 2004
|
version 1.2.3, July 18th, 2005
|
||||||
|
|
||||||
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2005 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,8 +37,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZLIB_VERSION "1.2.2"
|
#define ZLIB_VERSION "1.2.3"
|
||||||
#define ZLIB_VERNUM 0x1220
|
#define ZLIB_VERNUM 0x1230
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The 'zlib' compression library provides in-memory compression and
|
The 'zlib' compression library provides in-memory compression and
|
||||||
|
@ -95,13 +95,36 @@ typedef struct z_stream_s {
|
||||||
free_func zfree; /* used to free the internal state */
|
free_func zfree; /* used to free the internal state */
|
||||||
voidpf opaque; /* private data object passed to zalloc and zfree */
|
voidpf opaque; /* private data object passed to zalloc and zfree */
|
||||||
|
|
||||||
int data_type; /* best guess about the data type: ascii or binary */
|
int data_type; /* best guess about the data type: binary or text */
|
||||||
uLong adler; /* adler32 value of the uncompressed data */
|
uLong adler; /* adler32 value of the uncompressed data */
|
||||||
uLong reserved; /* reserved for future use */
|
uLong reserved; /* reserved for future use */
|
||||||
} z_stream;
|
} z_stream;
|
||||||
|
|
||||||
typedef z_stream FAR *z_streamp;
|
typedef z_stream FAR *z_streamp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
gzip header information passed to and from zlib routines. See RFC 1952
|
||||||
|
for more details on the meanings of these fields.
|
||||||
|
*/
|
||||||
|
typedef struct gz_header_s {
|
||||||
|
int text; /* true if compressed data believed to be text */
|
||||||
|
uLong time; /* modification time */
|
||||||
|
int xflags; /* extra flags (not used when writing a gzip file) */
|
||||||
|
int os; /* operating system */
|
||||||
|
Bytef *extra; /* pointer to extra field or Z_NULL if none */
|
||||||
|
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
|
||||||
|
uInt extra_max; /* space at extra (only when reading header) */
|
||||||
|
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
|
||||||
|
uInt name_max; /* space at name (only when reading header) */
|
||||||
|
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
|
||||||
|
uInt comm_max; /* space at comment (only when reading header) */
|
||||||
|
int hcrc; /* true if there was or will be a header crc */
|
||||||
|
int done; /* true when done reading gzip header (not used
|
||||||
|
when writing a gzip file) */
|
||||||
|
} gz_header;
|
||||||
|
|
||||||
|
typedef gz_header FAR *gz_headerp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The application must update next_in and avail_in when avail_in has
|
The application must update next_in and avail_in when avail_in has
|
||||||
dropped to zero. It must update next_out and avail_out when avail_out
|
dropped to zero. It must update next_out and avail_out when avail_out
|
||||||
|
@ -166,11 +189,13 @@ typedef z_stream FAR *z_streamp;
|
||||||
#define Z_FILTERED 1
|
#define Z_FILTERED 1
|
||||||
#define Z_HUFFMAN_ONLY 2
|
#define Z_HUFFMAN_ONLY 2
|
||||||
#define Z_RLE 3
|
#define Z_RLE 3
|
||||||
|
#define Z_FIXED 4
|
||||||
#define Z_DEFAULT_STRATEGY 0
|
#define Z_DEFAULT_STRATEGY 0
|
||||||
/* compression strategy; see deflateInit2() below for details */
|
/* compression strategy; see deflateInit2() below for details */
|
||||||
|
|
||||||
#define Z_BINARY 0
|
#define Z_BINARY 0
|
||||||
#define Z_ASCII 1
|
#define Z_TEXT 1
|
||||||
|
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
|
||||||
#define Z_UNKNOWN 2
|
#define Z_UNKNOWN 2
|
||||||
/* Possible values of the data_type field (though see inflate()) */
|
/* Possible values of the data_type field (though see inflate()) */
|
||||||
|
|
||||||
|
@ -244,6 +269,10 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||||
and with zero avail_out, it must be called again after making room in the
|
and with zero avail_out, it must be called again after making room in the
|
||||||
output buffer because there might be more output pending.
|
output buffer because there might be more output pending.
|
||||||
|
|
||||||
|
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
|
||||||
|
decide how much data to accumualte before producing output, in order to
|
||||||
|
maximize compression.
|
||||||
|
|
||||||
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
|
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
|
||||||
flushed to the output buffer and the output is aligned on a byte boundary, so
|
flushed to the output buffer and the output is aligned on a byte boundary, so
|
||||||
that the decompressor can get all input data available so far. (In particular
|
that the decompressor can get all input data available so far. (In particular
|
||||||
|
@ -255,7 +284,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||||
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
|
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
|
||||||
restart from this point if previous compressed data has been damaged or if
|
restart from this point if previous compressed data has been damaged or if
|
||||||
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
|
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
|
||||||
the compression.
|
compression.
|
||||||
|
|
||||||
If deflate returns with avail_out == 0, this function must be called again
|
If deflate returns with avail_out == 0, this function must be called again
|
||||||
with the same value of the flush parameter and more output space (updated
|
with the same value of the flush parameter and more output space (updated
|
||||||
|
@ -280,8 +309,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||||
deflate() sets strm->adler to the adler32 checksum of all input read
|
deflate() sets strm->adler to the adler32 checksum of all input read
|
||||||
so far (that is, total_in bytes).
|
so far (that is, total_in bytes).
|
||||||
|
|
||||||
deflate() may update data_type if it can make a good guess about
|
deflate() may update strm->data_type if it can make a good guess about
|
||||||
the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
|
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
|
||||||
binary. This field is only for information purposes and does not affect
|
binary. This field is only for information purposes and does not affect
|
||||||
the compression algorithm in any manner.
|
the compression algorithm in any manner.
|
||||||
|
|
||||||
|
@ -363,11 +392,11 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||||
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
|
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
|
||||||
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
|
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
|
||||||
output as possible to the output buffer. Z_BLOCK requests that inflate() stop
|
output as possible to the output buffer. Z_BLOCK requests that inflate() stop
|
||||||
if and when it get to the next deflate block boundary. When decoding the zlib
|
if and when it gets to the next deflate block boundary. When decoding the
|
||||||
or gzip format, this will cause inflate() to return immediately after the
|
zlib or gzip format, this will cause inflate() to return immediately after
|
||||||
header and before the first block. When doing a raw inflate, inflate() will
|
the header and before the first block. When doing a raw inflate, inflate()
|
||||||
go ahead and process the first block, and will return when it gets to the end
|
will go ahead and process the first block, and will return when it gets to
|
||||||
of that block, or when it runs out of data.
|
the end of that block, or when it runs out of data.
|
||||||
|
|
||||||
The Z_BLOCK option assists in appending to or combining deflate streams.
|
The Z_BLOCK option assists in appending to or combining deflate streams.
|
||||||
Also to assist in this, on return inflate() will set strm->data_type to the
|
Also to assist in this, on return inflate() will set strm->data_type to the
|
||||||
|
@ -496,7 +525,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||||
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
|
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
|
||||||
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
|
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
|
||||||
parameter only affects the compression ratio but not the correctness of the
|
parameter only affects the compression ratio but not the correctness of the
|
||||||
compressed output even if it is not set appropriately.
|
compressed output even if it is not set appropriately. Z_FIXED prevents the
|
||||||
|
use of dynamic Huffman codes, allowing for a simpler decoder for special
|
||||||
|
applications.
|
||||||
|
|
||||||
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||||
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
|
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
|
||||||
|
@ -525,7 +556,9 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||||
deflateInit or deflateInit2, a part of the dictionary may in effect be
|
deflateInit or deflateInit2, a part of the dictionary may in effect be
|
||||||
discarded, for example if the dictionary is larger than the window size in
|
discarded, for example if the dictionary is larger than the window size in
|
||||||
deflate or deflate2. Thus the strings most likely to be useful should be
|
deflate or deflate2. Thus the strings most likely to be useful should be
|
||||||
put at the end of the dictionary, not at the front.
|
put at the end of the dictionary, not at the front. In addition, the
|
||||||
|
current implementation of deflate will use at most the window size minus
|
||||||
|
262 bytes of the provided dictionary.
|
||||||
|
|
||||||
Upon return of this function, strm->adler is set to the adler32 value
|
Upon return of this function, strm->adler is set to the adler32 value
|
||||||
of the dictionary; the decompressor may later use this value to determine
|
of the dictionary; the decompressor may later use this value to determine
|
||||||
|
@ -591,6 +624,23 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||||
if strm->avail_out was zero.
|
if strm->avail_out was zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
|
||||||
|
int good_length,
|
||||||
|
int max_lazy,
|
||||||
|
int nice_length,
|
||||||
|
int max_chain));
|
||||||
|
/*
|
||||||
|
Fine tune deflate's internal compression parameters. This should only be
|
||||||
|
used by someone who understands the algorithm used by zlib's deflate for
|
||||||
|
searching for the best matching string, and even then only by the most
|
||||||
|
fanatic optimizer trying to squeeze out the last compressed bit for their
|
||||||
|
specific input data. Read the deflate.c source code for the meaning of the
|
||||||
|
max_lazy, good_length, nice_length, and max_chain parameters.
|
||||||
|
|
||||||
|
deflateTune() can be called after deflateInit() or deflateInit2(), and
|
||||||
|
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
||||||
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
|
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
|
||||||
uLong sourceLen));
|
uLong sourceLen));
|
||||||
/*
|
/*
|
||||||
|
@ -616,6 +666,30 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
|
||||||
stream state was inconsistent.
|
stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
|
||||||
|
gz_headerp head));
|
||||||
|
/*
|
||||||
|
deflateSetHeader() provides gzip header information for when a gzip
|
||||||
|
stream is requested by deflateInit2(). deflateSetHeader() may be called
|
||||||
|
after deflateInit2() or deflateReset() and before the first call of
|
||||||
|
deflate(). The text, time, os, extra field, name, and comment information
|
||||||
|
in the provided gz_header structure are written to the gzip header (xflag is
|
||||||
|
ignored -- the extra flags are set according to the compression level). The
|
||||||
|
caller must assure that, if not Z_NULL, name and comment are terminated with
|
||||||
|
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
|
||||||
|
available there. If hcrc is true, a gzip header crc is included. Note that
|
||||||
|
the current versions of the command-line version of gzip (up through version
|
||||||
|
1.3.x) do not support header crc's, and will report that it is a "multi-part
|
||||||
|
gzip file" and give up.
|
||||||
|
|
||||||
|
If deflateSetHeader is not used, the default gzip header has text false,
|
||||||
|
the time set to zero, and os set to 255, with no extra, name, or comment
|
||||||
|
fields. The gzip header is returned to the default state by deflateReset().
|
||||||
|
|
||||||
|
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
|
stream state was inconsistent.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||||
int windowBits));
|
int windowBits));
|
||||||
|
@ -648,15 +722,15 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||||
windowBits can also be greater than 15 for optional gzip decoding. Add
|
windowBits can also be greater than 15 for optional gzip decoding. Add
|
||||||
32 to windowBits to enable zlib and gzip decoding with automatic header
|
32 to windowBits to enable zlib and gzip decoding with automatic header
|
||||||
detection, or add 16 to decode only the gzip format (the zlib format will
|
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
|
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
|
||||||
a crc32 instead of an adler32.
|
a crc32 instead of an adler32.
|
||||||
|
|
||||||
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_STREAM_ERROR if a parameter is invalid (such as a negative
|
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
|
||||||
memLevel). msg is set to null if there is no error message. inflateInit2
|
is set to null if there is no error message. inflateInit2 does not perform
|
||||||
does not perform any decompression apart from reading the zlib header if
|
any decompression apart from reading the zlib header if present: this will
|
||||||
present: this will be done by inflate(). (So next_in and avail_in may be
|
be done by inflate(). (So next_in and avail_in may be modified, but next_out
|
||||||
modified, but next_out and avail_out are unchanged.)
|
and avail_out are unchanged.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||||
|
@ -664,11 +738,14 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||||
uInt dictLength));
|
uInt dictLength));
|
||||||
/*
|
/*
|
||||||
Initializes the decompression dictionary from the given uncompressed byte
|
Initializes the decompression dictionary from the given uncompressed byte
|
||||||
sequence. This function must be called immediately after a call of inflate
|
sequence. This function must be called immediately after a call of inflate,
|
||||||
if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
|
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
|
||||||
can be determined from the adler32 value returned by this call of
|
can be determined from the adler32 value returned by that call of inflate.
|
||||||
inflate. The compressor and decompressor must use exactly the same
|
The compressor and decompressor must use exactly the same dictionary (see
|
||||||
dictionary (see deflateSetDictionary).
|
deflateSetDictionary). For raw inflate, this function can be called
|
||||||
|
immediately after inflateInit2() or inflateReset() and before any call of
|
||||||
|
inflate() to set the dictionary. The application must insure that the
|
||||||
|
dictionary that was used for compression is provided.
|
||||||
|
|
||||||
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
|
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
|
||||||
parameter is invalid (such as NULL dictionary) or the stream state is
|
parameter is invalid (such as NULL dictionary) or the stream state is
|
||||||
|
@ -719,8 +796,64 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
|
||||||
stream state was inconsistent (such as zalloc or state being NULL).
|
stream state was inconsistent (such as zalloc or state being NULL).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
|
||||||
|
int bits,
|
||||||
|
int value));
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
|
This function inserts bits in the inflate input stream. The intent is
|
||||||
|
that this function is used to start inflating at a bit position in the
|
||||||
|
middle of a byte. The provided bits will be used before any bytes are used
|
||||||
|
from next_in. This function should only be used with raw inflate, and
|
||||||
|
should be used before the first inflate() call after inflateInit2() or
|
||||||
|
inflateReset(). bits must be less than or equal to 16, and that many of the
|
||||||
|
least significant bits of value will be inserted in the input.
|
||||||
|
|
||||||
|
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
|
stream state was inconsistent.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
|
||||||
|
gz_headerp head));
|
||||||
|
/*
|
||||||
|
inflateGetHeader() requests that gzip header information be stored in the
|
||||||
|
provided gz_header structure. inflateGetHeader() may be called after
|
||||||
|
inflateInit2() or inflateReset(), and before the first call of inflate().
|
||||||
|
As inflate() processes the gzip stream, head->done is zero until the header
|
||||||
|
is completed, at which time head->done is set to one. If a zlib stream is
|
||||||
|
being decoded, then head->done is set to -1 to indicate that there will be
|
||||||
|
no gzip header information forthcoming. Note that Z_BLOCK can be used to
|
||||||
|
force inflate() to return immediately after header processing is complete
|
||||||
|
and before any actual data is decompressed.
|
||||||
|
|
||||||
|
The text, time, xflags, and os fields are filled in with the gzip header
|
||||||
|
contents. hcrc is set to true if there is a header CRC. (The header CRC
|
||||||
|
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
|
||||||
|
contains the maximum number of bytes to write to extra. Once done is true,
|
||||||
|
extra_len contains the actual extra field length, and extra contains the
|
||||||
|
extra field, or that field truncated if extra_max is less than extra_len.
|
||||||
|
If name is not Z_NULL, then up to name_max characters are written there,
|
||||||
|
terminated with a zero unless the length is greater than name_max. If
|
||||||
|
comment is not Z_NULL, then up to comm_max characters are written there,
|
||||||
|
terminated with a zero unless the length is greater than comm_max. When
|
||||||
|
any of extra, name, or comment are not Z_NULL and the respective field is
|
||||||
|
not present in the header, then that field is set to Z_NULL to signal its
|
||||||
|
absence. This allows the use of deflateSetHeader() with the returned
|
||||||
|
structure to duplicate the header. However if those fields are set to
|
||||||
|
allocated memory, then the application will need to save those pointers
|
||||||
|
elsewhere so that they can be eventually freed.
|
||||||
|
|
||||||
|
If inflateGetHeader is not used, then the header information is simply
|
||||||
|
discarded. The header is always checked for validity, including the header
|
||||||
|
CRC if present. inflateReset() will reset the process to discard the header
|
||||||
|
information. The application would need to call inflateGetHeader() again to
|
||||||
|
retrieve the header from the next gzip stream.
|
||||||
|
|
||||||
|
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
|
stream state was inconsistent.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
|
||||||
unsigned char FAR *window));
|
unsigned char FAR *window));
|
||||||
|
|
||||||
Initialize the internal stream state for decompression using inflateBack()
|
Initialize the internal stream state for decompression using inflateBack()
|
||||||
|
@ -744,7 +877,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
|
||||||
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
|
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
|
||||||
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
|
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
|
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
|
||||||
in_func in, void FAR *in_desc,
|
in_func in, void FAR *in_desc,
|
||||||
out_func out, void FAR *out_desc));
|
out_func out, void FAR *out_desc));
|
||||||
/*
|
/*
|
||||||
|
@ -813,7 +946,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
|
||||||
that inflateBack() cannot return Z_OK.
|
that inflateBack() cannot return Z_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm));
|
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
|
||||||
/*
|
/*
|
||||||
All memory allocated by inflateBackInit() is freed.
|
All memory allocated by inflateBackInit() is freed.
|
||||||
|
|
||||||
|
@ -1087,6 +1220,12 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
||||||
input stream, otherwise zero.
|
input stream, otherwise zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
||||||
|
/*
|
||||||
|
Returns 1 if file is being read directly without decompression, otherwise
|
||||||
|
zero.
|
||||||
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
||||||
/*
|
/*
|
||||||
Flushes all pending output if necessary, closes the compressed file
|
Flushes all pending output if necessary, closes the compressed file
|
||||||
|
@ -1119,7 +1258,6 @@ 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 NULL, this function returns
|
return the updated checksum. If buf is NULL, this function returns
|
||||||
|
@ -1135,12 +1273,21 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||||
if (adler != original_adler) error();
|
if (adler != original_adler) error();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
|
||||||
|
z_off_t len2));
|
||||||
|
/*
|
||||||
|
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
|
||||||
|
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
|
||||||
|
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
|
||||||
|
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
|
||||||
|
*/
|
||||||
|
|
||||||
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 with the bytes buf[0..len-1] and return the updated
|
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
||||||
crc. If buf is NULL, this function returns the required initial value
|
updated CRC-32. If buf is NULL, this function returns the required initial
|
||||||
for the crc. Pre- and post-conditioning (one's complement) is performed
|
value for the for the crc. Pre- and post-conditioning (one's complement) is
|
||||||
within this function so it shouldn't be done by the application.
|
performed within this function so it shouldn't be done by the application.
|
||||||
Usage example:
|
Usage example:
|
||||||
|
|
||||||
uLong crc = crc32(0L, Z_NULL, 0);
|
uLong crc = crc32(0L, Z_NULL, 0);
|
||||||
|
@ -1151,6 +1298,16 @@ 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_combine OF((uLong crc1, uLong crc2, z_off_t len2));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Combine two CRC-32 check values into one. For two sequences of bytes,
|
||||||
|
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
||||||
|
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
||||||
|
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
||||||
|
len2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* various hacks, don't look :) */
|
/* various hacks, don't look :) */
|
||||||
|
|
||||||
|
@ -1167,7 +1324,7 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
||||||
int stream_size));
|
int stream_size));
|
||||||
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||||
const char *version, int stream_size));
|
const char *version, int stream_size));
|
||||||
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
|
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
||||||
unsigned char FAR *window,
|
unsigned char FAR *window,
|
||||||
const char *version,
|
const char *version,
|
||||||
int stream_size));
|
int stream_size));
|
||||||
|
|
33
zlib/zutil.c
33
zlib/zutil.c
|
@ -1,5 +1,5 @@
|
||||||
/* zutil.c -- target dependent utility functions for the compression library
|
/* zutil.c -- target dependent utility functions for the compression library
|
||||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -11,10 +11,6 @@
|
||||||
struct internal_state {int dummy;}; /* for buggy compilers */
|
struct internal_state {int dummy;}; /* for buggy compilers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STDC
|
|
||||||
extern void exit OF((int));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char * const z_errmsg[10] = {
|
const char * const z_errmsg[10] = {
|
||||||
"need dictionary", /* Z_NEED_DICT 2 */
|
"need dictionary", /* Z_NEED_DICT 2 */
|
||||||
"stream end", /* Z_STREAM_END 1 */
|
"stream end", /* Z_STREAM_END 1 */
|
||||||
|
@ -78,38 +74,38 @@ uLong ZEXPORT zlibCompileFlags()
|
||||||
flags += 1 << 13;
|
flags += 1 << 13;
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_GZCOMPRESS
|
#ifdef NO_GZCOMPRESS
|
||||||
flags += 1 << 16;
|
flags += 1L << 16;
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_GZIP
|
#ifdef NO_GZIP
|
||||||
flags += 1 << 17;
|
flags += 1L << 17;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PKZIP_BUG_WORKAROUND
|
#ifdef PKZIP_BUG_WORKAROUND
|
||||||
flags += 1 << 20;
|
flags += 1L << 20;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FASTEST
|
#ifdef FASTEST
|
||||||
flags += 1 << 21;
|
flags += 1L << 21;
|
||||||
#endif
|
#endif
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# ifdef NO_vsnprintf
|
# ifdef NO_vsnprintf
|
||||||
flags += 1 << 25;
|
flags += 1L << 25;
|
||||||
# ifdef HAS_vsprintf_void
|
# ifdef HAS_vsprintf_void
|
||||||
flags += 1 << 26;
|
flags += 1L << 26;
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef HAS_vsnprintf_void
|
# ifdef HAS_vsnprintf_void
|
||||||
flags += 1 << 26;
|
flags += 1L << 26;
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
flags += 1 << 24;
|
flags += 1L << 24;
|
||||||
# ifdef NO_snprintf
|
# ifdef NO_snprintf
|
||||||
flags += 1 << 25;
|
flags += 1L << 25;
|
||||||
# ifdef HAS_sprintf_void
|
# ifdef HAS_sprintf_void
|
||||||
flags += 1 << 26;
|
flags += 1L << 26;
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef HAS_snprintf_void
|
# ifdef HAS_snprintf_void
|
||||||
flags += 1 << 26;
|
flags += 1L << 26;
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,7 +137,10 @@ const char * ZEXPORT zError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
/* does not exist on WCE */
|
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||||
|
* errno. We define it as a global variable to simplify porting.
|
||||||
|
* Its value is always 0 and should not be used.
|
||||||
|
*/
|
||||||
int errno = 0;
|
int errno = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
30
zlib/zutil.h
30
zlib/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-2003 Jean-loup Gailly.
|
* Copyright (C) 1995-2005 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -17,14 +17,26 @@
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# include <stddef.h>
|
# ifndef _WIN32_WCE
|
||||||
|
# include <stddef.h>
|
||||||
|
# endif
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
|
# ifdef _WIN32_WCE
|
||||||
|
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||||
|
* errno. We define it as a global variable to simplify porting.
|
||||||
|
* Its value is always 0 and should not be used. We rename it to
|
||||||
|
* avoid conflict with other libraries that use the same workaround.
|
||||||
|
*/
|
||||||
|
# define errno z_errno
|
||||||
|
# endif
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#else
|
#else
|
||||||
# include <errno.h>
|
# ifndef _WIN32_WCE
|
||||||
|
# include <errno.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef local
|
#ifndef local
|
||||||
|
@ -105,6 +117,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
|
|
||||||
#ifdef OS2
|
#ifdef OS2
|
||||||
# define OS_CODE 0x06
|
# define OS_CODE 0x06
|
||||||
|
# ifdef M_I86
|
||||||
|
#include <malloc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||||
|
@ -193,15 +208,6 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# define NO_vsnprintf
|
# define NO_vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STRERROR
|
|
||||||
# ifndef VMS
|
|
||||||
extern char *strerror OF((int));
|
|
||||||
# endif
|
|
||||||
# define zstrerror(errnum) strerror(errnum)
|
|
||||||
#else
|
|
||||||
# define zstrerror(errnum) ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(pyr)
|
#if defined(pyr)
|
||||||
# define NO_MEMCPY
|
# define NO_MEMCPY
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue