Fix MinGW issues, take 2.

This commit is contained in:
Victor Zverovich 2014-07-09 09:45:18 -07:00
parent 0ffcec0090
commit 9c47f3e057

View File

@ -301,7 +301,12 @@ int fmt::internal::StrError(
if (message == buffer && strlen(buffer) == buffer_size - 1) if (message == buffer && strlen(buffer) == buffer_size - 1)
result = ERANGE; result = ERANGE;
buffer = message; buffer = message;
#elif defined(_WIN32) && !defined(__MINGW32__) #elif __MINGW32__
errno = 0;
(void)buffer_size;
buffer = strerror(error_code);
result = errno;
#elif _WIN32
result = strerror_s(buffer, buffer_size, error_code); result = strerror_s(buffer, buffer_size, error_code);
// If the buffer is full then the message is probably truncated. // If the buffer is full then the message is probably truncated.
if (result == 0 && std::strlen(buffer) == buffer_size - 1) if (result == 0 && std::strlen(buffer) == buffer_size - 1)