mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 06:01:33 -06:00
Fix MinGW compiler warnings
Cross-compiling with mxe on linux. PR #23470.
This commit is contained in:
@@ -127,10 +127,12 @@ namespace
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
|
||||||
void displayVersion()
|
void displayVersion()
|
||||||
{
|
{
|
||||||
printf("%s %s\n", qUtf8Printable(qApp->applicationName()), QBT_VERSION);
|
printf("%s %s\n", qUtf8Printable(qApp->applicationName()), QBT_VERSION);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
void showSplashScreen()
|
void showSplashScreen()
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace
|
|||||||
bool hasDriveLetter(const QStringView path)
|
bool hasDriveLetter(const QStringView path)
|
||||||
{
|
{
|
||||||
const QRegularExpression driveLetterRegex {u"^[A-Za-z]:/"_s};
|
const QRegularExpression driveLetterRegex {u"^[A-Za-z]:/"_s};
|
||||||
return driveLetterRegex.match(path).hasMatch();
|
return driveLetterRegex.matchView(path).hasMatch();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ bool Path::isValid() const
|
|||||||
|
|
||||||
// \\37 is using base-8 number system
|
// \\37 is using base-8 number system
|
||||||
const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_s};
|
const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_s};
|
||||||
return !regex.match(view).hasMatch();
|
return !regex.matchView(view).hasMatch();
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
const QRegularExpression regex {u"[\\0:]"_s};
|
const QRegularExpression regex {u"[\\0:]"_s};
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -275,11 +275,11 @@ bool Utils::OS::applyMarkOfTheWeb(const Path &file, const QString &url)
|
|||||||
const QByteArray zoneID = QByteArrayLiteral("[ZoneTransfer]\r\nZoneId=3\r\n")
|
const QByteArray zoneID = QByteArrayLiteral("[ZoneTransfer]\r\nZoneId=3\r\n")
|
||||||
+ u"HostUrl=%1\r\n"_s.arg(hostURL).toUtf8();
|
+ u"HostUrl=%1\r\n"_s.arg(hostURL).toUtf8();
|
||||||
|
|
||||||
if (LARGE_INTEGER streamSize = {0};
|
if (LARGE_INTEGER streamSize {};
|
||||||
::GetFileSizeEx(handle, &streamSize) && (streamSize.QuadPart > 0))
|
::GetFileSizeEx(handle, &streamSize) && (streamSize.QuadPart > 0))
|
||||||
{
|
{
|
||||||
const DWORD expectedReadSize = std::min<LONGLONG>(streamSize.QuadPart, 1024);
|
const DWORD expectedReadSize = std::min<LONGLONG>(streamSize.QuadPart, 1024);
|
||||||
QByteArray buf {expectedReadSize, '\0'};
|
QByteArray buf {static_cast<qsizetype>(expectedReadSize), '\0'};
|
||||||
|
|
||||||
if (DWORD actualReadSize = 0;
|
if (DWORD actualReadSize = 0;
|
||||||
::ReadFile(handle, buf.data(), expectedReadSize, &actualReadSize, nullptr) && (actualReadSize == expectedReadSize))
|
::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;
|
return false;
|
||||||
if (!::SetEndOfFile(handle))
|
if (!::SetEndOfFile(handle))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
const BOOL writeResult = ::WriteFile(handle, zoneID.constData(), zoneID.size(), &written, nullptr);
|
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
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MACOS || Q_OS_WIN
|
#endif // Q_OS_MACOS || Q_OS_WIN
|
||||||
|
|||||||
Reference in New Issue
Block a user