Fixed some complaints of PVS Studio

This commit is contained in:
PKEuS 2014-05-19 14:37:54 +02:00
parent ed7d0b321b
commit 09e03fa6ef
4 changed files with 11 additions and 11 deletions

View File

@ -149,7 +149,7 @@ bool FileLister::isDirectory(const std::string &path)
bool FileLister::fileExists(const std::string &path)
{
return (MyFileExists(path) == TRUE);
return (MyFileExists(path) != FALSE);
}

View File

@ -307,7 +307,7 @@ void CheckSizeof::sizeofVoid()
}
if (isMember) {
// Get 'struct.member' complete name (without spaces)
varname = tok2->stringifyList(tok->tokAt(index+1));
varname = tok2->stringifyList(tok->next());
varname.erase(remove_if(varname.begin(), varname.end(),
static_cast<int (*)(int)>(std::isspace)), varname.end());
}

View File

@ -879,7 +879,7 @@ static bool valueFlowForLoop1(const Token *tok, unsigned int * const varid, Math
*num1 = *num2;
while (tok && tok->str() != ";")
tok = tok->next();
if (!num2tok || !Token::Match(tok, "; %varid% ++ ) {", vartok->varId()))
if (!Token::Match(tok, "; %varid% ++ ) {", vartok->varId()))
return false;
return true;
}

View File

@ -29,21 +29,21 @@ class Settings;
namespace ValueFlow {
class Value {
public:
Value(long long val = 0) : condition(0), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {}
Value(const Token *c, long long val) : condition(c), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {}
/** Condition that this value depends on (TODO: replace with a 'callstack') */
const Token *condition;
Value(long long val = 0) : intvalue(val), varvalue(val), condition(0), varId(0U), conditional(false), inconclusive(false) {}
Value(const Token *c, long long val) : intvalue(val), varvalue(val), condition(c), varId(0U), conditional(false), inconclusive(false) {}
/** int value */
long long intvalue;
/** For calculated values - varId that calculated value depends on */
unsigned int varId;
/** For calculated values - variable value that calculated value depends on */
long long varvalue;
/** Condition that this value depends on (TODO: replace with a 'callstack') */
const Token *condition;
/** For calculated values - varId that calculated value depends on */
unsigned int varId;
/** Conditional value */
bool conditional;