Fix MinGW compiler warnings

Cross-compiling with mxe on linux.

PR #23470.
This commit is contained in:
Orgad Shaneh
2025-11-14 15:26:35 +02:00
committed by GitHub
parent 530c7d1bbd
commit ffbd01eb81
3 changed files with 8 additions and 6 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -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<LONGLONG>(streamSize.QuadPart, 1024);
QByteArray buf {expectedReadSize, '\0'};
QByteArray buf {static_cast<qsizetype>(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<qsizetype>(written) == zoneID.size());
#endif
}
#endif // Q_OS_MACOS || Q_OS_WIN