Fixed some gcc and cppcheck messages

This commit is contained in:
PKEuS 2013-03-05 07:07:59 -08:00
parent ca96aaa53b
commit a94598e447
3 changed files with 10 additions and 10 deletions

View File

@ -58,7 +58,7 @@ void ThreadHandler::Check(const Settings &settings, bool recheck)
mResults.SetFiles(GetReCheckFiles()); mResults.SetFiles(GetReCheckFiles());
} }
if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs <= 0) { if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs == 0) {
qDebug() << "Can't start checking if there's no files to check or if check is in progress."; qDebug() << "Can't start checking if there's no files to check or if check is in progress.";
emit Done(); emit Done();
return; return;

View File

@ -1253,8 +1253,8 @@ void CheckClass::virtualDestructor()
// pointer variables of type 'Base *' // pointer variables of type 'Base *'
std::set<unsigned int> basepointer; std::set<unsigned int> basepointer;
for (std::size_t i = 0; i < symbolDatabase->getVariableListSize(); i++) { for (std::size_t k = 0; k < symbolDatabase->getVariableListSize(); k++) {
const Variable* var = symbolDatabase->getVariableFromVarId(i); const Variable* var = symbolDatabase->getVariableFromVarId(k);
if (var && var->isPointer() && var->type() == derivedFrom) if (var && var->isPointer() && var->type() == derivedFrom)
basepointer.insert(var->varId()); basepointer.insert(var->varId());
} }

View File

@ -1907,13 +1907,13 @@ bool Function::isImplicitlyVirtual(bool defaultVal) const
return false; return false;
} }
bool Function::isImplicitlyVirtual_rec(const ::Type* type, bool& safe) const bool Function::isImplicitlyVirtual_rec(const ::Type* baseType, bool& safe) const
{ {
// check each base class // check each base class
for (unsigned int i = 0; i < type->derivedFrom.size(); ++i) { for (unsigned int i = 0; i < baseType->derivedFrom.size(); ++i) {
// check if base class exists in database // check if base class exists in database
if (type->derivedFrom[i].type && type->derivedFrom[i].type->classScope) { if (baseType->derivedFrom[i].type && baseType->derivedFrom[i].type->classScope) {
const Scope *parent = type->derivedFrom[i].type->classScope; const Scope *parent = baseType->derivedFrom[i].type->classScope;
std::list<Function>::const_iterator func; std::list<Function>::const_iterator func;
@ -1936,14 +1936,14 @@ bool Function::isImplicitlyVirtual_rec(const ::Type* type, bool& safe) const
} }
// check for matching function parameters // check for matching function parameters
if (returnMatch && argsMatch(type->classScope, func->argDef, argDef, "", 0)) { if (returnMatch && argsMatch(baseType->classScope, func->argDef, argDef, "", 0)) {
return true; return true;
} }
} }
} }
if (!type->derivedFrom[i].type->derivedFrom.empty()) if (!baseType->derivedFrom[i].type->derivedFrom.empty())
if (isImplicitlyVirtual_rec(type->derivedFrom[i].type, safe)) if (isImplicitlyVirtual_rec(baseType->derivedFrom[i].type, safe))
return true; return true;
} else { } else {
// unable to find base class so assume it has no virtual function // unable to find base class so assume it has no virtual function