mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 08:48:29 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
224
third_party/bzip2/bzlib.c
vendored
224
third_party/bzip2/bzlib.c
vendored
|
@ -12,7 +12,7 @@
|
|||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
|
@ -42,7 +42,7 @@
|
|||
#ifndef BZ_NO_STDIO
|
||||
void BZ2_bz__AssertH__fail ( int errcode )
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"\n\nbzip2/libbzip2: internal error number %d.\n"
|
||||
"This is a bug in bzip2/libbzip2, %s.\n"
|
||||
"Please report it to: bzip2-devel@sourceware.org. If this happened\n"
|
||||
|
@ -147,8 +147,8 @@ Bool isempty_RL ( EState* s )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ2_bzCompressInit
|
||||
( bz_stream* strm,
|
||||
int BZ2_bzCompressInit
|
||||
( bz_stream* strm,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor )
|
||||
|
@ -158,7 +158,7 @@ int BZ2_bzCompressInit
|
|||
|
||||
if (!bz_config_ok()) return BZ_CONFIG_ERROR;
|
||||
|
||||
if (strm == NULL ||
|
||||
if (strm == NULL ||
|
||||
blockSize100k < 1 || blockSize100k > 9 ||
|
||||
workFactor < 0 || workFactor > 250)
|
||||
return BZ_PARAM_ERROR;
|
||||
|
@ -301,7 +301,7 @@ Bool copy_input_until_stop ( EState* s )
|
|||
/*-- no input? --*/
|
||||
if (s->strm->avail_in == 0) break;
|
||||
progress_in = True;
|
||||
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
|
||||
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
|
||||
s->strm->next_in++;
|
||||
s->strm->avail_in--;
|
||||
s->strm->total_in_lo32++;
|
||||
|
@ -319,7 +319,7 @@ Bool copy_input_until_stop ( EState* s )
|
|||
/*-- flush/finish end? --*/
|
||||
if (s->avail_in_expect == 0) break;
|
||||
progress_in = True;
|
||||
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
|
||||
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
|
||||
s->strm->next_in++;
|
||||
s->strm->avail_in--;
|
||||
s->strm->total_in_lo32++;
|
||||
|
@ -365,18 +365,18 @@ Bool handle_compress ( bz_stream* strm )
|
|||
Bool progress_in = False;
|
||||
Bool progress_out = False;
|
||||
EState* s = strm->state;
|
||||
|
||||
|
||||
while (True) {
|
||||
|
||||
if (s->state == BZ_S_OUTPUT) {
|
||||
progress_out |= copy_output_until_stop ( s );
|
||||
if (s->state_out_pos < s->numZ) break;
|
||||
if (s->mode == BZ_M_FINISHING &&
|
||||
if (s->mode == BZ_M_FINISHING &&
|
||||
s->avail_in_expect == 0 &&
|
||||
isempty_RL(s)) break;
|
||||
prepare_new_block ( s );
|
||||
s->state = BZ_S_INPUT;
|
||||
if (s->mode == BZ_M_FLUSHING &&
|
||||
if (s->mode == BZ_M_FLUSHING &&
|
||||
s->avail_in_expect == 0 &&
|
||||
isempty_RL(s)) break;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
|
|||
if (action == BZ_RUN) {
|
||||
progress = handle_compress ( strm );
|
||||
return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (action == BZ_FLUSH) {
|
||||
s->avail_in_expect = strm->avail_in;
|
||||
|
@ -438,12 +438,12 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
|
|||
s->mode = BZ_M_FINISHING;
|
||||
goto preswitch;
|
||||
}
|
||||
else
|
||||
else
|
||||
return BZ_PARAM_ERROR;
|
||||
|
||||
case BZ_M_FLUSHING:
|
||||
if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
|
||||
if (s->avail_in_expect != s->strm->avail_in)
|
||||
if (s->avail_in_expect != s->strm->avail_in)
|
||||
return BZ_SEQUENCE_ERROR;
|
||||
progress = handle_compress ( strm );
|
||||
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
|
||||
|
@ -453,7 +453,7 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
|
|||
|
||||
case BZ_M_FINISHING:
|
||||
if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
|
||||
if (s->avail_in_expect != s->strm->avail_in)
|
||||
if (s->avail_in_expect != s->strm->avail_in)
|
||||
return BZ_SEQUENCE_ERROR;
|
||||
progress = handle_compress ( strm );
|
||||
if (!progress) return BZ_SEQUENCE_ERROR;
|
||||
|
@ -480,7 +480,7 @@ int BZ2_bzCompressEnd ( bz_stream *strm )
|
|||
if (s->ftab != NULL) BZFREE(s->ftab);
|
||||
BZFREE(strm->state);
|
||||
|
||||
strm->state = NULL;
|
||||
strm->state = NULL;
|
||||
|
||||
return BZ_OK;
|
||||
}
|
||||
|
@ -491,8 +491,8 @@ int BZ2_bzCompressEnd ( bz_stream *strm )
|
|||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ2_bzDecompressInit
|
||||
( bz_stream* strm,
|
||||
int BZ2_bzDecompressInit
|
||||
( bz_stream* strm,
|
||||
int verbosity,
|
||||
int small )
|
||||
{
|
||||
|
@ -557,34 +557,34 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
|
|||
|
||||
/* can a new run be started? */
|
||||
if (s->nblock_used == s->save_nblock+1) return False;
|
||||
|
||||
|
||||
/* Only caused by corrupt data stream? */
|
||||
if (s->nblock_used > s->save_nblock+1)
|
||||
return True;
|
||||
|
||||
|
||||
s->state_out_len = 1;
|
||||
s->state_out_ch = s->k0;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 2;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 3;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
|
||||
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
s->state_out_len = ((Int32)k1) + 4;
|
||||
BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
|
||||
s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
|
|||
}
|
||||
s_state_out_len_eq_one:
|
||||
{
|
||||
if (cs_avail_out == 0) {
|
||||
if (cs_avail_out == 0) {
|
||||
c_state_out_len = 1; goto return_notr;
|
||||
};
|
||||
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
|
||||
|
@ -630,7 +630,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
|
|||
cs_next_out++;
|
||||
cs_avail_out--;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Only caused by corrupt data stream? */
|
||||
if (c_nblock_used > s_save_nblockPP)
|
||||
return True;
|
||||
|
@ -638,25 +638,25 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
|
|||
/* can a new run be started? */
|
||||
if (c_nblock_used == s_save_nblockPP) {
|
||||
c_state_out_len = 0; goto return_notr;
|
||||
};
|
||||
};
|
||||
c_state_out_ch = c_k0;
|
||||
BZ_GET_FAST_C(k1); c_nblock_used++;
|
||||
if (k1 != c_k0) {
|
||||
c_k0 = k1; goto s_state_out_len_eq_one;
|
||||
if (k1 != c_k0) {
|
||||
c_k0 = k1; goto s_state_out_len_eq_one;
|
||||
};
|
||||
if (c_nblock_used == s_save_nblockPP)
|
||||
if (c_nblock_used == s_save_nblockPP)
|
||||
goto s_state_out_len_eq_one;
|
||||
|
||||
|
||||
c_state_out_len = 2;
|
||||
BZ_GET_FAST_C(k1); c_nblock_used++;
|
||||
if (c_nblock_used == s_save_nblockPP) continue;
|
||||
if (k1 != c_k0) { c_k0 = k1; continue; };
|
||||
|
||||
|
||||
c_state_out_len = 3;
|
||||
BZ_GET_FAST_C(k1); c_nblock_used++;
|
||||
if (c_nblock_used == s_save_nblockPP) continue;
|
||||
if (k1 != c_k0) { c_k0 = k1; continue; };
|
||||
|
||||
|
||||
BZ_GET_FAST_C(k1); c_nblock_used++;
|
||||
c_state_out_len = ((Int32)k1) + 4;
|
||||
BZ_GET_FAST_C(c_k0); c_nblock_used++;
|
||||
|
@ -724,37 +724,37 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
|
|||
s->strm->total_out_lo32++;
|
||||
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
|
||||
}
|
||||
|
||||
|
||||
/* can a new run be started? */
|
||||
if (s->nblock_used == s->save_nblock+1) return False;
|
||||
|
||||
/* Only caused by corrupt data stream? */
|
||||
if (s->nblock_used > s->save_nblock+1)
|
||||
return True;
|
||||
|
||||
|
||||
s->state_out_len = 1;
|
||||
s->state_out_ch = s->k0;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 2;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 3;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
|
||||
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
|
||||
k1 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
s->state_out_len = ((Int32)k1) + 4;
|
||||
BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
|
||||
BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
|
||||
s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
|
||||
}
|
||||
|
||||
|
@ -773,30 +773,30 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
|
|||
s->strm->total_out_lo32++;
|
||||
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
|
||||
}
|
||||
|
||||
|
||||
/* can a new run be started? */
|
||||
if (s->nblock_used == s->save_nblock+1) return False;
|
||||
|
||||
/* Only caused by corrupt data stream? */
|
||||
if (s->nblock_used > s->save_nblock+1)
|
||||
return True;
|
||||
|
||||
|
||||
s->state_out_len = 1;
|
||||
s->state_out_ch = s->k0;
|
||||
BZ_GET_SMALL(k1); s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 2;
|
||||
BZ_GET_SMALL(k1); s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
s->state_out_len = 3;
|
||||
BZ_GET_SMALL(k1); s->nblock_used++;
|
||||
if (s->nblock_used == s->save_nblock+1) continue;
|
||||
if (k1 != s->k0) { s->k0 = k1; continue; };
|
||||
|
||||
|
||||
BZ_GET_SMALL(k1); s->nblock_used++;
|
||||
s->state_out_len = ((Int32)k1) + 4;
|
||||
BZ_GET_SMALL(s->k0); s->nblock_used++;
|
||||
|
@ -825,14 +825,14 @@ int BZ2_bzDecompress ( bz_stream *strm )
|
|||
if (corrupt) return BZ_DATA_ERROR;
|
||||
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
|
||||
BZ_FINALISE_CRC ( s->calculatedBlockCRC );
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC,
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC,
|
||||
s->calculatedBlockCRC );
|
||||
if (s->verbosity >= 2) VPrintf0 ( "]" );
|
||||
if (s->calculatedBlockCRC != s->storedBlockCRC)
|
||||
return BZ_DATA_ERROR;
|
||||
s->calculatedCombinedCRC
|
||||
= (s->calculatedCombinedCRC << 1) |
|
||||
s->calculatedCombinedCRC
|
||||
= (s->calculatedCombinedCRC << 1) |
|
||||
(s->calculatedCombinedCRC >> 31);
|
||||
s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
|
||||
s->state = BZ_X_BLKHDR_1;
|
||||
|
@ -844,7 +844,7 @@ int BZ2_bzDecompress ( bz_stream *strm )
|
|||
Int32 r = BZ2_decompress ( s );
|
||||
if (r == BZ_STREAM_END) {
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
|
||||
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
|
||||
s->storedCombinedCRC, s->calculatedCombinedCRC );
|
||||
if (s->calculatedCombinedCRC != s->storedCombinedCRC)
|
||||
return BZ_DATA_ERROR;
|
||||
|
@ -890,7 +890,7 @@ int BZ2_bzDecompressEnd ( bz_stream *strm )
|
|||
if (bzf != NULL) bzf->lastErr = eee; \
|
||||
}
|
||||
|
||||
typedef
|
||||
typedef
|
||||
struct {
|
||||
FILE* handle;
|
||||
Char buf[BZ_MAX_UNUSED];
|
||||
|
@ -914,10 +914,10 @@ static Bool myfeof ( FILE* f )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
BZFILE* BZ2_bzWriteOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
BZFILE* BZ2_bzWriteOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor )
|
||||
{
|
||||
|
@ -949,23 +949,23 @@ BZFILE* BZ2_bzWriteOpen
|
|||
bzf->strm.opaque = NULL;
|
||||
|
||||
if (workFactor == 0) workFactor = 30;
|
||||
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
|
||||
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
|
||||
verbosity, workFactor );
|
||||
if (ret != BZ_OK)
|
||||
{ BZ_SETERR(ret); free(bzf); return NULL; };
|
||||
|
||||
bzf->strm.avail_in = 0;
|
||||
bzf->initialisedOk = True;
|
||||
return bzf;
|
||||
return bzf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_bzWrite
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len )
|
||||
{
|
||||
Int32 n, n2, ret;
|
||||
|
@ -994,7 +994,7 @@ void BZ2_bzWrite
|
|||
|
||||
if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
|
||||
n = BZ_MAX_UNUSED - bzf->strm.avail_out;
|
||||
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
|
||||
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
|
||||
n, bzf->handle );
|
||||
if (n != n2 || ferror(bzf->handle))
|
||||
{ BZ_SETERR(BZ_IO_ERROR); return; };
|
||||
|
@ -1008,20 +1008,20 @@ void BZ2_bzWrite
|
|||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_bzWriteClose
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in,
|
||||
unsigned int* nbytes_out )
|
||||
{
|
||||
BZ2_bzWriteClose64 ( bzerror, b, abandon,
|
||||
BZ2_bzWriteClose64 ( bzerror, b, abandon,
|
||||
nbytes_in, NULL, nbytes_out, NULL );
|
||||
}
|
||||
|
||||
|
||||
void BZ2_bzWriteClose64
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in_lo32,
|
||||
unsigned int* nbytes_in_hi32,
|
||||
|
@ -1053,7 +1053,7 @@ void BZ2_bzWriteClose64
|
|||
|
||||
if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
|
||||
n = BZ_MAX_UNUSED - bzf->strm.avail_out;
|
||||
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
|
||||
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
|
||||
n, bzf->handle );
|
||||
if (n != n2 || ferror(bzf->handle))
|
||||
{ BZ_SETERR(BZ_IO_ERROR); return; };
|
||||
|
@ -1085,9 +1085,9 @@ void BZ2_bzWriteClose64
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
BZFILE* BZ2_bzReadOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
BZFILE* BZ2_bzReadOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
int verbosity,
|
||||
int small,
|
||||
void* unused,
|
||||
|
@ -1098,7 +1098,7 @@ BZFILE* BZ2_bzReadOpen
|
|||
|
||||
BZ_SETERR(BZ_OK);
|
||||
|
||||
if (f == NULL ||
|
||||
if (f == NULL ||
|
||||
(small != 0 && small != 1) ||
|
||||
(verbosity < 0 || verbosity > 4) ||
|
||||
(unused == NULL && nUnused != 0) ||
|
||||
|
@ -1109,7 +1109,7 @@ BZFILE* BZ2_bzReadOpen
|
|||
{ BZ_SETERR(BZ_IO_ERROR); return NULL; };
|
||||
|
||||
bzf = malloc ( sizeof(bzFile) );
|
||||
if (bzf == NULL)
|
||||
if (bzf == NULL)
|
||||
{ BZ_SETERR(BZ_MEM_ERROR); return NULL; };
|
||||
|
||||
BZ_SETERR(BZ_OK);
|
||||
|
@ -1121,7 +1121,7 @@ BZFILE* BZ2_bzReadOpen
|
|||
bzf->strm.bzalloc = NULL;
|
||||
bzf->strm.bzfree = NULL;
|
||||
bzf->strm.opaque = NULL;
|
||||
|
||||
|
||||
while (nUnused > 0) {
|
||||
bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
|
||||
unused = ((void*)( 1 + ((UChar*)(unused)) ));
|
||||
|
@ -1136,7 +1136,7 @@ BZFILE* BZ2_bzReadOpen
|
|||
bzf->strm.next_in = bzf->buf;
|
||||
|
||||
bzf->initialisedOk = True;
|
||||
return bzf;
|
||||
return bzf;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1159,10 +1159,10 @@ void BZ2_bzReadClose ( int *bzerror, BZFILE *b )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ2_bzRead
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int BZ2_bzRead
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len )
|
||||
{
|
||||
Int32 n, ret;
|
||||
|
@ -1184,11 +1184,11 @@ int BZ2_bzRead
|
|||
|
||||
while (True) {
|
||||
|
||||
if (ferror(bzf->handle))
|
||||
if (ferror(bzf->handle))
|
||||
{ BZ_SETERR(BZ_IO_ERROR); return 0; };
|
||||
|
||||
if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
|
||||
n = fread ( bzf->buf, sizeof(UChar),
|
||||
n = fread ( bzf->buf, sizeof(UChar),
|
||||
BZ_MAX_UNUSED, bzf->handle );
|
||||
if (ferror(bzf->handle))
|
||||
{ BZ_SETERR(BZ_IO_ERROR); return 0; };
|
||||
|
@ -1202,7 +1202,7 @@ int BZ2_bzRead
|
|||
if (ret != BZ_OK && ret != BZ_STREAM_END)
|
||||
{ BZ_SETERR(ret); return 0; };
|
||||
|
||||
if (ret == BZ_OK && myfeof(bzf->handle) &&
|
||||
if (ret == BZ_OK && myfeof(bzf->handle) &&
|
||||
bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
|
||||
{ BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ int BZ2_bzRead
|
|||
return len - bzf->strm.avail_out; };
|
||||
if (bzf->strm.avail_out == 0)
|
||||
{ BZ_SETERR(BZ_OK); return len; };
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 0; /*not reached*/
|
||||
|
@ -1219,10 +1219,10 @@ int BZ2_bzRead
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_bzReadGetUnused
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
void BZ2_bzReadGetUnused
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
int* nUnused )
|
||||
{
|
||||
bzFile* bzf = (bzFile*)b;
|
||||
|
@ -1244,30 +1244,30 @@ void BZ2_bzReadGetUnused
|
|||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ2_bzBuffToBuffCompress
|
||||
( char* dest,
|
||||
int BZ2_bzBuffToBuffCompress
|
||||
( char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor )
|
||||
{
|
||||
bz_stream strm;
|
||||
int ret;
|
||||
|
||||
if (dest == NULL || destLen == NULL ||
|
||||
if (dest == NULL || destLen == NULL ||
|
||||
source == NULL ||
|
||||
blockSize100k < 1 || blockSize100k > 9 ||
|
||||
verbosity < 0 || verbosity > 4 ||
|
||||
workFactor < 0 || workFactor > 250)
|
||||
workFactor < 0 || workFactor > 250)
|
||||
return BZ_PARAM_ERROR;
|
||||
|
||||
if (workFactor == 0) workFactor = 30;
|
||||
strm.bzalloc = NULL;
|
||||
strm.bzfree = NULL;
|
||||
strm.opaque = NULL;
|
||||
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
|
||||
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
|
||||
verbosity, workFactor );
|
||||
if (ret != BZ_OK) return ret;
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ int BZ2_bzBuffToBuffCompress
|
|||
if (ret != BZ_STREAM_END) goto errhandler;
|
||||
|
||||
/* normal termination */
|
||||
*destLen -= strm.avail_out;
|
||||
*destLen -= strm.avail_out;
|
||||
BZ2_bzCompressEnd ( &strm );
|
||||
return BZ_OK;
|
||||
|
||||
|
@ -1296,10 +1296,10 @@ int BZ2_bzBuffToBuffCompress
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ2_bzBuffToBuffDecompress
|
||||
( char* dest,
|
||||
int BZ2_bzBuffToBuffDecompress
|
||||
( char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int small,
|
||||
int verbosity )
|
||||
|
@ -1307,10 +1307,10 @@ int BZ2_bzBuffToBuffDecompress
|
|||
bz_stream strm;
|
||||
int ret;
|
||||
|
||||
if (dest == NULL || destLen == NULL ||
|
||||
if (dest == NULL || destLen == NULL ||
|
||||
source == NULL ||
|
||||
(small != 0 && small != 1) ||
|
||||
verbosity < 0 || verbosity > 4)
|
||||
verbosity < 0 || verbosity > 4)
|
||||
return BZ_PARAM_ERROR;
|
||||
|
||||
strm.bzalloc = NULL;
|
||||
|
@ -1340,11 +1340,11 @@ int BZ2_bzBuffToBuffDecompress
|
|||
} else {
|
||||
BZ2_bzDecompressEnd ( &strm );
|
||||
return BZ_OUTBUFF_FULL;
|
||||
};
|
||||
};
|
||||
|
||||
errhandler:
|
||||
BZ2_bzDecompressEnd ( &strm );
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1396,7 +1396,7 @@ BZFILE * bzopen_or_bzdopen
|
|||
int verbosity = 0;
|
||||
int workFactor = 30;
|
||||
int smallMode = 0;
|
||||
int nUnused = 0;
|
||||
int nUnused = 0;
|
||||
|
||||
if (mode == NULL) return NULL;
|
||||
while (*mode) {
|
||||
|
@ -1436,7 +1436,7 @@ BZFILE * bzopen_or_bzdopen
|
|||
if (writing) {
|
||||
/* Guard against total chaos and anarchy -- JRS */
|
||||
if (blockSize100k < 1) blockSize100k = 1;
|
||||
if (blockSize100k > 9) blockSize100k = 9;
|
||||
if (blockSize100k > 9) blockSize100k = 9;
|
||||
bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
|
||||
verbosity,workFactor);
|
||||
} else {
|
||||
|
@ -1515,7 +1515,7 @@ void BZ2_bzclose (BZFILE* b)
|
|||
{
|
||||
int bzerr;
|
||||
FILE *fp;
|
||||
|
||||
|
||||
if (b==NULL) {return;}
|
||||
fp = ((bzFile *)b)->handle;
|
||||
if(((bzFile*)b)->writing){
|
||||
|
@ -1534,7 +1534,7 @@ void BZ2_bzclose (BZFILE* b)
|
|||
|
||||
/*---------------------------------------------------*/
|
||||
/*--
|
||||
return last error code
|
||||
return last error code
|
||||
--*/
|
||||
static const char *bzerrorstrings[] = {
|
||||
"OK"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue