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:
parent
ee80817c94
commit
6fc93c1fac
6 changed files with 18 additions and 79 deletions
|
@ -1082,6 +1082,7 @@ int CEXEBuild::write_output(void)
|
||||||
|
|
||||||
// Added by Amir Szekely 3rd August 2002
|
// Added by Amir Szekely 3rd August 2002
|
||||||
if (WriteStringTables() == PS_ERROR) return PS_ERROR;
|
if (WriteStringTables() == PS_ERROR) return PS_ERROR;
|
||||||
|
build_header.common.num_string_bytes=build_strlist.getlen();
|
||||||
|
|
||||||
/*#ifdef NSIS_CONFIG_COMPONENTPAGE
|
/*#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
if (build_header.componenttext_ptr < 0 &&
|
if (build_header.componenttext_ptr < 0 &&
|
||||||
|
@ -1373,6 +1374,7 @@ int CEXEBuild::write_output(void)
|
||||||
hdrcomp.add(build_sections.get(),build_sections.getlen());
|
hdrcomp.add(build_sections.get(),build_sections.getlen());
|
||||||
hdrcomp.add(build_entries.get(),build_entries.getlen());
|
hdrcomp.add(build_entries.get(),build_entries.getlen());
|
||||||
hdrcomp.add(build_strlist.get(),build_strlist.getlen());
|
hdrcomp.add(build_strlist.get(),build_strlist.getlen());
|
||||||
|
hdrcomp.add(build_langtables.get(),build_langtables.getlen());
|
||||||
|
|
||||||
if (add_data((char*)hdrcomp.get(),hdrcomp.getlen(),&ihd) < 0) return PS_ERROR;
|
if (add_data((char*)hdrcomp.get(),hdrcomp.getlen(),&ihd) < 0) return PS_ERROR;
|
||||||
|
|
||||||
|
@ -1638,6 +1640,8 @@ int CEXEBuild::uninstall_generate()
|
||||||
{
|
{
|
||||||
firstheader fh={0,};
|
firstheader fh={0,};
|
||||||
|
|
||||||
|
build_uninst.common.num_string_bytes=ubuild_strlist.getlen();
|
||||||
|
|
||||||
GrowBuf uhd;
|
GrowBuf uhd;
|
||||||
// add one more bit (the code+strtabs) to the uninstall datablock
|
// add one more bit (the code+strtabs) to the uninstall datablock
|
||||||
{
|
{
|
||||||
|
@ -1646,6 +1650,7 @@ int CEXEBuild::uninstall_generate()
|
||||||
udata.add(&build_uninst,sizeof(build_uninst));
|
udata.add(&build_uninst,sizeof(build_uninst));
|
||||||
udata.add(ubuild_entries.get(),ubuild_entries.getlen());
|
udata.add(ubuild_entries.get(),ubuild_entries.getlen());
|
||||||
udata.add(ubuild_strlist.get(),ubuild_strlist.getlen());
|
udata.add(ubuild_strlist.get(),ubuild_strlist.getlen());
|
||||||
|
udata.add(ubuild_langtables.get(),ubuild_langtables.getlen());
|
||||||
|
|
||||||
set_uninstall_mode(1);
|
set_uninstall_mode(1);
|
||||||
fh.length_of_header=udata.getlen();
|
fh.length_of_header=udata.getlen();
|
||||||
|
|
|
@ -195,6 +195,7 @@ class CEXEBuild {
|
||||||
GrowBuf build_functions, ubuild_functions, *cur_functions;
|
GrowBuf build_functions, ubuild_functions, *cur_functions;
|
||||||
GrowBuf build_labels, ubuild_labels, *cur_labels;
|
GrowBuf build_labels, ubuild_labels, *cur_labels;
|
||||||
StringList build_strlist,ubuild_strlist;
|
StringList build_strlist,ubuild_strlist;
|
||||||
|
GrowBuf build_langtables, ubuild_langtables;
|
||||||
|
|
||||||
MMapBuf build_datablock, ubuild_datablock; // use GrowBuf here instead of MMapBuf if you want
|
MMapBuf build_datablock, ubuild_datablock; // use GrowBuf here instead of MMapBuf if you want
|
||||||
IGrowBuf *cur_datablock;
|
IGrowBuf *cur_datablock;
|
||||||
|
|
|
@ -366,19 +366,12 @@ int NSISCALL ui_doinstall(void)
|
||||||
// Added by Amir Szekely 3rd August 2002
|
// Added by Amir Szekely 3rd August 2002
|
||||||
// Multilingual support
|
// Multilingual support
|
||||||
{
|
{
|
||||||
int size;
|
extern char *g_db_strtab;
|
||||||
lang_num=g_inst_header->common.str_tables_num;
|
lang_num=g_inst_cmnheader->str_tables_num;
|
||||||
size=lang_num*sizeof(common_strings);
|
cur_common_strings_table=common_strings_tables=
|
||||||
cur_common_strings_table=common_strings_tables=(common_strings*)my_GlobalAlloc(size);
|
(common_strings*)(g_db_strtab+g_inst_cmnheader->num_string_bytes);
|
||||||
GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size);
|
cur_install_strings_table=install_strings_tables=
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
(char*)((unsigned long)common_strings_tables+lang_num*sizeof(common_strings));
|
||||||
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);
|
|
||||||
|
|
||||||
myitoa(state_language, GetUserDefaultLangID());
|
myitoa(state_language, GetUserDefaultLangID());
|
||||||
set_language();
|
set_language();
|
||||||
|
|
|
@ -24,7 +24,7 @@ static int bz2_needreinit;
|
||||||
|
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
static char *g_db_strtab;
|
char *g_db_strtab;
|
||||||
|
|
||||||
static int g_db_offset;
|
static int g_db_offset;
|
||||||
HANDLE g_db_hFile;
|
HANDLE g_db_hFile;
|
||||||
|
@ -223,8 +223,6 @@ static int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int out
|
||||||
}
|
}
|
||||||
#else//NSIS_COMPRESS_WHOLE
|
#else//NSIS_COMPRESS_WHOLE
|
||||||
|
|
||||||
|
|
||||||
#if 0 // SHOUDLNT NEED THIS IF EVEYRTHING IS IN PROPER ORDER
|
|
||||||
static char _inbuffer[IBUFSIZE];
|
static char _inbuffer[IBUFSIZE];
|
||||||
static char _outbuffer[OBUFSIZE];
|
static char _outbuffer[OBUFSIZE];
|
||||||
extern int m_length;
|
extern int m_length;
|
||||||
|
@ -301,55 +299,6 @@ static int NSISCALL __ensuredata(int amount)
|
||||||
return 0;
|
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)
|
static int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -283,10 +283,9 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int str_tables_num; // number of strings tables in array
|
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_entries; // total number of entries
|
||||||
|
int num_string_bytes; // total number of bytes taken by strings
|
||||||
|
|
||||||
#ifdef NSIS_SUPPORT_BGBG
|
#ifdef NSIS_SUPPORT_BGBG
|
||||||
int bg_color1, bg_color2, bg_textcolor;
|
int bg_color1, bg_color2, bg_textcolor;
|
||||||
|
|
|
@ -214,27 +214,19 @@ int CEXEBuild::WriteStringTables() {
|
||||||
FillDefaultsIfNeeded(string_tables[i]);
|
FillDefaultsIfNeeded(string_tables[i]);
|
||||||
|
|
||||||
// Add string tables into datablock
|
// Add string tables into datablock
|
||||||
GrowBuf cst;
|
|
||||||
for (i = 0; i < st_num; i++)
|
for (i = 0; i < st_num; i++)
|
||||||
cst.add(&string_tables[i]->common, sizeof(common_strings));
|
build_langtables.add(&string_tables[i]->common, sizeof(common_strings));
|
||||||
build_header.common.str_tables_num = st_num;
|
build_header.common.str_tables_num = st_num;
|
||||||
build_header.common.str_tables = add_data((char*)cst.get(), st_num*sizeof(common_strings), &build_datablock);
|
|
||||||
|
|
||||||
GrowBuf ist;
|
|
||||||
for (i = 0; i < st_num; i++)
|
for (i = 0; i < st_num; i++)
|
||||||
ist.add(&string_tables[i]->installer, sizeof(installer_strings));
|
build_langtables.add(&string_tables[i]->installer, sizeof(installer_strings));
|
||||||
build_header.common.inst_str_tables = add_data((char*)ist.get(), st_num*sizeof(installer_strings), &build_datablock);
|
|
||||||
|
|
||||||
GrowBuf ucst;
|
|
||||||
for (i = 0; i < st_num; i++)
|
for (i = 0; i < st_num; i++)
|
||||||
ucst.add(&string_tables[i]->ucommon, sizeof(common_strings));
|
ubuild_langtables.add(&string_tables[i]->ucommon, sizeof(common_strings));
|
||||||
build_uninst.common.str_tables_num = st_num;
|
build_uninst.common.str_tables_num = st_num;
|
||||||
build_uninst.common.str_tables = add_data((char*)ucst.get(), st_num*sizeof(common_strings), &ubuild_datablock);
|
|
||||||
|
|
||||||
GrowBuf ust;
|
|
||||||
for (i = 0; i < st_num; i++)
|
for (i = 0; i < st_num; i++)
|
||||||
ust.add(&string_tables[i]->uninstall, sizeof(uninstall_strings));
|
ubuild_langtables.add(&string_tables[i]->uninstall, sizeof(uninstall_strings));
|
||||||
build_uninst.common.inst_str_tables = add_data((char*)ust.get(), st_num*sizeof(uninstall_strings), &ubuild_datablock);
|
|
||||||
|
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue