mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
Consolidate Win32-specific error formatting
GetErrorReason()'s Win32 implementation does the same thing as Win32ErrorString(int err) from syserror.cpp, so call the latter. Also remove now-unnecessary headers from sock.cpp and less verbose handling of #ifdefs.
This commit is contained in:
@@ -15,11 +15,6 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#endif
|
||||
|
||||
#ifdef USE_POLL
|
||||
#include <poll.h>
|
||||
#endif
|
||||
@@ -416,15 +411,12 @@ void Sock::Close()
|
||||
m_socket = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
std::string NetworkErrorString(int err)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return Win32ErrorString(err);
|
||||
}
|
||||
#else
|
||||
std::string NetworkErrorString(int err)
|
||||
{
|
||||
// On BSD sockets implementations, NetworkErrorString is the same as SysErrorString.
|
||||
return SysErrorString(err);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user