even smaller bzip2 code
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1244 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
83bfc82bed
commit
ed3a8ba913
4 changed files with 28 additions and 35 deletions
|
@ -443,12 +443,8 @@ static DState local_state;
|
|||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzDecompressInit)
|
||||
( bz_stream* strm)
|
||||
( DState * s)
|
||||
{
|
||||
DState* s=&local_state;
|
||||
|
||||
s->strm = strm;
|
||||
strm->state = s;
|
||||
s->state = BZ_X_BLKHDR_1;
|
||||
|
||||
return BZ_OK;
|
||||
|
@ -530,8 +526,8 @@ void unRLE_obuf_to_output_FAST ( DState* s )
|
|||
Int32 c_k0 = s->k0;
|
||||
UInt32* c_tt = s->tt;
|
||||
UInt32 c_tPos = s->tPos;
|
||||
char* cs_next_out = s->strm->next_out;
|
||||
unsigned int cs_avail_out = s->strm->avail_out;
|
||||
char* cs_next_out = s->next_out;
|
||||
unsigned int cs_avail_out = s->avail_out;
|
||||
/* end restore */
|
||||
|
||||
UInt32 avail_out_INIT = cs_avail_out;
|
||||
|
@ -594,8 +590,8 @@ void unRLE_obuf_to_output_FAST ( DState* s )
|
|||
s->k0 = c_k0;
|
||||
// s->tt = c_tt;
|
||||
s->tPos = c_tPos;
|
||||
s->strm->next_out = cs_next_out;
|
||||
s->strm->avail_out = cs_avail_out;
|
||||
s->next_out = cs_next_out;
|
||||
s->avail_out = cs_avail_out;
|
||||
/* end save */
|
||||
}
|
||||
|
||||
|
@ -603,10 +599,8 @@ void unRLE_obuf_to_output_FAST ( DState* s )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
|
||||
int BZ_API(BZ2_bzDecompress) ( DState *s )
|
||||
{
|
||||
DState* s;
|
||||
s = strm->state;
|
||||
|
||||
while (True) {
|
||||
if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
|
||||
|
|
|
@ -147,18 +147,6 @@ BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
|||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
||||
bz_stream *strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
||||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
||||
bz_stream *strm
|
||||
);
|
||||
|
||||
/*-- General stuff. --*/
|
||||
|
||||
#define BZ_VERSION "1.0.1, 23-June-2000"
|
||||
|
@ -236,7 +224,7 @@ typedef unsigned short UInt16;
|
|||
typedef
|
||||
struct {
|
||||
/* pointer back to the struct bz_stream */
|
||||
bz_stream* strm;
|
||||
bz_stream *strm;
|
||||
|
||||
/* mode this stream is in, and whether inputting */
|
||||
/* or outputting data */
|
||||
|
@ -386,10 +374,14 @@ typedef struct {
|
|||
typedef
|
||||
struct {
|
||||
/* pointer back to the struct bz_stream */
|
||||
bz_stream* strm;
|
||||
char *next_in;
|
||||
unsigned int avail_in;
|
||||
|
||||
char *next_out;
|
||||
unsigned int avail_out;
|
||||
|
||||
/* state indicator for this stream */
|
||||
Int32 state;
|
||||
char state;
|
||||
|
||||
/* for doing the final run-length decoding */
|
||||
UChar state_out_ch;
|
||||
|
@ -500,9 +492,19 @@ BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
|
|||
Int32, Int32, Int32 );
|
||||
|
||||
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
||||
DState *s
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
||||
DState * s
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
|
||||
|
||||
#ifdef BZ_NO_STDIO
|
||||
|
|
|
@ -81,13 +81,11 @@ static int __mygetbits(int *vtmp, int nnn, DState* s)
|
|||
*vtmp = v;
|
||||
return 0;
|
||||
}
|
||||
if (s->strm->avail_in == 0) return 1;
|
||||
s->bsBuff = (s->bsBuff << 8) | ((UInt32) (*((UChar*)(s->strm->next_in))));
|
||||
if (s->avail_in == 0) return 1;
|
||||
s->bsBuff = (s->bsBuff << 8) | ((UInt32) (*((UChar*)(s->next_in))));
|
||||
s->bsLive += 8;
|
||||
s->strm->next_in++;
|
||||
s->strm->avail_in--;
|
||||
// s->strm->total_in_lo32++;
|
||||
// if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
|
||||
s->next_in++;
|
||||
s->avail_in--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +141,6 @@ Int32 BZ2_decompress ( DState* s )
|
|||
Int32 uc;
|
||||
Int32 retVal;
|
||||
Int32 minLen, maxLen;
|
||||
bz_stream* strm = s->strm;
|
||||
|
||||
/* stuff that needs to be saved/restored */
|
||||
DState_save sv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue