diff --git a/src/checkbufferoverrun.cpp b/src/checkbufferoverrun.cpp index 2ebfec3bc..7b6e09309 100644 --- a/src/checkbufferoverrun.cpp +++ b/src/checkbufferoverrun.cpp @@ -38,39 +38,39 @@ // Register this check class (by creating a static instance of it) namespace { -CheckBufferOverrunClass instance; +CheckBufferOverrun instance; } //--------------------------------------------------------------------------- -void CheckBufferOverrunClass::arrayIndexOutOfBounds(const Token *tok) +void CheckBufferOverrun::arrayIndexOutOfBounds(const Token *tok) { _callStack.push_back(tok); arrayIndexOutOfBounds(); _callStack.pop_back(); } -void CheckBufferOverrunClass::arrayIndexOutOfBounds() +void CheckBufferOverrun::arrayIndexOutOfBounds() { reportError(_callStack, Severity::possibleError, "arrayIndexOutOfBounds", "Array index out of bounds"); } -void CheckBufferOverrunClass::bufferOverrun(const Token *tok) +void CheckBufferOverrun::bufferOverrun(const Token *tok) { reportError(tok, Severity::possibleError, "bufferOverrun", "Buffer overrun"); } -void CheckBufferOverrunClass::strncatUsage(const Token *tok) +void CheckBufferOverrun::strncatUsage(const Token *tok) { reportError(tok, Severity::possibleError, "strncatUsage", "Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append"); } -void CheckBufferOverrunClass::outOfBounds(const Token *tok, const std::string &what) +void CheckBufferOverrun::outOfBounds(const Token *tok, const std::string &what) { reportError(tok, Severity::error, "outOfBounds", what + " is out of bounds"); } -void CheckBufferOverrunClass::sizeArgumentAsChar(const Token *tok) +void CheckBufferOverrun::sizeArgumentAsChar(const Token *tok) { reportError(tok, Severity::possibleError, "sizeArgumentAsChar", "The size argument is given as a char constant"); } @@ -82,7 +82,7 @@ void CheckBufferOverrunClass::sizeArgumentAsChar(const Token *tok) // Check array usage.. //--------------------------------------------------------------------------- -void CheckBufferOverrunClass::checkScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid) +void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid) { unsigned int varc = 0; @@ -440,7 +440,7 @@ void CheckBufferOverrunClass::checkScope(const Token *tok, const char *varname[] // Checking local variables in a scope //--------------------------------------------------------------------------- -void CheckBufferOverrunClass::checkGlobalAndLocalVariable() +void CheckBufferOverrun::checkGlobalAndLocalVariable() { int indentlevel = 0; for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) @@ -509,7 +509,7 @@ void CheckBufferOverrunClass::checkGlobalAndLocalVariable() // Checking member variables of structs.. //--------------------------------------------------------------------------- -void CheckBufferOverrunClass::checkStructVariable() +void CheckBufferOverrun::checkStructVariable() { const char declstruct[] = "struct|class %var% {"; for (const Token *tok = Token::findmatch(_tokenizer->tokens(), declstruct); @@ -622,7 +622,7 @@ void CheckBufferOverrunClass::checkStructVariable() } //--------------------------------------------------------------------------- -void CheckBufferOverrunClass::bufferOverrun() +void CheckBufferOverrun::bufferOverrun() { checkGlobalAndLocalVariable(); checkStructVariable(); diff --git a/src/checkbufferoverrun.h b/src/checkbufferoverrun.h index 0a5f44b84..eec97430d 100644 --- a/src/checkbufferoverrun.h +++ b/src/checkbufferoverrun.h @@ -30,24 +30,24 @@ class ErrorLogger; class Token; class Tokenizer; -class CheckBufferOverrunClass : public Check +class CheckBufferOverrun : public Check { public: /** This constructor is used when registering the CheckClass */ - CheckBufferOverrunClass() : Check() + CheckBufferOverrun() : Check() { } /** This constructor is used when running checks.. */ - CheckBufferOverrunClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) : Check(tokenizer, settings, errorLogger) { } void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { - CheckBufferOverrunClass checkBufferOverrunClass(tokenizer, settings, errorLogger); + CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger); if (settings->_showAll) - checkBufferOverrunClass.bufferOverrun(); + checkBufferOverrun.bufferOverrun(); } /** Check for buffer overruns */ diff --git a/src/checkdangerousfunctions.cpp b/src/checkdangerousfunctions.cpp index 3c1539805..1fa6bcd43 100644 --- a/src/checkdangerousfunctions.cpp +++ b/src/checkdangerousfunctions.cpp @@ -28,10 +28,10 @@ // Register this check class (by creating a static instance of it) namespace { -CheckDangerousFunctionsClass instance; +CheckDangerousFunctions instance; } -void CheckDangerousFunctionsClass::dangerousFunctions() +void CheckDangerousFunctions::dangerousFunctions() { for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { @@ -52,17 +52,17 @@ void CheckDangerousFunctionsClass::dangerousFunctions() //--------------------------------------------------------------------------- -void CheckDangerousFunctionsClass::dangerousFunctionmktemp(const Token *tok) +void CheckDangerousFunctions::dangerousFunctionmktemp(const Token *tok) { reportError(tok, Severity::style, "dangerousFunctionmktemp", "Found 'mktemp'. You should use 'mkstemp' instead"); } -void CheckDangerousFunctionsClass::dangerousFunctiongets(const Token *tok) +void CheckDangerousFunctions::dangerousFunctiongets(const Token *tok) { reportError(tok, Severity::style, "dangerousFunctiongets", "Found 'gets'. You should use 'fgets' instead"); } -void CheckDangerousFunctionsClass::dangerousFunctionscanf(const Token *tok) +void CheckDangerousFunctions::dangerousFunctionscanf(const Token *tok) { reportError(tok, Severity::style, "dangerousFunctionscanf", "Found 'scanf'. You should use 'fgets' instead"); } diff --git a/src/checkdangerousfunctions.h b/src/checkdangerousfunctions.h index 9b71b64f9..1dbd820e8 100644 --- a/src/checkdangerousfunctions.h +++ b/src/checkdangerousfunctions.h @@ -24,24 +24,24 @@ #include "check.h" -class CheckDangerousFunctionsClass : public Check +class CheckDangerousFunctions : public Check { public: - /** This constructor is used when registering the CheckClass */ - CheckDangerousFunctionsClass() : Check() + /** This constructor is used when registering the CheckDangerousFunctions */ + CheckDangerousFunctions() : Check() { } /** This constructor is used when running checks.. */ - CheckDangerousFunctionsClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + CheckDangerousFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) : Check(tokenizer, settings, errorLogger) { } void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { - CheckDangerousFunctionsClass checkDangerousFunctionsClass(tokenizer, settings, errorLogger); + CheckDangerousFunctions checkDangerousFunctions(tokenizer, settings, errorLogger); if (settings->_checkCodingStyle) { - checkDangerousFunctionsClass.dangerousFunctions(); + checkDangerousFunctions.dangerousFunctions(); } } diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 854c7c5f2..77765a452 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -55,7 +55,7 @@ private: // Check for buffer overruns.. Settings settings; settings._showAll = true; - CheckBufferOverrunClass checkBufferOverrun(&tokenizer, &settings, this); + CheckBufferOverrun checkBufferOverrun(&tokenizer, &settings, this); checkBufferOverrun.bufferOverrun(); } diff --git a/test/testdangerousfunctions.cpp b/test/testdangerousfunctions.cpp index 979963111..549e755a5 100644 --- a/test/testdangerousfunctions.cpp +++ b/test/testdangerousfunctions.cpp @@ -55,7 +55,7 @@ private: // Check for dangerous functions.. Settings settings; settings._showAll = true; - CheckDangerousFunctionsClass checkDangerousFunctions(&tokenizer, &settings, this); + CheckDangerousFunctions checkDangerousFunctions(&tokenizer, &settings, this); checkDangerousFunctions.dangerousFunctions(); }