Made some functions const according to cppcheck results

This commit is contained in:
PKEuS 2012-05-17 02:54:17 -07:00
parent 4825f78663
commit a9cfe2814a
3 changed files with 11 additions and 11 deletions

View File

@ -2752,7 +2752,7 @@ namespace {
struct FuncFilter { struct FuncFilter {
FuncFilter(const Scope *scope, const Token *tok): _scope(scope), _tok(tok) {} FuncFilter(const Scope *scope, const Token *tok): _scope(scope), _tok(tok) {}
bool operator()(const Function &func) { bool operator()(const Function &func) const {
bool matchingFunc = func.type == Function::eFunction && bool matchingFunc = func.type == Function::eFunction &&
_tok->str() == func.token->str(); _tok->str() == func.token->str();
// either a class function, or a global function with the same name // either a class function, or a global function with the same name

View File

@ -131,7 +131,7 @@ Token *Tokenizer::copyTokens(Token *dest, const Token *first, const Token *last,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Tokenizer::duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string &type) void Tokenizer::duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string &type) const
{ {
if (tok1 && !(_settings->isEnabled("style") && _settings->inconclusive)) if (tok1 && !(_settings->isEnabled("style") && _settings->inconclusive))
return; return;
@ -145,7 +145,7 @@ void Tokenizer::duplicateTypedefError(const Token *tok1, const Token *tok2, cons
std::string("The " + type + " '" + tok2_str + "' hides a typedef with the same name."), true); std::string("The " + type + " '" + tok2_str + "' hides a typedef with the same name."), true);
} }
void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2, const std::string &type) void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2, const std::string &type) const
{ {
if (tok1 && !(_settings->isEnabled("style"))) if (tok1 && !(_settings->isEnabled("style")))
return; return;
@ -160,7 +160,7 @@ void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2,
} }
// check if this statement is a duplicate definition // check if this statement is a duplicate definition
bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token *typeDef, bool undefinedStruct) bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token *typeDef, bool undefinedStruct) const
{ {
// check for an end of definition // check for an end of definition
const Token * tok = *tokPtr; const Token * tok = *tokPtr;
@ -6675,7 +6675,7 @@ void Tokenizer::simplifyNestedStrcat()
} }
void Tokenizer::duplicateEnumError(const Token * tok1, const Token * tok2, const std::string & type) void Tokenizer::duplicateEnumError(const Token * tok1, const Token * tok2, const std::string & type) const
{ {
if (tok1 && !(_settings->isEnabled("style"))) if (tok1 && !(_settings->isEnabled("style")))
return; return;
@ -6692,7 +6692,7 @@ void Tokenizer::duplicateEnumError(const Token * tok1, const Token * tok2, const
// Check if this statement is a duplicate definition. A duplicate // Check if this statement is a duplicate definition. A duplicate
// definition will hide the enumerator within it's scope so just // definition will hide the enumerator within it's scope so just
// skip the entire scope of the duplicate. // skip the entire scope of the duplicate.
bool Tokenizer::duplicateDefinition(Token ** tokPtr, const Token * name) bool Tokenizer::duplicateDefinition(Token ** tokPtr, const Token * name) const
{ {
// check for an end of definition // check for an end of definition
const Token * tok = *tokPtr; const Token * tok = *tokPtr;

View File

@ -642,7 +642,7 @@ public:
/** /**
* check for duplicate enum definition * check for duplicate enum definition
*/ */
bool duplicateDefinition(Token **tokPtr, const Token *name); bool duplicateDefinition(Token **tokPtr, const Token *name) const;
/** /**
* report error message * report error message
@ -653,15 +653,15 @@ public:
/** /**
* duplicate enum definition error * duplicate enum definition error
*/ */
void duplicateEnumError(const Token *tok1, const Token *tok2, const std::string & type); void duplicateEnumError(const Token *tok1, const Token *tok2, const std::string & type) const;
bool duplicateTypedef(Token **tokPtr, const Token *name, const Token *typeDef, bool undefinedStruct); bool duplicateTypedef(Token **tokPtr, const Token *name, const Token *typeDef, bool undefinedStruct) const;
void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type); void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type) const;
/** /**
* Report error - duplicate declarations * Report error - duplicate declarations
*/ */
void duplicateDeclarationError(const Token *tok1, const Token *tok2, const std::string &type); void duplicateDeclarationError(const Token *tok1, const Token *tok2, const std::string &type) const;
void unsupportedTypedef(const Token *tok) const; void unsupportedTypedef(const Token *tok) const;