#include <immintrin.h>
extern void fill_window_sse(deflate_state *s);
-extern void flush_pending (z_streamp strm);
+extern void flush_pending (z_stream *strm);
local inline long compare258(z_const unsigned char *z_const src0,
z_const unsigned char *z_const src1)
#include <immintrin.h>
#include "deflate.h"
-extern int read_buf (z_streamp strm, Byte *buf, unsigned size);
+extern int read_buf (z_stream *strm, Byte *buf, unsigned size);
ZLIB_INTERNAL void fill_window_sse(deflate_state *s)
{
#endif
}
-ZLIB_INTERNAL void copy_with_crc(z_streamp strm, Byte *dst, long size)
+ZLIB_INTERNAL void copy_with_crc(z_stream *strm, Byte *dst, long size)
{
#ifdef X86_PCLMULQDQ_CRC
if (x86_cpu_has_pclmulqdq) {
local block_state deflate_huff (deflate_state *s, int flush);
local void lm_init (deflate_state *s);
local void putShortMSB (deflate_state *s, uInt b);
-ZLIB_INTERNAL void flush_pending (z_streamp strm);
-ZLIB_INTERNAL int read_buf (z_streamp strm, Byte *buf, unsigned size);
+ZLIB_INTERNAL void flush_pending (z_stream *strm);
+ZLIB_INTERNAL int read_buf (z_stream *strm, Byte *buf, unsigned size);
#ifdef DEBUG
local void check_match (deflate_state *s, IPos start, IPos match, int length);
extern void crc_reset(deflate_state *const s);
extern void crc_finalize(deflate_state *const s);
-extern void copy_with_crc(z_streamp strm, Byte *dst, long size);
+extern void copy_with_crc(z_stream *strm, Byte *dst, long size);
/* ===========================================================================
* Local data
/* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
+ z_stream *strm;
int level;
const char *version;
int stream_size;
/* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
version, stream_size)
- z_streamp strm;
+ z_stream *strm;
int level;
int method;
int windowBits;
/* ========================================================================= */
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
+ z_stream *strm;
const Byte *dictionary;
uInt dictLength;
{
/* ========================================================================= */
int ZEXPORT deflateResetKeep (strm)
- z_streamp strm;
+ z_stream *strm;
{
deflate_state *s;
/* ========================================================================= */
int ZEXPORT deflateReset (strm)
- z_streamp strm;
+ z_stream *strm;
{
int ret;
/* ========================================================================= */
int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
+ z_stream *strm;
gz_headerp head;
{
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
int ZEXPORT deflatePending (strm, pending, bits)
unsigned *pending;
int *bits;
- z_streamp strm;
+ z_stream *strm;
{
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
if (pending != Z_NULL)
/* ========================================================================= */
int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
+ z_stream *strm;
int bits;
int value;
{
/* ========================================================================= */
int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
+ z_stream *strm;
int level;
int strategy;
{
/* ========================================================================= */
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
+ z_stream *strm;
int good_length;
int max_lazy;
int nice_length;
* allocation.
*/
uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
+ z_stream *strm;
uLong sourceLen;
{
deflate_state *s;
* (See also read_buf()).
*/
ZLIB_INTERNAL void flush_pending(strm)
- z_streamp strm;
+ z_stream *strm;
{
unsigned len;
deflate_state *s = strm->state;
/* ========================================================================= */
int ZEXPORT deflate (strm, flush)
- z_streamp strm;
+ z_stream *strm;
int flush;
{
int old_flush; /* value of flush param for previous deflate call */
/* ========================================================================= */
int ZEXPORT deflateEnd (strm)
- z_streamp strm;
+ z_stream *strm;
{
int status;
* Copy the source state to the destination state.
*/
int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
+ z_stream *dest;
+ z_stream *source;
{
deflate_state *ds;
deflate_state *ss;
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-ZLIB_INTERNAL int read_buf(z_streamp strm, Byte *buf, unsigned size)
+ZLIB_INTERNAL int read_buf(z_stream *strm, Byte *buf, unsigned size)
{
unsigned len = strm->avail_in;
*/
typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
+ z_stream *strm; /* pointer back to this zlib stream */
int status; /* as the name implies */
Byte *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */
local int gz_avail(gz_statep state)
{
unsigned got;
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
if (state->err != Z_OK && state->err != Z_BUF_ERROR)
return -1;
gz_look() will return 0 on success or -1 on failure. */
local int gz_look(gz_statep state)
{
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
/* allocate read buffers and inflate memory */
if (state->size == 0) {
{
int ret = Z_OK;
unsigned had;
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
/* fill output buffer up to end of deflate stream */
had = strm->avail_out;
end of the input file has been reached and all data has been processed. */
local int gz_fetch(gz_statep state)
{
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
do {
switch(state->how) {
{
unsigned got, n;
gz_statep state;
- z_streamp strm;
+ z_stream *strm;
/* get internal structure */
if (file == NULL)
local int gz_init(gz_statep state)
{
int ret;
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
/* allocate input buffer */
state->in = (unsigned char *)malloc(state->want);
{
int ret, got;
unsigned have;
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
/* allocate memory if this is the first time through */
if (state->size == 0 && gz_init(state) == -1)
{
int first;
unsigned n;
- z_streamp strm = &(state->strm);
+ z_stream *strm = &(state->strm);
/* consume whatever's left in the input buffer */
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
{
unsigned put = len;
gz_statep state;
- z_streamp strm;
+ z_stream *strm;
/* get internal structure */
if (file == NULL)
unsigned have;
unsigned char buf[1];
gz_statep state;
- z_streamp strm;
+ z_stream *strm;
/* get internal structure */
if (file == NULL)
{
int size, len;
gz_statep state;
- z_streamp strm;
+ z_stream *strm;
/* get internal structure */
if (file == NULL)
int strategy;
{
gz_statep state;
- z_streamp strm;
+ z_stream *strm;
/* get internal structure */
if (file == NULL)
window and output buffer that is 2**windowBits bytes.
*/
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
-z_streamp strm;
+z_stream *strm;
int windowBits;
unsigned char *window;
const char *version;
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)
-z_streamp strm;
+z_stream *strm;
in_func in;
void *in_desc;
out_func out;
}
int ZEXPORT inflateBackEnd(strm)
-z_streamp strm;
+z_stream *strm;
{
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR;
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
+void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start)
{
/* start: inflate()'s starting value for strm->avail_out */
struct inflate_state *state;
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast (z_streamp strm, unsigned start);
+void ZLIB_INTERNAL inflate_fast (z_stream *strm, unsigned start);
/* function prototypes */
local void fixedtables (struct inflate_state *state);
-local int updatewindow (z_streamp strm, const unsigned char *end, unsigned copy);
+local int updatewindow (z_stream *strm, const unsigned char *end, unsigned copy);
#ifdef BUILDFIXED
void makefixed (void);
#endif
local unsigned syncsearch (unsigned *have, const unsigned char *buf, unsigned len);
int ZEXPORT inflateResetKeep(strm)
-z_streamp strm;
+z_stream *strm;
{
struct inflate_state *state;
}
int ZEXPORT inflateReset(strm)
-z_streamp strm;
+z_stream *strm;
{
struct inflate_state *state;
}
int ZEXPORT inflateReset2(strm, windowBits)
-z_streamp strm;
+z_stream *strm;
int windowBits;
{
int wrap;
}
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
+z_stream *strm;
int windowBits;
const char *version;
int stream_size;
}
int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
+z_stream *strm;
const char *version;
int stream_size;
{
}
int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
+z_stream *strm;
int bits;
int value;
{
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.
*/
-local int updatewindow(z_streamp strm, const Byte *end, unsigned copy)
+local int updatewindow(z_stream *strm, const Byte *end, unsigned copy)
{
struct inflate_state *state;
unsigned dist;
*/
int ZEXPORT inflate(strm, flush)
-z_streamp strm;
+z_stream *strm;
int flush;
{
struct inflate_state *state;
}
int ZEXPORT inflateEnd(strm)
-z_streamp strm;
+z_stream *strm;
{
struct inflate_state *state;
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
}
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
+z_stream *strm;
Byte *dictionary;
uInt *dictLength;
{
}
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
+z_stream *strm;
const Byte *dictionary;
uInt dictLength;
{
}
int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
+z_stream *strm;
gz_headerp head;
{
struct inflate_state *state;
}
int ZEXPORT inflateSync(strm)
-z_streamp strm;
+z_stream *strm;
{
unsigned len; /* number of bytes to look at or looked at */
unsigned long in, out; /* temporary to save total_in and total_out */
inflate is waiting for these length bytes.
*/
int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
+z_stream *strm;
{
struct inflate_state *state;
}
int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
+z_stream *dest;
+z_stream *source;
{
struct inflate_state *state;
struct inflate_state *copy;
}
int ZEXPORT inflateUndermine(strm, subvert)
-z_streamp strm;
+z_stream *strm;
int subvert;
{
struct inflate_state *state;
}
long ZEXPORT inflateMark(strm)
-z_streamp strm;
+z_stream *strm;
{
struct inflate_state *state;
uLong reserved; /* reserved for future use */
} z_stream;
-typedef z_stream *z_streamp;
+typedef z_stream *z_streamp; // Obsolete type, retained for compatability only
/*
gzip header information passed to and from zlib routines. See RFC 1952
*/
/*
-ZEXTERN int ZEXPORT deflateInit (z_streamp strm, int level);
+ZEXTERN int ZEXPORT deflateInit (z_stream *strm, int level);
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If
*/
-ZEXTERN int ZEXPORT deflate (z_streamp strm, int flush);
+ZEXTERN int ZEXPORT deflate (z_stream *strm, int flush);
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
*/
-ZEXTERN int ZEXPORT deflateEnd (z_streamp strm);
+ZEXTERN int ZEXPORT deflateEnd (z_stream *strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
/*
-ZEXTERN int ZEXPORT inflateInit (z_streamp strm);
+ZEXTERN int ZEXPORT inflateInit (z_stream *strm);
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
*/
-ZEXTERN int ZEXPORT inflate (z_streamp strm, int flush);
+ZEXTERN int ZEXPORT inflate (z_stream *strm, int flush);
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
*/
-ZEXTERN int ZEXPORT inflateEnd (z_streamp strm);
+ZEXTERN int ZEXPORT inflateEnd (z_stream *strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
*/
/*
-ZEXTERN int ZEXPORT deflateInit2 (z_streamp strm,
+ZEXTERN int ZEXPORT deflateInit2 (z_stream *strm,
int level,
int method,
int windowBits,
compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateSetDictionary (z_streamp strm,
+ZEXTERN int ZEXPORT deflateSetDictionary (z_stream *strm,
const Byte *dictionary,
uInt dictLength);
/*
not perform any compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateCopy (z_streamp dest,
- z_streamp source);
+ZEXTERN int ZEXPORT deflateCopy (z_stream *dest,
+ z_stream *source);
/*
Sets the destination stream as a complete copy of the source stream.
destination.
*/
-ZEXTERN int ZEXPORT deflateReset (z_streamp strm);
+ZEXTERN int ZEXPORT deflateReset (z_stream *strm);
/*
This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state. The
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT deflateParams (z_streamp strm,
+ZEXTERN int ZEXPORT deflateParams (z_stream *strm,
int level,
int strategy);
/*
strm->avail_out was zero.
*/
-ZEXTERN int ZEXPORT deflateTune (z_streamp strm,
+ZEXTERN int ZEXPORT deflateTune (z_stream *strm,
int good_length,
int max_lazy,
int nice_length,
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
-ZEXTERN uLong ZEXPORT deflateBound (z_streamp strm,
+ZEXTERN uLong ZEXPORT deflateBound (z_stream *strm,
uLong sourceLen);
/*
deflateBound() returns an upper bound on the compressed size after
than Z_FINISH or Z_NO_FLUSH are used.
*/
-ZEXTERN int ZEXPORT deflatePending (z_streamp strm,
+ZEXTERN int ZEXPORT deflatePending (z_stream *strm,
unsigned *pending,
int *bits);
/*
stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflatePrime (z_streamp strm,
+ZEXTERN int ZEXPORT deflatePrime (z_stream *strm,
int bits,
int value);
/*
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflateSetHeader (z_streamp strm,
+ZEXTERN int ZEXPORT deflateSetHeader (z_stream *strm,
gz_headerp head);
/*
deflateSetHeader() provides gzip header information for when a gzip
*/
/*
-ZEXTERN int ZEXPORT inflateInit2 (z_streamp strm,
+ZEXTERN int ZEXPORT inflateInit2 (z_stream *strm,
int windowBits);
This is another version of inflateInit with an extra parameter. The
deferred until inflate() is called.
*/
-ZEXTERN int ZEXPORT inflateSetDictionary (z_streamp strm,
+ZEXTERN int ZEXPORT inflateSetDictionary (z_stream *strm,
const Byte *dictionary,
uInt dictLength);
/*
inflate().
*/
-ZEXTERN int ZEXPORT inflateGetDictionary (z_streamp strm,
+ZEXTERN int ZEXPORT inflateGetDictionary (z_stream *strm,
Byte *dictionary,
uInt *dictLength);
/*
stream state is inconsistent.
*/
-ZEXTERN int ZEXPORT inflateSync (z_streamp strm);
+ZEXTERN int ZEXPORT inflateSync (z_stream *strm);
/*
Skips invalid compressed data until a possible full flush point (see above
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
input each time, until success or end of the input data.
*/
-ZEXTERN int ZEXPORT inflateCopy (z_streamp dest,
- z_streamp source);
+ZEXTERN int ZEXPORT inflateCopy (z_stream *dest,
+ z_stream *source);
/*
Sets the destination stream as a complete copy of the source stream.
destination.
*/
-ZEXTERN int ZEXPORT inflateReset (z_streamp strm);
+ZEXTERN int ZEXPORT inflateReset (z_stream *strm);
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state. The
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT inflateReset2 (z_streamp strm,
+ZEXTERN int ZEXPORT inflateReset2 (z_stream *strm,
int windowBits);
/*
This function is the same as inflateReset, but it also permits changing
the windowBits parameter is invalid.
*/
-ZEXTERN int ZEXPORT inflatePrime (z_streamp strm,
+ZEXTERN int ZEXPORT inflatePrime (z_stream *strm,
int bits,
int value);
/*
stream state was inconsistent.
*/
-ZEXTERN long ZEXPORT inflateMark (z_streamp strm);
+ZEXTERN long ZEXPORT inflateMark (z_stream *strm);
/*
This function returns two values, one in the lower 16 bits of the return
value, and the other in the remaining upper bits, obtained by shifting the
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT inflateGetHeader (z_streamp strm,
+ZEXTERN int ZEXPORT inflateGetHeader (z_stream *strm,
gz_headerp head);
/*
inflateGetHeader() requests that gzip header information be stored in the
*/
/*
-ZEXTERN int ZEXPORT inflateBackInit (z_streamp strm, int windowBits,
+ZEXTERN int ZEXPORT inflateBackInit (z_stream *strm, int windowBits,
unsigned char *window);
Initialize the internal stream state for decompression using inflateBack()
z_const unsigned char * *);
typedef int (*out_func) (void *, unsigned char *, unsigned);
-ZEXTERN int ZEXPORT inflateBack (z_streamp strm,
+ZEXTERN int ZEXPORT inflateBack (z_stream *strm,
in_func in, void *in_desc,
out_func out, void *out_desc);
/*
cannot return Z_OK.
*/
-ZEXTERN int ZEXPORT inflateBackEnd (z_streamp strm);
+ZEXTERN int ZEXPORT inflateBackEnd (z_stream *strm);
/*
All memory allocated by inflateBackInit() is freed.
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
-ZEXTERN int ZEXPORT deflateInit_ (z_streamp strm, int level, const char *version, int stream_size);
-ZEXTERN int ZEXPORT inflateInit_ (z_streamp strm, const char *version, int stream_size);
-ZEXTERN int ZEXPORT deflateInit2_ (z_streamp strm, int level, int method, int windowBits, int memLevel,
+ZEXTERN int ZEXPORT deflateInit_ (z_stream *strm, int level, const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateInit_ (z_stream *strm, const char *version, int stream_size);
+ZEXTERN int ZEXPORT deflateInit2_ (z_stream *strm, int level, int method, int windowBits, int memLevel,
int strategy, const char *version, int stream_size);
-ZEXTERN int ZEXPORT inflateInit2_ (z_streamp strm, int windowBits, const char *version, int stream_size);
-ZEXTERN int ZEXPORT inflateBackInit_ (z_streamp strm, int windowBits, unsigned char *window,
+ZEXTERN int ZEXPORT inflateInit2_ (z_stream *strm, int windowBits, const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateBackInit_ (z_stream *strm, int windowBits, unsigned char *window,
const char *version, int stream_size);
#define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError (int);
-ZEXTERN int ZEXPORT inflateSyncPoint (z_streamp);
+ZEXTERN int ZEXPORT inflateSyncPoint (z_stream *);
ZEXTERN const z_crc_t * ZEXPORT get_crc_table (void);
-ZEXTERN int ZEXPORT inflateUndermine (z_streamp, int);
-ZEXTERN int ZEXPORT inflateResetKeep (z_streamp);
-ZEXTERN int ZEXPORT deflateResetKeep (z_streamp);
+ZEXTERN int ZEXPORT inflateUndermine (z_stream *, int);
+ZEXTERN int ZEXPORT inflateResetKeep (z_stream *);
+ZEXTERN int ZEXPORT deflateResetKeep (z_stream *);
#if defined(_WIN32) && !defined(Z_SOLO)
ZEXTERN gzFile ZEXPORT gzopen_w (const wchar_t *path, const char *mode);
#endif