chore(build): containers, toolchains and portability fixes
This commit is contained in:
1 parent
774df0fd1e
commit
5a74233a4d
1 file changed
+6
-10
@@ -209,22 +209,18 @@ private:
|
||||
|
||||
[[nodiscard]] inline std::string win32_message(DWORD error)
|
||||
{
|
||||
char* buffer = nullptr;
|
||||
std::array<char, 512> 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<char*>(&buffer),
|
||||
0,
|
||||
buffer.data(),
|
||||
static_cast<DWORD>(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() == '.')) {
|
||||
|
||||
Reference in new issue
Block a user