diff --git a/boost_1_61_0/boost/iostreams/detail/system_failure.hpp b/boost_1_61_0/boost/iostreams/detail/system_failure.hpp
index 7d86eaf..e658016 100644
|
a
|
b
|
|
| 21 | 21 | #include <boost/throw_exception.hpp> |
| 22 | 22 | #include <boost/iostreams/detail/config/windows_posix.hpp> |
| 23 | 23 | #include <boost/iostreams/detail/ios.hpp> // failure. |
| | 24 | #include <boost/system/error_code.hpp> |
| 24 | 25 | |
| 25 | 26 | #if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__LIBCOMO__) |
| 26 | 27 | namespace std { using ::strlen; } |
| … |
… |
|
| 39 | 40 | inline BOOST_IOSTREAMS_FAILURE system_failure(const char* msg) |
| 40 | 41 | { |
| 41 | 42 | std::string result; |
| | 43 | result += msg; |
| 42 | 44 | #ifdef BOOST_IOSTREAMS_WINDOWS |
| 43 | 45 | DWORD err; |
| 44 | | LPVOID lpMsgBuf; |
| 45 | | if ( (err = ::GetLastError()) != NO_ERROR && |
| 46 | | ::FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 47 | | FORMAT_MESSAGE_FROM_SYSTEM, |
| 48 | | NULL, |
| 49 | | err, |
| 50 | | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 51 | | (LPSTR) &lpMsgBuf, |
| 52 | | 0, |
| 53 | | NULL ) != 0 ) |
| 54 | | { |
| 55 | | result.reserve(std::strlen(msg) + 2 + std::strlen((LPSTR)lpMsgBuf)); |
| 56 | | result.append(msg); |
| 57 | | result.append(": "); |
| 58 | | result.append((LPSTR) lpMsgBuf); |
| 59 | | ::LocalFree(lpMsgBuf); |
| 60 | | } else { |
| 61 | | result += msg; |
| 62 | | } |
| | 46 | if ( (err = ::GetLastError()) != NO_ERROR ) |
| 63 | 47 | #else |
| 64 | | const char* system_msg = errno ? strerror(errno) : ""; |
| 65 | | result.reserve(std::strlen(msg) + 2 + std::strlen(system_msg)); |
| 66 | | result.append(msg); |
| 67 | | result.append(": "); |
| 68 | | result.append(system_msg); |
| 69 | | #endif |
| | 48 | int err = errno; |
| | 49 | if ( err ) |
| | 50 | #endif |
| | 51 | { |
| | 52 | result.append(": "); |
| | 53 | result.append(boost::system::get_system_category().message(err)); |
| | 54 | } |
| 70 | 55 | return BOOST_IOSTREAMS_FAILURE(result); |
| 71 | 56 | } |
| 72 | 57 | |
diff --git a/boost_1_61_0/boost/system/detail/error_code.ipp b/boost_1_61_0/boost/system/detail/error_code.ipp
index 71c60f6..64b4451 100644
|
a
|
b
|
|
| 368 | 368 | |
| 369 | 369 | std::string system_error_category::message( int ev ) const |
| 370 | 370 | { |
| 371 | | #if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS) |
| | 371 | #if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS) || defined(BOOST_WINDOWS_ERRORS_IN_UTF8) |
| 372 | 372 | std::wstring buf(128, wchar_t()); |
| 373 | 373 | for (;;) |
| 374 | 374 | { |
| … |
… |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| | 401 | # ifdef BOOST_WINDOWS_ERRORS_IN_UTF8 |
| | 402 | UINT cp = CP_UTF8; |
| | 403 | # else |
| | 404 | UINT cp = CP_ACP; |
| | 405 | # endif |
| 401 | 406 | int num_chars = (buf.size() + 1) * 2; |
| 402 | 407 | LPSTR narrow_buffer = (LPSTR)_alloca( num_chars ); |
| 403 | | if (::WideCharToMultiByte(CP_ACP, 0, buf.c_str(), -1, narrow_buffer, num_chars, NULL, NULL) == 0) |
| | 408 | if (::WideCharToMultiByte(cp, 0, buf.c_str(), -1, narrow_buffer, num_chars, NULL, NULL) == 0) |
| 404 | 409 | { |
| 405 | 410 | return std::string("Unknown error"); |
| 406 | 411 | } |