more size savings, and fixed bzip2 small mode

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1292 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
justin1014 2002-10-03 06:22:06 +00:00
parent df46b6aefc
commit ce90415670
2 changed files with 19 additions and 28 deletions

View file

@ -436,23 +436,23 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
} }
#else // EXEHEAD #else // EXEHEAD
/*---------------------------------------------------*/ #ifdef NSIS_COMPRESS_BZIP2_SMALLMODE
/*--- Decompression stuff ---*/
/*---------------------------------------------------*/ /*---------------------------------------------------*/
int BZ_API(BZ2_bzDecompressInit) Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
( DState * s) {
{ Int32 nb, na, mid;
s->state = BZ_X_BLKHDR_1; nb = 0;
na = 256;
return BZ_OK; do {
mid = (nb + na) >> 1;
if (indx >= cftab[mid]) nb = mid;
else na = mid;
} while (na - nb != 1);
return nb;
} }
#ifdef NSIS_COMPRESS_BZIP2_SMALLMODE
/*---------------------------------------------------*/
static static
void unRLE_obuf_to_output_SMALL ( DState* s ) void unRLE_obuf_to_output_SMALL ( DState* s )
{ {
@ -460,14 +460,12 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
while (True) { while (True) {
/* try to finish existing run */ /* try to finish existing run */
while (True) { while (True) {
if (s->strm->avail_out == 0) return; if (s->avail_out == 0) return;
if (s->state_out_len == 0) break; if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch; *( (UChar*)(s->next_out) ) = s->state_out_ch;
s->state_out_len--; s->state_out_len--;
s->strm->next_out++; s->next_out++;
s->strm->avail_out--; s->avail_out--;
// s->strm->total_out_lo32++;
// if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
} }
/* can a new run be started? */ /* can a new run be started? */
@ -495,8 +493,7 @@ void unRLE_obuf_to_output_SMALL ( DState* s )
} }
} }
#else//!small, fast #else//!small, fast
static static void unRLE_obuf_to_output_FAST ( DState* s )
void unRLE_obuf_to_output_FAST ( DState* s )
{ {
UChar k1; UChar k1;

View file

@ -480,19 +480,13 @@ BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
Int32, Int32, Int32 ); Int32, Int32, Int32 );
#define BZ2_bzDecompressInit(s) { (s)->state = BZ_X_BLKHDR_1; }
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( DState * s );
DState *s
);
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
DState * s
);
#endif #endif
/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ /*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
#ifdef BZ_NO_STDIO #ifdef BZ_NO_STDIO