Remove uneeded indentation

This commit is contained in:
Raphael Geissert 2011-02-02 09:54:04 -06:00
parent 8d5863133c
commit 15dceed6cd
1 changed files with 35 additions and 35 deletions

View File

@ -335,48 +335,48 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
reportErr(errmsg); reportErr(errmsg);
} }
if (re) if (!re)
continue;
int pos = 0;
int ovector[30];
if (0 <= pcre_exec(re, NULL, str.c_str(), (int)str.size(), pos, 0, ovector, 30))
{ {
int pos = 0; unsigned int pos1 = (unsigned int)ovector[0];
int ovector[30]; unsigned int pos2 = (unsigned int)ovector[1];
if (0 <= pcre_exec(re, NULL, str.c_str(), (int)str.size(), pos, 0, ovector, 30))
// determine location..
ErrorLogger::ErrorMessage::FileLocation loc;
loc.setfile(_tokenizer.getFiles()->front());
loc.line = 0;
unsigned int len = 0;
for (const Token *tok = _tokenizer.tokens(); tok; tok = tok->next())
{ {
unsigned int pos1 = (unsigned int)ovector[0]; len = len + 1 + tok->str().size();
unsigned int pos2 = (unsigned int)ovector[1]; if (len > pos1)
// determine location..
ErrorLogger::ErrorMessage::FileLocation loc;
loc.setfile(_tokenizer.getFiles()->front());
loc.line = 0;
unsigned int len = 0;
for (const Token *tok = _tokenizer.tokens(); tok; tok = tok->next())
{ {
len = len + 1 + tok->str().size(); loc.setfile(_tokenizer.getFiles()->at(tok->fileIndex()));
if (len > pos1) loc.line = tok->linenr();
{ break;
loc.setfile(_tokenizer.getFiles()->at(tok->fileIndex()));
loc.line = tok->linenr();
break;
}
} }
const std::list<ErrorLogger::ErrorMessage::FileLocation> callStack(1, loc);
// Create error message
std::string summary;
if (rule.summary.empty())
summary = "found '" + str.substr(pos1, pos2 - pos1) + "'";
else
summary = rule.summary;
ErrorLogger::ErrorMessage errmsg(callStack, Severity::fromString(rule.severity), summary, rule.id);
// Report error
reportErr(errmsg);
} }
pcre_free(re); const std::list<ErrorLogger::ErrorMessage::FileLocation> callStack(1, loc);
// Create error message
std::string summary;
if (rule.summary.empty())
summary = "found '" + str.substr(pos1, pos2 - pos1) + "'";
else
summary = rule.summary;
ErrorLogger::ErrorMessage errmsg(callStack, Severity::fromString(rule.severity), summary, rule.id);
// Report error
reportErr(errmsg);
} }
pcre_free(re);
} }
} }
#endif #endif