diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 415903966..97c253729 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -861,7 +861,7 @@ void CheckClass::operatorEq() const Token *tok2 = _tokenizer->tokens(); const Token *tok; - while ((tok = Token::findmatch(tok2, "void operator = ("))) + while ((tok = Token::findmatch(tok2, "void operator = (")) != NULL) { const Token *tok1 = tok; while (tok1 && !Token::Match(tok1, "class|struct %var%")) @@ -955,7 +955,7 @@ void CheckClass::operatorEqRetRefThis() const Token *tok2 = _tokenizer->tokens(); const Token *tok; - while ((tok = Token::findmatch(tok2, "operator = ("))) + while ((tok = Token::findmatch(tok2, "operator = (")) != NULL) { const Token *tok1 = tok; @@ -1199,7 +1199,7 @@ void CheckClass::operatorEqToSelf() const Token *tok2 = _tokenizer->tokens(); const Token *tok; - while ((tok = Token::findmatch(tok2, "operator = ("))) + while ((tok = Token::findmatch(tok2, "operator = (")) != NULL) { const Token *tok1 = tok; @@ -1600,7 +1600,7 @@ void CheckClass::checkConst() int level = 0; for (int j = nestInfo.size() - 1; j >= i; j--, level++) 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(); if (!paramEnd) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index cd63589e6..f8e42a510 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -529,9 +529,9 @@ static int countParameters(const Token *tok) bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname) { - 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[0]), call_func_white_list_compare); + 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[0]), call_func_white_list_compare) != NULL); } const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index f4a3a5e70..59e394d40 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -378,7 +378,7 @@ void CheckOther::checkUnsignedDivision() void CheckOther::unreachableCode() { const Token *tok = _tokenizer->tokens(); - while ((tok = Token::findmatch(tok, "[;{}] return"))) + while ((tok = Token::findmatch(tok, "[;{}] return")) != NULL) { // Goto the 'return' token tok = tok->next();