mirror of
https://github.com/fltk/fltk.git
synced 2026-05-29 20:45:33 +08:00
Upgrade bundled zlib to version 1.3 dated 18-aug-2023
This commit is contained in:
@@ -23,13 +23,13 @@ The nanosvg library is not affected.
|
|||||||
|
|
||||||
\section bundled-status Current status
|
\section bundled-status Current status
|
||||||
\code
|
\code
|
||||||
Current versions of bundled libraries (as of July 24, 2023):
|
Current versions of bundled libraries (as of August 23, 2023):
|
||||||
Library Version/git commit Release date FLTK Version
|
Library Version/git commit Release date FLTK Version
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
jpeg jpeg-9e 2022-01-16 1.4.0
|
jpeg jpeg-9e 2022-01-16 1.4.0
|
||||||
nanosvg abcd277ea4 [1] 2022-12-22 1.4.0
|
nanosvg abcd277ea4 [1] 2022-12-22 1.4.0
|
||||||
png libpng-1.6.40 2023-06-21 1.4.0
|
png libpng-1.6.40 2023-06-21 1.4.0
|
||||||
zlib zlib-1.2.13 2022-10-13 1.4.0
|
zlib zlib-1.3 2023-08-18 1.4.0
|
||||||
libdecor f43652c7 [2] 2023-07-15 1.4.0
|
libdecor f43652c7 [2] 2023-07-15 1.4.0
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -219,7 +219,7 @@
|
|||||||
#define PNG_USER_HEIGHT_MAX 1000000
|
#define PNG_USER_HEIGHT_MAX 1000000
|
||||||
#define PNG_USER_WIDTH_MAX 1000000
|
#define PNG_USER_WIDTH_MAX 1000000
|
||||||
#define PNG_ZBUF_SIZE 8192
|
#define PNG_ZBUF_SIZE 8192
|
||||||
#define PNG_ZLIB_VERNUM 0x12d0
|
#define PNG_ZLIB_VERNUM 0x1300
|
||||||
#define PNG_Z_DEFAULT_COMPRESSION (-1)
|
#define PNG_Z_DEFAULT_COMPRESSION (-1)
|
||||||
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
|
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
|
||||||
#define PNG_Z_DEFAULT_STRATEGY 1
|
#define PNG_Z_DEFAULT_STRATEGY 1
|
||||||
|
|||||||
+19
-1
@@ -1,6 +1,24 @@
|
|||||||
|
|
||||||
ChangeLog file for zlib
|
ChangeLog file for zlib
|
||||||
|
|
||||||
|
Changes in 1.3 (18 Aug 2023)
|
||||||
|
- Remove K&R function definitions and zlib2ansi
|
||||||
|
- Fix bug in deflateBound() for level 0 and memLevel 9
|
||||||
|
- Fix bug when gzungetc() is used immediately after gzopen()
|
||||||
|
- Fix bug when using gzflush() with a very small buffer
|
||||||
|
- Fix crash when gzsetparams() attempted for transparent write
|
||||||
|
- Fix test/example.c to work with FORCE_STORED
|
||||||
|
- Rewrite of zran in examples (see zran.c version history)
|
||||||
|
- Fix minizip to allow it to open an empty zip file
|
||||||
|
- Fix reading disk number start on zip64 files in minizip
|
||||||
|
- Fix logic error in minizip argument processing
|
||||||
|
- Add minizip testing to Makefile
|
||||||
|
- Read multiple bytes instead of byte-by-byte in minizip unzip.c
|
||||||
|
- Add memory sanitizer to configure (--memory)
|
||||||
|
- Various portability improvements
|
||||||
|
- Various documentation improvements
|
||||||
|
- Various spelling and typo corrections
|
||||||
|
|
||||||
Changes in 1.2.13 (13 Oct 2022)
|
Changes in 1.2.13 (13 Oct 2022)
|
||||||
- Fix configure issue that discarded provided CC definition
|
- Fix configure issue that discarded provided CC definition
|
||||||
- Correct incorrect inputs provided to the CRC functions
|
- Correct incorrect inputs provided to the CRC functions
|
||||||
@@ -1445,7 +1463,7 @@ Changes in 0.99 (27 Jan 96)
|
|||||||
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
|
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
|
||||||
- in fcalloc, normalize pointer if size > 65520 bytes
|
- in fcalloc, normalize pointer if size > 65520 bytes
|
||||||
- don't use special fcalloc for 32 bit Borland C++
|
- don't use special fcalloc for 32 bit Borland C++
|
||||||
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
|
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
|
||||||
- use Z_BINARY instead of BINARY
|
- use Z_BINARY instead of BINARY
|
||||||
- document that gzclose after gzdopen will close the file
|
- document that gzclose after gzdopen will close the file
|
||||||
- allow "a" as mode in gzopen
|
- allow "a" as mode in gzopen
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
If your question is not there, please check the zlib home page
|
If your question is not there, please check the zlib home page
|
||||||
http://zlib.net/ which may have more recent information.
|
http://zlib.net/ which may have more recent information.
|
||||||
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
The latest zlib FAQ is at http://zlib.net/zlib_faq.html
|
||||||
|
|
||||||
|
|
||||||
1. Is zlib Y2K-compliant?
|
1. Is zlib Y2K-compliant?
|
||||||
|
|||||||
+9
-10
@@ -1,6 +1,6 @@
|
|||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.13 is a general purpose data compression library. All the code is
|
zlib 1.3 is a general purpose data compression library. All the code is
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
thread safe. The data format used by the zlib library is described by RFCs
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
(Request for Comments) 1950 to 1952 in the files
|
||||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||||
@@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
|||||||
|
|
||||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
https://marknelson.us/posts/1997/01/01/zlib-engine.html .
|
||||||
|
|
||||||
The changes made in version 1.2.13 are documented in the file ChangeLog.
|
The changes made in version 1.3 are documented in the file ChangeLog.
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory contrib/ .
|
Unsupported third party contributions are provided in directory contrib/ .
|
||||||
|
|
||||||
zlib is available in Java using the java.util.zip package, documented at
|
zlib is available in Java using the java.util.zip package. Follow the API
|
||||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
|
||||||
|
|
||||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
|
||||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
can be found at https://github.com/pmqs/IO-Compress .
|
||||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
|
||||||
|
|
||||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||||
available in Python 1.5 and later versions, see
|
available in Python 1.5 and later versions, see
|
||||||
@@ -64,7 +63,7 @@ Notes for some targets:
|
|||||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
||||||
when compiled with cc.
|
when compiled with cc.
|
||||||
|
|
||||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
|
||||||
necessary to get gzprintf working correctly. This is done by configure.
|
necessary to get gzprintf working correctly. This is done by configure.
|
||||||
|
|
||||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||||
@@ -84,7 +83,7 @@ Acknowledgments:
|
|||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
(C) 1995-2023 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
|
||||||
|
|||||||
+5
-27
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include "zutil.h"
|
#include "zutil.h"
|
||||||
|
|
||||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
|
||||||
|
|
||||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
#define BASE 65521U /* largest prime smaller than 65536 */
|
||||||
#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 */
|
||||||
@@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_z(adler, buf, len)
|
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
@@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32(adler, buf, len)
|
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return adler32_z(adler, buf, len);
|
return adler32_z(adler, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
local uLong adler32_combine_(adler1, adler2, len2)
|
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
unsigned long sum1;
|
unsigned long sum1;
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned rem;
|
unsigned rem;
|
||||||
@@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-16
@@ -19,13 +19,8 @@
|
|||||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
Z_STREAM_ERROR if the level parameter is invalid.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen, int level) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
int level;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
const uInt max = (uInt)-1;
|
const uInt max = (uInt)-1;
|
||||||
@@ -65,12 +60,8 @@ int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
|||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress(dest, destLen, source, sourceLen)
|
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,9 +69,7 @@ int ZEXPORT compress(dest, destLen, source, sourceLen)
|
|||||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
If the default memLevel or windowBits for deflateInit() is changed, then
|
||||||
this function needs to be updated.
|
this function needs to be updated.
|
||||||
*/
|
*/
|
||||||
uLong ZEXPORT compressBound(sourceLen)
|
uLong ZEXPORT compressBound(uLong sourceLen) {
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||||
(sourceLen >> 25) + 13;
|
(sourceLen >> 25) + 13;
|
||||||
}
|
}
|
||||||
|
|||||||
+86
-162
@@ -103,19 +103,6 @@
|
|||||||
# define ARMCRC32
|
# define ARMCRC32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Local functions. */
|
|
||||||
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
|
|
||||||
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
|
|
||||||
|
|
||||||
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
|
||||||
local z_word_t byte_swap OF((z_word_t word));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(W) && !defined(ARMCRC32)
|
|
||||||
local z_crc_t crc_word OF((z_word_t data));
|
|
||||||
local z_word_t crc_word_big OF((z_word_t data));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
||||||
/*
|
/*
|
||||||
Swap the bytes in a z_word_t to convert between little and big endian. Any
|
Swap the bytes in a z_word_t to convert between little and big endian. Any
|
||||||
@@ -123,9 +110,7 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
|
|||||||
instruction, if one is available. This assumes that word_t is either 32 bits
|
instruction, if one is available. This assumes that word_t is either 32 bits
|
||||||
or 64 bits.
|
or 64 bits.
|
||||||
*/
|
*/
|
||||||
local z_word_t byte_swap(word)
|
local z_word_t byte_swap(z_word_t word) {
|
||||||
z_word_t word;
|
|
||||||
{
|
|
||||||
# if W == 8
|
# if W == 8
|
||||||
return
|
return
|
||||||
(word & 0xff00000000000000) >> 56 |
|
(word & 0xff00000000000000) >> 56 |
|
||||||
@@ -146,24 +131,77 @@ local z_word_t byte_swap(word)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
/* =========================================================================
|
||||||
|
* Table of powers of x for combining CRC-32s, filled in by make_crc_table()
|
||||||
|
* below.
|
||||||
|
*/
|
||||||
|
local z_crc_t FAR x2n_table[32];
|
||||||
|
#else
|
||||||
|
/* =========================================================================
|
||||||
|
* Tables for byte-wise and braided CRC-32 calculations, and a table of powers
|
||||||
|
* of x for combining CRC-32s, all made by make_crc_table().
|
||||||
|
*/
|
||||||
|
# include "crc32.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* CRC polynomial. */
|
/* CRC polynomial. */
|
||||||
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
|
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
/*
|
||||||
|
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
|
||||||
|
reflected. For speed, this requires that a not be zero.
|
||||||
|
*/
|
||||||
|
local z_crc_t multmodp(z_crc_t a, z_crc_t b) {
|
||||||
|
z_crc_t m, p;
|
||||||
|
|
||||||
|
m = (z_crc_t)1 << 31;
|
||||||
|
p = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (a & m) {
|
||||||
|
p ^= b;
|
||||||
|
if ((a & (m - 1)) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m >>= 1;
|
||||||
|
b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
|
||||||
|
initialized.
|
||||||
|
*/
|
||||||
|
local z_crc_t x2nmodp(z_off64_t n, unsigned k) {
|
||||||
|
z_crc_t p;
|
||||||
|
|
||||||
|
p = (z_crc_t)1 << 31; /* x^0 == 1 */
|
||||||
|
while (n) {
|
||||||
|
if (n & 1)
|
||||||
|
p = multmodp(x2n_table[k & 31], p);
|
||||||
|
n >>= 1;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
/* =========================================================================
|
||||||
|
* Build the tables for byte-wise and braided CRC-32 calculations, and a table
|
||||||
|
* of powers of x for combining CRC-32s.
|
||||||
|
*/
|
||||||
local z_crc_t FAR crc_table[256];
|
local z_crc_t FAR crc_table[256];
|
||||||
local z_crc_t FAR x2n_table[32];
|
|
||||||
local void make_crc_table OF((void));
|
|
||||||
#ifdef W
|
#ifdef W
|
||||||
local z_word_t FAR crc_big_table[256];
|
local z_word_t FAR crc_big_table[256];
|
||||||
local z_crc_t FAR crc_braid_table[W][256];
|
local z_crc_t FAR crc_braid_table[W][256];
|
||||||
local z_word_t FAR crc_braid_big_table[W][256];
|
local z_word_t FAR crc_braid_big_table[W][256];
|
||||||
local void braid OF((z_crc_t [][256], z_word_t [][256], int, int));
|
local void braid(z_crc_t [][256], z_word_t [][256], int, int);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAKECRCH
|
#ifdef MAKECRCH
|
||||||
local void write_table OF((FILE *, const z_crc_t FAR *, int));
|
local void write_table(FILE *, const z_crc_t FAR *, int);
|
||||||
local void write_table32hi OF((FILE *, const z_word_t FAR *, int));
|
local void write_table32hi(FILE *, const z_word_t FAR *, int);
|
||||||
local void write_table64 OF((FILE *, const z_word_t FAR *, int));
|
local void write_table64(FILE *, const z_word_t FAR *, int);
|
||||||
#endif /* MAKECRCH */
|
#endif /* MAKECRCH */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -176,7 +214,6 @@ local void make_crc_table OF((void));
|
|||||||
|
|
||||||
/* Definition of once functionality. */
|
/* Definition of once functionality. */
|
||||||
typedef struct once_s once_t;
|
typedef struct once_s once_t;
|
||||||
local void once OF((once_t *, void (*)(void)));
|
|
||||||
|
|
||||||
/* Check for the availability of atomics. */
|
/* Check for the availability of atomics. */
|
||||||
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
|
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
|
||||||
@@ -196,10 +233,7 @@ struct once_s {
|
|||||||
invoke once() at the same time. The state must be a once_t initialized with
|
invoke once() at the same time. The state must be a once_t initialized with
|
||||||
ONCE_INIT.
|
ONCE_INIT.
|
||||||
*/
|
*/
|
||||||
local void once(state, init)
|
local void once(once_t *state, void (*init)(void)) {
|
||||||
once_t *state;
|
|
||||||
void (*init)(void);
|
|
||||||
{
|
|
||||||
if (!atomic_load(&state->done)) {
|
if (!atomic_load(&state->done)) {
|
||||||
if (atomic_flag_test_and_set(&state->begun))
|
if (atomic_flag_test_and_set(&state->begun))
|
||||||
while (!atomic_load(&state->done))
|
while (!atomic_load(&state->done))
|
||||||
@@ -222,10 +256,7 @@ struct once_s {
|
|||||||
|
|
||||||
/* Test and set. Alas, not atomic, but tries to minimize the period of
|
/* Test and set. Alas, not atomic, but tries to minimize the period of
|
||||||
vulnerability. */
|
vulnerability. */
|
||||||
local int test_and_set OF((int volatile *));
|
local int test_and_set(int volatile *flag) {
|
||||||
local int test_and_set(flag)
|
|
||||||
int volatile *flag;
|
|
||||||
{
|
|
||||||
int was;
|
int was;
|
||||||
|
|
||||||
was = *flag;
|
was = *flag;
|
||||||
@@ -234,10 +265,7 @@ local int test_and_set(flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Run the provided init() function once. This is not thread-safe. */
|
/* Run the provided init() function once. This is not thread-safe. */
|
||||||
local void once(state, init)
|
local void once(once_t *state, void (*init)(void)) {
|
||||||
once_t *state;
|
|
||||||
void (*init)(void);
|
|
||||||
{
|
|
||||||
if (!state->done) {
|
if (!state->done) {
|
||||||
if (test_and_set(&state->begun))
|
if (test_and_set(&state->begun))
|
||||||
while (!state->done)
|
while (!state->done)
|
||||||
@@ -279,8 +307,7 @@ local once_t made = ONCE_INIT;
|
|||||||
combinations of CRC register values and incoming bytes.
|
combinations of CRC register values and incoming bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
local void make_crc_table()
|
local void make_crc_table(void) {
|
||||||
{
|
|
||||||
unsigned i, j, n;
|
unsigned i, j, n;
|
||||||
z_crc_t p;
|
z_crc_t p;
|
||||||
|
|
||||||
@@ -447,11 +474,7 @@ local void make_crc_table()
|
|||||||
Write the 32-bit values in table[0..k-1] to out, five per line in
|
Write the 32-bit values in table[0..k-1] to out, five per line in
|
||||||
hexadecimal separated by commas.
|
hexadecimal separated by commas.
|
||||||
*/
|
*/
|
||||||
local void write_table(out, table, k)
|
local void write_table(FILE *out, const z_crc_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_crc_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
@@ -464,11 +487,7 @@ local void write_table(out, table, k)
|
|||||||
Write the high 32-bits of each value in table[0..k-1] to out, five per line
|
Write the high 32-bits of each value in table[0..k-1] to out, five per line
|
||||||
in hexadecimal separated by commas.
|
in hexadecimal separated by commas.
|
||||||
*/
|
*/
|
||||||
local void write_table32hi(out, table, k)
|
local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_word_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
@@ -484,11 +503,7 @@ int k;
|
|||||||
bits. If not, then the type cast and format string can be adjusted
|
bits. If not, then the type cast and format string can be adjusted
|
||||||
accordingly.
|
accordingly.
|
||||||
*/
|
*/
|
||||||
local void write_table64(out, table, k)
|
local void write_table64(FILE *out, const z_word_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_word_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
@@ -498,8 +513,7 @@ local void write_table64(out, table, k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Actually do the deed. */
|
/* Actually do the deed. */
|
||||||
int main()
|
int main(void) {
|
||||||
{
|
|
||||||
make_crc_table();
|
make_crc_table();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -511,12 +525,7 @@ int main()
|
|||||||
Generate the little and big-endian braid tables for the given n and z_word_t
|
Generate the little and big-endian braid tables for the given n and z_word_t
|
||||||
size w. Each array must have room for w blocks of 256 elements.
|
size w. Each array must have room for w blocks of 256 elements.
|
||||||
*/
|
*/
|
||||||
local void braid(ltl, big, n, w)
|
local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) {
|
||||||
z_crc_t ltl[][256];
|
|
||||||
z_word_t big[][256];
|
|
||||||
int n;
|
|
||||||
int w;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
z_crc_t i, p, q;
|
z_crc_t i, p, q;
|
||||||
for (k = 0; k < w; k++) {
|
for (k = 0; k < w; k++) {
|
||||||
@@ -531,69 +540,13 @@ local void braid(ltl, big, n, w)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* !DYNAMIC_CRC_TABLE */
|
|
||||||
/* ========================================================================
|
|
||||||
* Tables for byte-wise and braided CRC-32 calculations, and a table of powers
|
|
||||||
* of x for combining CRC-32s, all made by make_crc_table().
|
|
||||||
*/
|
|
||||||
#include "crc32.h"
|
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
||||||
/* ========================================================================
|
|
||||||
* Routines used for CRC calculation. Some are also required for the table
|
|
||||||
* generation above.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
|
|
||||||
reflected. For speed, this requires that a not be zero.
|
|
||||||
*/
|
|
||||||
local z_crc_t multmodp(a, b)
|
|
||||||
z_crc_t a;
|
|
||||||
z_crc_t b;
|
|
||||||
{
|
|
||||||
z_crc_t m, p;
|
|
||||||
|
|
||||||
m = (z_crc_t)1 << 31;
|
|
||||||
p = 0;
|
|
||||||
for (;;) {
|
|
||||||
if (a & m) {
|
|
||||||
p ^= b;
|
|
||||||
if ((a & (m - 1)) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m >>= 1;
|
|
||||||
b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
|
|
||||||
initialized.
|
|
||||||
*/
|
|
||||||
local z_crc_t x2nmodp(n, k)
|
|
||||||
z_off64_t n;
|
|
||||||
unsigned k;
|
|
||||||
{
|
|
||||||
z_crc_t p;
|
|
||||||
|
|
||||||
p = (z_crc_t)1 << 31; /* x^0 == 1 */
|
|
||||||
while (n) {
|
|
||||||
if (n & 1)
|
|
||||||
p = multmodp(x2n_table[k & 31], p);
|
|
||||||
n >>= 1;
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* This function can be used by asm versions of crc32(), and to force the
|
* This function can be used by asm versions of crc32(), and to force the
|
||||||
* generation of the CRC tables in a threaded application.
|
* generation of the CRC tables in a threaded application.
|
||||||
*/
|
*/
|
||||||
const z_crc_t FAR * ZEXPORT get_crc_table()
|
const z_crc_t FAR * ZEXPORT get_crc_table(void) {
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
@@ -619,11 +572,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
|||||||
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
|
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
|
||||||
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
|
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
|
||||||
|
|
||||||
unsigned long ZEXPORT crc32_z(crc, buf, len)
|
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
z_size_t len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_crc_t val;
|
z_crc_t val;
|
||||||
z_word_t crc1, crc2;
|
z_word_t crc1, crc2;
|
||||||
const z_word_t *word;
|
const z_word_t *word;
|
||||||
@@ -723,18 +673,14 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
|||||||
least-significant byte of the word as the first byte of data, without any pre
|
least-significant byte of the word as the first byte of data, without any pre
|
||||||
or post conditioning. This is used to combine the CRCs of each braid.
|
or post conditioning. This is used to combine the CRCs of each braid.
|
||||||
*/
|
*/
|
||||||
local z_crc_t crc_word(data)
|
local z_crc_t crc_word(z_word_t data) {
|
||||||
z_word_t data;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; k < W; k++)
|
for (k = 0; k < W; k++)
|
||||||
data = (data >> 8) ^ crc_table[data & 0xff];
|
data = (data >> 8) ^ crc_table[data & 0xff];
|
||||||
return (z_crc_t)data;
|
return (z_crc_t)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
local z_word_t crc_word_big(data)
|
local z_word_t crc_word_big(z_word_t data) {
|
||||||
z_word_t data;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; k < W; k++)
|
for (k = 0; k < W; k++)
|
||||||
data = (data << 8) ^
|
data = (data << 8) ^
|
||||||
@@ -745,11 +691,8 @@ local z_word_t crc_word_big(data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
unsigned long ZEXPORT crc32_z(crc, buf, len)
|
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
z_size_t len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
/* Return initial CRC, if requested. */
|
/* Return initial CRC, if requested. */
|
||||||
if (buf == Z_NULL) return 0;
|
if (buf == Z_NULL) return 0;
|
||||||
|
|
||||||
@@ -781,8 +724,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
|||||||
words = (z_word_t const *)buf;
|
words = (z_word_t const *)buf;
|
||||||
|
|
||||||
/* Do endian check at execution time instead of compile time, since ARM
|
/* Do endian check at execution time instead of compile time, since ARM
|
||||||
processors can change the endianess at execution time. If the
|
processors can change the endianness at execution time. If the
|
||||||
compiler knows what the endianess will be, it can optimize out the
|
compiler knows what the endianness will be, it can optimize out the
|
||||||
check and the unused branch. */
|
check and the unused branch. */
|
||||||
endian = 1;
|
endian = 1;
|
||||||
if (*(unsigned char *)&endian) {
|
if (*(unsigned char *)&endian) {
|
||||||
@@ -1069,20 +1012,13 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
unsigned long ZEXPORT crc32(crc, buf, len)
|
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
uInt len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return crc32_z(crc, buf, len);
|
return crc32_z(crc, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
@@ -1090,18 +1026,12 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
|
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_gen64(len2)
|
uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) {
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
@@ -1109,17 +1039,11 @@ uLong ZEXPORT crc32_combine_gen64(len2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_gen(len2)
|
uLong ZEXPORT crc32_combine_gen(z_off_t len2) {
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return crc32_combine_gen64((z_off64_t)len2);
|
return crc32_combine_gen64((z_off64_t)len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
|
uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
uLong op;
|
|
||||||
{
|
|
||||||
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|||||||
+233
-336
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -291,14 +291,14 @@ typedef struct internal_state {
|
|||||||
memory checker errors from longest match routines */
|
memory checker errors from longest match routines */
|
||||||
|
|
||||||
/* in trees.c */
|
/* in trees.c */
|
||||||
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_init(deflate_state *s);
|
||||||
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
|
||||||
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
|
void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
|
||||||
ulg stored_len, int last));
|
ulg stored_len, int last);
|
||||||
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
|
||||||
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_align(deflate_state *s);
|
||||||
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
|
||||||
ulg stored_len, int last));
|
ulg stored_len, int last);
|
||||||
|
|
||||||
#define d_code(dist) \
|
#define d_code(dist) \
|
||||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||||
|
|||||||
+1
-3
@@ -8,9 +8,7 @@
|
|||||||
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
||||||
That way the other gzclose functions can be used instead to avoid linking in
|
That way the other gzclose functions can be used instead to avoid linking in
|
||||||
unneeded compression or decompression routines. */
|
unneeded compression or decompression routines. */
|
||||||
int ZEXPORT gzclose(file)
|
int ZEXPORT gzclose(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
#ifndef NO_GZCOMPRESS
|
#ifndef NO_GZCOMPRESS
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -7,9 +7,8 @@
|
|||||||
# ifndef _LARGEFILE_SOURCE
|
# ifndef _LARGEFILE_SOURCE
|
||||||
# define _LARGEFILE_SOURCE 1
|
# define _LARGEFILE_SOURCE 1
|
||||||
# endif
|
# endif
|
||||||
# ifdef _FILE_OFFSET_BITS
|
# undef _FILE_OFFSET_BITS
|
||||||
# undef _FILE_OFFSET_BITS
|
# undef _TIME_BITS
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_HIDDEN
|
#ifdef HAVE_HIDDEN
|
||||||
@@ -119,8 +118,8 @@
|
|||||||
|
|
||||||
/* gz* functions always use library allocation functions */
|
/* gz* functions always use library allocation functions */
|
||||||
#ifndef STDC
|
#ifndef STDC
|
||||||
extern voidp malloc OF((uInt size));
|
extern voidp malloc(uInt size);
|
||||||
extern void free OF((voidpf ptr));
|
extern void free(voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get errno and strerror definition */
|
/* get errno and strerror definition */
|
||||||
@@ -138,10 +137,10 @@
|
|||||||
|
|
||||||
/* provide prototypes for these when building zlib without LFS */
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
|
||||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* default memLevel */
|
/* default memLevel */
|
||||||
@@ -203,9 +202,9 @@ typedef struct {
|
|||||||
typedef gz_state FAR *gz_statep;
|
typedef gz_state FAR *gz_statep;
|
||||||
|
|
||||||
/* shared functions */
|
/* shared functions */
|
||||||
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||||
@@ -214,6 +213,6 @@ char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
|||||||
#ifdef INT_MAX
|
#ifdef INT_MAX
|
||||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
||||||
#else
|
#else
|
||||||
unsigned ZLIB_INTERNAL gz_intmax OF((void));
|
unsigned ZLIB_INTERNAL gz_intmax(void);
|
||||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+22
-79
@@ -15,10 +15,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local void gz_reset OF((gz_statep));
|
|
||||||
local gzFile gz_open OF((const void *, int, const char *));
|
|
||||||
|
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
|
|
||||||
/* Map the Windows error number in ERROR to a locale-dependent error message
|
/* Map the Windows error number in ERROR to a locale-dependent error message
|
||||||
@@ -30,9 +26,7 @@ local gzFile gz_open OF((const void *, int, const char *));
|
|||||||
|
|
||||||
The gz_strwinerror function does not change the current setting of
|
The gz_strwinerror function does not change the current setting of
|
||||||
GetLastError. */
|
GetLastError. */
|
||||||
char ZLIB_INTERNAL *gz_strwinerror(error)
|
char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
|
||||||
DWORD error;
|
|
||||||
{
|
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
|
||||||
wchar_t *msgbuf;
|
wchar_t *msgbuf;
|
||||||
@@ -72,9 +66,7 @@ char ZLIB_INTERNAL *gz_strwinerror(error)
|
|||||||
#endif /* UNDER_CE */
|
#endif /* UNDER_CE */
|
||||||
|
|
||||||
/* Reset gzip file state */
|
/* Reset gzip file state */
|
||||||
local void gz_reset(state)
|
local void gz_reset(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
state->x.have = 0; /* no output data available */
|
state->x.have = 0; /* no output data available */
|
||||||
if (state->mode == GZ_READ) { /* for reading ... */
|
if (state->mode == GZ_READ) { /* for reading ... */
|
||||||
state->eof = 0; /* not at end of file */
|
state->eof = 0; /* not at end of file */
|
||||||
@@ -90,11 +82,7 @@ local void gz_reset(state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Open a gzip file either by name or file descriptor. */
|
/* Open a gzip file either by name or file descriptor. */
|
||||||
local gzFile gz_open(path, fd, mode)
|
local gzFile gz_open(const void *path, int fd, const char *mode) {
|
||||||
const void *path;
|
|
||||||
int fd;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
int oflag;
|
int oflag;
|
||||||
@@ -269,26 +257,17 @@ local gzFile gz_open(path, fd, mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzopen(path, mode)
|
gzFile ZEXPORT gzopen(const char *path, const char *mode) {
|
||||||
const char *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -1, mode);
|
return gz_open(path, -1, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzopen64(path, mode)
|
gzFile ZEXPORT gzopen64(const char *path, const char *mode) {
|
||||||
const char *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -1, mode);
|
return gz_open(path, -1, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzdopen(fd, mode)
|
gzFile ZEXPORT gzdopen(int fd, const char *mode) {
|
||||||
int fd;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
char *path; /* identifier for error messages */
|
char *path; /* identifier for error messages */
|
||||||
gzFile gz;
|
gzFile gz;
|
||||||
|
|
||||||
@@ -306,19 +285,13 @@ gzFile ZEXPORT gzdopen(fd, mode)
|
|||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
#ifdef WIDECHAR
|
#ifdef WIDECHAR
|
||||||
gzFile ZEXPORT gzopen_w(path, mode)
|
gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
|
||||||
const wchar_t *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -2, mode);
|
return gz_open(path, -2, mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzbuffer(file, size)
|
int ZEXPORT gzbuffer(gzFile file, unsigned size) {
|
||||||
gzFile file;
|
|
||||||
unsigned size;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
@@ -335,16 +308,14 @@ int ZEXPORT gzbuffer(file, size)
|
|||||||
/* check and set requested size */
|
/* check and set requested size */
|
||||||
if ((size << 1) < size)
|
if ((size << 1) < size)
|
||||||
return -1; /* need to be able to double it */
|
return -1; /* need to be able to double it */
|
||||||
if (size < 2)
|
if (size < 8)
|
||||||
size = 2; /* need two bytes to check magic header */
|
size = 8; /* needed to behave well with flushing */
|
||||||
state->want = size;
|
state->want = size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzrewind(file)
|
int ZEXPORT gzrewind(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -365,11 +336,7 @@ int ZEXPORT gzrewind(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
|
||||||
gzFile file;
|
|
||||||
z_off64_t offset;
|
|
||||||
int whence;
|
|
||||||
{
|
|
||||||
unsigned n;
|
unsigned n;
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
@@ -442,11 +409,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gzseek(file, offset, whence)
|
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
|
||||||
gzFile file;
|
|
||||||
z_off_t offset;
|
|
||||||
int whence;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gzseek64(file, (z_off64_t)offset, whence);
|
ret = gzseek64(file, (z_off64_t)offset, whence);
|
||||||
@@ -454,9 +417,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gztell64(file)
|
z_off64_t ZEXPORT gztell64(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
@@ -471,9 +432,7 @@ z_off64_t ZEXPORT gztell64(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gztell(file)
|
z_off_t ZEXPORT gztell(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gztell64(file);
|
ret = gztell64(file);
|
||||||
@@ -481,9 +440,7 @@ z_off_t ZEXPORT gztell(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gzoffset64(file)
|
z_off64_t ZEXPORT gzoffset64(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t offset;
|
z_off64_t offset;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -504,9 +461,7 @@ z_off64_t ZEXPORT gzoffset64(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gzoffset(file)
|
z_off_t ZEXPORT gzoffset(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gzoffset64(file);
|
ret = gzoffset64(file);
|
||||||
@@ -514,9 +469,7 @@ z_off_t ZEXPORT gzoffset(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzeof(file)
|
int ZEXPORT gzeof(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
@@ -531,10 +484,7 @@ int ZEXPORT gzeof(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
const char * ZEXPORT gzerror(file, errnum)
|
const char * ZEXPORT gzerror(gzFile file, int *errnum) {
|
||||||
gzFile file;
|
|
||||||
int *errnum;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
@@ -552,9 +502,7 @@ const char * ZEXPORT gzerror(file, errnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
void ZEXPORT gzclearerr(file)
|
void ZEXPORT gzclearerr(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
@@ -578,11 +526,7 @@ void ZEXPORT gzclearerr(file)
|
|||||||
memory). Simply save the error message as a static string. If there is an
|
memory). Simply save the error message as a static string. If there is an
|
||||||
allocation failure constructing the error message, then convert the error to
|
allocation failure constructing the error message, then convert the error to
|
||||||
out of memory. */
|
out of memory. */
|
||||||
void ZLIB_INTERNAL gz_error(state, err, msg)
|
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
|
||||||
gz_statep state;
|
|
||||||
int err;
|
|
||||||
const char *msg;
|
|
||||||
{
|
|
||||||
/* free previously allocated message and clear */
|
/* free previously allocated message and clear */
|
||||||
if (state->msg != NULL) {
|
if (state->msg != NULL) {
|
||||||
if (state->err != Z_MEM_ERROR)
|
if (state->err != Z_MEM_ERROR)
|
||||||
@@ -624,8 +568,7 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
|
|||||||
available) -- we need to do this to cover cases where 2's complement not
|
available) -- we need to do this to cover cases where 2's complement not
|
||||||
used, since C standard permits 1's complement and sign-bit representations,
|
used, since C standard permits 1's complement and sign-bit representations,
|
||||||
otherwise we could just use ((unsigned)-1) >> 1 */
|
otherwise we could just use ((unsigned)-1) >> 1 */
|
||||||
unsigned ZLIB_INTERNAL gz_intmax()
|
unsigned ZLIB_INTERNAL gz_intmax(void) {
|
||||||
{
|
|
||||||
unsigned p, q;
|
unsigned p, q;
|
||||||
|
|
||||||
p = 1;
|
p = 1;
|
||||||
|
|||||||
+20
-68
@@ -5,25 +5,12 @@
|
|||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
|
|
||||||
local int gz_avail OF((gz_statep));
|
|
||||||
local int gz_look OF((gz_statep));
|
|
||||||
local int gz_decomp OF((gz_statep));
|
|
||||||
local int gz_fetch OF((gz_statep));
|
|
||||||
local int gz_skip OF((gz_statep, z_off64_t));
|
|
||||||
local z_size_t gz_read OF((gz_statep, voidp, z_size_t));
|
|
||||||
|
|
||||||
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
||||||
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
||||||
This function needs to loop on read(), since read() is not guaranteed to
|
This function needs to loop on read(), since read() is not guaranteed to
|
||||||
read the number of bytes requested, depending on the type of descriptor. */
|
read the number of bytes requested, depending on the type of descriptor. */
|
||||||
local int gz_load(state, buf, len, have)
|
local int gz_load(gz_statep state, unsigned char *buf, unsigned len,
|
||||||
gz_statep state;
|
unsigned *have) {
|
||||||
unsigned char *buf;
|
|
||||||
unsigned len;
|
|
||||||
unsigned *have;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
unsigned get, max = ((unsigned)-1 >> 2) + 1;
|
unsigned get, max = ((unsigned)-1 >> 2) + 1;
|
||||||
|
|
||||||
@@ -53,9 +40,7 @@ local int gz_load(state, buf, len, have)
|
|||||||
If strm->avail_in != 0, then the current data is moved to the beginning of
|
If strm->avail_in != 0, then the current data is moved to the beginning of
|
||||||
the input buffer, and then the remainder of the buffer is loaded with the
|
the input buffer, and then the remainder of the buffer is loaded with the
|
||||||
available data from the input file. */
|
available data from the input file. */
|
||||||
local int gz_avail(state)
|
local int gz_avail(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
unsigned got;
|
unsigned got;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
@@ -88,9 +73,7 @@ local int gz_avail(state)
|
|||||||
case, all further file reads will be directly to either the output buffer or
|
case, all further file reads will be directly to either the output buffer or
|
||||||
a user buffer. If decompressing, the inflate state will be initialized.
|
a user buffer. If decompressing, the inflate state will be initialized.
|
||||||
gz_look() will return 0 on success or -1 on failure. */
|
gz_look() will return 0 on success or -1 on failure. */
|
||||||
local int gz_look(state)
|
local int gz_look(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
/* allocate read buffers and inflate memory */
|
/* allocate read buffers and inflate memory */
|
||||||
@@ -170,9 +153,7 @@ local int gz_look(state)
|
|||||||
data. If the gzip stream completes, state->how is reset to LOOK to look for
|
data. If the gzip stream completes, state->how is reset to LOOK to look for
|
||||||
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
|
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
|
||||||
on success, -1 on failure. */
|
on success, -1 on failure. */
|
||||||
local int gz_decomp(state)
|
local int gz_decomp(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
int ret = Z_OK;
|
int ret = Z_OK;
|
||||||
unsigned had;
|
unsigned had;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
@@ -224,9 +205,7 @@ local int gz_decomp(state)
|
|||||||
looked for to determine whether to copy or decompress. Returns -1 on error,
|
looked for to determine whether to copy or decompress. Returns -1 on error,
|
||||||
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
|
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
|
||||||
end of the input file has been reached and all data has been processed. */
|
end of the input file has been reached and all data has been processed. */
|
||||||
local int gz_fetch(state)
|
local int gz_fetch(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -254,10 +233,7 @@ local int gz_fetch(state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
||||||
local int gz_skip(state, len)
|
local int gz_skip(gz_statep state, z_off64_t len) {
|
||||||
gz_statep state;
|
|
||||||
z_off64_t len;
|
|
||||||
{
|
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
/* skip over len bytes or reach end-of-file, whichever comes first */
|
/* skip over len bytes or reach end-of-file, whichever comes first */
|
||||||
@@ -289,11 +265,7 @@ local int gz_skip(state, len)
|
|||||||
input. Return the number of bytes read. If zero is returned, either the
|
input. Return the number of bytes read. If zero is returned, either the
|
||||||
end of file was reached, or there was an error. state->err must be
|
end of file was reached, or there was an error. state->err must be
|
||||||
consulted in that case to determine which. */
|
consulted in that case to determine which. */
|
||||||
local z_size_t gz_read(state, buf, len)
|
local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) {
|
||||||
gz_statep state;
|
|
||||||
voidp buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_size_t got;
|
z_size_t got;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
@@ -370,11 +342,7 @@ local z_size_t gz_read(state, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzread(file, buf, len)
|
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
|
||||||
gzFile file;
|
|
||||||
voidp buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -406,12 +374,7 @@ int ZEXPORT gzread(file, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
|
||||||
voidp buf;
|
|
||||||
z_size_t size;
|
|
||||||
z_size_t nitems;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -442,9 +405,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
|||||||
#else
|
#else
|
||||||
# undef gzgetc
|
# undef gzgetc
|
||||||
#endif
|
#endif
|
||||||
int ZEXPORT gzgetc(file)
|
int ZEXPORT gzgetc(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -469,17 +430,12 @@ int ZEXPORT gzgetc(file)
|
|||||||
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT gzgetc_(file)
|
int ZEXPORT gzgetc_(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
return gzgetc(file);
|
return gzgetc(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzungetc(c, file)
|
int ZEXPORT gzungetc(int c, gzFile file) {
|
||||||
int c;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -487,6 +443,10 @@ int ZEXPORT gzungetc(c, file)
|
|||||||
return -1;
|
return -1;
|
||||||
state = (gz_statep)file;
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* in case this was just opened, set up the input buffer */
|
||||||
|
if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
|
||||||
|
(void)gz_look(state);
|
||||||
|
|
||||||
/* check that we're reading and that there's no (serious) error */
|
/* check that we're reading and that there's no (serious) error */
|
||||||
if (state->mode != GZ_READ ||
|
if (state->mode != GZ_READ ||
|
||||||
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
||||||
@@ -536,11 +496,7 @@ int ZEXPORT gzungetc(c, file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
char * ZEXPORT gzgets(file, buf, len)
|
char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
|
||||||
gzFile file;
|
|
||||||
char *buf;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
unsigned left, n;
|
unsigned left, n;
|
||||||
char *str;
|
char *str;
|
||||||
unsigned char *eol;
|
unsigned char *eol;
|
||||||
@@ -600,9 +556,7 @@ char * ZEXPORT gzgets(file, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzdirect(file)
|
int ZEXPORT gzdirect(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -620,9 +574,7 @@ int ZEXPORT gzdirect(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzclose_r(file)
|
int ZEXPORT gzclose_r(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
int ret, err;
|
int ret, err;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|||||||
+19
-65
@@ -5,18 +5,10 @@
|
|||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local int gz_init OF((gz_statep));
|
|
||||||
local int gz_comp OF((gz_statep, int));
|
|
||||||
local int gz_zero OF((gz_statep, z_off64_t));
|
|
||||||
local z_size_t gz_write OF((gz_statep, voidpc, z_size_t));
|
|
||||||
|
|
||||||
/* Initialize state for writing a gzip file. Mark initialization by setting
|
/* Initialize state for writing a gzip file. Mark initialization by setting
|
||||||
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
|
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
|
||||||
success. */
|
success. */
|
||||||
local int gz_init(state)
|
local int gz_init(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
@@ -70,10 +62,7 @@ local int gz_init(state)
|
|||||||
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
|
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
|
||||||
reset to start a new gzip stream. If gz->direct is true, then simply write
|
reset to start a new gzip stream. If gz->direct is true, then simply write
|
||||||
to the output file without compressing, and ignore flush. */
|
to the output file without compressing, and ignore flush. */
|
||||||
local int gz_comp(state, flush)
|
local int gz_comp(gz_statep state, int flush) {
|
||||||
gz_statep state;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
int ret, writ;
|
int ret, writ;
|
||||||
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
|
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
@@ -151,10 +140,7 @@ local int gz_comp(state, flush)
|
|||||||
|
|
||||||
/* Compress len zeros to output. Return -1 on a write error or memory
|
/* Compress len zeros to output. Return -1 on a write error or memory
|
||||||
allocation failure by gz_comp(), or 0 on success. */
|
allocation failure by gz_comp(), or 0 on success. */
|
||||||
local int gz_zero(state, len)
|
local int gz_zero(gz_statep state, z_off64_t len) {
|
||||||
gz_statep state;
|
|
||||||
z_off64_t len;
|
|
||||||
{
|
|
||||||
int first;
|
int first;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
@@ -184,11 +170,7 @@ local int gz_zero(state, len)
|
|||||||
|
|
||||||
/* Write len bytes from buf to file. Return the number of bytes written. If
|
/* Write len bytes from buf to file. Return the number of bytes written. If
|
||||||
the returned value is less than len, then there was an error. */
|
the returned value is less than len, then there was an error. */
|
||||||
local z_size_t gz_write(state, buf, len)
|
local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
|
||||||
gz_statep state;
|
|
||||||
voidpc buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_size_t put = len;
|
z_size_t put = len;
|
||||||
|
|
||||||
/* if len is zero, avoid unnecessary operations */
|
/* if len is zero, avoid unnecessary operations */
|
||||||
@@ -252,11 +234,7 @@ local z_size_t gz_write(state, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzwrite(file, buf, len)
|
int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
|
||||||
gzFile file;
|
|
||||||
voidpc buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -280,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
|
||||||
voidpc buf;
|
gzFile file) {
|
||||||
z_size_t size;
|
|
||||||
z_size_t nitems;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -310,10 +284,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzputc(file, c)
|
int ZEXPORT gzputc(gzFile file, int c) {
|
||||||
gzFile file;
|
|
||||||
int c;
|
|
||||||
{
|
|
||||||
unsigned have;
|
unsigned have;
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
@@ -358,10 +329,7 @@ int ZEXPORT gzputc(file, c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzputs(file, s)
|
int ZEXPORT gzputs(gzFile file, const char *s) {
|
||||||
gzFile file;
|
|
||||||
const char *s;
|
|
||||||
{
|
|
||||||
z_size_t len, put;
|
z_size_t len, put;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@@ -388,8 +356,7 @@ int ZEXPORT gzputs(file, s)
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
|
||||||
{
|
|
||||||
int len;
|
int len;
|
||||||
unsigned left;
|
unsigned left;
|
||||||
char *next;
|
char *next;
|
||||||
@@ -460,8 +427,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
|
||||||
{
|
|
||||||
va_list va;
|
va_list va;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -474,13 +440,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
|||||||
#else /* !STDC && !Z_HAVE_STDARG_H */
|
#else /* !STDC && !Z_HAVE_STDARG_H */
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3,
|
||||||
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
int a4, int a5, int a6, int a7, int a8, int a9, int a10,
|
||||||
gzFile file;
|
int a11, int a12, int a13, int a14, int a15, int a16,
|
||||||
const char *format;
|
int a17, int a18, int a19, int a20) {
|
||||||
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
|
||||||
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
|
|
||||||
{
|
|
||||||
unsigned len, left;
|
unsigned len, left;
|
||||||
char *next;
|
char *next;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
@@ -562,10 +525,7 @@ int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzflush(file, flush)
|
int ZEXPORT gzflush(gzFile file, int flush) {
|
||||||
gzFile file;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
@@ -594,11 +554,7 @@ int ZEXPORT gzflush(file, flush)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzsetparams(file, level, strategy)
|
int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
|
||||||
gzFile file;
|
|
||||||
int level;
|
|
||||||
int strategy;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
|
|
||||||
@@ -609,7 +565,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
|
|||||||
strm = &(state->strm);
|
strm = &(state->strm);
|
||||||
|
|
||||||
/* check that we're writing and that there's no error */
|
/* check that we're writing and that there's no error */
|
||||||
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
/* if no change is requested, then do nothing */
|
/* if no change is requested, then do nothing */
|
||||||
@@ -636,9 +592,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzclose_w(file)
|
int ZEXPORT gzclose_w(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
int ret = Z_OK;
|
int ret = Z_OK;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -15,9 +15,6 @@
|
|||||||
#include "inflate.h"
|
#include "inflate.h"
|
||||||
#include "inffast.h"
|
#include "inffast.h"
|
||||||
|
|
||||||
/* function prototypes */
|
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
strm provides memory allocation functions in zalloc and zfree, or
|
strm provides memory allocation functions in zalloc and zfree, or
|
||||||
Z_NULL to use the library memory allocation functions.
|
Z_NULL to use the library memory allocation functions.
|
||||||
@@ -25,13 +22,9 @@ local void fixedtables OF((struct inflate_state FAR *state));
|
|||||||
windowBits is in the range 8..15, and window is a user-supplied
|
windowBits is in the range 8..15, and window is a user-supplied
|
||||||
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_(z_streamp strm, int windowBits,
|
||||||
z_streamp strm;
|
unsigned char FAR *window, const char *version,
|
||||||
int windowBits;
|
int stream_size) {
|
||||||
unsigned char FAR *window;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||||
@@ -80,9 +73,7 @@ int stream_size;
|
|||||||
used for threaded applications, since the rewriting of the tables and virgin
|
used for threaded applications, since the rewriting of the tables and virgin
|
||||||
may not be thread-safe.
|
may not be thread-safe.
|
||||||
*/
|
*/
|
||||||
local void fixedtables(state)
|
local void fixedtables(struct inflate_state FAR *state) {
|
||||||
struct inflate_state FAR *state;
|
|
||||||
{
|
|
||||||
#ifdef BUILDFIXED
|
#ifdef BUILDFIXED
|
||||||
static int virgin = 1;
|
static int virgin = 1;
|
||||||
static code *lenfix, *distfix;
|
static code *lenfix, *distfix;
|
||||||
@@ -248,13 +239,8 @@ struct inflate_state FAR *state;
|
|||||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||||
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(z_streamp strm, in_func in, void FAR *in_desc,
|
||||||
z_streamp strm;
|
out_func out, void FAR *out_desc) {
|
||||||
in_func in;
|
|
||||||
void FAR *in_desc;
|
|
||||||
out_func out;
|
|
||||||
void FAR *out_desc;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *next; /* next input */
|
z_const unsigned char FAR *next; /* next input */
|
||||||
unsigned char FAR *put; /* next output */
|
unsigned char FAR *put; /* next output */
|
||||||
@@ -632,9 +618,7 @@ void FAR *out_desc;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateBackEnd(strm)
|
int ZEXPORT inflateBackEnd(z_streamp 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;
|
||||||
ZFREE(strm, strm->state);
|
ZFREE(strm, strm->state);
|
||||||
|
|||||||
+1
-4
@@ -47,10 +47,7 @@
|
|||||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||||
output space.
|
output space.
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL inflate_fast(strm, start)
|
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
|
||||||
z_streamp strm;
|
|
||||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *in; /* local strm->next_in */
|
z_const unsigned char FAR *in; /* local strm->next_in */
|
||||||
z_const unsigned char FAR *last; /* have enough input while in < last */
|
z_const unsigned char FAR *last; /* have enough input while in < last */
|
||||||
|
|||||||
+1
-1
@@ -8,4 +8,4 @@
|
|||||||
subject to change. Applications should only use zlib.h.
|
subject to change. Applications should only use zlib.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);
|
||||||
|
|||||||
+30
-99
@@ -91,20 +91,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* function prototypes */
|
local int inflateStateCheck(z_streamp strm) {
|
||||||
local int inflateStateCheck OF((z_streamp strm));
|
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
|
||||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
|
||||||
unsigned copy));
|
|
||||||
#ifdef BUILDFIXED
|
|
||||||
void makefixed OF((void));
|
|
||||||
#endif
|
|
||||||
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
|
||||||
unsigned len));
|
|
||||||
|
|
||||||
local int inflateStateCheck(strm)
|
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (strm == Z_NULL ||
|
if (strm == Z_NULL ||
|
||||||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
||||||
@@ -116,9 +103,7 @@ z_streamp strm;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateResetKeep(strm)
|
int ZEXPORT inflateResetKeep(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
@@ -142,9 +127,7 @@ z_streamp strm;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateReset(strm)
|
int ZEXPORT inflateReset(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
@@ -155,10 +138,7 @@ z_streamp strm;
|
|||||||
return inflateResetKeep(strm);
|
return inflateResetKeep(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateReset2(strm, windowBits)
|
int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
|
||||||
z_streamp strm;
|
|
||||||
int windowBits;
|
|
||||||
{
|
|
||||||
int wrap;
|
int wrap;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
@@ -195,12 +175,8 @@ int windowBits;
|
|||||||
return inflateReset(strm);
|
return inflateReset(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
|
||||||
z_streamp strm;
|
const char *version, int stream_size) {
|
||||||
int windowBits;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
@@ -239,22 +215,17 @@ int stream_size;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit_(strm, version, stream_size)
|
int ZEXPORT inflateInit_(z_streamp strm, const char *version,
|
||||||
z_streamp strm;
|
int stream_size) {
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflatePrime(strm, bits, value)
|
int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) {
|
||||||
z_streamp strm;
|
|
||||||
int bits;
|
|
||||||
int value;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
if (bits == 0)
|
||||||
|
return Z_OK;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
if (bits < 0) {
|
if (bits < 0) {
|
||||||
state->hold = 0;
|
state->hold = 0;
|
||||||
@@ -278,9 +249,7 @@ int value;
|
|||||||
used for threaded applications, since the rewriting of the tables and virgin
|
used for threaded applications, since the rewriting of the tables and virgin
|
||||||
may not be thread-safe.
|
may not be thread-safe.
|
||||||
*/
|
*/
|
||||||
local void fixedtables(state)
|
local void fixedtables(struct inflate_state FAR *state) {
|
||||||
struct inflate_state FAR *state;
|
|
||||||
{
|
|
||||||
#ifdef BUILDFIXED
|
#ifdef BUILDFIXED
|
||||||
static int virgin = 1;
|
static int virgin = 1;
|
||||||
static code *lenfix, *distfix;
|
static code *lenfix, *distfix;
|
||||||
@@ -342,7 +311,7 @@ struct inflate_state FAR *state;
|
|||||||
|
|
||||||
a.out > inffixed.h
|
a.out > inffixed.h
|
||||||
*/
|
*/
|
||||||
void makefixed()
|
void makefixed(void)
|
||||||
{
|
{
|
||||||
unsigned low, size;
|
unsigned low, size;
|
||||||
struct inflate_state state;
|
struct inflate_state state;
|
||||||
@@ -396,11 +365,7 @@ void makefixed()
|
|||||||
output will fall in the output data, making match copies simpler and faster.
|
output will fall in the output data, making match copies simpler and faster.
|
||||||
The advantage may be dependent on the size of the processor's data caches.
|
The advantage may be dependent on the size of the processor's data caches.
|
||||||
*/
|
*/
|
||||||
local int updatewindow(strm, end, copy)
|
local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
|
||||||
z_streamp strm;
|
|
||||||
const Bytef *end;
|
|
||||||
unsigned copy;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
unsigned dist;
|
unsigned dist;
|
||||||
|
|
||||||
@@ -622,10 +587,7 @@ unsigned copy;
|
|||||||
will return Z_BUF_ERROR if it has not reached the end of the stream.
|
will return Z_BUF_ERROR if it has not reached the end of the stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ZEXPORT inflate(strm, flush)
|
int ZEXPORT inflate(z_streamp strm, int flush) {
|
||||||
z_streamp strm;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *next; /* next input */
|
z_const unsigned char FAR *next; /* next input */
|
||||||
unsigned char FAR *put; /* next output */
|
unsigned char FAR *put; /* next output */
|
||||||
@@ -1301,9 +1263,7 @@ int flush;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateEnd(strm)
|
int ZEXPORT inflateEnd(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (inflateStateCheck(strm))
|
if (inflateStateCheck(strm))
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
@@ -1315,11 +1275,8 @@ z_streamp strm;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt *dictLength) {
|
||||||
Bytef *dictionary;
|
|
||||||
uInt *dictLength;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
@@ -1338,11 +1295,8 @@ uInt *dictLength;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt dictLength) {
|
||||||
const Bytef *dictionary;
|
|
||||||
uInt dictLength;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
unsigned long dictid;
|
unsigned long dictid;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -1373,10 +1327,7 @@ uInt dictLength;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateGetHeader(strm, head)
|
int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) {
|
||||||
z_streamp strm;
|
|
||||||
gz_headerp head;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
@@ -1401,11 +1352,8 @@ gz_headerp head;
|
|||||||
called again with more data and the *have state. *have is initialized to
|
called again with more data and the *have state. *have is initialized to
|
||||||
zero for the first call.
|
zero for the first call.
|
||||||
*/
|
*/
|
||||||
local unsigned syncsearch(have, buf, len)
|
local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf,
|
||||||
unsigned FAR *have;
|
unsigned len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
unsigned got;
|
unsigned got;
|
||||||
unsigned next;
|
unsigned next;
|
||||||
|
|
||||||
@@ -1424,9 +1372,7 @@ unsigned len;
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateSync(strm)
|
int ZEXPORT inflateSync(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
unsigned len; /* number of bytes to look at or looked at */
|
unsigned len; /* number of bytes to look at or looked at */
|
||||||
int flags; /* temporary to save header status */
|
int flags; /* temporary to save header status */
|
||||||
unsigned long in, out; /* temporary to save total_in and total_out */
|
unsigned long in, out; /* temporary to save total_in and total_out */
|
||||||
@@ -1482,9 +1428,7 @@ z_streamp strm;
|
|||||||
block. When decompressing, PPP checks that at the end of input packet,
|
block. When decompressing, PPP checks that at the end of input packet,
|
||||||
inflate is waiting for these length bytes.
|
inflate is waiting for these length bytes.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateSyncPoint(strm)
|
int ZEXPORT inflateSyncPoint(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
@@ -1492,10 +1436,7 @@ z_streamp strm;
|
|||||||
return state->mode == STORED && state->bits == 0;
|
return state->mode == STORED && state->bits == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateCopy(dest, source)
|
int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
|
||||||
z_streamp dest;
|
|
||||||
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;
|
||||||
@@ -1539,10 +1480,7 @@ z_streamp source;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateUndermine(strm, subvert)
|
int ZEXPORT inflateUndermine(z_streamp strm, int subvert) {
|
||||||
z_streamp strm;
|
|
||||||
int subvert;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
@@ -1557,10 +1495,7 @@ int subvert;
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateValidate(strm, check)
|
int ZEXPORT inflateValidate(z_streamp strm, int check) {
|
||||||
z_streamp strm;
|
|
||||||
int check;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
@@ -1572,9 +1507,7 @@ int check;
|
|||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long ZEXPORT inflateMark(strm)
|
long ZEXPORT inflateMark(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm))
|
if (inflateStateCheck(strm))
|
||||||
@@ -1585,9 +1518,7 @@ z_streamp strm;
|
|||||||
(state->mode == MATCH ? state->was - state->length : 0));
|
(state->mode == MATCH ? state->was - state->length : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long ZEXPORT inflateCodesUsed(strm)
|
unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
|||||||
+6
-11
@@ -1,5 +1,5 @@
|
|||||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2022 Mark Adler
|
* Copyright (C) 1995-2023 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.13 Copyright 1995-2022 Mark Adler ";
|
" inflate 1.3 Copyright 1995-2023 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
|
||||||
@@ -29,14 +29,9 @@ const char inflate_copyright[] =
|
|||||||
table index bits. It will differ if the request is greater than the
|
table index bits. It will differ if the request is greater than the
|
||||||
longest code or if it is less than the shortest code.
|
longest code or if it is less than the shortest code.
|
||||||
*/
|
*/
|
||||||
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
|
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
||||||
codetype type;
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned short FAR *lens;
|
unsigned FAR *bits, unsigned short FAR *work) {
|
||||||
unsigned codes;
|
|
||||||
code FAR * FAR *table;
|
|
||||||
unsigned FAR *bits;
|
|
||||||
unsigned short FAR *work;
|
|
||||||
{
|
|
||||||
unsigned len; /* a code's length in bits */
|
unsigned len; /* a code's length in bits */
|
||||||
unsigned sym; /* index of code symbols */
|
unsigned sym; /* index of code symbols */
|
||||||
unsigned min, max; /* minimum and maximum code lengths */
|
unsigned min, max; /* minimum and maximum code lengths */
|
||||||
@@ -62,7 +57,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, 194, 65};
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203};
|
||||||
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,
|
||||||
|
|||||||
+3
-3
@@ -57,6 +57,6 @@ typedef enum {
|
|||||||
DISTS
|
DISTS
|
||||||
} codetype;
|
} codetype;
|
||||||
|
|
||||||
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
||||||
unsigned codes, code FAR * FAR *table,
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned FAR *bits, unsigned short FAR *work));
|
unsigned FAR *bits, unsigned short FAR *work);
|
||||||
|
|||||||
+224
-302
File diff suppressed because it is too large
Load Diff
+4
-12
@@ -24,12 +24,8 @@
|
|||||||
Z_DATA_ERROR if the input data was corrupted, including if the input data is
|
Z_DATA_ERROR if the input data was corrupted, including if the input data is
|
||||||
an incomplete zlib stream.
|
an incomplete zlib stream.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
|
int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong *sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong *sourceLen;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
const uInt max = (uInt)-1;
|
const uInt max = (uInt)-1;
|
||||||
@@ -83,11 +79,7 @@ int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
|
|||||||
err;
|
err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT uncompress(dest, destLen, source, sourceLen)
|
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return uncompress2(dest, destLen, source, &sourceLen);
|
return uncompress2(dest, destLen, source, &sourceLen);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -254,7 +254,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_SOLO
|
#ifdef Z_SOLO
|
||||||
typedef unsigned long z_size_t;
|
# ifdef _WIN64
|
||||||
|
typedef unsigned long long z_size_t;
|
||||||
|
# else
|
||||||
|
typedef unsigned long z_size_t;
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# define z_longlong long long
|
# define z_longlong long long
|
||||||
# if defined(NO_SIZE_T)
|
# if defined(NO_SIZE_T)
|
||||||
@@ -533,7 +537,7 @@ typedef uLong FAR uLongf;
|
|||||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||||
# define z_off64_t off64_t
|
# define z_off64_t off64_t
|
||||||
#else
|
#else
|
||||||
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
# if defined(_WIN32) && !defined(__GNUC__)
|
||||||
# define z_off64_t __int64
|
# define z_off64_t __int64
|
||||||
# else
|
# else
|
||||||
# define z_off64_t z_off_t
|
# define z_off64_t z_off_t
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
.TH ZLIB 3 "13 Oct 2022"
|
.TH ZLIB 3 "18 Aug 2023"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zlib \- compression/decompression library
|
zlib \- compression/decompression library
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -105,9 +105,9 @@ before asking for help.
|
|||||||
Send questions and/or comments to zlib@gzip.org,
|
Send questions and/or comments to zlib@gzip.org,
|
||||||
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
||||||
.SH AUTHORS AND LICENSE
|
.SH AUTHORS AND LICENSE
|
||||||
Version 1.2.13
|
Version 1.3
|
||||||
.LP
|
.LP
|
||||||
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
|
||||||
.LP
|
.LP
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
+191
-186
File diff suppressed because it is too large
Load Diff
+16
-44
@@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char * ZEXPORT zlibVersion()
|
const char * ZEXPORT zlibVersion(void) {
|
||||||
{
|
|
||||||
return ZLIB_VERSION;
|
return ZLIB_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
uLong ZEXPORT zlibCompileFlags()
|
uLong ZEXPORT zlibCompileFlags(void) {
|
||||||
{
|
|
||||||
uLong flags;
|
uLong flags;
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
@@ -121,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags()
|
|||||||
# endif
|
# endif
|
||||||
int ZLIB_INTERNAL z_verbose = verbose;
|
int ZLIB_INTERNAL z_verbose = verbose;
|
||||||
|
|
||||||
void ZLIB_INTERNAL z_error(m)
|
void ZLIB_INTERNAL z_error(char *m) {
|
||||||
char *m;
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s\n", m);
|
fprintf(stderr, "%s\n", m);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -132,9 +128,7 @@ void ZLIB_INTERNAL z_error(m)
|
|||||||
/* exported to allow conversion of error code to string for compress() and
|
/* exported to allow conversion of error code to string for compress() and
|
||||||
* uncompress()
|
* uncompress()
|
||||||
*/
|
*/
|
||||||
const char * ZEXPORT zError(err)
|
const char * ZEXPORT zError(int err) {
|
||||||
int err;
|
|
||||||
{
|
|
||||||
return ERR_MSG(err);
|
return ERR_MSG(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,22 +142,14 @@ const char * ZEXPORT zError(err)
|
|||||||
|
|
||||||
#ifndef HAVE_MEMCPY
|
#ifndef HAVE_MEMCPY
|
||||||
|
|
||||||
void ZLIB_INTERNAL zmemcpy(dest, source, len)
|
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
|
||||||
Bytef* dest;
|
|
||||||
const Bytef* source;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
if (len == 0) return;
|
if (len == 0) return;
|
||||||
do {
|
do {
|
||||||
*dest++ = *source++; /* ??? to be unrolled */
|
*dest++ = *source++; /* ??? to be unrolled */
|
||||||
} while (--len != 0);
|
} while (--len != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
|
||||||
const Bytef* s1;
|
|
||||||
const Bytef* s2;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
uInt j;
|
uInt j;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (j = 0; j < len; j++) {
|
||||||
@@ -172,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zmemzero(dest, len)
|
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
|
||||||
Bytef* dest;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
if (len == 0) return;
|
if (len == 0) return;
|
||||||
do {
|
do {
|
||||||
*dest++ = 0; /* ??? to be unrolled */
|
*dest++ = 0; /* ??? to be unrolled */
|
||||||
@@ -216,8 +199,7 @@ local ptr_table table[MAX_PTR];
|
|||||||
* a protected system like OS/2. Use Microsoft C instead.
|
* a protected system like OS/2. Use Microsoft C instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
||||||
{
|
|
||||||
voidpf buf;
|
voidpf buf;
|
||||||
ulg bsize = (ulg)items*size;
|
ulg bsize = (ulg)items*size;
|
||||||
|
|
||||||
@@ -242,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
@@ -279,14 +260,12 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
|||||||
# define _hfree hfree
|
# define _hfree hfree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
return _halloc((long)items, size);
|
return _halloc((long)items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
_hfree(ptr);
|
_hfree(ptr);
|
||||||
}
|
}
|
||||||
@@ -299,25 +278,18 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
|||||||
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
||||||
|
|
||||||
#ifndef STDC
|
#ifndef STDC
|
||||||
extern voidp malloc OF((uInt size));
|
extern voidp malloc(uInt size);
|
||||||
extern voidp calloc OF((uInt items, uInt size));
|
extern voidp calloc(uInt items, uInt size);
|
||||||
extern void free OF((voidpf ptr));
|
extern void free(voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
||||||
voidpf opaque;
|
|
||||||
unsigned items;
|
|
||||||
unsigned size;
|
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
||||||
(voidpf)calloc(items, size);
|
(voidpf)calloc(items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(opaque, ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
voidpf opaque;
|
|
||||||
voidpf ptr;
|
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -191,9 +191,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
/* provide prototypes for these when building zlib without LFS */
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
#if !defined(_WIN32) && \
|
#if !defined(_WIN32) && \
|
||||||
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* common defaults */
|
/* common defaults */
|
||||||
@@ -232,16 +232,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
|
||||||
int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
|
||||||
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
|
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Diagnostic functions */
|
/* Diagnostic functions */
|
||||||
#ifdef ZLIB_DEBUG
|
#ifdef ZLIB_DEBUG
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
extern int ZLIB_INTERNAL z_verbose;
|
extern int ZLIB_INTERNAL z_verbose;
|
||||||
extern void ZLIB_INTERNAL z_error OF((char *m));
|
extern void ZLIB_INTERNAL z_error(char *m);
|
||||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||||
@@ -258,9 +258,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_SOLO
|
#ifndef Z_SOLO
|
||||||
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
|
||||||
unsigned size));
|
unsigned size);
|
||||||
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
|
|||||||
Reference in New Issue
Block a user