From a94598e4473176f427dad9ce9de56d97ad035730 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 5 Mar 2013 07:07:59 -0800 Subject: [PATCH] Fixed some gcc and cppcheck messages --- gui/threadhandler.cpp | 2 +- lib/checkclass.cpp | 4 ++-- lib/symboldatabase.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index e4a0bce88..89d17225c 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -58,7 +58,7 @@ void ThreadHandler::Check(const Settings &settings, bool recheck) 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."; emit Done(); return; diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 618f7edd7..50e89078c 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1253,8 +1253,8 @@ void CheckClass::virtualDestructor() // pointer variables of type 'Base *' std::set basepointer; - for (std::size_t i = 0; i < symbolDatabase->getVariableListSize(); i++) { - const Variable* var = symbolDatabase->getVariableFromVarId(i); + for (std::size_t k = 0; k < symbolDatabase->getVariableListSize(); k++) { + const Variable* var = symbolDatabase->getVariableFromVarId(k); if (var && var->isPointer() && var->type() == derivedFrom) basepointer.insert(var->varId()); } diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 94761d9c8..9d53cc382 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1907,13 +1907,13 @@ bool Function::isImplicitlyVirtual(bool defaultVal) const 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 - 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 - if (type->derivedFrom[i].type && type->derivedFrom[i].type->classScope) { - const Scope *parent = type->derivedFrom[i].type->classScope; + if (baseType->derivedFrom[i].type && baseType->derivedFrom[i].type->classScope) { + const Scope *parent = baseType->derivedFrom[i].type->classScope; std::list::const_iterator func; @@ -1936,14 +1936,14 @@ bool Function::isImplicitlyVirtual_rec(const ::Type* type, bool& safe) const } // 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; } } } - if (!type->derivedFrom[i].type->derivedFrom.empty()) - if (isImplicitlyVirtual_rec(type->derivedFrom[i].type, safe)) + if (!baseType->derivedFrom[i].type->derivedFrom.empty()) + if (isImplicitlyVirtual_rec(baseType->derivedFrom[i].type, safe)) return true; } else { // unable to find base class so assume it has no virtual function