astyle formatting
This commit is contained in:
parent
ca6a93816b
commit
1d95416840
|
@ -522,7 +522,7 @@ void CheckOther::checkSizeofForPointerSize()
|
||||||
{
|
{
|
||||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
if(!_settings->isEnabled("style"))
|
if (!_settings->isEnabled("style"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
||||||
|
@ -546,8 +546,8 @@ void CheckOther::checkSizeofForPointerSize()
|
||||||
variable = tok->tokAt(2);
|
variable = tok->tokAt(2);
|
||||||
tokVar = variable->tokAt(2)->nextArgument();
|
tokVar = variable->tokAt(2)->nextArgument();
|
||||||
|
|
||||||
// The following tests can be inconclusive in case the variable in sizeof
|
// The following tests can be inconclusive in case the variable in sizeof
|
||||||
// is constant string by intention
|
// is constant string by intention
|
||||||
} else if (!_settings->inconclusive) {
|
} else if (!_settings->inconclusive) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ void CheckOther::checkSizeofForPointerSize()
|
||||||
if (variable2) {
|
if (variable2) {
|
||||||
var = symbolDatabase->getVariableFromVarId(variable2->varId());
|
var = symbolDatabase->getVariableFromVarId(variable2->varId());
|
||||||
if (!var || !var->isPointer()) {
|
if (!var || !var->isPointer()) {
|
||||||
variable2 = 0;
|
variable2 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,17 +583,17 @@ void CheckOther::checkSizeofForPointerSize()
|
||||||
|
|
||||||
// Jump to the next sizeof token in the function and in the parameter
|
// Jump to the next sizeof token in the function and in the parameter
|
||||||
// This is to allow generic operations with sizeof
|
// This is to allow generic operations with sizeof
|
||||||
for (; tokVar && tokVar->str() != ")" && tokVar->str() != "," && tokVar->str() != "sizeof"; tokVar = tokVar->next());
|
for (; tokVar && tokVar->str() != ")" && tokVar->str() != "," && tokVar->str() != "sizeof"; tokVar = tokVar->next());
|
||||||
|
|
||||||
// Now check for the sizeof usage. Once here, everything using sizeof(varid)
|
// Now check for the sizeof usage. Once here, everything using sizeof(varid)
|
||||||
// looks suspicious
|
// looks suspicious
|
||||||
// Do it for first variable
|
// Do it for first variable
|
||||||
if (variable && (Token::Match(tokVar, "sizeof ( %varid% )", variable->varId()) ||
|
if (variable && (Token::Match(tokVar, "sizeof ( %varid% )", variable->varId()) ||
|
||||||
Token::Match(tokVar, "sizeof %varid%", variable->varId()))) {
|
Token::Match(tokVar, "sizeof %varid%", variable->varId()))) {
|
||||||
sizeofForPointerError(variable, variable->str());
|
sizeofForPointerError(variable, variable->str());
|
||||||
// Then do it for second - TODO: Perhaps we should invert?
|
// Then do it for second - TODO: Perhaps we should invert?
|
||||||
} else if (variable2 && (Token::Match(tokVar, "sizeof ( %varid% )", variable2->varId()) ||
|
} else if (variable2 && (Token::Match(tokVar, "sizeof ( %varid% )", variable2->varId()) ||
|
||||||
Token::Match(tokVar, "sizeof %varid%", variable2->varId()))) {
|
Token::Match(tokVar, "sizeof %varid%", variable2->varId()))) {
|
||||||
sizeofForPointerError(variable2, variable2->str());
|
sizeofForPointerError(variable2, variable2->str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,7 +383,7 @@ int Token::multiCompare(const char *haystack, const char *needle)
|
||||||
|
|
||||||
bool emptyStringFound = false;
|
bool emptyStringFound = false;
|
||||||
const char *needlePointer = needle;
|
const char *needlePointer = needle;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (*needlePointer == *haystack) {
|
if (*needlePointer == *haystack) {
|
||||||
if (*needlePointer == '\0')
|
if (*needlePointer == '\0')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue