From dba998fea035c0fa2feea8e2a86d697c480a86b6 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Fri, 6 May 2022 13:00:36 +0800 Subject: [PATCH 1/4] Don't use hardcoded path for temp folder --- src/gui/torrentcontentmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp index 0fe41bf24..d1bf952fc 100644 --- a/src/gui/torrentcontentmodel.cpp +++ b/src/gui/torrentcontentmodel.cpp @@ -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()); } From a0a45333f1295c88b8bdace683ce100646888d03 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 8 May 2022 14:51:51 +0800 Subject: [PATCH 2/4] Don't use old style casts --- src/base/utils/foreignapps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/utils/foreignapps.cpp b/src/base/utils/foreignapps.cpp index 2af79ca15..6214c4bc1 100644 --- a/src/base/utils/foreignapps.cpp +++ b/src/base/utils/foreignapps.cpp @@ -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(lpData), &cbData); QString result; if (res == ERROR_SUCCESS) From be4a1e7fd7f0ef7eeae92a69c22d2f8633f6f511 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 8 May 2022 14:52:32 +0800 Subject: [PATCH 3/4] Suppress wrong print specifier By removing unimportant debug message. --- src/base/utils/foreignapps.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/base/utils/foreignapps.cpp b/src/base/utils/foreignapps.cpp index 6214c4bc1..37e36d3b0 100644 --- a/src/base/utils/foreignapps.cpp +++ b/src/base/utils/foreignapps.cpp @@ -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; From 002d56d8b3bccdbdc80809e0dd74838c80c404c8 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 8 May 2022 16:48:29 +0800 Subject: [PATCH 4/4] Fix type mismatch msys2 was reporting the following error: ``` D:/a/qbittorent_msys2/qbittorent_msys2/src/qBittorrent/src/app/application.cpp: In member function 'void Application::applyMemoryWorkingSetLimit()': D:/a/qbittorent_msys2/qbittorent_msys2/src/qBittorrent/src/app/application.cpp:777:36: error: no matching function for call to 'min(unsigned int, long unsigned int)' 777 | const SIZE_T minSize = std::min((64 * MiB), (maxSize / 2)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- src/app/application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index f7f48a158..120854475 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -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((64 * MiB), (maxSize / 2)); if (!::SetProcessWorkingSetSizeEx(::GetCurrentProcess(), minSize, maxSize, QUOTA_LIMITS_HARDWS_MAX_ENABLE)) { const DWORD errorCode = ::GetLastError();