From 5a4d5b9f3138c930cb1d24bef86ec15018ab929e Mon Sep 17 00:00:00 2001 From: oltolm Date: Wed, 25 Sep 2024 17:39:04 +0200 Subject: [PATCH] use ComPtr in gui_context_menus.h (#719) * use ComPtr in gui_context_menus.h * fix pragma diagnostic * fix compiler warnings --- .gitignore | 6 ++++-- src/core/libraries/np_trophy/trophy_ui.cpp | 2 +- src/qt_gui/cheats_patches.cpp | 4 ++-- src/qt_gui/gui_context_menus.h | 11 +++++------ src/video_core/buffer_cache/buffer.cpp | 3 --- src/video_core/renderer_vulkan/renderer_vulkan.cpp | 3 --- src/video_core/renderer_vulkan/vk_common.cpp | 6 +++--- src/video_core/renderer_vulkan/vk_instance.cpp | 3 --- src/video_core/texture_cache/image.cpp | 3 --- src/video_core/texture_cache/tile_manager.cpp | 3 --- 10 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 087f29683..9abc4aae4 100644 --- a/.gitignore +++ b/.gitignore @@ -387,6 +387,8 @@ FodyWeavers.xsd !.vscode/launch.json !.vscode/extensions.json *.code-workspace +/CMakeUserPresets.json +/compile_commands.json # Local History for Visual Studio Code .history/ @@ -409,6 +411,6 @@ FodyWeavers.xsd /out/* /third-party/out/* /src/common/scm_rev.cpp - + # for macOS -**/.DS_Store \ No newline at end of file +**/.DS_Store diff --git a/src/core/libraries/np_trophy/trophy_ui.cpp b/src/core/libraries/np_trophy/trophy_ui.cpp index 6f60e8f9a..8deaac25b 100644 --- a/src/core/libraries/np_trophy/trophy_ui.cpp +++ b/src/core/libraries/np_trophy/trophy_ui.cpp @@ -71,4 +71,4 @@ void TrophyUI::Draw() { End(); } } -} \ No newline at end of file +} diff --git a/src/qt_gui/cheats_patches.cpp b/src/qt_gui/cheats_patches.cpp index a58106cb3..aaa6b4f01 100644 --- a/src/qt_gui/cheats_patches.cpp +++ b/src/qt_gui/cheats_patches.cpp @@ -679,7 +679,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes request.setRawHeader("Accept", "application/vnd.github.v3+json"); QNetworkReply* reply = manager->get(request); - connect(reply, &QNetworkReply::finished, [=]() { + connect(reply, &QNetworkReply::finished, [=, this]() { if (reply->error() == QNetworkReply::NoError) { QByteArray jsonData = reply->readAll(); reply->deleteLater(); @@ -712,7 +712,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes QNetworkRequest fileRequest(downloadUrl); QNetworkReply* fileReply = manager->get(fileRequest); - connect(fileReply, &QNetworkReply::finished, [=]() { + connect(fileReply, &QNetworkReply::finished, [=, this]() { if (fileReply->error() == QNetworkReply::NoError) { QByteArray fileData = fileReply->readAll(); QFile localFile(dir.filePath(fileName)); diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index a2f7f28ff..9300ca6e5 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -20,6 +20,7 @@ #include #include #include +#include #endif #include "common/path_util.h" @@ -342,9 +343,9 @@ private: CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); // Create the ShellLink object - IShellLink* pShellLink = nullptr; + Microsoft::WRL::ComPtr pShellLink; HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID*)&pShellLink); + IID_PPV_ARGS(&pShellLink)); if (SUCCEEDED(hres)) { // Defines the path to the program executable pShellLink->SetPath((LPCWSTR)exePath.utf16()); @@ -360,13 +361,11 @@ private: pShellLink->SetIconLocation((LPCWSTR)iconPath.utf16(), 0); // Save the shortcut - IPersistFile* pPersistFile = nullptr; - hres = pShellLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile); + Microsoft::WRL::ComPtr pPersistFile; + hres = pShellLink.As(&pPersistFile); if (SUCCEEDED(hres)) { hres = pPersistFile->Save((LPCWSTR)linkPath.utf16(), TRUE); - pPersistFile->Release(); } - pShellLink->Release(); } CoUninitialize(); diff --git a/src/video_core/buffer_cache/buffer.cpp b/src/video_core/buffer_cache/buffer.cpp index 9fc972248..f8afd6991 100644 --- a/src/video_core/buffer_cache/buffer.cpp +++ b/src/video_core/buffer_cache/buffer.cpp @@ -9,10 +9,7 @@ #include "video_core/renderer_vulkan/vk_platform.h" #include "video_core/renderer_vulkan/vk_scheduler.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop namespace VideoCore { diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 102bb6a22..9fa64d5b9 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -12,10 +12,7 @@ #include "video_core/renderer_vulkan/vk_rasterizer.h" #include "video_core/texture_cache/image.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop namespace Vulkan { diff --git a/src/video_core/renderer_vulkan/vk_common.cpp b/src/video_core/renderer_vulkan/vk_common.cpp index 0823fd23d..b19567808 100644 --- a/src/video_core/renderer_vulkan/vk_common.cpp +++ b/src/video_core/renderer_vulkan/vk_common.cpp @@ -5,10 +5,10 @@ // Implement vma functions #define VMA_IMPLEMENTATION -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop +#pragma clang diagnostic pop // Store the dispatch loader here VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index 76d7aea56..c09414a11 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -14,10 +14,7 @@ #include "video_core/renderer_vulkan/vk_instance.h" #include "video_core/renderer_vulkan/vk_platform.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop namespace Vulkan { diff --git a/src/video_core/texture_cache/image.cpp b/src/video_core/texture_cache/image.cpp index c8c7ea18c..bea2ce4ff 100644 --- a/src/video_core/texture_cache/image.cpp +++ b/src/video_core/texture_cache/image.cpp @@ -8,10 +8,7 @@ #include "video_core/renderer_vulkan/vk_scheduler.h" #include "video_core/texture_cache/image.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop namespace VideoCore { diff --git a/src/video_core/texture_cache/tile_manager.cpp b/src/video_core/texture_cache/tile_manager.cpp index 429afcae6..40a1825a2 100644 --- a/src/video_core/texture_cache/tile_manager.cpp +++ b/src/video_core/texture_cache/tile_manager.cpp @@ -15,10 +15,7 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnullability-completeness" #include -#pragma GCC diagnostic pop namespace VideoCore {