From cf3f8c2f3832043aa0d035a26622088a2450312d Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 1 Dec 2014 16:22:56 +0100 Subject: [PATCH] Refactoring: Replace names with underscores with camelCase names --- lib/checkbool.cpp | 26 +++++++++++++------------- lib/checkboost.cpp | 12 ++++++------ lib/checkbufferoverrun.cpp | 6 +++--- lib/tokenize.cpp | 16 ++++++++-------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/checkbool.cpp b/lib/checkbool.cpp index 245053e5c..a285dca40 100644 --- a/lib/checkbool.cpp +++ b/lib/checkbool.cpp @@ -290,26 +290,26 @@ void CheckBool::checkComparisonOfBoolWithBool() for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { if (tok->type() != Token::eComparisonOp || tok->str() == "==" || tok->str() == "!=") continue; - bool first_token_bool = false; + bool firstTokenBool = false; - const Token *first_token = tok->previous(); - if (first_token->varId()) { - if (isBool(first_token->variable())) { - first_token_bool = true; + const Token *firstToken = tok->previous(); + if (firstToken->varId()) { + if (isBool(firstToken->variable())) { + firstTokenBool = true; } } - if (!first_token_bool) + if (!firstTokenBool) continue; - bool second_token_bool = false; - const Token *second_token = tok->next(); - if (second_token->varId()) { - if (isBool(second_token->variable())) { - second_token_bool = true; + bool secondTokenBool = false; + const Token *secondToken = tok->next(); + if (secondToken->varId()) { + if (isBool(secondToken->variable())) { + secondTokenBool = true; } } - if (second_token_bool) { - comparisonOfBoolWithBoolError(first_token->next(), first_token->str()); + if (secondTokenBool) { + comparisonOfBoolWithBoolError(firstToken->next(), secondToken->str()); } } } diff --git a/lib/checkboost.cpp b/lib/checkboost.cpp index 779cd87e4..e3df295fd 100644 --- a/lib/checkboost.cpp +++ b/lib/checkboost.cpp @@ -34,18 +34,18 @@ void CheckBoost::checkBoostForeachModification() if (!Token::simpleMatch(tok, "BOOST_FOREACH (")) continue; - const Token *container_tok = tok->next()->link()->previous(); - if (!Token::Match(container_tok, "%var% ) {")) + const Token *containerTok = tok->next()->link()->previous(); + if (!Token::Match(containerTok, "%var% ) {")) continue; - const unsigned int container_id = container_tok->varId(); - if (container_id == 0) + const unsigned int containerId = containerTok->varId(); + if (containerId == 0) continue; - const Token *tok2 = container_tok->tokAt(2); + const Token *tok2 = containerTok->tokAt(2); const Token *end = tok2->link(); for (; tok2 != end; tok2 = tok2->next()) { - if (Token::Match(tok2, "%varid% . insert|erase|push_back|push_front|pop_front|pop_back|clear|swap|resize|assign|merge|remove|remove_if|reverse|sort|splice|unique|pop|push", container_id)) { + if (Token::Match(tok2, "%varid% . insert|erase|push_back|push_front|pop_front|pop_back|clear|swap|resize|assign|merge|remove|remove_if|reverse|sort|splice|unique|pop|push", containerId)) { const Token* nextStatement = Token::findsimplematch(tok2->linkAt(3), ";", end); if (!Token::Match(nextStatement, "; break|return|throw")) boostForeachError(tok2); diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 72243ae41..e94a1c734 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -1116,12 +1116,12 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable() Token sizeTok(0); sizeTok.str(type); - const MathLib::bigint total_size = size * static_cast(_tokenizer->sizeOfType(&sizeTok)); - if (total_size == 0) + const MathLib::bigint totalSize = size * static_cast(_tokenizer->sizeOfType(&sizeTok)); + if (totalSize == 0) continue; std::vector v; - ArrayInfo temp(var->declarationId(), tok->next()->str(), total_size / size, size); + ArrayInfo temp(var->declarationId(), tok->next()->str(), totalSize / size, size); checkScope(tok->tokAt(nextTok), v, temp); } } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d407d00b6..d959a3f80 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5696,7 +5696,6 @@ void Tokenizer::simplifyPlatformTypes() const Library::PlatformType * const platformtype = _settings->library.platform_type(tok->str(), platform_type); if (platformtype) { - Token *type_token; // check for namespace if (tok->strAt(-1) == "::") { const Token * tok1 = tok->tokAt(-2); @@ -5706,31 +5705,32 @@ void Tokenizer::simplifyPlatformTypes() tok = tok->tokAt(-1); tok->deleteThis(); } + Token *typeToken; if (platformtype->_const_ptr) { tok->str("const"); tok->insertToken("*"); tok->insertToken(platformtype->_type); - type_token = tok; + typeToken = tok; } else if (platformtype->_pointer) { tok->str(platformtype->_type); - type_token = tok; + typeToken = tok; tok->insertToken("*"); } else if (platformtype->_ptr_ptr) { tok->str(platformtype->_type); - type_token = tok; + typeToken = tok; tok->insertToken("*"); tok->insertToken("*"); } else { tok->originalName(tok->str()); tok->str(platformtype->_type); - type_token = tok; + typeToken = tok; } if (platformtype->_signed) - type_token->isSigned(true); + typeToken->isSigned(true); if (platformtype->_unsigned) - type_token->isUnsigned(true); + typeToken->isUnsigned(true); if (platformtype->_long) - type_token->isLong(true); + typeToken->isLong(true); } } }