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

@ -366,19 +366,12 @@ int NSISCALL ui_doinstall(void)
// Added by Amir Szekely 3rd August 2002
// Multilingual support
{
int size;
lang_num=g_inst_header->common.str_tables_num;
size=lang_num*sizeof(common_strings);
cur_common_strings_table=common_strings_tables=(common_strings*)my_GlobalAlloc(size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
if (g_is_uninstaller)
size=lang_num*sizeof(uninstall_strings);
else
#endif
size=lang_num*sizeof(installer_strings);
cur_install_strings_table=install_strings_tables=(char *)my_GlobalAlloc(size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->common.inst_str_tables,install_strings_tables,size);
extern char *g_db_strtab;
lang_num=g_inst_cmnheader->str_tables_num;
cur_common_strings_table=common_strings_tables=
(common_strings*)(g_db_strtab+g_inst_cmnheader->num_string_bytes);
cur_install_strings_table=install_strings_tables=
(char*)((unsigned long)common_strings_tables+lang_num*sizeof(common_strings));
myitoa(state_language, GetUserDefaultLangID());
set_language();

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)
{

View file

@ -283,10 +283,9 @@ typedef struct
typedef struct
{
int str_tables_num; // number of strings tables in array
int str_tables; // offset to common string tables array
int inst_str_tables; // offset to install/uninstall string tables array
int num_entries; // total number of entries
int num_string_bytes; // total number of bytes taken by strings
#ifdef NSIS_SUPPORT_BGBG
int bg_color1, bg_color2, bg_textcolor;