ZLIB
Loading...
Searching...
No Matches
z_stream Struct Reference

Compressed stream state information. More...

#include <zlib.h>

Data Fields

const Bytef * next_in
 next input byte
 
uInt avail_in
 number of bytes available at next_in
 
uLong total_in
 total number of input bytes read so far
 
Bytef * next_out
 next output byte will go here
 
uInt avail_out
 remaining free space at next_out
 
uLong total_out
 total number of bytes output so far
 
const char * msg
 last error message, NULL if no error
 
struct internal_state * state
 not visible by applications
 
alloc_func zalloc
 used to allocate the internal state
 
free_func zfree
 used to free the internal state
 
voidpf opaque
 private data object passed to zalloc and zfree
 
int data_type
 
uLong adler
 Adler-32 or CRC-32 value of the uncompressed data.
 
uLong reserved
 reserved for future use
 

Detailed Description

Compressed stream state information.

The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application.

The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use by the decompressor (particularly if the decompressor wants to decompress everything in a single step).

zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. In that case, zlib is thread-safe. When zalloc and zfree are Z_NULL on entry to the initialization function, they are set to internal routines that use the standard library functions malloc() and free().

On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h).

Warning
On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes must have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).

Field Documentation

◆ data_type

int z_stream::data_type

best guess about the data type: binary or text for deflate, or the decoding state for inflate


The documentation for this struct was generated from the following file: