w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

deflate.c File Reference
#include "deflate.h"
Include dependency graph for deflate.c:

Go to the source code of 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) ()
 
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 ,
  need_more , block_done , finish_started , finish_done ,
  need_more , block_done , finish_started , finish_done ,
  need_more , block_done , finish_started , finish_done
}
 

Functions

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

Variables

char deflate_copyright []
 
static config configuration_table [10]
 

Macro Definition Documentation

◆ check_match

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

Definition at line 1469 of file deflate.c.

◆ 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 s
Definition: afcover.h:80
Byte Bytef
Definition: ftzconf.h:228
#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; \
}
@ finish_started
Definition: deflate.c:69
@ need_more
Definition: deflate.c:67
static int32_t last
Definition: ppagelist.c:29
#define return(val)

Definition at line 1617 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: ftzconf.h:230
#define Z_NULL
Definition: zlib.h:164
unsigned long ulg
Definition: zutil.h:38
@ L
Definition: ubidiimp.h:45

Definition at line 1605 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 crc32(unsigned long crc, unsigned char *buf, uInt len)
Definition: crc32.c:237

Definition at line 755 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 MIN_MATCH
Definition: zutil.h:64
#define UPDATE_HASH(s, h, c)
Definition: deflate.c:163
ush Pos
Definition: deflate.h:92
#define str(s)
Definition: sh6.c:399

Definition at line 182 of file deflate.c.

◆ MAX_STORED

#define MAX_STORED   65535

Definition at line 1623 of file deflate.c.

◆ MIN

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

Definition at line 1626 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,
  c 
)    (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)

Definition at line 163 of file deflate.c.

Typedef Documentation

◆ compress_func

typedef block_state(* compress_func) ()

Definition at line 73 of file deflate.c.

◆ config

typedef struct config_s config

Enumeration Type Documentation

◆ block_state

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

◆ deflate_fast() [1/2]

static block_state deflate_fast ( )
static

◆ deflate_fast() [2/2]

◆ deflate_huff() [1/2]

static block_state deflate_huff ( )
static

Referenced by deflate().

◆ deflate_huff() [2/2]

static block_state deflate_huff ( deflate_state s,
int  flush 
)
static

◆ deflate_rle() [1/2]

static block_state deflate_rle ( )
static

Referenced by deflate().

◆ deflate_rle() [2/2]

◆ deflate_slow() [1/2]

static block_state deflate_slow ( )
static

◆ deflate_slow() [2/2]

◆ deflate_stored() [1/2]

static block_state deflate_stored ( )
static

Referenced by deflate().

◆ deflate_stored() [2/2]

◆ deflateBound()

uLong deflateBound ( z_streamp  strm,
uLong  sourceLen 
)

Definition at line 652 of file deflate.c.

References deflateStateCheck(), s, z_stream_s::state, str, internal_state::strm, and Z_NULL.

◆ deflateCopy()

◆ deflateEnd()

◆ deflateGetDictionary()

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

◆ deflateInit2_()

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

◆ deflateInit_()

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

Definition at line 228 of file deflate.c.

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

◆ deflateParams()

◆ deflatePending()

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

◆ deflatePrime()

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

◆ deflateReset()

◆ deflateResetKeep()

◆ deflateSetDictionary()

◆ deflateSetHeader()

int deflateSetHeader ( z_streamp  strm,
gz_headerp  head 
)

◆ deflateStateCheck() [1/2]

◆ deflateStateCheck() [2/2]

◆ deflateTune()

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

◆ fill_window() [1/2]

◆ fill_window() [2/2]

static void fill_window ( deflate_state s)
static

◆ flush_pending() [1/2]

static void flush_pending ( )
static

Referenced by deflate(), and deflate_stored().

◆ flush_pending() [2/2]

◆ lm_init() [1/2]

static void lm_init ( )
static

Referenced by deflateReset().

◆ lm_init() [2/2]

◆ longest_match() [1/2]

static uInt longest_match ( )
static

Referenced by deflate_fast(), and deflate_slow().

◆ longest_match() [2/2]

static uInt longest_match ( deflate_state s,
IPos  cur_match 
)
static

◆ putShortMSB() [1/2]

static void putShortMSB ( )
static

Referenced by deflate().

◆ putShortMSB() [2/2]

static void putShortMSB ( deflate_state s,
uInt  b 
)
static

Definition at line 716 of file deflate.c.

References b, put_byte, and s.

◆ read_buf() [1/2]

static unsigned read_buf ( )
static

Referenced by deflate_stored(), and fill_window().

◆ read_buf() [2/2]

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

◆ slide_hash() [1/2]

static void slide_hash ( )
static

Referenced by deflateParams(), and fill_window().

◆ slide_hash() [2/2]

static void slide_hash ( deflate_state s)
static

Definition at line 201 of file deflate.c.

References m, n, NIL, p, and s.

Variable Documentation

◆ configuration_table

config configuration_table[10]
static
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}}
static block_state deflate_stored()
static block_state deflate_slow()
static block_state deflate_fast()

Definition at line 134 of file deflate.c.

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

◆ deflate_copyright

char deflate_copyright[]
Initial value:
=
" deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "

Definition at line 54 of file deflate.c.