fs: fix warning. fix size argument in report_fatal_error

This commit is contained in:
Megamouse 2024-01-20 13:02:00 +01:00
parent f19744ae88
commit 8edd7d54cf
2 changed files with 7 additions and 5 deletions

View File

@ -1906,8 +1906,9 @@ std::string fs::get_executable_path()
static const std::string s_exe_path = []
{
#if defined(_WIN32)
std::vector<wchar_t> buffer(32767);
GetModuleFileNameW(nullptr, buffer.data(), buffer.size());
constexpr DWORD size = 32767;
std::vector<wchar_t> buffer(size);
GetModuleFileNameW(nullptr, buffer.data(), size);
return wchar_to_utf8(buffer.data());
#elif defined(__APPLE__)
char bin_path[PATH_MAX];

View File

@ -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<wchar_t> 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<char> data(text.data(), text.data() + text.size() + 1);