From 42d001ee6ada86d9cf93c6c42f0e8b142c938d4c Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 8 Jul 2026 16:21:06 +0200 Subject: [PATCH] lint + fix Linux versions (missing declaration) --- .../network/update/client/release_channel.cpp | 19 +++++++++++-------- .../network/update/client/release_channel.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index 5ed276765..beba05c7d 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -2,7 +2,6 @@ #include "version_string.h" -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #if defined(Q_OS_MACOS) #include @@ -47,6 +47,8 @@ void ReleaseChannel::checkForUpdates() // Different release channel checking functions for different operating systems std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &fileName) { + const QRegularExpression *regex = nullptr; + #if defined(Q_OS_MACOS) const bool isIntel = [] { // QSysInfo does not go through translation layers @@ -58,12 +60,14 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f } return false; }(); - static const QRegularExpression macIntelRegex(R"(macOS(\d+)_Intel\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); + static const QRegularExpression macIntelRegex(R"(macOS(\d+)_Intel\.[^.]+$)", + QRegularExpression::CaseInsensitiveOption); static const QRegularExpression macArmRegex(R"(macOS(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); - const QRegularExpression ®ex = isIntel ? macIntelRegex : macArmRegex; + regex = isIntel ? &macIntelRegex : &macArmRegex; #elif defined(Q_OS_WIN) - static const QRegularExpression regex(R"(Win(?:dows)?(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); + static const QRegularExpression winRegex(R"(Win(?:dows)?(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); + regex = &winRegex; #else // if the OS doesn't fit one of the above #defines, then it will never match Q_UNUSED(fileName); @@ -71,7 +75,7 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f #endif const int systemVersion = QSysInfo::productVersion().split('.').first().toInt(); - auto match = regex.match(fileName); + auto match = regex->match(fileName); if (!match.hasMatch()) { return std::nullopt; } @@ -100,8 +104,7 @@ QString ReleaseChannel::findBestDownloadUrl(const QVariantList &assets) } } if (!bestUrl.isEmpty()) { - qCInfo(ReleaseChannelLog) - << "Best compatible asset=" << bestUrl; + qCInfo(ReleaseChannelLog) << "Best compatible asset=" << bestUrl; } return bestUrl; } @@ -152,7 +155,7 @@ void StableReleaseChannel::releaseListFinished() if (resultMap.contains("assets")) { auto url = findBestDownloadUrl(resultMap["assets"].toList()); if (!url.isEmpty()) { - lastRelease->setDownloadUrl(url); + lastRelease->setDownloadUrl(url); } } diff --git a/cockatrice/src/client/network/update/client/release_channel.h b/cockatrice/src/client/network/update/client/release_channel.h index 79a23f8cc..c7a4ebc48 100644 --- a/cockatrice/src/client/network/update/client/release_channel.h +++ b/cockatrice/src/client/network/update/client/release_channel.h @@ -7,12 +7,12 @@ #ifndef RELEASECHANNEL_H #define RELEASECHANNEL_H -#include #include #include #include #include #include +#include #include inline Q_LOGGING_CATEGORY(ReleaseChannelLog, "release_channel");