bzip2 installers should now start a lot faster

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1096 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-09-20 23:22:11 +00:00
parent ee80817c94
commit 6fc93c1fac
6 changed files with 18 additions and 79 deletions

View file

@ -24,7 +24,7 @@ static int bz2_needreinit;
#include "ui.h"
static char *g_db_strtab;
char *g_db_strtab;
static int g_db_offset;
HANDLE g_db_hFile;
@ -223,8 +223,6 @@ static int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int out
}
#else//NSIS_COMPRESS_WHOLE
#if 0 // SHOUDLNT NEED THIS IF EVEYRTHING IS IN PROPER ORDER
static char _inbuffer[IBUFSIZE];
static char _outbuffer[OBUFSIZE];
extern int m_length;
@ -301,55 +299,6 @@ static int NSISCALL __ensuredata(int amount)
return 0;
}
#else // JUSTINS CLASSIC VERSION
static char _inbuffer[IBUFSIZE];
static char _outbuffer[OBUFSIZE];
static int __ensuredata(int amount)
{
int needed=amount-(dbd_size-dbd_pos);
if (needed>0)
{
SetFilePointer(g_db_hFile,dbd_srcpos,NULL,FILE_BEGIN);
SetFilePointer(dbd_hFile,dbd_size,NULL,FILE_BEGIN);
for (;;)
{
int err;
DWORD or;
if (!ReadFile(g_db_hFile,(LPVOID)_inbuffer,min(IBUFSIZE,dbd_fulllen-dbd_srcpos),&or,NULL)) return -1;
dbd_srcpos+=or;
g_inflate_stream.next_in=_inbuffer;
g_inflate_stream.avail_in=or;
do
{
DWORD r,t;
g_inflate_stream.next_out=_outbuffer;
g_inflate_stream.avail_out=OBUFSIZE;
err=inflate(&g_inflate_stream);
if (err<0)
{
return -3;
}
r=g_inflate_stream.next_out-_outbuffer;
if (r)
{
if (!WriteFile(dbd_hFile,_outbuffer,r,&t,NULL) || r != t)
{
return -2;
}
dbd_size+=r;
}
else if (g_inflate_stream.avail_in || !or) return -3;
else break;
}
while (g_inflate_stream.avail_in);
if (amount-(dbd_size-dbd_pos) <= 0) break;
}
SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN);
}
return 0;
}
#endif
static int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
{