Merge pull request #677 from Dmitry-Me/simplifySearchReplace
Simplify overengineered search-replace code
This commit is contained in:
commit
7dadd9f3ca
|
@ -6245,9 +6245,11 @@ bool Tokenizer::simplifyKnownVariables()
|
||||||
const Token * const valueToken = tok2->tokAt(4);
|
const Token * const valueToken = tok2->tokAt(4);
|
||||||
std::string value(valueToken->str());
|
std::string value(valueToken->str());
|
||||||
if (tok2->str() == "sprintf") {
|
if (tok2->str() == "sprintf") {
|
||||||
std::string::difference_type n = -1;
|
std::string::size_type n = 0;
|
||||||
while (static_cast<std::string::size_type>(n = value.find("%%",n+1)) != std::string::npos) {
|
while ((n = value.find("%%", n)) != std::string::npos) {
|
||||||
value.replace(n,2,"%");
|
// Replace "%%" with "%" - erase the first '%' and continue past the second '%'
|
||||||
|
value.erase(n, 1);
|
||||||
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const unsigned int valueVarId(0);
|
const unsigned int valueVarId(0);
|
||||||
|
|
Loading…
Reference in New Issue