Skip to content

Commit 8b0e481

Browse files
committed
Refactoring: Rename member functions to follow naming guidelines.
1 parent f676deb commit 8b0e481

26 files changed

Lines changed: 163 additions & 162 deletions

cppcheck.cbp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
<Unit filename="gui/threadhandler.h" />
6161
<Unit filename="gui/threadresult.cpp" />
6262
<Unit filename="gui/threadresult.h" />
63+
<Unit filename="gui/translationhandler.cpp" />
64+
<Unit filename="gui/translationhandler.h" />
6365
<Unit filename="gui/txtreport.cpp" />
6466
<Unit filename="gui/txtreport.h" />
6567
<Unit filename="gui/xmlreport.cpp" />

gui/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ QStringList MainWindow::RemoveUnacceptedFiles(const QStringList &list)
349349
QString str;
350350
foreach(str, list)
351351
{
352-
if (FileLister::AcceptFile(str.toStdString()))
352+
if (FileLister::acceptFile(str.toStdString()))
353353
{
354354
result << str;
355355
}

src/checkbufferoverrun.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void CheckBufferOverrunClass::sizeArgumentAsChar(const Token *tok)
8282
// Check array usage..
8383
//---------------------------------------------------------------------------
8484

85-
void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid)
85+
void CheckBufferOverrunClass::checkScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid)
8686
{
8787
unsigned int varc = 0;
8888

@@ -390,7 +390,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope(const Token *tok, co
390390
continue;
391391

392392
// Find function..
393-
const Token *ftok = _tokenizer->GetFunctionTokenByName(tok->str().c_str());
393+
const Token *ftok = _tokenizer->getFunctionTokenByName(tok->str().c_str());
394394
if (!ftok)
395395
continue;
396396

@@ -422,7 +422,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope(const Token *tok, co
422422

423423
// Check variable usage in the function..
424424
_callStack.push_back(tok);
425-
CheckBufferOverrun_CheckScope(ftok, parname, size, total_size, 0);
425+
checkScope(ftok, parname, size, total_size, 0);
426426
_callStack.pop_back();
427427

428428
// break out..
@@ -440,7 +440,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_CheckScope(const Token *tok, co
440440
// Checking local variables in a scope
441441
//---------------------------------------------------------------------------
442442

443-
void CheckBufferOverrunClass::CheckBufferOverrun_GlobalAndLocalVariable()
443+
void CheckBufferOverrunClass::checkGlobalAndLocalVariable()
444444
{
445445
int indentlevel = 0;
446446
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
@@ -493,13 +493,13 @@ void CheckBufferOverrunClass::CheckBufferOverrun_GlobalAndLocalVariable()
493493
continue;
494494
}
495495

496-
int total_size = size * ((*type == '*') ? 4 : _tokenizer->SizeOfType(type));
496+
int total_size = size * ((*type == '*') ? 4 : _tokenizer->sizeOfType(type));
497497
if (total_size == 0)
498498
continue;
499499

500500
// The callstack is empty
501501
_callStack.clear();
502-
CheckBufferOverrun_CheckScope(tok->tokAt(nextTok), varname, size, total_size, varid);
502+
checkScope(tok->tokAt(nextTok), varname, size, total_size, varid);
503503
}
504504
}
505505
//---------------------------------------------------------------------------
@@ -509,7 +509,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_GlobalAndLocalVariable()
509509
// Checking member variables of structs..
510510
//---------------------------------------------------------------------------
511511

512-
void CheckBufferOverrunClass::CheckBufferOverrun_StructVariable()
512+
void CheckBufferOverrunClass::checkStructVariable()
513513
{
514514
const char declstruct[] = "struct|class %var% {";
515515
for (const Token *tok = Token::findmatch(_tokenizer->tokens(), declstruct);
@@ -538,7 +538,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_StructVariable()
538538
const char *varname[3] = {0, 0, 0};
539539
varname[1] = tok2->strAt(ivar);
540540
int arrsize = std::atoi(tok2->strAt(ivar + 2));
541-
int total_size = arrsize * _tokenizer->SizeOfType(tok2->strAt(1));
541+
int total_size = arrsize * _tokenizer->sizeOfType(tok2->strAt(1));
542542
if (total_size == 0)
543543
continue;
544544

@@ -558,7 +558,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_StructVariable()
558558
if (Token::simpleMatch(tok4, ") {"))
559559
{
560560
const char *names[2] = {varname[1], 0};
561-
CheckBufferOverrun_CheckScope(tok4->tokAt(2), names, arrsize, total_size, 0);
561+
checkScope(tok4->tokAt(2), names, arrsize, total_size, 0);
562562
break;
563563
}
564564
}
@@ -615,7 +615,7 @@ void CheckBufferOverrunClass::CheckBufferOverrun_StructVariable()
615615
continue;
616616

617617
// Check variable usage..
618-
CheckBufferOverrun_CheckScope(CheckTok, varname, arrsize, total_size, 0);
618+
checkScope(CheckTok, varname, arrsize, total_size, 0);
619619
}
620620
}
621621
}
@@ -624,8 +624,8 @@ void CheckBufferOverrunClass::CheckBufferOverrun_StructVariable()
624624

