Fix bug#1086, don't parse non-branch instructions inside a !if 0 block
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6418 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
c16bc083b5
commit
527cf2d7a4
4 changed files with 15 additions and 9 deletions
|
@ -10,6 +10,8 @@ Released on ?
|
|||
|
||||
\b !include defaults to UTF-8 after \cw{Unicode True}
|
||||
|
||||
\b Preprocessor does not parse all branches and will not validate code that is never executed (\W{http://sf.net/p/nsis/bugs/1086/}{bug #1086})
|
||||
|
||||
\S2{} Minor Changes
|
||||
|
||||
\b FileRead in Unicode installers can handle DBCS, conversion output is limited to UCS-2.
|
||||
|
|
|
@ -169,7 +169,7 @@ class CEXEBuild {
|
|||
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
||||
|
||||
// tokens.cpp
|
||||
bool is_valid_token(TCHAR *s);
|
||||
bool is_ppbranch_token(TCHAR *s);
|
||||
int get_commandtoken(TCHAR *s, int *np, int *op, int *pos);
|
||||
const TCHAR* get_commandtoken_name(int tok);
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ int CEXEBuild::doParse(const TCHAR *str)
|
|||
{
|
||||
bool ignore_line = cur_ifblock && (cur_ifblock->ignore || cur_ifblock->inherited_ignore);
|
||||
TCHAR first_char = *(TCHAR *) m_linebuild.get();
|
||||
if (ignore_line && (first_char!=_T('!') || !is_valid_token(line.gettoken_str(0))))
|
||||
if (ignore_line && (first_char!=_T('!') || !is_ppbranch_token(line.gettoken_str(0))))
|
||||
{
|
||||
m_linebuild.resize(0);
|
||||
return PS_OK;
|
||||
|
|
|
@ -326,18 +326,22 @@ void CEXEBuild::print_help(const TCHAR *commandname)
|
|||
|
||||
}
|
||||
|
||||
bool CEXEBuild::is_valid_token(TCHAR *s)
|
||||
bool CEXEBuild::is_ppbranch_token(TCHAR *s)
|
||||
{
|
||||
for (int x = 0; x < TOK__LAST; x ++)
|
||||
if (!_tcsicmp(tokenlist[x].name,s))
|
||||
return true;
|
||||
return false;
|
||||
int np, op, pos, tkid = get_commandtoken(s, &np, &op, &pos);
|
||||
switch(tkid)
|
||||
{
|
||||
case TOK_P_IF: case TOK_P_ELSE: case TOK_P_ENDIF:
|
||||
case TOK_P_IFDEF: case TOK_P_IFNDEF:
|
||||
case TOK_P_IFMACRODEF: case TOK_P_IFMACRONDEF:
|
||||
return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
int CEXEBuild::get_commandtoken(TCHAR *s, int *np, int *op, int *pos)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < TOK__LAST; x ++)
|
||||
for (int x = 0; x < TOK__LAST; x ++)
|
||||
if (!_tcsicmp(tokenlist[x].name,s))
|
||||
{
|
||||
*np=tokenlist[x].num_parms;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue