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)  

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

Go to the source code of this file.

Classes

struct  bzFile
 

Macros

#define ADD_CHAR_TO_BLOCK(zs, zchh0)
 
#define BZ_SETERR(eee)
 
#define SET_BINARY_MODE(file)
 

Functions

void BZ2_bz__AssertH__fail (int errcode)
 
static int bz_config_ok (void)
 
static voiddefault_bzalloc (void *opaque, Int32 items, Int32 size)
 
static void default_bzfree (void *opaque, void *addr)
 
static void prepare_new_block (EState *s)
 
static void init_RL (EState *s)
 
static Bool isempty_RL (EState *s)
 
int BZ2_bzCompressInit (bz_stream *strm, int blockSize100k, int verbosity, int workFactor)
 
static void add_pair_to_block (EState *s)
 
static void flush_RL (EState *s)
 
static Bool copy_input_until_stop (EState *s)
 
static Bool copy_output_until_stop (EState *s)
 
static Bool handle_compress (bz_stream *strm)
 
int BZ2_bzCompress (bz_stream *strm, int action)
 
int BZ2_bzCompressEnd (bz_stream *strm)
 
int BZ2_bzDecompressInit (bz_stream *strm, int verbosity, int small)
 
static Bool unRLE_obuf_to_output_FAST (DState *s)
 
Int32 BZ2_indexIntoF (Int32 indx, Int32 *cftab)
 
static Bool unRLE_obuf_to_output_SMALL (DState *s)
 
int BZ2_bzDecompress (bz_stream *strm)
 
int BZ2_bzDecompressEnd (bz_stream *strm)
 
static Bool myfeof (FILE *f)
 
BZFILEBZ2_bzWriteOpen (int *bzerror, FILE *f, int blockSize100k, int verbosity, int workFactor)
 
void BZ2_bzWrite (int *bzerror, BZFILE *b, void *buf, int len)
 
void BZ2_bzWriteClose (int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in, unsigned int *nbytes_out)
 
void BZ2_bzWriteClose64 (int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in_lo32, unsigned int *nbytes_in_hi32, unsigned int *nbytes_out_lo32, unsigned int *nbytes_out_hi32)
 
BZFILEBZ2_bzReadOpen (int *bzerror, FILE *f, int verbosity, int small, void *unused, int nUnused)
 
void BZ2_bzReadClose (int *bzerror, BZFILE *b)
 
int BZ2_bzRead (int *bzerror, BZFILE *b, void *buf, int len)
 
void BZ2_bzReadGetUnused (int *bzerror, BZFILE *b, void **unused, int *nUnused)
 
int BZ2_bzBuffToBuffCompress (char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor)
 
int BZ2_bzBuffToBuffDecompress (char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int small, int verbosity)
 
const char * BZ2_bzlibVersion (void)
 
static BZFILEbzopen_or_bzdopen (const char *path, int fd, const char *mode, int open_mode)
 
BZFILEBZ2_bzopen (const char *path, const char *mode)
 
BZFILEBZ2_bzdopen (int fd, const char *mode)
 
int BZ2_bzread (BZFILE *b, void *buf, int len)
 
int BZ2_bzwrite (BZFILE *b, void *buf, int len)
 
int BZ2_bzflush (BZFILE *b)
 
void BZ2_bzclose (BZFILE *b)
 
const char * BZ2_bzerror (BZFILE *b, int *errnum)
 

Variables

static const char * bzerrorstrings []
 

Macro Definition Documentation

◆ ADD_CHAR_TO_BLOCK

#define ADD_CHAR_TO_BLOCK (   zs,
  zchh0 
)
Value:
{ \
UInt32 zchh = (UInt32)(zchh0); \
/*-- fast track the common case --*/ \
if (zchh != zs->state_in_ch && \
zs->state_in_len == 1) { \
UChar ch = (UChar)(zs->state_in_ch); \
BZ_UPDATE_CRC( zs->blockCRC, ch ); \
zs->inUse[zs->state_in_ch] = True; \
zs->block[zs->nblock] = (UChar)ch; \
zs->nblock++; \
zs->state_in_ch = zchh; \
} \
else \
/*-- general, uncommon cases --*/ \
if (zchh != zs->state_in_ch || \
zs->state_in_len == 255) { \
if (zs->state_in_ch < 256) \
add_pair_to_block ( zs ); \
zs->state_in_ch = zchh; \
zs->state_in_len = 1; \
} else { \
zs->state_in_len++; \
} \
}
unsigned int UInt32
Definition: bzip2.c:165
unsigned char UChar
Definition: bzip2.c:163
ch
Definition: t4ht.c:1443
@ True
Definition: ttf2tfm.h:20

Definition at line 260 of file bzlib.c.

◆ BZ_SETERR

#define BZ_SETERR (   eee)
Value:
{ \
if (bzerror != NULL) *bzerror = eee; \
if (bzf != NULL) bzf->lastErr = eee; \
}
#define NULL
Definition: ftobjs.h:61

Definition at line 886 of file bzlib.c.

◆ SET_BINARY_MODE

#define SET_BINARY_MODE (   file)

Definition at line 1380 of file bzlib.c.

Function Documentation

◆ add_pair_to_block()

static void add_pair_to_block ( EState s)
static

Definition at line 216 of file bzlib.c.

References BZ_UPDATE_CRC, ch, i, s, and True.

Referenced by flush_RL().

◆ BZ2_bz__AssertH__fail()

void BZ2_bz__AssertH__fail ( int  errcode)

Definition at line 41 of file bzlib.c.

References BZ2_bzlibVersion(), exit(), and fprintf.

◆ BZ2_bzBuffToBuffCompress()

int BZ2_bzBuffToBuffCompress ( char *  dest,
unsigned int destLen,
char *  source,
unsigned int  sourceLen,
int  blockSize100k,
int  verbosity,
int  workFactor 
)

◆ BZ2_bzBuffToBuffDecompress()

int BZ2_bzBuffToBuffDecompress ( char *  dest,
unsigned int destLen,
char *  source,
unsigned int  sourceLen,
int  small,
int  verbosity 
)

◆ BZ2_bzclose()

void BZ2_bzclose ( BZFILE b)

Definition at line 1514 of file bzlib.c.

References b, BZ2_bzReadClose(), BZ2_bzWriteClose(), BZ_OK, fclose, FILE, fp, NULL, and fc-lang::stdout.

◆ BZ2_bzCompress()

◆ BZ2_bzCompressEnd()

int BZ2_bzCompressEnd ( bz_stream strm)

Definition at line 468 of file bzlib.c.

References BZ_OK, BZ_PARAM_ERROR, BZFREE, NULL, and s.

◆ BZ2_bzCompressInit()

int BZ2_bzCompressInit ( bz_stream strm,
int  blockSize100k,
int  verbosity,
int  workFactor 
)

◆ BZ2_bzDecompress()

◆ BZ2_bzDecompressEnd()

int BZ2_bzDecompressEnd ( bz_stream strm)

Definition at line 862 of file bzlib.c.

References BZ_OK, BZ_PARAM_ERROR, BZFREE, NULL, and s.

◆ BZ2_bzDecompressInit()

int BZ2_bzDecompressInit ( bz_stream strm,
int  verbosity,
int  small 
)

◆ BZ2_bzdopen()

BZFILE* BZ2_bzdopen ( int  fd,
const char *  mode 
)

Definition at line 1469 of file bzlib.c.

References bzopen_or_bzdopen(), mode, and NULL.

◆ BZ2_bzerror()

const char* BZ2_bzerror ( BZFILE b,
int errnum 
)

Definition at line 1559 of file bzlib.c.

References b, bzerrorstrings, and err.

◆ BZ2_bzflush()

int BZ2_bzflush ( BZFILE b)

Definition at line 1506 of file bzlib.c.

◆ BZ2_bzlibVersion()

const char* BZ2_bzlibVersion ( void  )

Definition at line 1366 of file bzlib.c.

References BZ_VERSION.

◆ BZ2_bzopen()

BZFILE* BZ2_bzopen ( const char *  path,
const char *  mode 
)

Definition at line 1460 of file bzlib.c.

References bzopen_or_bzdopen(), and mode.

◆ BZ2_bzread()

int BZ2_bzread ( BZFILE b,
void buf,
int  len 
)

Definition at line 1478 of file bzlib.c.

References b, buf, BZ2_bzRead(), BZ_OK, BZ_STREAM_END, and len.

◆ BZ2_bzRead()

◆ BZ2_bzReadClose()

void BZ2_bzReadClose ( int bzerror,
BZFILE b 
)

◆ BZ2_bzReadGetUnused()

void BZ2_bzReadGetUnused ( int bzerror,
BZFILE b,
void **  unused,
int nUnused 
)

◆ BZ2_bzReadOpen()

◆ BZ2_bzwrite()

int BZ2_bzwrite ( BZFILE b,
void buf,
int  len 
)

Definition at line 1492 of file bzlib.c.

References b, buf, BZ2_bzWrite(), BZ_OK, and len.

◆ BZ2_bzWrite()

◆ BZ2_bzWriteClose()

