OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
deflate.c File Reference
#include "deflate.h"

Go to the source code of this file.

Data Structures

struct  config_s
 

Macros

#define NIL   0
 
#define TOO_FAR   4096
 
#define RANK(f)
 
#define UPDATE_HASH(s, h, c)
 
#define INSERT_STRING(s, str, match_head)
 
#define CLEAR_HASH(s)
 
#define HCRC_UPDATE(beg)
 
#define check_match(s, start, match, length)
 
#define FLUSH_BLOCK_ONLY(s, last)
 
#define FLUSH_BLOCK(s, last)
 
#define MAX_STORED   65535
 
#define MIN(a, b)
 

Typedefs

typedef block_state compress_func OF((deflate_state *s, int flush))
 
typedef struct config_s config
 

Enumerations

enum  block_state { need_more , block_done , finish_started , finish_done }
 

Functions

local int deflateStateCheck OF ((z_streamp strm))
 
local void slide_hash OF ((deflate_state *s))
 
local void putShortMSB OF ((deflate_state *s, uInt b))
 
local unsigned read_buf OF ((z_streamp strm, Bytef *buf, unsigned size))
 
local uInt longest_match OF ((deflate_state *s, IPos cur_match))
 
local void slide_hash (deflate_state *s)
 
int ZEXPORT deflateInit_ (z_streamp strm, int level, const char *version, int stream_size)
 
int ZEXPORT deflateInit2_ (z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)
 
local int deflateStateCheck (z_streamp strm)
 
int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
 
int ZEXPORT deflateGetDictionary (z_streamp strm, Bytef *dictionary, uInt *dictLength)
 
int ZEXPORT deflateResetKeep (z_streamp strm)
 
int ZEXPORT deflateReset (z_streamp strm)
 
int ZEXPORT deflateSetHeader (z_streamp strm, gz_headerp head)
 
int ZEXPORT deflatePending (z_streamp strm, unsigned *pending, int *bits)
 
int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
 
int ZEXPORT deflateParams (z_streamp strm, int level, int strategy)
 
int ZEXPORT deflateTune (z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
 
uLong ZEXPORT deflateBound (z_streamp strm, uLong sourceLen)
 
local void putShortMSB (deflate_state *s, uInt b)
 
local void flush_pending (z_streamp strm)
 
int ZEXPORT deflate (z_streamp strm, int flush)
 
int ZEXPORT deflateEnd (z_streamp strm)
 
int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
 
local unsigned read_buf (z_streamp strm, Bytef *buf, unsigned size)
 
local void lm_init (deflate_state *s)
 
local uInt longest_match (deflate_state *s, IPos cur_match)
 
local void fill_window (deflate_state *s)
 
local block_state deflate_stored (deflate_state *s, int flush)
 
local block_state deflate_fast (deflate_state *s, int flush)
 
local block_state deflate_slow (deflate_state *s, int flush)
 
local block_state deflate_rle (deflate_state *s, int flush)
 
local block_state deflate_huff (deflate_state *s, int flush)
 

Variables

const char deflate_copyright []
 
local const config configuration_table [10]
 

Macro Definition Documentation

◆ check_match

#define check_match ( s,
start,
match,
length )

Definition at line 1514 of file deflate.c.

◆ CLEAR_HASH

#define CLEAR_HASH ( s)
Value:
do { \
s->head[s->hash_size - 1] = NIL; \
zmemzero((Bytef *)s->head, \
(unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
} while (0)
#define NIL
Definition deflate.c:101
Byte Bytef
Definition zconf.h:52

Definition at line 186 of file deflate.c.

◆ FLUSH_BLOCK

#define FLUSH_BLOCK ( s,
last )
Value:
{ \
FLUSH_BLOCK_ONLY(s, last); \
if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
}
@ finish_started
Definition deflate.c:69
@ need_more
Definition deflate.c:67

Definition at line 1664 of file deflate.c.

◆ FLUSH_BLOCK_ONLY

#define FLUSH_BLOCK_ONLY ( s,
last )
Value:
{ \
_tr_flush_block(s, (s->block_start >= 0L ? \
(charf *)&s->window[(unsigned)s->block_start] : \
(charf *)Z_NULL), \
(ulg)((long)s->strstart - s->block_start), \
(last)); \
s->block_start = s->strstart; \
flush_pending(s->strm); \
Tracev((stderr,"[FLUSH]")); \
}
char charf
Definition zconf.h:53
#define Z_NULL
Definition zlib.h:212
unsigned long ulg
Definition zutil.h:43

