From 5a74233a4d9e663267e05898135570dc806e1095 Mon Sep 17 00:00:00 2001 From: Aleksey Selihov <1+faumaray@noreply@void.com> Date: Thu, 3 Dec 2026 08:10:02 +0000 Subject: [PATCH] chore(build): containers, toolchains and portability fixes --- include/Void/System/Path.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/Void/System/Path.hpp b/include/Void/System/Path.hpp index 9fcfedc..dc68e10 100644 --- a/include/Void/System/Path.hpp +++ b/include/Void/System/Path.hpp @@ -209,22 +209,18 @@ private: [[nodiscard]] inline std::string win32_message(DWORD error) { - char* buffer = nullptr; + std::array buffer{}; const DWORD length = ::FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - reinterpret_cast(&buffer), - 0, + buffer.data(), + static_cast(buffer.size()), nullptr); - std::string message = (length != 0 && buffer != nullptr) - ? std::string{buffer, length} + std::string message = length != 0 + ? std::string{buffer.data(), length} : std::string{"unknown error"}; - if (buffer != nullptr) { - ::LocalFree(buffer); - } while (!message.empty() && (message.back() == '\n' || message.back() == '\r' || message.back() == ' ' || message.back() == '.')) {