Reduced !include/!insertmacro recursion stack usage (Bug #3067954)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6306 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
6ef6d6dfb0
commit
0e851e4b79
3 changed files with 14 additions and 9 deletions
|
@ -12,6 +12,8 @@ Released on ?, 2013
|
||||||
|
|
||||||
\b MakeNSIS /NOTIFYHWND uses a (optional) new event name to abort compilation, see build.cpp/h for details.
|
\b MakeNSIS /NOTIFYHWND uses a (optional) new event name to abort compilation, see build.cpp/h for details.
|
||||||
|
|
||||||
|
\b Reduced !include/!insertmacro recursion stack usage (\W{http://sourceforge.net/support/tracker.php?aid=3067954}{bug #3067954})
|
||||||
|
|
||||||
\S2{} Translations
|
\S2{} Translations
|
||||||
|
|
||||||
\b Changed LANGFILE macro in LangFile.nsh
|
\b Changed LANGFILE macro in LangFile.nsh
|
||||||
|
|
|
@ -98,6 +98,10 @@ class CEXEBuild {
|
||||||
void initialize(const TCHAR *makensis_path);
|
void initialize(const TCHAR *makensis_path);
|
||||||
~CEXEBuild();
|
~CEXEBuild();
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MAX_LINELENGTH = 16384 // NSI/NSH line limit, in TCHARs (including \0)
|
||||||
|
};
|
||||||
|
|
||||||
void warning(const TCHAR *s, ...); // to add a warning to the compiler's warning list.
|
void warning(const TCHAR *s, ...); // to add a warning to the compiler's warning list.
|
||||||
void warning_fl(const TCHAR *s, ...); // warning with file name and line count
|
void warning_fl(const TCHAR *s, ...); // warning with file name and line count
|
||||||
void ERROR_MSG(const TCHAR *s, ...) const;
|
void ERROR_MSG(const TCHAR *s, ...) const;
|
||||||
|
@ -192,6 +196,7 @@ class CEXEBuild {
|
||||||
#endif
|
#endif
|
||||||
int doParse(const TCHAR *str);
|
int doParse(const TCHAR *str);
|
||||||
int doCommand(int which_token, LineParser &line);
|
int doCommand(int which_token, LineParser &line);
|
||||||
|
TCHAR m_templinebuf[MAX_LINELENGTH]; // Buffer used by parseScript() & doCommand(), not recursion safe!
|
||||||
|
|
||||||
int do_add_file(const TCHAR *lgss, int attrib, int recurse, int *total_files, const TCHAR
|
int do_add_file(const TCHAR *lgss, int attrib, int recurse, int *total_files, const TCHAR
|
||||||
*name_override=0, int generatecode=1, int *data_handle=0,
|
*name_override=0, int generatecode=1, int *data_handle=0,
|
||||||
|
|
|
@ -51,7 +51,6 @@ using namespace std;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_INCLUDEDEPTH 10
|
#define MAX_INCLUDEDEPTH 10
|
||||||
#define MAX_LINELENGTH 16384
|
|
||||||
|
|
||||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||||
// Added by Sunil Kamath 11 June 2003
|
// Added by Sunil Kamath 11 June 2003
|
||||||
|
@ -770,7 +769,7 @@ void CEXEBuild::ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hi
|
||||||
int CEXEBuild::parseScript()
|
int CEXEBuild::parseScript()
|
||||||
{
|
{
|
||||||
assert(curlinereader);
|
assert(curlinereader);
|
||||||
TCHAR str[MAX_LINELENGTH];
|
TCHAR *str = m_templinebuf;
|
||||||
NStreamLineReader &linereader = *curlinereader;
|
NStreamLineReader &linereader = *curlinereader;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -1115,8 +1114,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
TCHAR str[MAX_LINELENGTH];
|
TCHAR *str = m_templinebuf, *p = str;
|
||||||
TCHAR *p=str;
|
|
||||||
UINT lrres = curlinereader->ReadLine(str,MAX_LINELENGTH);
|
UINT lrres = curlinereader->ReadLine(str,MAX_LINELENGTH);
|
||||||
if (NStream::OK != lrres)
|
if (NStream::OK != lrres)
|
||||||
{
|
{
|
||||||
|
@ -1139,7 +1137,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
while (*p) p++;
|
while (*p) p++;
|
||||||
if (p > str) p--;
|
if (p > str) p--;
|
||||||
while (p >= str && (*p == _T('\r') || *p == _T('\n') || *p == _T(' ') || *p == _T('\t'))) p--;
|
while (p >= str && (*p == _T('\r') || *p == _T('\n') || *p == _T(' ') || *p == _T('\t'))) p--;
|
||||||
*++p=0;
|
*++p = 0;
|
||||||
LineParser l2(false);
|
LineParser l2(false);
|
||||||
if (!l2.parse(str))
|
if (!l2.parse(str))
|
||||||
{
|
{
|
||||||
|
@ -1411,7 +1409,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
ERROR_MSG(_T("%s: error reading version info from \"%s\"\n"), cmdname, line.gettoken_str(1));
|
ERROR_MSG(_T("%s: error reading version info from \"%s\"\n"), cmdname, line.gettoken_str(1));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
TCHAR symbuf[MAX_LINELENGTH], numbuf[30], *basesymname = line.gettoken_str(2);
|
TCHAR *symbuf = m_templinebuf, numbuf[30], *basesymname = line.gettoken_str(2);
|
||||||
DWORD vals[] = { high>>16, high&0xffff, low>>16, low&0xffff };
|
DWORD vals[] = { high>>16, high&0xffff, low>>16, low&0xffff };
|
||||||
SCRIPT_MSG(_T("%s: %s (%u.%u.%u.%u)->(%s<1..4>)\n"),
|
SCRIPT_MSG(_T("%s: %s (%u.%u.%u.%u)->(%s<1..4>)\n"),
|
||||||
cmdname, line.gettoken_str(1), vals[0], vals[1], vals[2], vals[3], basesymname);
|
cmdname, line.gettoken_str(1), vals[0], vals[1], vals[2], vals[3], basesymname);
|
||||||
|
@ -3043,7 +3041,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
TCHAR str[MAX_LINELENGTH];
|
TCHAR *str=m_templinebuf;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TCHAR *p=str;
|
TCHAR *p=str;
|
||||||
*p=0;
|
*p=0;
|
||||||
|
@ -3359,14 +3357,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
int req_parm = (line.getnumtokens() - parmOffs)/2;
|
int req_parm = (line.getnumtokens() - parmOffs)/2;
|
||||||
|
|
||||||
GrowBuf tmpstr;
|
GrowBuf tmpstr;
|
||||||
TCHAR str[MAX_LINELENGTH];
|
TCHAR *str=m_templinebuf;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
tmpstr.resize(0);
|
tmpstr.resize(0);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
str[0]=0;
|
str[0]=0;
|
||||||
_fgetts(str,COUNTOF(str),fp);
|
_fgetts(str,MAX_LINELENGTH,fp);
|
||||||
if (!str[0]) break; // eof
|
if (!str[0]) break; // eof
|
||||||
|
|
||||||
TCHAR *p=str;
|
TCHAR *p=str;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue