From 8edd7d54cf1f7021108a42b2a12dd90f10836b40 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 20 Jan 2024 13:02:00 +0100 Subject: [PATCH] fs: fix warning. fix size argument in report_fatal_error --- Utilities/File.cpp | 5 +++-- rpcs3/main.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Utilities/File.cpp b/Utilities/File.cpp index 6b0a5f7c55..6414f6981e 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -1906,8 +1906,9 @@ std::string fs::get_executable_path() static const std::string s_exe_path = [] { #if defined(_WIN32) - std::vector buffer(32767); - GetModuleFileNameW(nullptr, buffer.data(), buffer.size()); + constexpr DWORD size = 32767; + std::vector buffer(size); + GetModuleFileNameW(nullptr, buffer.data(), size); return wchar_to_utf8(buffer.data()); #elif defined(__APPLE__) char bin_path[PATH_MAX]; diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 55451a5e09..349db34673 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -187,10 +187,11 @@ LOG_CHANNEL(q_debug, "QDEBUG"); } #ifdef _WIN32 - wchar_t buffer[32767]; - GetModuleFileNameW(nullptr, buffer, sizeof(buffer) / 2); + constexpr DWORD size = 32767; + std::vector buffer(size); + GetModuleFileNameW(nullptr, buffer.data(), size); const std::wstring arg(text.cbegin(), text.cend()); // ignore unicode for now - _wspawnl(_P_WAIT, buffer, buffer, L"--error", arg.c_str(), nullptr); + _wspawnl(_P_WAIT, buffer.data(), buffer.data(), L"--error", arg.c_str(), nullptr); #else pid_t pid; std::vector data(text.data(), text.data() + text.size() + 1);