Removed bogus comment about possible string prefix bug

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6491 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2014-06-15 13:58:04 +00:00
parent 8ed10146ef
commit 5574a0e7a2

View file

@ -603,7 +603,6 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
else
{
// starts with a $ but not $$.
{ // block - why do we need this extra {?
bool bProceced=false;
if ( *p )
{
@ -616,19 +615,11 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
if (m_ShellConstants.get(p, BUGBUG64TRUNCATE(int, pUserVarName-p)) >= 0)
break; // Woops it's a shell constant
// Jim Park: The following line could be a source of bugs for
// variables where one variable name is a prefix of another
// variable name. For example, if you are searching for
// variable 'UserVar', you can get 'UserVariable' instead.
// Suggest that we do:
// TCHAR varname[NSIS_MAX_STRLEN];
// _tcsncpy(varname, p, pUserVarName-p);
// int idxUserVar = m_UserVarNames.get(varname);
int idxUserVar = m_UserVarNames.get(p, BUGBUG64TRUNCATE(int, pUserVarName-p));
if (idxUserVar >= 0)
{
// Well, using variables inside string formating doens't mean
// using the variable, beacuse it will be always an empty string
// using the variable, because it will be always an empty string
// which is also memory wasting
// So the line below must be commented !??
//m_UserVarNames.inc_reference(idxUserVar);
@ -702,16 +693,12 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
continue; // outermost while
else
{
TCHAR tbuf[64];
TCHAR cBracket = _T('\0');
TCHAR tbuf[64], cBracket = _T('\0');
bool bDoWarning = true;
if ( *p == _T('[') )
cBracket = _T(']');
else if ( *p == _T('(') )
cBracket = _T(')');
else if ( *p == _T('{') )
cBracket = _T('}');
if ( *p == _T('[') ) cBracket = _T(']');
else if ( *p == _T('(') ) cBracket = _T(')');
else if ( *p == _T('{') ) cBracket = _T('}');
my_strncpy(tbuf,p,COUNTOF(tbuf));
@ -732,13 +719,10 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
}
if ( bDoWarning )
warning_fl(_T("unknown variable/constant \"%") NPRIs _T("\" detected, ignoring"),tbuf);
i = _T('$'); // redundant since i is already '$' and has
// not changed.
i = _T('$'); // redundant since i is already '$' and has not changed.
}
} // block
} // else
} // else if (i == _T('$'))
*out++=(TCHAR)i;
} // outside while
*out=0;