NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
deflate.c File Reference
#include "deflate.h"
+ Include dependency graph for deflate.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  config_s
 

Macros

#define NIL   0
 
#define TOO_FAR   4096
 
#define RANK(f)   (((f) * 2) - ((f) > 4 ? 9 : 0))
 
#define UPDATE_HASH(s, h, c)   (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
 
#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)   ((a) > (b) ? (b) : (a))
 

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 ,
  need_more , block_done , finish_started , finish_done
}
 

Functions

int deflateStateCheck OF ((z_streamp strm))
 
void slide_hash OF ((deflate_state *s))
 
void putShortMSB OF ((deflate_state *s, uInt b))
 
unsigned read_buf OF ((z_streamp strm, Bytef *buf, unsigned size))
 
uInt longest_match OF ((deflate_state *s, IPos cur_match))
 
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)
 
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)
 
void putShortMSB (deflate_state *s, uInt b)
 
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)
 
unsigned read_buf (z_streamp strm, Bytef *buf, unsigned size)
 
void lm_init (deflate_state *s)
 
uInt longest_match (deflate_state *s, IPos cur_match)
 
void fill_window (deflate_state *s)
 
block_state deflate_stored (deflate_state *s, int flush)
 
block_state deflate_fast (deflate_state *s, int flush)
 
block_state deflate_slow (deflate_state *s, int flush)
 
block_state deflate_rle (deflate_state *s, int flush)
 
block_state deflate_huff (deflate_state *s, int flush)
 

Variables

const char deflate_copyright []
 
const config configuration_table [10]
 

Macro Definition Documentation

◆ check_match

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

Definition at line 1509 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)
Byte Bytef
Definition: zconf.h:402
#define NIL
Definition: deflate.c:107

Definition at line 192 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; \
}
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:51
@ finish_started
Definition: deflate.c:69
@ need_more
Definition: deflate.c:67

Definition at line 1659 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:404
#define Z_NULL
Definition: zlib.h:212
unsigned long ulg
Definition: zutil.h:43

Definition at line 1647 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)
#define crc32
Definition: zconf_cf.h:43

Definition at line 796 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))
unsigned short Pos
static const char * str(char *buf, int n)
Definition: stats.c:84
#define UPDATE_HASH(s, h, c)
Definition: deflate.c:163
#define MIN_MATCH
Definition: zutil.h:84

Definition at line 182 of file deflate.c.

◆ MAX_STORED

#define MAX_STORED   65535

Definition at line 1665 of file deflate.c.

◆ MIN

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

Definition at line 1668 of file deflate.c.

◆ NIL

#define NIL   0

Definition at line 107 of file deflate.c.

◆ RANK

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

Definition at line 155 of file deflate.c.

◆ TOO_FAR

#define TOO_FAR   4096

Definition at line 111 of file deflate.c.

◆ UPDATE_HASH

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

Definition at line 163 of file deflate.c.

Typedef Documentation

◆ config

typedef struct config_s config

◆ OF

void bi_flush OF

Definition at line 73 of file deflate.c.

Enumeration Type Documentation

◆ block_state

Enumerator
need_more 
block_done 
finish_started 
finish_done 
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 
)

◆ deflate_fast()

static block_state deflate_fast ( deflate_state s,
int  flush 
)

◆ deflate_huff()

static block_state deflate_huff ( deflate_state s,
int  flush 
)

Definition at line 2178 of file deflate.c.

References _tr_tally_lit, block_done, fill_window(), finish_done, FLUSH_BLOCK, need_more, Tracevv, Z_FINISH, and Z_NO_FLUSH.

Referenced by deflate().

◆ deflate_rle()

static block_state deflate_rle ( deflate_state s,
int  flush 
)

◆ deflate_slow()

static block_state deflate_slow ( deflate_state s,
int  flush 
)

◆ deflate_stored()

static block_state deflate_stored ( deflate_state s,
int  flush 
)

◆ deflateBound()

uLong ZEXPORT deflateBound ( z_streamp  strm,
uLong  sourceLen 
)

◆ deflateCopy()

int ZEXPORT deflateCopy ( z_streamp  dest,
z_streamp  source 
)

◆ deflateEnd()

int ZEXPORT deflateEnd ( z_streamp  strm)

◆ deflateGetDictionary()

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

◆ deflateInit2_()

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

◆ deflateInit_()

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

Definition at line 231 of file deflate.c.

References DEF_MEM_LEVEL, deflateInit2_(), MAX_WBITS, version, Z_DEFAULT_STRATEGY, and Z_DEFLATED.

◆ deflateParams()

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

◆ deflatePending()

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

◆ deflatePrime()

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

◆ deflateReset()

int ZEXPORT deflateReset ( z_streamp  strm)

Definition at line 545 of file deflate.c.

References deflateResetKeep(), lm_init(), z_stream_s::state, internal_state::strm, and Z_OK.

Referenced by deflateInit2_().

◆ deflateResetKeep()

int ZEXPORT deflateResetKeep ( z_streamp  strm)

◆ deflateSetDictionary()

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

◆ deflateSetHeader()

int ZEXPORT deflateSetHeader ( z_streamp  strm,
gz_headerp  head 
)

◆ deflateStateCheck()

static int deflateStateCheck ( z_streamp  strm)

◆ deflateTune()

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

◆ fill_window()

static void fill_window ( deflate_state s)

◆ flush_pending()

static void flush_pending ( z_streamp  strm)

◆ lm_init()

static void lm_init ( deflate_state s)

◆ longest_match()

uInt longest_match ( deflate_state s,
IPos  cur_match 
)

◆ OF() [1/5]

void slide_hash OF ( (deflate_state *s)  )

◆ OF() [2/5]

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

◆ OF() [3/5]

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

◆ OF() [4/5]

int deflateStateCheck OF ( (z_streamp strm)  )

◆ OF() [5/5]

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

◆ putShortMSB()

void putShortMSB ( deflate_state s,
uInt  b 
)

Definition at line 757 of file deflate.c.

References b, and put_byte.

Referenced by deflate().

◆ read_buf()

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

◆ slide_hash()

void slide_hash ( deflate_state s)

Definition at line 204 of file deflate.c.

References n, and NIL.

Referenced by deflateParams(), and fill_window().

Variable Documentation

◆ configuration_table

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}}
block_state deflate_fast(deflate_state *s, int flush)
Definition: deflate.c:1872
block_state deflate_stored(deflate_state *s, int flush)
Definition: deflate.c:1685
block_state deflate_slow(deflate_state *s, int flush)
Definition: deflate.c:1974

Definition at line 134 of file deflate.c.

Referenced by deflate(), deflateParams(), and lm_init().

◆ deflate_copyright

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

Definition at line 54 of file deflate.c.

Modified on Mon Jul 15 05:32:41 2024 by modify_doxy.py rev. 669887