diff --git a/src/app/main.cpp b/src/app/main.cpp index 21730827f..3eccdc1ce 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -127,10 +127,12 @@ namespace #endif } +#if !defined(Q_OS_WIN) || defined(DISABLE_GUI) void displayVersion() { printf("%s %s\n", qUtf8Printable(qApp->applicationName()), QBT_VERSION); } +#endif #ifndef DISABLE_GUI void showSplashScreen() diff --git a/src/base/path.cpp b/src/base/path.cpp index c1357f3cf..e746fbf5c 100644 --- a/src/base/path.cpp +++ b/src/base/path.cpp @@ -65,7 +65,7 @@ namespace bool hasDriveLetter(const QStringView path) { const QRegularExpression driveLetterRegex {u"^[A-Za-z]:/"_s}; - return driveLetterRegex.match(path).hasMatch(); + return driveLetterRegex.matchView(path).hasMatch(); } #endif } @@ -104,7 +104,7 @@ bool Path::isValid() const // \\37 is using base-8 number system const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_s}; - return !regex.match(view).hasMatch(); + return !regex.matchView(view).hasMatch(); #elif defined(Q_OS_MACOS) const QRegularExpression regex {u"[\\0:]"_s}; #else diff --git a/src/base/utils/os.cpp b/src/base/utils/os.cpp index f0a78b132..ad1cd4057 100644 --- a/src/base/utils/os.cpp +++ b/src/base/utils/os.cpp @@ -275,11 +275,11 @@ bool Utils::OS::applyMarkOfTheWeb(const Path &file, const QString &url) const QByteArray zoneID = QByteArrayLiteral("[ZoneTransfer]\r\nZoneId=3\r\n") + u"HostUrl=%1\r\n"_s.arg(hostURL).toUtf8(); - if (LARGE_INTEGER streamSize = {0}; + if (LARGE_INTEGER streamSize {}; ::GetFileSizeEx(handle, &streamSize) && (streamSize.QuadPart > 0)) { const DWORD expectedReadSize = std::min(streamSize.QuadPart, 1024); - QByteArray buf {expectedReadSize, '\0'}; + QByteArray buf {static_cast(expectedReadSize), '\0'}; if (DWORD actualReadSize = 0; ::ReadFile(handle, buf.data(), expectedReadSize, &actualReadSize, nullptr) && (actualReadSize == expectedReadSize)) @@ -289,14 +289,14 @@ bool Utils::OS::applyMarkOfTheWeb(const Path &file, const QString &url) } } - if (!::SetFilePointerEx(handle, {0}, nullptr, FILE_BEGIN)) + if (!::SetFilePointerEx(handle, {}, nullptr, FILE_BEGIN)) return false; if (!::SetEndOfFile(handle)) return false; DWORD written = 0; const BOOL writeResult = ::WriteFile(handle, zoneID.constData(), zoneID.size(), &written, nullptr); - return writeResult && (written == zoneID.size()); + return writeResult && (static_cast(written) == zoneID.size()); #endif } #endif // Q_OS_MACOS || Q_OS_WIN