Fixed Visual Studio compiler warnings

This commit is contained in:
Daniel Marjamäki 2011-12-01 18:27:25 +01:00
parent 98480bf504
commit 93b21c6cc5
1 changed files with 2 additions and 2 deletions

View File

@ -2163,14 +2163,14 @@ void CheckOther::checkIncorrectStringCompare()
{ {
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, ". substr ( %any% , %num% ) ==|!= %str%")) { if (Token::Match(tok, ". substr ( %any% , %num% ) ==|!= %str%")) {
std::size_t clen = MathLib::toLongNumber(tok->strAt(5)); MathLib::bigint clen = MathLib::toLongNumber(tok->strAt(5));
std::size_t slen = Token::getStrLength(tok->tokAt(8)); std::size_t slen = Token::getStrLength(tok->tokAt(8));
if (clen != slen) { if (clen != slen) {
incorrectStringCompareError(tok->next(), "substr", tok->strAt(8), tok->strAt(5)); incorrectStringCompareError(tok->next(), "substr", tok->strAt(8), tok->strAt(5));
} }
} }
if (Token::Match(tok, "%str% ==|!= %var% . substr ( %any% , %num% )")) { if (Token::Match(tok, "%str% ==|!= %var% . substr ( %any% , %num% )")) {
std::size_t clen = MathLib::toLongNumber(tok->strAt(8)); MathLib::bigint clen = MathLib::toLongNumber(tok->strAt(8));
std::size_t slen = Token::getStrLength(tok); std::size_t slen = Token::getStrLength(tok);
if (clen != slen) { if (clen != slen) {
incorrectStringCompareError(tok->next(), "substr", tok->str(), tok->strAt(8)); incorrectStringCompareError(tok->next(), "substr", tok->str(), tok->strAt(8));