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 {
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 &&
_tok->str() == func.token->str();
// 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))
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);
}
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")))
return;
@ -160,7 +160,7 @@ void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2,
}
// 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
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")))
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
// definition will hide the enumerator within it's scope so just
// 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
const Token * tok = *tokPtr;

View File

@ -642,7 +642,7 @@ public:
/**
* check for duplicate enum definition
*/
bool duplicateDefinition(Token **tokPtr, const Token *name);
bool duplicateDefinition(Token **tokPtr, const Token *name) const;
/**
* report error message
@ -653,15 +653,15 @@ public:
/**
* 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);
void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type);
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) const;
/**
* 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;