pngcrush  1.8.13
About: Pngcrush is an optimizer for PNG (Portable Network Graphics) files.
  Fossies Dox: pngcrush-1.8.13.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

inflate.c File Reference
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
#include "inffixed.h"
Include dependency graph for inflate.c:

Go to the source code of this file.

Macros

#define UPDATE(check, buf, len)   (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
 
#define CRC2(check, word)
 
#define CRC4(check, word)
 
#define LOAD()
 
#define RESTORE()
 
#define INITBITS()
 
#define PULLBYTE()
 
#define NEEDBITS(n)
 
#define BITS(n)   ((unsigned)hold & ((1U << (n)) - 1))
 
#define DROPBITS(n)
 
#define BYTEBITS()
 

Functions

static int inflateStateCheck ()
 
static void fixedtables ()
 
static int updatewindow ()
 
static unsigned syncsearch ()
 
static int inflateStateCheck (z_streamp strm)
 
int inflateResetKeep (z_streamp strm)
 
int inflateReset (z_streamp strm)
 
int inflateReset2 (z_streamp strm, int windowBits)
 
int inflateInit2_ (z_streamp strm, int windowBits, const char *version, int stream_size)
 
int inflateInit_ (z_streamp strm, const char *version, int stream_size)
 
int inflatePrime (z_streamp strm, int bits, int value)
 
static void fixedtables (struct inflate_state *state)
 
static int updatewindow (z_streamp strm, const Bytef *end, unsigned copy)
 
int inflate (z_streamp strm, int flush)
 
int inflateEnd (z_streamp strm)
 
int inflateGetDictionary (z_streamp strm, Bytef *dictionary, uInt *dictLength)
 
int inflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
 
int inflateGetHeader (z_streamp strm, gz_headerp head)
 
static unsigned syncsearch (unsigned *have, const unsigned char *buf, unsigned len)
 
int inflateSync (z_streamp strm)
 
int inflateSyncPoint (z_streamp strm)
 
int inflateCopy (z_streamp dest, z_streamp source)
 
int inflateUndermine (z_streamp strm, int subvert)
 
int inflateValidate (z_streamp strm, int check)
 
long inflateMark (z_streamp strm)
 
unsigned long inflateCodesUsed (z_streamp strm)
 

Macro Definition Documentation

◆ BITS

#define BITS (   n)    ((unsigned)hold & ((1U << (n)) - 1))

Definition at line 523 of file inflate.c.

◆ BYTEBITS

#define BYTEBITS ( )
Value:
do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)

Definition at line 534 of file inflate.c.

◆ CRC2

#define CRC2 (   check,
  word 
)
Value:
do { \
hbuf[0] = (unsigned char)(word); \
hbuf[1] = (unsigned char)((word) >> 8); \
check = crc32(check, hbuf, 2); \
} while (0)

Definition at line 458 of file inflate.c.

◆ CRC4

#define CRC4 (   check,
  word 
)
Value:
do { \
hbuf[0] = (unsigned char)(word); \
hbuf[1] = (unsigned char)((word) >> 8); \
hbuf[2] = (unsigned char)((word) >> 16); \
hbuf[3] = (unsigned char)((word) >> 24); \
check = crc32(check, hbuf, 4); \
} while (0)

Definition at line 465 of file inflate.c.

◆ DROPBITS

#define DROPBITS (   n)
Value:
do { \
hold >>= (n); \
bits -= (unsigned)(n); \
} while (0)

Definition at line 527 of file inflate.c.

◆ INITBITS

#define INITBITS ( )
Value:
do { \
hold = 0; \
bits = 0; \
} while (0)

Definition at line 498 of file inflate.c.

◆ LOAD

#define LOAD ( )
Value:
do { \
put = strm->next_out; \
left = strm->avail_out; \
next = strm->next_in; \
have = strm->avail_in; \
hold = state->hold; \
bits = state->bits; \
} while (0)

Definition at line 476 of file inflate.c.

◆ NEEDBITS

#define NEEDBITS (   n)
Value:
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)

Definition at line 516 of file inflate.c.

◆ PULLBYTE

#define PULLBYTE ( )
Value:
do { \
if (have == 0) goto inf_leave; \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8; \
} while (0)

Definition at line 506 of file inflate.c.

◆ RESTORE

#define RESTORE ( )
Value:
do { \
strm->next_out = put; \
strm->avail_out = left; \
strm->next_in = next; \
strm->avail_in = have; \
state->hold = hold; \
state->bits = bits; \
} while (0)

Definition at line 487 of file inflate.c.

◆ UPDATE

#define UPDATE (   check,
  buf,
  len 
)    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))

Definition at line 450 of file inflate.c.

Function Documentation

◆ fixedtables() [1/2]

static void fixedtables ( )
static

Referenced by inflate().

◆ fixedtables() [2/2]

◆ inflate()

int inflate ( z_streamp  strm,
int  flush 
)

Definition at line 622 of file inflate.c.

References z_stream_s::adler, adler32(), z_stream_s::avail_in, z_stream_s::avail_out, inflate_state::back, BAD, code::bits, inflate_state::bits, BITS, BYTEBITS, CHECK, inflate_state::check, CODELENS, CODES, inflate_state::codes, gz_header_s::comm_max, COMMENT, gz_header_s::comment, COPY, COPY_, CRC2, crc32(), CRC4, z_stream_s::data_type, DICT, DICTID, DIST, inflate_state::distbits, inflate_state::distcode, DISTEXT, DISTS, inflate_state::dmax, DONE, gz_header_s::done, DROPBITS, EXLEN, EXTRA, inflate_state::extra, gz_header_s::extra, gz_header_s::extra_len, gz_header_s::extra_max, FAR, fixedtables(), FLAGS, inflate_state::flags, GUNZIP, inflate_state::have, inflate_state::havedict, HCRC, gz_header_s::hcrc, HEAD, inflate_state::head, inflate_state::hold, inflate_fast(), inflate_table(), inflateStateCheck(), INITBITS, inflate_state::last, LEN, LEN_, inflate_state::lenbits, inflate_state::lencode, LENEXT, LENGTH, inflate_state::length, LENLENS, LENS, inflate_state::lens, LIT, LOAD, MATCH, MEM, inflate_state::mode, z_stream_s::msg, NAME, gz_header_s::name, gz_header_s::name_max, inflate_state::ncode, inflate_state::ndist, NEEDBITS, inflate_state::next, z_stream_s::next_in, z_stream_s::next_out, inflate_state::nlen, inflate_state::offset, code::op, OS, gz_header_s::os, PULLBYTE, RESTORE, inflate_state::sane, z_stream_s::state, STORED, inflate_state::strm, SYNC, TABLE, gz_header_s::text, TIME, gz_header_s::time, inflate_state::total, z_stream_s::total_in, z_stream_s::total_out, Trace, Tracev, Tracevv, TYPE, TYPEDO, UPDATE, updatewindow(), code::val, inflate_state::was, inflate_state::wbits, inflate_state::whave, inflate_state::window, inflate_state::wnext, inflate_state::work, inflate_state::wrap, inflate_state::wsize, gz_header_s::xflags, Z_BLOCK, Z_BUF_ERROR, z_const, Z_DATA_ERROR, Z_DEFLATED, Z_FINISH, Z_MEM_ERROR, Z_NEED_DICT, Z_NULL, Z_OK, Z_STREAM_END, Z_STREAM_ERROR, Z_TREES, zmemcpy(), and ZSWAP32.

Referenced by gz_decomp(), png_zlib_inflate(), and uncompress2().

◆ inflateCodesUsed()

unsigned long inflateCodesUsed ( z_streamp  strm)

◆ inflateCopy()

◆ inflateEnd()

◆ inflateGetDictionary()

int inflateGetDictionary ( z_streamp  strm,
Bytef dictionary,
uInt dictLength 
)

◆ inflateGetHeader()

◆ inflateInit2_()

◆ inflateInit_()

int inflateInit_ ( z_streamp  strm,
const char *  version,
int  stream_size 
)

Definition at line 239 of file inflate.c.

References DEF_WBITS, inflateInit2_(), and internal_state::strm.

◆ inflateMark()

◆ inflatePrime()

int inflatePrime ( z_streamp  strm,
int  bits,
int  value 
)

◆ inflateReset()

◆ inflateReset2()

◆ inflateResetKeep()

◆ inflateSetDictionary()

◆ inflateStateCheck() [1/2]

◆ inflateStateCheck() [2/2]

static int inflateStateCheck ( z_streamp  strm)
static

◆ inflateSync()

◆ inflateSyncPoint()

int inflateSyncPoint ( z_streamp  strm)

◆ inflateUndermine()

int inflateUndermine ( z_streamp  strm,
int  subvert 
)

◆ inflateValidate()

int inflateValidate ( z_streamp  strm,
int  check 
)

◆ syncsearch() [1/2]

static unsigned syncsearch ( )
static

Referenced by inflateSync().

◆ syncsearch() [2/2]

static unsigned syncsearch ( unsigned *  have,
const unsigned char *  buf,
unsigned  len 
)
static

Definition at line 1377 of file inflate.c.

References inflate_state::have, and inflate_state::next.

◆ updatewindow() [1/2]

static int updatewindow ( )
static

Referenced by inflate(), and inflateSetDictionary().

◆ updatewindow() [2/2]

static int updatewindow ( z_streamp  strm,
const Bytef end,
unsigned  copy 
)
static
crc32
unsigned long crc32(unsigned long crc, const unsigned char *buf, uInt len)
Definition: crc32.c:237