Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Macros | Functions
inflate.c File Reference
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
#include "inffixed.h"

Go to the source code of this file.

Macros

#define UPDATE_CHECK(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

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

Macro Definition Documentation

◆ BITS

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

Definition at line 526 of file inflate.c.

◆ BYTEBITS

#define BYTEBITS ( )
Value:
do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)
int bits(struct state *s, int need)
Definition: blast.c:72

Definition at line 537 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)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
Definition: crc32.c:1072

Definition at line 461 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 468 of file inflate.c.

◆ DROPBITS

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

Definition at line 530 of file inflate.c.

◆ INITBITS

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

Definition at line 501 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: blast.c:41

Definition at line 479 of file inflate.c.

◆ NEEDBITS

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

Definition at line 519 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 509 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 490 of file inflate.c.

◆ UPDATE_CHECK

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

Definition at line 453 of file inflate.c.

Function Documentation

◆ fixedtables()

void fixedtables ( struct inflate_state FAR state)

Definition at line 281 of file inflate.c.

References bits(), DISTS, fixed(), inflate_table(), LENS, inflate_state::next, and sym.

Referenced by inflate().

◆ inflate()

int ZEXPORT inflate ( z_streamp  strm,
int  flush 
)

◆ inflateCodesUsed()

unsigned long ZEXPORT inflateCodesUsed ( z_streamp  strm)

Definition at line 1588 of file inflate.c.

References FAR, inflateStateCheck(), state::next, and inflate_state::strm.

◆ inflateCopy()

int ZEXPORT inflateCopy ( z_streamp  dest,
z_streamp  source 
)

◆ inflateEnd()

int ZEXPORT inflateEnd ( z_streamp  strm)

◆ inflateGetDictionary()

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

Definition at line 1318 of file inflate.c.

References FAR, if(), inflateStateCheck(), inflate_state::strm, Z_NULL, Z_OK, Z_STREAM_ERROR, and zmemcpy.

◆ inflateGetHeader()

int ZEXPORT inflateGetHeader ( z_streamp  strm,
gz_headerp  head 
)

◆ inflateInit2_()

int ZEXPORT inflateInit2_ ( z_streamp  strm,
int  windowBits,
const char *  version,
int  stream_size 
)

◆ inflateInit_()

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

Definition at line 242 of file inflate.c.

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

◆ inflateMark()

long ZEXPORT inflateMark ( z_streamp  strm)

Definition at line 1575 of file inflate.c.

References COPY, FAR, inflateStateCheck(), long(), MATCH, and inflate_state::strm.

◆ inflatePrime()

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

Definition at line 250 of file inflate.c.

References bits(), FAR, if(), inflateStateCheck(), inflate_state::strm, Z_OK, and Z_STREAM_ERROR.

Referenced by deflate_index_extract().

◆ inflateReset()

int ZEXPORT inflateReset ( z_streamp  strm)

◆ inflateReset2()

int ZEXPORT inflateReset2 ( z_streamp  strm,
int  windowBits 
)

◆ inflateResetKeep()

int ZEXPORT inflateResetKeep ( z_streamp  strm)

Definition at line 119 of file inflate.c.

References FAR, HEAD, if(), inflateStateCheck(), state::next, inflate_state::strm, Tracev, Z_NULL, Z_OK, and Z_STREAM_ERROR.

Referenced by inflateReset().

◆ inflateSetDictionary()

int ZEXPORT inflateSetDictionary ( z_streamp  strm,
const Bytef dictionary,
uInt  dictLength 
)

◆ inflateStateCheck()

int inflateStateCheck ( z_streamp  strm)

◆ inflateSync()

int ZEXPORT inflateSync ( z_streamp  strm)

◆ inflateSyncPoint()

int ZEXPORT inflateSyncPoint ( z_streamp  strm)

Definition at line 1485 of file inflate.c.

References FAR, inflateStateCheck(), STORED, inflate_state::strm, and Z_STREAM_ERROR.

◆ inflateUndermine()

int ZEXPORT inflateUndermine ( z_streamp  strm,
int  subvert 
)

Definition at line 1542 of file inflate.c.

References FAR, inflateStateCheck(), inflate_state::strm, Z_DATA_ERROR, Z_OK, and Z_STREAM_ERROR.

◆ inflateValidate()

int ZEXPORT inflateValidate ( z_streamp  strm,
int  check 
)

◆ OF() [1/4]

void fixedtables OF ( (struct inflate_state FAR *state )

◆ OF() [2/4]

unsigned syncsearch OF ( (unsigned FAR *have, const unsigned char FAR *buf, unsigned len )

◆ OF() [3/4]

int inflateStateCheck OF ( (z_streamp strm)  )

◆ OF() [4/4]

int updatewindow OF ( (z_streamp strm, const unsigned char FAR *end, unsigned copy)  )

◆ syncsearch()

unsigned syncsearch ( unsigned FAR have,
const unsigned char FAR buf,
unsigned  len 
)

Definition at line 1404 of file inflate.c.

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

Referenced by inflateSync().

◆ updatewindow()

int updatewindow ( z_streamp  strm,
const Bytef end,
unsigned  copy 
)

Definition at line 399 of file inflate.c.

References FAR, if(), inflate_state::strm, Z_NULL, ZALLOC, and zmemcpy.

Referenced by inflate(), and inflateSetDictionary().