625625
void CheckBufferOverrunClass::bufferOverrun()
626626
{
627-
CheckBufferOverrun_GlobalAndLocalVariable();
628-
CheckBufferOverrun_StructVariable();
627+
checkGlobalAndLocalVariable();
628+
checkStructVariable();
629629
}
630630
//---------------------------------------------------------------------------
631631

src/checkbufferoverrun.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ class CheckBufferOverrunClass : public Check
5555
private:
5656

5757
/** Check for buffer overruns - locate struct variables and check them with the .._CheckScope function */
58-
void CheckBufferOverrun_StructVariable();
58+
void checkStructVariable();
5959

60-
/** Check for buffer overruns - locate global variables and local function variables and check them with the .._CheckScope function */
61-
void CheckBufferOverrun_GlobalAndLocalVariable();
60+
/** Check for buffer overruns - locate global variables and local function variables and check them with the checkScope function */
61+
void checkGlobalAndLocalVariable();
6262

6363
/** Check for buffer overruns - this is the function that performs the actual checking */
64-
void CheckBufferOverrun_CheckScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid);
64+
void checkScope(const Token *tok, const char *varname[], const int size, const int total_size, unsigned int varid);
6565

6666
/** callstack - used during intra-function checking */
6767
std::list<const Token *> _callStack;

src/checkclass.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ CheckClass instance;
4141

4242
//---------------------------------------------------------------------------
4343

