diff options
author | marha <marha@users.sourceforge.net> | 2009-08-04 13:58:23 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-08-04 13:58:23 +0000 |
commit | 392f542ca74be7b3721e7a4af75544a39e0eceae (patch) | |
tree | 39e7d8d5625c8563de18bfd882543910ca69af84 /tools/mhmake/src/mhmakefileparser.cpp | |
parent | a1c52b0d76b73151014d62f920a73df8097563e9 (diff) | |
download | vcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.tar.gz vcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.tar.bz2 vcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.zip |
Escaping of the $ sign by doubling it was not always done correctly.
Diffstat (limited to 'tools/mhmake/src/mhmakefileparser.cpp')
-rw-r--r-- | tools/mhmake/src/mhmakefileparser.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp index 28ad0a682..cbcb33648 100644 --- a/tools/mhmake/src/mhmakefileparser.cpp +++ b/tools/mhmake/src/mhmakefileparser.cpp @@ -167,7 +167,7 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const int i=0;
int Length=Expr.size();
string Ret;
- bool DollarEscaped=false;
+ string ToAdd;
while (i<Length)
{
char Char=Expr[i++];
@@ -176,9 +176,8 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const char CharNext=Expr[i];
if (CharNext=='$')
{
- Ret+="$$";
+ ToAdd="$$";
i++;
- DollarEscaped=true;
}
else
{
@@ -186,34 +185,31 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const i++;
if (inew>i)
{
- Ret+=ExpandMacro(Expr.substr(i,inew-i-1));
+ ToAdd=ExpandMacro(Expr.substr(i,inew-i-1));
i=inew;
}
else
{
// This is a single character expression
- Ret+=ExpandMacro(string(1,Expr[i-1]));
+ ToAdd=ExpandMacro(string(1,Expr[i-1]));
}
}
+ Ret+=ToAdd;
}
else
{
Ret+=Char;
}
-
}
- // Here we do a special case in case we still have a $ without a %
if (m_InExpandExpression==1)
{
+ // Here we do a special case in case we still have a $ within a %
if (Ret.find('$')!=string::npos)
Ret=ExpandExpression(Ret);
- if (DollarEscaped)
+ int Pos;
+ while ((Pos=Ret.find("$$"))!=string::npos)
{
- int Pos;
- while ((Pos=Ret.find("$$"))!=string::npos)
- {
- Ret=Ret.replace(Pos,2,"$");
- }
+ Ret=Ret.replace(Pos,2,"$");
}
}
((mhmakefileparser*)this)->m_InExpandExpression--;
|