void BZ2_bzWriteClose ( int bzerror,
BZFILE b,
int  abandon,
unsigned int nbytes_in,
unsigned int nbytes_out 
)

Definition at line 1009 of file bzlib.c.

References b, BZ2_bzWriteClose64(), and NULL.

◆ BZ2_bzWriteClose64()

void BZ2_bzWriteClose64 ( int bzerror,
BZFILE b,
int  abandon,
unsigned int nbytes_in_lo32,
unsigned int nbytes_in_hi32,
unsigned int nbytes_out_lo32,
unsigned int nbytes_out_hi32 
)

◆ BZ2_bzWriteOpen()

◆ BZ2_indexIntoF()

Int32 BZ2_indexIntoF ( Int32  indx,
Int32 cftab 
)

Definition at line 687 of file bzlib.c.

References nb.

◆ bz_config_ok()

static int bz_config_ok ( void  )
static

Definition at line 91 of file bzlib.c.

Referenced by BZ2_bzCompressInit(), and BZ2_bzDecompressInit().

◆ bzopen_or_bzdopen()

static BZFILE* bzopen_or_bzdopen ( const char *  path,
int  fd,
const char *  mode,
int  open_mode 
)
static

◆ copy_input_until_stop()

static Bool copy_input_until_stop ( EState s)
static

Definition at line 289 of file bzlib.c.

References ADD_CHAR_TO_BLOCK, BZ_M_RUNNING, False, s, and True.

Referenced by handle_compress().

◆ copy_output_until_stop()

static Bool copy_output_until_stop ( EState s)
static

Definition at line 334 of file bzlib.c.

References False, if, s, and True.

Referenced by handle_compress().

◆ default_bzalloc()

static void* default_bzalloc ( void opaque,
Int32  items,
Int32  size 
)
static

Definition at line 102 of file bzlib.c.

References items, malloc, size, and v.

Referenced by BZ2_bzCompressInit(), and BZ2_bzDecompressInit().

◆ default_bzfree()

static void default_bzfree ( void opaque,
void addr 
)
static

Definition at line 109 of file bzlib.c.

References free, and NULL.

Referenced by BZ2_bzCompressInit(), and BZ2_bzDecompressInit().

◆ flush_RL()

static void flush_RL ( EState s)
static

Definition at line 252 of file bzlib.c.

References add_pair_to_block(), init_RL(), and s.

Referenced by handle_compress().

◆ handle_compress()

◆ init_RL()

static void init_RL ( EState s)
static

Definition at line 131 of file bzlib.c.

References s.

Referenced by BZ2_bzCompressInit(), and flush_RL().

◆ isempty_RL()

static Bool isempty_RL ( EState s)
static

Definition at line 139 of file bzlib.c.

References False, s, and True.

Referenced by BZ2_bzCompress(), and handle_compress().

◆ myfeof()

static Bool myfeof ( FILE f)
static

Definition at line 906 of file bzlib.c.

References c, EOF, f, False, fgetc, True, and ungetc.

Referenced by BZ2_bzRead().

◆ prepare_new_block()

static void prepare_new_block ( EState s)
static

Definition at line 117 of file bzlib.c.

References BZ_INITIALISE_CRC, False, i, and s.

Referenced by BZ2_bzCompressInit(), and handle_compress().

◆ unRLE_obuf_to_output_FAST()

static Bool unRLE_obuf_to_output_FAST ( DState s)
static

Definition at line 536 of file bzlib.c.

References BZ_GET_FAST, BZ_GET_FAST_C, BZ_RAND_MASK, BZ_RAND_UPD_MASK, BZ_UPDATE_CRC, False, k1, s, and True.

Referenced by BZ2_bzDecompress().

◆ unRLE_obuf_to_output_SMALL()

static Bool unRLE_obuf_to_output_SMALL ( DState s)
static

Definition at line 706 of file bzlib.c.

References BZ_GET_SMALL, BZ_RAND_MASK, BZ_RAND_UPD_MASK, BZ_UPDATE_CRC, False, k1, s, and True.

Referenced by BZ2_bzDecompress().

Variable Documentation

◆ bzerrorstrings

const char* bzerrorstrings[]
static
Initial value:
= {
"OK"
,"SEQUENCE_ERROR"
,"PARAM_ERROR"
,"MEM_ERROR"
,"DATA_ERROR"
,"DATA_ERROR_MAGIC"
,"IO_ERROR"
,"UNEXPECTED_EOF"
,"OUTBUFF_FULL"
,"CONFIG_ERROR"
,"???"
,"???"
,"???"
,"???"
,"???"
,"???"
}

Definition at line 1539 of file bzlib.c.

Referenced by BZ2_bzerror().