From e365d57063fe8a49c2583248b6eca432b9b5328c Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 10 Apr 2019 16:33:06 +0800 Subject: [PATCH] Fix unsafe type narrowing Appending the warning below: qBittorrent\src\base/utils/version.h(176): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data qBittorrent\src\base/utils/version.h(185): note: see reference to function template instantiation 'std::array Utils::Version::parseList(const StringsList &)' being compiled with [ T=unsigned short, StringsList=QList ] --- src/base/utils/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/utils/version.h b/src/base/utils/version.h index e82e3b6e9..b4bb4fee6 100644 --- a/src/base/utils/version.h +++ b/src/base/utils/version.h @@ -168,12 +168,12 @@ namespace Utils { if ((static_cast(versionParts.size()) > N) || (static_cast(versionParts.size()) < Mandatory)) - throw std::runtime_error ("Incorrect number of version components"); + throw std::runtime_error("Incorrect number of version components"); bool ok = false; ComponentsArray res {{}}; for (std::size_t i = 0; i < static_cast(versionParts.size()); ++i) { - res[i] = static_cast(versionParts[i].toInt(&ok)); + res[i] = static_cast(versionParts[static_cast(i)].toInt(&ok)); if (!ok) throw std::runtime_error("Can not parse version component"); }