astyle formatting, use isEnabled("warning") instead of isEnabled("style")

This commit is contained in:
Daniel Marjamäki 2013-07-28 16:13:16 +02:00
parent 1409461e4f
commit 9ff204f8bc
3 changed files with 13 additions and 12 deletions

View File

@ -524,7 +524,8 @@ void CheckIO::checkWrongPrintfScanfArguments()
bool _continue = false;
std::string width;
unsigned int parameterPosition = 0; bool hasParameterPosition = false;
unsigned int parameterPosition = 0;
bool hasParameterPosition = false;
while (i != formatString.end() && *i != ']' && !std::isalpha(*i)) {
if (*i == '*') {
if (scan)
@ -552,8 +553,8 @@ void CheckIO::checkWrongPrintfScanfArguments()
++numFormat;
// Handle parameter positions (POSIX extension) - Ticket #4900
if(hasParameterPosition) {
if(parameterPositionsUsed.find(parameterPosition) == parameterPositionsUsed.end())
if (hasParameterPosition) {
if (parameterPositionsUsed.find(parameterPosition) == parameterPositionsUsed.end())
parameterPositionsUsed.insert(parameterPosition);
else // Parameter already referenced, hence don't consider it a new format
--numFormat;
@ -735,8 +736,8 @@ void CheckIO::checkWrongPrintfScanfArguments()
}
// Check that all parameter positions reference an actual parameter
for(std::set<unsigned int>::const_iterator it = parameterPositionsUsed.begin() ; it != parameterPositionsUsed.end() ; ++it) {
if((*it == 0) || (*it > numFormat))
for (std::set<unsigned int>::const_iterator it = parameterPositionsUsed.begin() ; it != parameterPositionsUsed.end() ; ++it) {
if ((*it == 0) || (*it > numFormat))
wrongPrintfScanfPosixParameterPositionError(tok, tok->str(), *it, numFormat);
}
@ -769,13 +770,13 @@ void CheckIO::wrongPrintfScanfArgumentsError(const Token* tok,
}
void CheckIO::wrongPrintfScanfPosixParameterPositionError(const Token* tok, const std::string& functionName,
unsigned int index, unsigned int numFunction)
unsigned int index, unsigned int numFunction)
{
if (!_settings->isEnabled("style"))
if (!_settings->isEnabled("warning"))
return;
std::ostringstream errmsg;
errmsg << functionName << ": ";
if(index == 0) {
if (index == 0) {
errmsg << "parameter positions start at 1, not 0";
} else {
errmsg << "referencing parameter " << index << " while " << numFunction << " arguments given";

View File

@ -83,7 +83,7 @@ private:
unsigned int numFormat,
unsigned int numFunction);
void wrongPrintfScanfPosixParameterPositionError(const Token* tok, const std::string& functionName,
unsigned int index, unsigned int numFunction);
unsigned int index, unsigned int numFunction);
void invalidScanfArgTypeError(const Token* tok, const std::string &functionName, unsigned int numFormat);
void invalidPrintfArgTypeError_s(const Token* tok, unsigned int numFormat);
void invalidPrintfArgTypeError_n(const Token* tok, unsigned int numFormat);