size optimizations

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3731 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-10-14 21:33:33 +00:00
parent 3a7bfe74e6
commit 0677224b1f

View file

@ -789,14 +789,16 @@ static char * NSISCALL inttosizestr(int kb, char *str)
static int NSISCALL _sumsecsfield(int idx) static int NSISCALL _sumsecsfield(int idx)
{ {
int x,total; int total = 0;
section *sections = g_sections; int x = num_sections;
for (total = x = 0; x < num_sections; x++) section *s = g_sections;
while (x--)
{ {
#ifdef NSIS_CONFIG_COMPONENTPAGE #ifdef NSIS_CONFIG_COMPONENTPAGE
if (sections[x].flags & SF_SELECTED) if (s->flags & SF_SELECTED)
#endif #endif
total += ((int *)&sections[x])[idx]; total += ((int *)s)[idx];
s++;
} }
return total; return total;
} }
@ -1156,8 +1158,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{ {
int j; int j;
if (i != NSIS_MAX_INST_TYPES) noCombo = 0; if (i != NSIS_MAX_INST_TYPES) noCombo = 0;
GetNSISString(g_tmp,install_types[i]); j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)GetNSISStringTT(install_types[i]));
j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)g_tmp);
SendMessage(hwndCombo1,CB_SETITEMDATA,j,i); SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
if (i == g_exec_flags.cur_insttype) if (i == g_exec_flags.cur_insttype)
SendMessage(hwndCombo1, CB_SETCURSEL, j, 0); SendMessage(hwndCombo1, CB_SETCURSEL, j, 0);
@ -1501,8 +1502,9 @@ void NSISCALL update_status_text(int strtab, const char *text) {
static DWORD WINAPI install_thread(LPVOID p) static DWORD WINAPI install_thread(LPVOID p)
{ {
int m_inst_sec=0; int m_inst_sec=num_sections;
HWND progresswnd = (HWND)p; HWND progresswnd = (HWND)p;
section *s = g_sections;
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
{ {
@ -1511,14 +1513,14 @@ static DWORD WINAPI install_thread(LPVOID p)
} }
#endif #endif
while (m_inst_sec<num_sections) while (m_inst_sec--)
{ {
#ifdef NSIS_CONFIG_COMPONENTPAGE #ifdef NSIS_CONFIG_COMPONENTPAGE
if (g_sections[m_inst_sec].flags&SF_SELECTED) if (s->flags&SF_SELECTED)
#endif #endif
{ {
log_printf2("Section: \"%s\"",GetNSISStringTT(g_sections[m_inst_sec].name_ptr)); log_printf2("Section: \"%s\"",GetNSISStringTT(s->name_ptr));
if (ExecuteCodeSegment(g_sections[m_inst_sec].code,progresswnd)) if (ExecuteCodeSegment(s->code,progresswnd))
{ {
g_exec_flags.abort++; g_exec_flags.abort++;
break; break;
@ -1527,10 +1529,10 @@ static DWORD WINAPI install_thread(LPVOID p)
#ifdef NSIS_CONFIG_COMPONENTPAGE #ifdef NSIS_CONFIG_COMPONENTPAGE
else else
{ {
log_printf2("Skipping section: \"%s\"",GetNSISStringTT(g_sections[m_inst_sec].name_ptr)); log_printf2("Skipping section: \"%s\"",GetNSISStringTT(s->name_ptr));
} }
#endif #endif
m_inst_sec++; s++;
} }
NotifyCurWnd(WM_NOTIFY_INSTPROC_DONE); NotifyCurWnd(WM_NOTIFY_INSTPROC_DONE);