Merge pull request #17004 from Chocobo1/fixes

Improve compatiability with various platforms
This commit is contained in:
Chocobo1 2022-05-09 12:14:09 +08:00 committed by GitHub
commit 80f624e4cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -774,7 +774,7 @@ void Application::applyMemoryWorkingSetLimit()
#ifdef Q_OS_WIN
const SIZE_T maxSize = memoryWorkingSetLimit() * MiB;
const SIZE_T minSize = std::min((64 * MiB), (maxSize / 2));
const auto minSize = std::min<SIZE_T>((64 * MiB), (maxSize / 2));
if (!::SetProcessWorkingSetSizeEx(::GetCurrentProcess(), minSize, maxSize, QUOTA_LIMITS_HARDWS_MAX_ENABLE))
{
const DWORD errorCode = ::GetLastError();

View file

@ -136,7 +136,7 @@ namespace
::RegQueryValueExW(handle, nameWStr.c_str(), NULL, &type, NULL, &cbData);
DWORD cBuffer = (cbData / sizeof(WCHAR)) + 1;
LPWSTR lpData = new WCHAR[cBuffer];
LONG res = ::RegQueryValueExW(handle, nameWStr.c_str(), NULL, &type, (LPBYTE)lpData, &cbData);
LONG res = ::RegQueryValueExW(handle, nameWStr.c_str(), NULL, &type, reinterpret_cast<LPBYTE>(lpData), &cbData);
QString result;
if (res == ERROR_SUCCESS)
@ -171,7 +171,6 @@ namespace
if (res == ERROR_SUCCESS)
{
QStringList versions = getRegSubkeys(hkPythonCore);
qDebug("Python versions nb: %d", versions.size());
versions.sort();
bool found = false;

View file

@ -151,10 +151,10 @@ namespace
*/
bool doesQFileIconProviderWork()
{
const QString PSEUDO_UNIQUE_FILE_NAME = u"/tmp/qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9"_qs;
const Path PSEUDO_UNIQUE_FILE_NAME = Utils::Fs::tempPath() / Path(u"qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9"_qs);
QFileIconProvider provider;
const QIcon testIcon1 = provider.icon(QFileInfo(PSEUDO_UNIQUE_FILE_NAME + u".pdf"));
const QIcon testIcon2 = provider.icon(QFileInfo(PSEUDO_UNIQUE_FILE_NAME + u".png"));
const QIcon testIcon1 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".pdf").data()));
const QIcon testIcon2 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".png").data()));
return (!testIcon1.isNull() || !testIcon2.isNull());
}