Support special ${U+1}...${U+FFFFFFFF} Unicode character defines
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6324 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
12cb8bf7e3
commit
9fa3398dd9
5 changed files with 56 additions and 0 deletions
|
@ -684,6 +684,23 @@ 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 *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(unichar,COUNTOF(unichar),codpts[i])) break;
|
||||
t=unichar;
|
||||
}
|
||||
}
|
||||
if (t && hist.find((TCHAR*)defname.get(),0)<0)
|
||||
{
|
||||
in+=_tcslen(s)+2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue