size optimization - use GetNSISString and GetStringFromParm instead of mystrcat
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5188 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
338bf03bff
commit
035579824d
2 changed files with 15 additions and 18 deletions
|
@ -371,12 +371,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
char *buf3=GetStringFromParm(-0x30);
|
||||
char *buf2=GetStringFromParm(-0x21);
|
||||
mystrcpy(buf1,buf3);
|
||||
if (mystrlen(buf3)+mystrlen(buf2) < NSIS_MAX_STRLEN-3)
|
||||
{
|
||||
mystrcat(buf1,"->");
|
||||
mystrcat(buf1,buf2);
|
||||
}
|
||||
char *buf1=GetStringFromParm(0x13);
|
||||
log_printf2("Rename: %s",buf1);
|
||||
if (MoveFile(buf3,buf2))
|
||||
{
|
||||
|
@ -1083,6 +1078,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
SHFILEOPSTRUCT op;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
char *buf1=GetStringFromParm(0x11);
|
||||
char *buf2=GetStringFromParm(0x23); // LANG_COPYTO + buf1
|
||||
log_printf3("CopyFiles \"%s\"->\"%s\"",buf0,buf1);
|
||||
|
||||
if (!file_exists(buf0))
|
||||
|
@ -1102,9 +1098,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
buf0[mystrlen(buf0)+1]=0;
|
||||
buf1[mystrlen(buf1)+1]=0;
|
||||
|
||||
GetNSISString(buf2,LANG_COPYTO);
|
||||
mystrcat(buf2,buf1);
|
||||
|
||||
op.pFrom=buf0;
|
||||
op.pTo=buf1;
|
||||
op.lpszProgressTitle=buf2;
|
||||
|
@ -1463,16 +1456,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
int ret=-666;
|
||||
HANDLE hFile;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
char *buf1=GetStringFromParm(0x10);
|
||||
|
||||
if (!validpathspec(buf1))
|
||||
GetStringFromParm(0x13);
|
||||
|
||||
if (validpathspec(buf0))
|
||||
{
|
||||
mystrcpy(buf1,buf0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mystrcat(addtrailingslash(mystrcpy(buf1,state_install_directory)),buf0);
|
||||
}
|
||||
validate_filename(buf1);
|
||||
|
||||
remove_ro_attr(buf1);
|
||||
|
|
|
@ -3132,6 +3132,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
return PS_OK;
|
||||
case TOK_WRITEUNINSTALLER:
|
||||
{
|
||||
if (uninstall_mode)
|
||||
{
|
||||
ERROR_MSG("WriteUninstaller only valid from install, not from uninstall.\n");
|
||||
|
@ -3140,11 +3141,15 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
uninstaller_writes_used++;
|
||||
ent.which=EW_WRITEUNINSTALLER;
|
||||
ent.offsets[0]=add_string(line.gettoken_str(1));
|
||||
string full = string("$INSTDIR\\") + string(line.gettoken_str(1));
|
||||
ent.offsets[3]=add_string(full.c_str());
|
||||
// ent.offsets[1] and ent.offsets[2] are set in CEXEBuild::uninstall_generate()
|
||||
if (!ent.offsets[0]) PRINTHELP()
|
||||
SCRIPT_MSG("WriteUninstaller: \"%s\"\n",line.gettoken_str(1));
|
||||
|
||||
DefineInnerLangString(NLF_ERR_CREATING);
|
||||
DefineInnerLangString(NLF_CREATED_UNINST);
|
||||
}
|
||||
return add_entry(&ent);
|
||||
#else//!NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
case TOK_WRITEUNINSTALLER:
|
||||
|
@ -3762,6 +3767,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (line.getnumtokens()!=a+2) PRINTHELP()
|
||||
ent.offsets[0]=add_string(line.gettoken_str(a));
|
||||
ent.offsets[1]=add_string(line.gettoken_str(a+1));
|
||||
string print = string(line.gettoken_str(a)) + "->" + string(line.gettoken_str(a+1));
|
||||
ent.offsets[3]=add_string(print.c_str());
|
||||
SCRIPT_MSG("Rename: %s%s->%s\n",ent.offsets[2]?"/REBOOTOK ":"",line.gettoken_str(a),line.gettoken_str(a+1));
|
||||
|
||||
DefineInnerLangString(NLF_RENAME);
|
||||
|
@ -4438,6 +4445,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (line.getnumtokens() < a+2) PRINTHELP()
|
||||
ent.offsets[0]=add_string(line.gettoken_str(a));
|
||||
ent.offsets[1]=add_string(line.gettoken_str(a+1));
|
||||
string copy_to = string("$(^CopyTo)") + line.gettoken_str(a+1);
|
||||
ent.offsets[3]=add_string(copy_to.c_str());
|
||||
int s;
|
||||
int size_kb=line.gettoken_int(a+2,&s);
|
||||
if (!s && line.gettoken_str(a+2)[0]) PRINTHELP()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue