zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
deflate.c File Reference
#include "deflate.h"

Go to the source code of this file.

Macros

#define check_match(s, start, match, length)
 
#define CLEAR_HASH(s)
 
#define EQUAL   0
 
#define FLUSH_BLOCK(s, last)
 
#define FLUSH_BLOCK_ONLY(s, last)
 
#define INSERT_STRING(s, str, match_head)
 
#define NIL   0
 
#define TOO_FAR   4096
 
#define UPDATE_HASH(s, h, c)   (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
 

Typedefs

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

Enumerations

enum  block_state { need_more, block_done, finish_started, finish_done }
 

Functions

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

Variables

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

Macro Definition Documentation

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

Definition at line 1292 of file deflate.c.

Referenced by deflate_fast(), deflate_rle(), and deflate_slow().

#define CLEAR_HASH (   s)
Value:
s->head[s->hash_size-1] = NIL; \
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
GLdouble s
Definition: glew.h:1376
void zmemzero(Bytef *dest, uInt len)
Definition: zutil.c:41
Byte FAR Bytef
Definition: zconf.h:228
#define NIL
Definition: deflate.c:104

Definition at line 193 of file deflate.c.

Referenced by deflate(), and lm_init().

#define EQUAL   0

Definition at line 151 of file deflate.c.

Referenced by while().

#define FLUSH_BLOCK (   s,
  last 
)
Value:
{ \
if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
}
return
Definition: pngrutil.c:1266
GLdouble s
Definition: glew.h:1376
if(!yyg->yy_init)
#define FLUSH_BLOCK_ONLY(s, last)
Definition: deflate.c:1436

Definition at line 1448 of file deflate.c.

Referenced by deflate_fast(), deflate_huff(), deflate_rle(), deflate_slow(), and deflate_stored().

#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; \
Tracev((stderr,"[FLUSH]")); \
}
GLdouble s
Definition: glew.h:1376
local void flush_pending(z_streamp strm)
Definition: deflate.c:562
unsigned long ulg
Definition: zutil.h:38
#define Tracev(x)
Definition: zutil.h:198
#define Z_NULL
Definition: zlib.h:164
char FAR charf
Definition: zconf.h:230
void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int last)
Definition: trees.c:925

Definition at line 1436 of file deflate.c.

Referenced by deflate_slow().

#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))
GLdouble s
Definition: glew.h:1376
ush Pos
Definition: deflate.h:86
#define UPDATE_HASH(s, h, c)
Definition: deflate.c:164
#define MIN_MATCH
Definition: zutil.h:64
#define str(s)

Definition at line 183 of file deflate.c.

Referenced by deflate_fast(), deflate_slow(), and deflateSetDictionary().

#define NIL   0

Definition at line 104 of file deflate.c.

Referenced by deflate_fast(), deflate_slow(), fill_window(), and longest_match().

#define TOO_FAR   4096

Definition at line 108 of file deflate.c.

Referenced by deflate_slow().

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

Definition at line 164 of file deflate.c.

Referenced by deflate_fast(), deflateSetDictionary(), and fill_window().

Typedef Documentation

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

Definition at line 73 of file deflate.c.

Enumeration Type Documentation

Enumerator
need_more 
block_done 
finish_started 
finish_done 

Definition at line 66 of file deflate.c.

Function Documentation

local block_state deflate_huff ( deflate_state s,
int  flush 
)

Definition at line 1807 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().

local block_state deflate_stored ( deflate_state s,
int  flush 
)
uLong ZEXPORT deflateBound ( z_streamp  strm,
uLong  sourceLen 
)

Definition at line 486 of file deflate.c.

References str, and Z_NULL.

int ZEXPORT deflateCopy ( z_streamp  dest,
z_streamp  source 
)

Definition at line 930 of file deflate.c.

References deflateEnd(), Z_MEM_ERROR, Z_NULL, Z_OK, Z_STREAM_ERROR, ZALLOC, and zmemcpy().

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

Definition at line 198 of file deflate.c.

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

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

Definition at line 412 of file deflate.c.

References deflate(), Z_BLOCK, Z_DEFAULT_COMPRESSION, Z_FIXED, Z_NULL, Z_OK, and Z_STREAM_ERROR.

Referenced by gzsetparams(), and test_large_deflate().

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

Definition at line 400 of file deflate.c.

References bits, Z_NULL, Z_OK, and Z_STREAM_ERROR.

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

Definition at line 311 of file deflate.c.

References adler32(), INIT_STATE, INSERT_STRING, MIN_MATCH, UPDATE_HASH, Z_NULL, Z_OK, Z_STREAM_ERROR, and zmemcpy().

Referenced by test_dict_deflate().

int ZEXPORT deflateSetHeader ( z_streamp  strm,
gz_headerp  head 
)

Definition at line 389 of file deflate.c.

References head, Z_NULL, Z_OK, and Z_STREAM_ERROR.

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

Definition at line 451 of file deflate.c.

References Z_NULL, Z_OK, and Z_STREAM_ERROR.

local void flush_pending ( z_streamp  strm)

Definition at line 562 of file deflate.c.

References zmemcpy().

Referenced by deflate().

local void lm_init ( deflate_state s)

Definition at line 1022 of file deflate.c.

References CLEAR_HASH, and MIN_MATCH.

Referenced by deflateReset().

local uInt longest_match ( deflate_state s,
IPos  cur_match 
)

Definition at line 1063 of file deflate.c.

References Assert, int, MAX_DIST, MAX_MATCH, MIN_LOOKAHEAD, and NIL.

Referenced by deflate_fast(), and deflate_slow().

local void flush_pending OF ( (z_streamp strm)  )
local int read_buf OF ( (z_streamp strm, Bytef *buf, unsigned size )
local uInt longest_match OF ( (deflate_state *s, IPos cur_match)  )
local void putShortMSB ( deflate_state s,
uInt  b 
)

Definition at line 548 of file deflate.c.

References put_byte.

Referenced by deflate().

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

Definition at line 992 of file deflate.c.

References adler32(), crc32(), and zmemcpy().

Referenced by fill_window().

Variable Documentation

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_stored(deflate_state *s, int flush)
Definition: deflate.c:1462
local block_state deflate_fast(deflate_state *s, int flush)
Definition: deflate.c:1520
local block_state deflate_slow(deflate_state *s, int flush)
Definition: deflate.c:1616

Definition at line 131 of file deflate.c.

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

Definition at line 54 of file deflate.c.