From f44be03eeb3fcd606e1e39cb4bb5867ef2931fe2 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 20 Apr 2007 23:40:05 +0000 Subject: [PATCH] size optimization git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5111 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/exec.c | 34 ++++++++++++++++++++++------------ Source/script.cpp | 9 +++++---- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index bf48f92a..86968374 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -59,7 +59,14 @@ HRESULT g_hres; static int NSISCALL ExecuteEntry(entry *entry_); -#define resolveaddr(v) ((v<0) ? myatoi(g_usrvars[-(v+1)]) : v) +int NSISCALL resolveaddr(int v) +{ + if (v < 0) + { + return myatoi(g_usrvars[-(v+1)]); + } + return v; +} int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress) { @@ -257,19 +264,23 @@ static int NSISCALL ExecuteEntry(entry *entry_) return ExecuteCodeSegment(v,NULL); } case EW_UPDATETEXT: - if (parm1) { - static int old_st_updateflag=6; - if (parm1&8) ui_st_updateflag=old_st_updateflag; - else { - old_st_updateflag=ui_st_updateflag; - ui_st_updateflag=parm1; - } + { + static int old_st_updateflag=6; + if (parm2) + { + ui_st_updateflag=old_st_updateflag; + } + else if (parm1) + { + old_st_updateflag=ui_st_updateflag; + ui_st_updateflag=parm1; } else { log_printf2("detailprint: %s",GetStringFromParm(0x00)); update_status_text(parm0,0); } + } break; case EW_SLEEP: { @@ -923,8 +934,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) char *highout=var0; char *lowout=var1; DWORD s1; - DWORD t[4]; // our two members are the 3rd and 4th.. - VS_FIXEDFILEINFO *pvsf1=(VS_FIXEDFILEINFO*)t; + VS_FIXEDFILEINFO *pvsf1; DWORD d; char *buf1=GetStringFromParm(-0x12); s1=GetFileVersionInfoSize(buf1,&d); @@ -1277,12 +1287,12 @@ static int NSISCALL ExecuteEntry(entry *entry_) { if (t==REG_DWORD) { - if (!parm4) exec_error++; + exec_error += !parm4; myitoa(p,*((DWORD*)p)); } else { - if (parm4) exec_error++; + exec_error += parm4; p[l]=0; } } diff --git a/Source/script.cpp b/Source/script.cpp index d19af77a..db94ae0f 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -4540,7 +4540,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) if (ent.offsets[1] < 0) PRINTHELP(); switch (ent.offsets[1]) { case 0: - ent.offsets[1]=8; + ent.offsets[2]=1; break; case 1: case 2: @@ -5794,8 +5794,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) // SetDetailsPrint lastused ent.which=EW_UPDATETEXT; ent.offsets[0]=0; - ent.offsets[1]=8; // lastused - ent.offsets[2]=0; + ent.offsets[1]=0; + ent.offsets[2]=1; // lastused ret=add_entry(&ent); if (ret != PS_OK) { return ret; @@ -5866,7 +5866,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) // SetDetailsPrint lastused ent.which=EW_UPDATETEXT; ent.offsets[0]=0; - ent.offsets[1]=8; // lastused + ent.offsets[1]=0; + ent.offsets[2]=1; // lastused ret=add_entry(&ent); if (ret != PS_OK) return ret; }