44-
struct CheckClass::VAR *CheckClass::ClassChecking_GetVarList(const Token *tok1, bool withClasses)
44+
struct CheckClass::VAR *CheckClass::getVarList(const Token *tok1, bool withClasses)
4545
{
4646
// Get variable list..
4747
struct VAR *varlist = NULL;
@@ -136,7 +136,7 @@ struct CheckClass::VAR *CheckClass::ClassChecking_GetVarList(const Token *tok1,
136136
}
137137
//---------------------------------------------------------------------------
138138

139-
void CheckClass::InitVar(struct VAR *varlist, const char varname[])
139+
void CheckClass::initVar(struct VAR *varlist, const char varname[])
140140
{
141141
for (struct VAR *var = varlist; var; var = var->next)
142142
{
@@ -149,7 +149,7 @@ void CheckClass::InitVar(struct VAR *varlist, const char varname[])
149149
}
150150
//---------------------------------------------------------------------------
151151

152-
void CheckClass::ClassChecking_VarList_Initialize(const Token *tok1, const Token *ftok, struct VAR *varlist, const char classname[], std::list<std::string> &callstack)
152+
void CheckClass::initializeVarList(const Token *tok1, const Token *ftok, struct VAR *varlist, const char classname[], std::list<std::string> &callstack)
153153
{
154154
bool Assign = false;
155155
unsigned int indentlevel = 0;
@@ -165,7 +165,7 @@ void CheckClass::ClassChecking_VarList_Initialize(const Token *tok1, const Token
165165
{
166166
if (Assign && Token::Match(ftok, "%var% ("))
167167
{
168-
InitVar(varlist, ftok->str().c_str());
168+
initVar(varlist, ftok->str().c_str());
169169
}
170170

171171
Assign |= (ftok->str() == ":");
@@ -191,7 +191,7 @@ void CheckClass::ClassChecking_VarList_Initialize(const Token *tok1, const Token
191191
// Variable getting value from stream?
192192
if (Token::Match(ftok, ">> %var%"))
193193
{
194-
InitVar(varlist, ftok->next()->str().c_str());
194+
initVar(varlist, ftok->next()->str().c_str());
195195
}
196196

197197
// Before a new statement there is "[{};)=]" or "else"
@@ -232,21 +232,21 @@ void CheckClass::ClassChecking_VarList_Initialize(const Token *tok1, const Token
232232
{
233233
callstack.push_back(ftok->str());
234234
int i = 0;
235-
const Token *ftok2 = Tokenizer::FindClassFunction(tok1, classname, ftok->str().c_str(), i);
236-
ClassChecking_VarList_Initialize(tok1, ftok2, varlist, classname, callstack);
235+
const Token *ftok2 = Tokenizer::findClassFunction(tok1, classname, ftok->str().c_str(), i);
236+
initializeVarList(tok1, ftok2, varlist, classname, callstack);
237237
}
238238
}
239239

240240
// Assignment of member variable?
241241
else if (Token::Match(ftok, "%var% ="))
242242
{
243-
InitVar(varlist, ftok->str().c_str());
243+
initVar(varlist, ftok->str().c_str());
244244
}
245245

246246
// The functions 'clear' and 'Clear' are supposed to initialize variable.
247247
if (Token::Match(ftok, "%var% . clear|Clear ("))
248248
{
249-
InitVar(varlist, ftok->str().c_str());
249+
initVar(varlist, ftok->str().c_str());
250250
}
251251
}
252252
}
@@ -331,7 +331,7 @@ void CheckClass::constructors()
331331
if (ErrorLogger::noConstructor(*_settings))
332332
{
333333
// If the class has member variables there should be an constructor
334-
struct VAR *varlist = ClassChecking_GetVarList(tok1, false);
334+
struct VAR *varlist = getVarList(tok1, false);
335335
if (varlist)
336336
{
337337
noConstructorError(tok1, classNameToken->str());
@@ -350,27 +350,27 @@ void CheckClass::constructors()
350350
}
351351

352352
// Check constructors
353-
CheckConstructors(tok1, className[0]);
353+
checkConstructors(tok1, className[0]);
354354

355355
// Check assignment operators
356-
CheckConstructors(tok1, "operator =");
356+
checkConstructors(tok1, "operator =");
357357

358358
tok1 = Token::findmatch(tok1->next(), pattern_class);
359359
}
360360
}
361361

362-
void CheckClass::CheckConstructors(const Token *tok1, const char funcname[])
362+
void CheckClass::checkConstructors(const Token *tok1, const char funcname[])
363363
{
364364
const char * const className = tok1->strAt(1);
365365

366366
// Check that all member variables are initialized..
367367
bool withClasses = bool(_settings->_showAll && std::string(funcname) == "operator =");
368-
struct VAR *varlist = ClassChecking_GetVarList(tok1, withClasses);
368+
struct VAR *varlist = getVarList(tok1, withClasses);
369369

370370
int indentlevel = 0;
371-
const Token *constructor_token = Tokenizer::FindClassFunction(tok1, className, funcname, indentlevel);
371+
const Token *constructor_token = Tokenizer::findClassFunction(tok1, className, funcname, indentlevel);
372372
std::list<std::string> callstack;
373-
ClassChecking_VarList_Initialize(tok1, constructor_token, varlist, className, callstack);
373+
initializeVarList(tok1, constructor_token, varlist, className, callstack);
374374
while (constructor_token)
375375
{
376376
// Check if any variables are uninitialized
@@ -415,9 +415,9 @@ void CheckClass::CheckConstructors(const Token *tok1, const char funcname[])
415415
for (struct VAR *var = varlist; var; var = var->next)
416416
var->init = false;
417417

418-
constructor_token = Tokenizer::FindClassFunction(constructor_token->next(), className, funcname, indentlevel);
418+
constructor_token = Tokenizer::findClassFunction(constructor_token->next(), className, funcname, indentlevel);
419419
callstack.clear();
420-
ClassChecking_VarList_Initialize(tok1, constructor_token, varlist, className, callstack);
420+
initializeVarList(tok1, constructor_token, varlist, className, callstack);
421421
}
422422

423423
// Delete the varlist..

src/checkclass.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ class CheckClass : public Check
9090
struct VAR *next;
9191
};
9292

93-
void ClassChecking_VarList_Initialize(const Token *tok1, const Token *ftok, struct VAR *varlist, const char classname[], std::list<std::string> &callstack);
94-
void InitVar(struct VAR *varlist, const char varname[]);
95-
struct VAR *ClassChecking_GetVarList(const Token *tok1, bool withClasses);
93+
void initializeVarList(const Token *tok1, const Token *ftok, struct VAR *varlist, const char classname[], std::list<std::string> &callstack);
94+
void initVar(struct VAR *varlist, const char varname[]);
95+
struct VAR *getVarList(const Token *tok1, bool withClasses);
9696

9797
// Check constructors for a specified class
98-
void CheckConstructors(const Token *tok1, const char funcname[]);
98+
void checkConstructors(const Token *tok1, const char funcname[]);
9999

100100
// Reporting errors..
101101
void noConstructorError(const Token *tok, const std::string &classname);

src/checkheaders.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CheckHeaders::~CheckHeaders()
4747

4848
}
4949

50-
void CheckHeaders::WarningHeaderWithImplementation()
50+
void CheckHeaders::warningHeaderWithImplementation()
5151
{
5252
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
5353
{
@@ -86,7 +86,7 @@ void CheckHeaders::WarningHeaderWithImplementation()
8686
// HEADERS - Unneeded include
8787
//---------------------------------------------------------------------------
8888

89-
void CheckHeaders::WarningIncludeHeader()
89+
void CheckHeaders::warningIncludeHeader()
9090
{
9191
// Including..
9292
for (const Token *includetok = _tokenizer->tokens(); includetok; includetok = includetok->next())
@@ -99,7 +99,7 @@ void CheckHeaders::WarningIncludeHeader()
9999
const char *includefile = includetok->strAt(1);
100100
while (hfile < _tokenizer->getFiles()->size())
101101
{
102-
if (FileLister::SameFileName(_tokenizer->getFiles()->at(hfile).c_str(), includefile))
102+
if (FileLister::sameFileName(_tokenizer->getFiles()->at(hfile).c_str(), includefile))
103103
break;
104104
++hfile;
105105
}

src/checkheaders.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class CheckHeaders
3030
public:
3131
CheckHeaders(const Tokenizer *tokenizer, ErrorLogger *errorLogger);
3232
~CheckHeaders();
33-
void WarningHeaderWithImplementation();
34-
void WarningIncludeHeader();
33+
void warningHeaderWithImplementation();
34+
void warningIncludeHeader();
3535

3636
private:
3737
const Tokenizer *_tokenizer;

0 commit comments

Comments
 (0)