Refactoring: Replace names with underscores with camelCase names

This commit is contained in:
Dmitry-Me 2014-12-01 16:22:56 +01:00 committed by Daniel Marjamäki
parent 02298bf4d9
commit cf3f8c2f38
4 changed files with 30 additions and 30 deletions

View File

@ -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());
}
}
}

View File

@ -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);

View File

@ -1116,12 +1116,12 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
Token sizeTok(0);
sizeTok.str(type);
const MathLib::bigint total_size = size * static_cast<int>(_tokenizer->sizeOfType(&sizeTok));
if (total_size == 0)
const MathLib::bigint totalSize = size * static_cast<int>(_tokenizer->sizeOfType(&sizeTok));
if (totalSize == 0)
continue;
std::vector<std::string> 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);
}
}

View File

@ -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);
}
}
}