From 15dceed6cd81d1c1b6dec7f20ee360fabf917bc7 Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Wed, 2 Feb 2011 09:54:04 -0600 Subject: [PATCH] Remove uneeded indentation --- lib/cppcheck.cpp | 70 ++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index db0a15105..951ca3470 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -335,48 +335,48 @@ void CppCheck::checkFile(const std::string &code, const char FileName[]) 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; - int ovector[30]; - if (0 <= pcre_exec(re, NULL, str.c_str(), (int)str.size(), pos, 0, ovector, 30)) + unsigned int pos1 = (unsigned int)ovector[0]; + unsigned int pos2 = (unsigned int)ovector[1]; + + // 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]; - unsigned int pos2 = (unsigned int)ovector[1]; - - // 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(); + if (len > pos1) { - len = len + 1 + tok->str().size(); - if (len > pos1) - { - loc.setfile(_tokenizer.getFiles()->at(tok->fileIndex())); - loc.line = tok->linenr(); - break; - } + loc.setfile(_tokenizer.getFiles()->at(tok->fileIndex())); + loc.line = tok->linenr(); + break; } - - const std::list 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 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