Added ${__COUNTER__} predefine
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6325 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9fa3398dd9
commit
fe8e4a36bf
3 changed files with 31 additions and 13 deletions
|
@ -684,21 +684,33 @@ void CEXEBuild::ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hi
|
|||
ps_addtoline(s,defname,hist);
|
||||
defname.add(_T(""),sizeof(_T("")));
|
||||
t=definedlist.find((TCHAR*)defname.get());
|
||||
TCHAR unichar[4+1];
|
||||
if (!t && _T('U')==s[0] && _T('+')==s[1])
|
||||
TCHAR dyndefbuf[10+1];
|
||||
if (!t)
|
||||
{
|
||||
TCHAR *n=s+2;
|
||||
unsigned long utf32=_tcstoul(n,&t,16);
|
||||
// We only want to accept "${U+HEXDIGITS}" and not "${U+ -HEXDIGITS }"
|
||||
if (*t || _T('-')==*n || _T('+')==*n) t=0;
|
||||
if (_T(' ')==*n || _T('\t')==*n) t=0; // TODO: _istspace()?
|
||||
if (!utf32) t=0; // Don't allow "${U+0}"
|
||||
if (t)
|
||||
if (_T('_')==s[0] && _T('_')==s[1])
|
||||
{
|
||||
UINT32 codpts[]={utf32,UNICODE_REPLACEMENT_CHARACTER,'?'};
|
||||
for(UINT i=0; i < COUNTOF(codpts); ++i)
|
||||
if (WCFromCodePoint(unichar,COUNTOF(unichar),codpts[i])) break;
|
||||
t=unichar;
|
||||
if (!_tcscmp(s,_T("__COUNTER__")))
|
||||
{
|
||||
static unsigned long cntr=0;
|
||||
_stprintf(dyndefbuf,_T("%lu"),cntr++);
|
||||
t=dyndefbuf;
|
||||
}
|
||||
}
|
||||
if (_T('U')==s[0] && _T('+')==s[1])
|
||||
{
|
||||
TCHAR *n=s+2;
|
||||
unsigned long utf32=_tcstoul(n,&t,16);
|
||||
// We only want to accept "${U+HEXDIGITS}" and not "${U+ -HEXDIGITS }"
|
||||
if (*t || _T('-')==*n || _T('+')==*n) t=0;
|
||||
if (_T(' ')==*n || _T('\t')==*n) t=0; // TODO: _istspace()?
|
||||
if (!utf32) t=0; // Don't allow "${U+0}"
|
||||
if (t)
|
||||
{
|
||||
UINT32 codpts[]={utf32,UNICODE_REPLACEMENT_CHARACTER,'?'};
|
||||
for(UINT i=0; i < COUNTOF(codpts); ++i)
|
||||
if (WCFromCodePoint(dyndefbuf,COUNTOF(dyndefbuf),codpts[i])) break;
|
||||
t=dyndefbuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t && hist.find((TCHAR*)defname.get(),0)<0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue