mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Common/Network: Use StrErrorWrapper
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "Common/BitUtils.h"
|
#include "Common/BitUtils.h"
|
||||||
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/Random.h"
|
#include "Common/Random.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
@ -551,23 +552,14 @@ const char* DecodeNetworkError(s32 error_code)
|
|||||||
{
|
{
|
||||||
thread_local char buffer[1024];
|
thread_local char buffer[1024];
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(ANDROID) || \
|
|
||||||
defined(__APPLE__)
|
|
||||||
#define IS_BSD_STRERROR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
|
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||||
FORMAT_MESSAGE_MAX_WIDTH_MASK,
|
FORMAT_MESSAGE_MAX_WIDTH_MASK,
|
||||||
nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
|
nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
|
||||||
sizeof(buffer), nullptr);
|
sizeof(buffer), nullptr);
|
||||||
return buffer;
|
return buffer;
|
||||||
#elif defined(IS_BSD_STRERROR) || \
|
|
||||||
((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
|
|
||||||
strerror_r(error_code, buffer, sizeof(buffer));
|
|
||||||
return buffer;
|
|
||||||
#else
|
#else
|
||||||
return strerror_r(error_code, buffer, sizeof(buffer));
|
return Common::StrErrorWrapper(error_code, buffer, sizeof(buffer));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user