bzlib.c revision f9227b3195a9c18631fd7189f610528ced15121a
1879N/A#include "bzlib_private.h"
0N/A#ifndef BZ_NO_STDIO
0N/A " (www.memtest86.com). At the time of writing it is free (GPLd).\n"
0N/Aint bz_config_ok ( void )
0N/A int error_code
2630N/A switch (error_code)
0N/A s->state_out_pos = 0;
2797N/A s->state_in_len = 0;
0N/A int blockSize100k,
0N/A int workFactor )
0N/A return BZ_PARAM_ERROR;
0N/A return BZ_MEM_ERROR;
0N/A s->combinedCRC = 0;
0N/A prepare_new_block ( s );
0N/A int blockSize100k)
s->blockNo = 0;
s->combinedCRC = 0;
init_RL ( s );
prepare_new_block ( s );
return BZ_OK;
s->bsLive = 0;
s->bsBuff = 0;
s->calculatedCombinedCRC = 0;
s->currBlockNo = 0;
return BZ_OK;
Int32 i;
for (i = 0; i < s->state_in_len; i++) {
switch (s->state_in_len) {
s->nblock++;
init_RL ( s );
while (True) {
while (True) {
if (s->avail_in_expect == 0) break;
s->avail_in_expect--;
return progress_in;
while (True) {
s->state_out_pos++;
return progress_out;
while (True) {
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
prepare_new_block ( s );
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
flush_RL ( s );
EState* s;
switch (s->mode) {
case BZ_M_IDLE:
return BZ_SEQUENCE_ERROR;
case BZ_M_RUNNING:
goto preswitch;
goto preswitch;
return BZ_PARAM_ERROR;
case BZ_M_FLUSHING:
return BZ_SEQUENCE_ERROR;
return BZ_RUN_OK;
case BZ_M_FINISHING:
return BZ_SEQUENCE_ERROR;
return BZ_STREAM_END;
EState* s;
return BZ_OK;
int verbosity,
int small )
DState* s;
s->bsLive = 0;
s->bsBuff = 0;
s->calculatedCombinedCRC = 0;
s->currBlockNo = 0;
return BZ_OK;
if (s->blockRandomised) {
while (True) {
while (True) {
if (s->state_out_len == 0) break;
s->state_out_len--;
return True;
unsigned int total_out_lo32_old;
while (True) {
if (c_state_out_len > 0) {
while (True) {
cs_next_out++;
cs_avail_out--;
if (cs_avail_out == 0) {
cs_next_out++;
cs_avail_out--;
return True;
goto s_state_out_len_eq_one;
return False;
nb = 0;
return nb;
if (s->blockRandomised) {
while (True) {
while (True) {
if (s->state_out_len == 0) break;
s->state_out_len--;
return True;
while (True) {
while (True) {
if (s->state_out_len == 0) break;
s->state_out_len--;
return True;
DState* s;
while (True) {
if (s->smallDecompress)
s->calculatedBlockCRC );
return BZ_DATA_ERROR;
return BZ_OK;
if (r == BZ_STREAM_END) {
return BZ_DATA_ERROR;
DState* s;
return BZ_OK;
#ifndef BZ_NO_STDIO
ungetc ( c, f );
return False;
( int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor )
if (f == NULL ||
if (ferror(f))
return bzf;
( int* bzerror,
BZFILE* b,
void* buf,
int len )
if (len == 0)
while (True) {
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out )
( 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 )
while (True) {
( int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
int nUnused )
int ret;
if (f == NULL ||
if (ferror(f))
while (nUnused > 0) {
nUnused--;
return bzf;
( int* bzerror,
BZFILE* b,
void* buf,
int len )
if (len == 0)
while (True) {
( int* bzerror,
BZFILE* b,
void** unused,
int* nUnused )
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int workFactor )
int ret;
return BZ_PARAM_ERROR;
return BZ_OK;
return BZ_OUTBUFF_FULL;
return ret;
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int small,
int verbosity )
int ret;
return BZ_PARAM_ERROR;
return BZ_OK;
return BZ_UNEXPECTED_EOF;
return BZ_OUTBUFF_FULL;
return ret;
return BZ_VERSION;
#ifndef BZ_NO_STDIO
# include <fcntl.h>
# include <io.h>
const char *mode,
int bzerr;
int writing = 0;
int verbosity = 0;
int smallMode = 0;
int nUnused = 0;
while (*mode) {
switch (*mode) {
writing = 0; break;
mode++;
if (open_mode==0) {
#ifdef BZ_STRICT_ANSI
if (writing) {
return NULL;
return bzfp;
( const char *path,
const char *mode )
( int fd,
const char *mode )
return nread;
int bzerr;
return len;
int bzerr;
if (b==NULL) {return;}
static const char *bzerrorstrings[] = {
/*--- end bzlib.c ---*/