Definition at line 1652 of file deflate.c.

◆ HCRC_UPDATE

#define HCRC_UPDATE ( beg)
Value:
do { \
if (s->gzhead->hcrc && s->pending > (beg)) \
strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
s->pending - (beg)); \
} while (0)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
Definition crc32.c:1072

Definition at line 807 of file deflate.c.

◆ INSERT_STRING

#define INSERT_STRING ( s,
str,
match_head )
Value:
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
s->head[s->ins_h] = (Pos)(str))
#define UPDATE_HASH(s, h, c)
Definition deflate.c:157
ush Pos
Definition deflate.h:92
#define MIN_MATCH
Definition zutil.h:84

Definition at line 176 of file deflate.c.

◆ MAX_STORED

#define MAX_STORED   65535

Definition at line 1670 of file deflate.c.

◆ MIN

#define MIN ( a,
b )
Value:
((a) > (b) ? (b) : (a))

Definition at line 1673 of file deflate.c.

◆ NIL

#define NIL   0

Definition at line 101 of file deflate.c.

◆ RANK

#define RANK ( f)
Value:
(((f) * 2) - ((f) > 4 ? 9 : 0))

Definition at line 149 of file deflate.c.

◆ TOO_FAR

#define TOO_FAR   4096

Definition at line 105 of file deflate.c.

◆ UPDATE_HASH

#define UPDATE_HASH ( s,
h,
c )
Value:
(h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)

Definition at line 157 of file deflate.c.

Typedef Documentation

◆ config

typedef struct config_s config

◆ OF

Definition at line 73 of file deflate.c.

Enumeration Type Documentation

◆ block_state

Enumerator
need_more 
block_done 
finish_started 
finish_done 

Definition at line 66 of file deflate.c.

Function Documentation

◆ deflate()

int ZEXPORT deflate ( z_streamp strm,
int flush )

Definition at line 815 of file deflate.c.

◆ deflate_fast()

local block_state deflate_fast ( deflate_state * s,
int flush )

Definition at line 1877 of file deflate.c.

◆ deflate_huff()

local block_state deflate_huff ( deflate_state * s,
int flush )

Definition at line 2184 of file deflate.c.

◆ deflate_rle()

local block_state deflate_rle ( deflate_state * s,
int flush )

Definition at line 2110 of file deflate.c.

◆ deflate_slow()

local block_state deflate_slow ( deflate_state * s,
int flush )

Definition at line 1979 of file deflate.c.

◆ deflate_stored()

local block_state deflate_stored ( deflate_state * s,
int flush )

Definition at line 1690 of file deflate.c.

◆ deflateBound()

uLong ZEXPORT deflateBound ( z_streamp strm,
uLong sourceLen )

Definition at line 696 of file deflate.c.

◆ deflateCopy()

int ZEXPORT deflateCopy ( z_streamp dest,
z_streamp source )

Definition at line 1156 of file deflate.c.

◆ deflateEnd()

int ZEXPORT deflateEnd ( z_streamp strm)

Definition at line 1130 of file deflate.c.

◆ deflateGetDictionary()

int ZEXPORT deflateGetDictionary ( z_streamp strm,
Bytef * dictionary,
uInt * dictLength )

Definition at line 481 of file deflate.c.

◆ deflateInit2_()

int ZEXPORT deflateInit2_ ( z_streamp strm,
int level,
int method,
int windowBits,
int memLevel,
int strategy,
const char * version,
int stream_size )

Definition at line 237 of file deflate.c.

◆ deflateInit_()

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

Definition at line 225 of file deflate.c.

◆ deflateParams()

int ZEXPORT deflateParams ( z_streamp strm,
int level,
int strategy )

Definition at line 605 of file deflate.c.

◆ deflatePending()

int ZEXPORT deflatePending ( z_streamp strm,
unsigned * pending,
int * bits )

Definition at line 564 of file deflate.c.

◆ deflatePrime()

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

Definition at line 578 of file deflate.c.

◆ deflateReset()

int ZEXPORT deflateReset ( z_streamp strm)

Definition at line 541 of file deflate.c.

◆ deflateResetKeep()

int ZEXPORT deflateResetKeep ( z_streamp strm)

Definition at line 503 of file deflate.c.

◆ deflateSetDictionary()

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

Definition at line 412 of file deflate.c.

◆ deflateSetHeader()

int ZEXPORT deflateSetHeader ( z_streamp strm,
gz_headerp head )

Definition at line 553 of file deflate.c.

◆ deflateStateCheck()

local int deflateStateCheck ( z_streamp strm)

Definition at line 389 of file deflate.c.

◆ deflateTune()

int ZEXPORT deflateTune ( z_streamp strm,
int good_length,
int max_lazy,
int nice_length,
int max_chain )

Definition at line 654 of file deflate.c.

◆ fill_window()

local void fill_window ( deflate_state * s)

Definition at line 1527 of file deflate.c.

◆ flush_pending()

local void flush_pending ( z_streamp strm)

Definition at line 782 of file deflate.c.

◆ lm_init()

local void lm_init ( deflate_state * s)

Definition at line 1245 of file deflate.c.

◆ longest_match()

local uInt longest_match ( deflate_state * s,
IPos cur_match )

Definition at line 1278 of file deflate.c.

◆ OF() [1/5]

local void slide_hash OF ( (deflate_state *s) )

◆ OF() [2/5]

local uInt longest_match OF ( (deflate_state *s, IPos cur_match) )

◆ OF() [3/5]

local void putShortMSB OF ( (deflate_state *s, uInt b) )

◆ OF() [4/5]

local int deflateStateCheck OF ( (z_streamp strm) )

◆ OF() [5/5]

local unsigned read_buf OF ( (z_streamp strm, Bytef *buf, unsigned size) )

◆ putShortMSB()

local void putShortMSB ( deflate_state * s,
uInt b )

Definition at line 768 of file deflate.c.

◆ read_buf()

local unsigned read_buf ( z_streamp strm,
Bytef * buf,
unsigned size )

Definition at line 1215 of file deflate.c.

◆ slide_hash()

local void slide_hash ( deflate_state * s)

Definition at line 198 of file deflate.c.

Variable Documentation

◆ configuration_table

local const config configuration_table[10]
Initial value:
= {
{0, 0, 0, 0, deflate_stored},
{4, 4, 8, 4, deflate_fast},
{4, 5, 16, 8, deflate_fast},
{4, 6, 32, 32, deflate_fast},
{4, 4, 16, 16, deflate_slow},
{8, 16, 32, 32, deflate_slow},
{8, 16, 128, 128, deflate_slow},
{8, 32, 128, 256, deflate_slow},
{32, 128, 258, 1024, deflate_slow},
{32, 258, 258, 4096, deflate_slow}}
local block_state deflate_fast(deflate_state *s, int flush)
Definition deflate.c:1877
local block_state deflate_stored(deflate_state *s, int flush)
Definition deflate.c:1690
local block_state deflate_slow(deflate_state *s, int flush)
Definition deflate.c:1979

Definition at line 128 of file deflate.c.

◆ deflate_copyright

const char deflate_copyright[]
Initial value:
=
" deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "

Definition at line 54 of file deflate.c.