Merge pull request #677 from Dmitry-Me/simplifySearchReplace

Simplify overengineered search-replace code
This commit is contained in:
amai2012 2015-09-11 16:02:39 +07:00
commit 7dadd9f3ca
1 changed files with 5 additions and 3 deletions

View File

@ -6245,9 +6245,11 @@ bool Tokenizer::simplifyKnownVariables()
const Token * const valueToken = tok2->tokAt(4);
std::string value(valueToken->str());
if (tok2->str() == "sprintf") {
std::string::difference_type n = -1;
while (static_cast<std::string::size_type>(n = value.find("%%",n+1)) != std::string::npos) {
value.replace(n,2,"%");
std::string::size_type n = 0;
while ((n = value.find("%%", n)) != std::string::npos) {
// Replace "%%" with "%" - erase the first '%' and continue past the second '%'
value.erase(n, 1);
++n;
}
}
const unsigned int valueVarId(0);