Fix Cppcheck warnings and remove Travis suppressions

This commit is contained in:
Daniel Marjamäki 2016-10-29 15:50:08 +02:00
parent a860c4c231
commit faa32fd51d
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -111,16 +111,18 @@ ErrorLogger::ErrorMessage::ErrorMessage(const std::list<const Token*>& 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"))));