From faa32fd51d6adb63387a14083cabd1d792b178ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 29 Oct 2016 15:50:08 +0200 Subject: [PATCH] Fix Cppcheck warnings and remove Travis suppressions --- .travis_suppressions | 2 -- lib/errorlogger.cpp | 12 +++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis_suppressions b/.travis_suppressions index 29a3759db..85a45c887 100644 --- a/.travis_suppressions +++ b/.travis_suppressions @@ -7,8 +7,6 @@ passedByValue:lib/symboldatabase.h passedByValue:lib/library.h knownConditionTrueFalse:lib/platform.cpp knownConditionTrueFalse:build/* -useInitializationList:lib/errorlogger.cpp -useInitializationList:build/errorlogger.cpp *:gui/test* *:test/test.cxx diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 56317ff6b..40268032a 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -111,16 +111,18 @@ ErrorLogger::ErrorMessage::ErrorMessage(const std::list& callstack setmsg(msg); } -ErrorLogger::ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg) : _cwe(0U) +ErrorLogger::ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg) + : _id(errmsg->Attribute("id")), + _severity(Severity::fromString(errmsg->Attribute("severity"))), + _cwe(0U), + _inconclusive(false), + _shortMessage(errmsg->Attribute("msg")), + _verboseMessage(errmsg->Attribute("verbose")) { - _id = errmsg->Attribute("id"); - _severity = Severity::fromString(errmsg->Attribute("severity")); const char *attr = errmsg->Attribute("cwe"); std::istringstream(attr ? attr : "0") >> _cwe.id; attr = errmsg->Attribute("inconclusive"); _inconclusive = attr && (std::strcmp(attr, "true") == 0); - _shortMessage = errmsg->Attribute("msg"); - _verboseMessage = errmsg->Attribute("verbose"); for (const tinyxml2::XMLElement *e = errmsg->FirstChildElement(); e; e = e->NextSiblingElement()) { if (std::strcmp(e->Name(),"location")==0) { _callStack.push_back(ErrorLogger::ErrorMessage::FileLocation(e->Attribute("file"), std::atoi(e->Attribute("line"))));