Core: Fix several coverity issues:

* CID 350582: Big parameter passed by value
* CID 350639: Big parameter passed by value
* CID 305234: Uncaught exception
* CID 316529: Uncaught exception
* CID 350597: Uncaught exception
* CID 350623: Uncaught exception
* CID 332690: Uncaught exception
* CID 332700: Unchecked return value
* CID 350576: Uninitialized scalar field
* CID 350587: Uninitialized scalar variable
* CID 192606: Uninitialized scalar field
* CID 332699: Uninitialized pointer field
* CID 350561: Dereference null return value
* CID 350610: Dereference null return value
* CID 350567: Dereference after null check
This commit is contained in:
wmayer
2022-03-13 13:53:32 +01:00
parent 2e6c4373bf
commit b78dc894e1
14 changed files with 94 additions and 48 deletions

View File

@@ -315,7 +315,7 @@ void App::Metadata::addGenericMetadata(const std::string& tag, const Meta::Gener
void App::Metadata::removeContentItem(const std::string& tag, const std::string& itemName)
{
auto tagRange = _content.equal_range(tag);
auto foundItem = std::find_if(tagRange.first, tagRange.second, [itemName](auto check) -> bool { return itemName == check.second.name(); });
auto foundItem = std::find_if(tagRange.first, tagRange.second, [&itemName](auto check) -> bool { return itemName == check.second.name(); });
if (foundItem != tagRange.second)
_content.erase(foundItem);
}
@@ -686,6 +686,8 @@ Meta::Url::Url(const XERCES_CPP_NAMESPACE::DOMElement* e)
type = UrlType::readme;
else if (typeAttribute == "documentation")
type = UrlType::documentation;
else
type = UrlType::website;
if (type == UrlType::repository)
branch = StrXUTF8(e->getAttribute(XUTF8Str("branch").unicodeForm())).str;