Fix vs warnings. Apply patch from kidkat.

This commit is contained in:
Reijo Tomperi 2010-04-06 21:35:21 +03:00
parent 8ce5379299
commit 5aa88ee5a2
3 changed files with 8 additions and 8 deletions

View File

@ -861,7 +861,7 @@ void CheckClass::operatorEq()
const Token *tok2 = _tokenizer->tokens(); const Token *tok2 = _tokenizer->tokens();
const Token *tok; const Token *tok;
while ((tok = Token::findmatch(tok2, "void operator = ("))) while ((tok = Token::findmatch(tok2, "void operator = (")) != NULL)
{ {
const Token *tok1 = tok; const Token *tok1 = tok;
while (tok1 && !Token::Match(tok1, "class|struct %var%")) while (tok1 && !Token::Match(tok1, "class|struct %var%"))
@ -955,7 +955,7 @@ void CheckClass::operatorEqRetRefThis()
const Token *tok2 = _tokenizer->tokens(); const Token *tok2 = _tokenizer->tokens();
const Token *tok; const Token *tok;
while ((tok = Token::findmatch(tok2, "operator = ("))) while ((tok = Token::findmatch(tok2, "operator = (")) != NULL)
{ {
const Token *tok1 = tok; const Token *tok1 = tok;
@ -1199,7 +1199,7 @@ void CheckClass::operatorEqToSelf()
const Token *tok2 = _tokenizer->tokens(); const Token *tok2 = _tokenizer->tokens();
const Token *tok; const Token *tok;
while ((tok = Token::findmatch(tok2, "operator = ("))) while ((tok = Token::findmatch(tok2, "operator = (")) != NULL)
{ {
const Token *tok1 = tok; const Token *tok1 = tok;
@ -1600,7 +1600,7 @@ void CheckClass::checkConst()
int level = 0; int level = 0;
for (int j = nestInfo.size() - 1; j >= i; j--, level++) for (int j = nestInfo.size() - 1; j >= i; j--, level++)
pattern = std::string(nestInfo[j].className + " :: " + pattern); pattern = std::string(nestInfo[j].className + " :: " + pattern);
while ((found = Token::findmatch(found->next(), pattern.c_str()))) while ((found = Token::findmatch(found->next(), pattern.c_str())) != NULL)
{ {
const Token *paramEnd = found->tokAt(1 + (2 * level))->link(); const Token *paramEnd = found->tokAt(1 + (2 * level))->link();
if (!paramEnd) if (!paramEnd)

View File

@ -529,9 +529,9 @@ static int countParameters(const Token *tok)
bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname) bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname)
{ {
return std::bsearch(funcname.c_str(), call_func_white_list, return (std::bsearch(funcname.c_str(), call_func_white_list,
sizeof(call_func_white_list) / sizeof(call_func_white_list[0]), sizeof(call_func_white_list) / sizeof(call_func_white_list[0]),
sizeof(call_func_white_list[0]), call_func_white_list_compare); sizeof(call_func_white_list[0]), call_func_white_list_compare) != NULL);
} }
const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<const Token *> callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<const Token *> callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz)

View File

@ -378,7 +378,7 @@ void CheckOther::checkUnsignedDivision()
void CheckOther::unreachableCode() void CheckOther::unreachableCode()
{ {
const Token *tok = _tokenizer->tokens(); const Token *tok = _tokenizer->tokens();
while ((tok = Token::findmatch(tok, "[;{}] return"))) while ((tok = Token::findmatch(tok, "[;{}] return")) != NULL)
{ {
// Goto the 'return' token // Goto the 'return' token
tok = tok->next(); tok = tok->next();