mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
Improve coding style
This commit is contained in:
@@ -151,10 +151,12 @@ namespace Utils
|
||||
template <typename StringClassWithSplitMethod>
|
||||
static Version tryParse(const StringClassWithSplitMethod &s, const Version &defaultVersion)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
return Version(s);
|
||||
}
|
||||
catch (const std::runtime_error &er) {
|
||||
catch (const std::runtime_error &er)
|
||||
{
|
||||
qDebug() << "Error parsing version:" << er.what();
|
||||
return defaultVersion;
|
||||
}
|
||||
@@ -172,7 +174,8 @@ namespace Utils
|
||||
|
||||
bool ok = false;
|
||||
ComponentsArray res {{}};
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(versionParts.size()); ++i) {
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(versionParts.size()); ++i)
|
||||
{
|
||||
res[i] = static_cast<T>(versionParts[static_cast<typename StringsList::size_type>(i)].toInt(&ok));
|
||||
if (!ok)
|
||||
throw std::runtime_error("Can not parse version component");
|
||||
|
||||
Reference in New Issue
Block a user