Avoid deep copying std::string
This commit is contained in:
parent
4c843eb171
commit
d81776b8c8
|
@ -526,7 +526,6 @@ void CheckIO::checkWrongPrintfScanfArguments()
|
||||||
|
|
||||||
const Token* argListTok = 0; // Points to first va_list argument
|
const Token* argListTok = 0; // Points to first va_list argument
|
||||||
const Token* formatStringTok = 0; // Points to format string token
|
const Token* formatStringTok = 0; // Points to format string token
|
||||||
std::string formatString;
|
|
||||||
|
|
||||||
bool scan = false;
|
bool scan = false;
|
||||||
bool scanf_s = false;
|
bool scanf_s = false;
|
||||||
|
@ -589,18 +588,18 @@ void CheckIO::checkWrongPrintfScanfArguments()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatStringTok)
|
if (!formatStringTok)
|
||||||
formatString = formatStringTok->str();
|
|
||||||
else
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
const std::string& formatString = formatStringTok->str();
|
||||||
|
|
||||||
// Count format string parameters..
|
// Count format string parameters..
|
||||||
unsigned int numFormat = 0;
|
unsigned int numFormat = 0;
|
||||||
unsigned int numSecure = 0;
|
unsigned int numSecure = 0;
|
||||||
bool percent = false;
|
bool percent = false;
|
||||||
const Token* argListTok2 = argListTok;
|
const Token* argListTok2 = argListTok;
|
||||||
std::set<unsigned int> parameterPositionsUsed;
|
std::set<unsigned int> parameterPositionsUsed;
|
||||||
for (std::string::iterator i = formatString.begin(); i != formatString.end(); ++i) {
|
for (std::string::const_iterator i = formatString.begin(); i != formatString.end(); ++i) {
|
||||||
if (*i == '%') {
|
if (*i == '%') {
|
||||||
percent = !percent;
|
percent = !percent;
|
||||||
} else if (percent && *i == '[') {
|
} else if (percent && *i == '[') {
|
||||||
|
|
Loading…
Reference in New Issue