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)
|
[[nodiscard]] inline std::string win32_message(DWORD error)
|
||||||
{
|
{
|
||||||
char* buffer = nullptr;
|
std::array<char, 512> buffer{};
|
||||||
const DWORD length = ::FormatMessageA(
|
const DWORD length = ::FormatMessageA(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
|
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
||||||
nullptr,
|
nullptr,
|
||||||
error,
|
error,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
reinterpret_cast<char*>(&buffer),
|
buffer.data(),
|
||||||
0,
|
static_cast<DWORD>(buffer.size()),
|
||||||
nullptr);
|
nullptr);
|
||||||
std::string message = (length != 0 && buffer != nullptr)
|
std::string message = length != 0
|
||||||
? std::string{buffer, length}
|
? std::string{buffer.data(), length}
|
||||||
: std::string{"unknown error"};
|
: std::string{"unknown error"};
|
||||||
if (buffer != nullptr) {
|
|
||||||
::LocalFree(buffer);
|
|
||||||
}
|
|
||||||
while (!message.empty() &&
|
while (!message.empty() &&
|
||||||
(message.back() == '\n' || message.back() == '\r' ||
|
(message.back() == '\n' || message.back() == '\r' ||
|
||||||
message.back() == ' ' || message.back() == '.')) {
|
message.back() == ' ' || message.back() == '.')) {
|
||||||
|
|||||||
Reference in new issue
Block a user