Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Macros | Typedefs | Enumerations | Functions | Variables
deflate.c File Reference
#include "deflate.h"

Go to the source code of this file.

Macros

#define NIL   0
 
#define TOO_FAR   4096
 
#define EQUAL   0
 
#define RANK(f)   (((f) << 1) - ((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 check_match(s, start, match, length)
 
#define FLUSH_BLOCK_ONLY(s, last)
 
#define FLUSH_BLOCK(s, last)
 

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 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))
 
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 ZEXPORT deflateSetDictionary (z_streamp strm, const 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 int 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 1377 of file deflate.c.

Referenced by deflate_fast(), and deflate_slow().

◆ CLEAR_HASH

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

Definition at line 196 of file deflate.c.

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

◆ EQUAL

#define EQUAL   0

Definition at line 151 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; \
}
GLdouble s

Definition at line 1550 of file deflate.c.

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

◆ 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]")); \
}
unsigned long ulg
Definition: zutil.h:38
#define Z_NULL
Definition: zlib.h:164
GLdouble s
char FAR charf
Definition: zconf.h:230

Definition at line 1538 of file deflate.c.

Referenced by deflate_slow().

◆ 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 MIN_MATCH
Definition: zutil.h:64
ush Pos
Definition: deflate.h:89
#define UPDATE_HASH(s, h, c)
Definition: deflate.c:167
GLdouble s

Definition at line 186 of file deflate.c.

Referenced by deflate_fast(), and deflate_slow().

◆ NIL

#define NIL   0

Definition at line 104 of file deflate.c.

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

◆ RANK

#define RANK (   f)    (((f) << 1) - ((f) > 4 ? 9 : 0))

Definition at line 159 of file deflate.c.

Referenced by deflate().

◆ TOO_FAR

#define TOO_FAR   4096

Definition at line 108 of file deflate.c.

Referenced by deflate_slow().

◆ UPDATE_HASH

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

Definition at line 167 of file deflate.c.

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

Typedef Documentation

◆ config

typedef struct config_s config

◆ OF

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

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 
)

◆ deflate_fast()

local block_state deflate_fast ( deflate_state s,
int  flush 
)

◆ deflate_huff()

local block_state deflate_huff ( deflate_state s,
int  flush 
)

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

local block_state deflate_rle ( deflate_state s,
int  flush 
)

Definition at line 1861 of file deflate.c.

References Assert, fill_window(), int, MAX_MATCH, MIN_MATCH, need_more, and Z_NO_FLUSH.

Referenced by deflate().

◆ deflate_slow()

local block_state deflate_slow ( deflate_state s,
int  flush 
)

◆ deflate_stored()

local block_state deflate_stored ( deflate_state s,
int  flush 
)

◆ deflateBound()

uLong ZEXPORT deflateBound ( z_streamp  strm,
uLong  sourceLen 
)

Definition at line 566 of file deflate.c.

References Z_NULL.

◆ deflateCopy()

int ZEXPORT deflateCopy ( z_streamp  dest,
z_streamp  source 
)

Definition at line 1014 of file deflate.c.

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

◆ deflateEnd()

int ZEXPORT deflateEnd ( z_streamp  strm)

◆ 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 201 of file deflate.c.

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

◆ deflateParams()

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

Definition at line 490 of file deflate.c.

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

Referenced by gzsetparams().

◆ deflatePending()

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

Definition at line 450 of file deflate.c.

References Z_NULL, Z_OK, and Z_STREAM_ERROR.

◆ deflatePrime()

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

Definition at line 464 of file deflate.c.

References _tr_flush_bits(), bits, Buf_size, Z_BUF_ERROR, Z_NULL, Z_OK, and Z_STREAM_ERROR.

Referenced by log_compress().

◆ deflateReset()

int ZEXPORT deflateReset ( z_streamp  strm)

Definition at line 427 of file deflate.c.

References deflateResetKeep(), lm_init(), and Z_OK.

Referenced by deflateInit2_(), gz_comp(), and main().

◆ deflateResetKeep()

int ZEXPORT deflateResetKeep ( z_streamp  strm)

Definition at line 392 of file deflate.c.

References _tr_init(), adler32(), BUSY_STATE, crc32(), if(), INIT_STATE, Z_NO_FLUSH, Z_NULL, Z_OK, Z_STREAM_ERROR, and Z_UNKNOWN.

Referenced by deflateReset().

◆ deflateSetDictionary()

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

Definition at line 323 of file deflate.c.

References adler32(), CLEAR_HASH, fill_window(), INIT_STATE, long(), MIN_MATCH, UPDATE_HASH, z_const, Z_NULL, Z_OK, and Z_STREAM_ERROR.

Referenced by log_compress().

◆ deflateSetHeader()

int ZEXPORT deflateSetHeader ( z_streamp  strm,
gz_headerp  head 
)

Definition at line 439 of file deflate.c.

References Z_NULL, Z_OK, and Z_STREAM_ERROR.

◆ deflateTune()

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

Definition at line 531 of file deflate.c.

References Z_NULL, Z_OK, and Z_STREAM_ERROR.

◆ fill_window()

local void fill_window ( deflate_state s)

◆ flush_pending()

local void flush_pending ( z_streamp  strm)

Definition at line 642 of file deflate.c.

References _tr_flush_bits(), and zmemcpy().

Referenced by deflate().

◆ lm_init()

local void lm_init ( deflate_state s)

Definition at line 1106 of file deflate.c.

References CLEAR_HASH, and MIN_MATCH.

Referenced by deflateReset().

◆ longest_match()

local uInt longest_match ( deflate_state s,
IPos  cur_match 
)

Definition at line 1148 of file deflate.c.

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

Referenced by deflate_fast(), and deflate_slow().

◆ OF() [1/6]

◆ OF() [2/6]

◆ OF() [3/6]

◆ OF() [4/6]

local void flush_pending OF ( (z_streamp strm)  )

◆ OF() [5/6]

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

◆ OF() [6/6]

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

◆ putShortMSB()

local void putShortMSB ( deflate_state s,
uInt  b 
)

Definition at line 628 of file deflate.c.

References put_byte.

Referenced by deflate().

◆ read_buf()

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

Definition at line 1076 of file deflate.c.

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

Referenced by fill_window().

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

Definition at line 131 of file deflate.c.

◆ deflate_copyright

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

Definition at line 54 of file deflate.c.