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:
John Moffett
2022-12-08 13:45:51 -05:00
parent c95a4432d7
commit 5408a55fc8
2 changed files with 3 additions and 16 deletions

View File

@@ -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
}