diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-21 17:07:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 17:07:48 +0200 |
commit | 1100b04b59b461f1a2cc3dfe7b53b5473daa7992 (patch) | |
tree | ef38a4a731e0c03c6f923708bac0249560ab611f /src/OSSupport/Errors.cpp | |
parent | Resets ticks alive on death (#5197) (diff) | |
download | cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar.gz cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar.bz2 cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar.lz cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar.xz cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.tar.zst cuberite-1100b04b59b461f1a2cc3dfe7b53b5473daa7992.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/Errors.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/OSSupport/Errors.cpp b/src/OSSupport/Errors.cpp deleted file mode 100644 index df94d34da..000000000 --- a/src/OSSupport/Errors.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -#include "Globals.h" - -#include "Errors.h" - -AString GetOSErrorString( int a_ErrNo) -{ - char buffer[ 1024 ]; - AString Out; - - #ifdef _WIN32 - - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, a_ErrNo, 0, buffer, ARRAYCOUNT(buffer), nullptr); - Printf(Out, "%d: %s", a_ErrNo, buffer); - if (!Out.empty() && (Out[Out.length() - 1] == '\n')) - { - Out.erase(Out.length() - 2); - } - return Out; - - #else // _WIN32 - - // According to https://linux.die.net/man/3/strerror_r there are two versions of strerror_r(): - - #if defined(__GLIBC__) && defined( _GNU_SOURCE) // GNU version of strerror_r() - - char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer)); - if (res != nullptr) - { - Printf(Out, "%d: %s", a_ErrNo, res); - return Out; - } - - #else // XSI version of strerror_r(): - - int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer)); - if (res == 0) - { - Printf(Out, "%d: %s", a_ErrNo, buffer); - return Out; - } - - #endif // strerror_r() version - - else - { - Printf(Out, "Error %d while getting error string for error #%d!", errno, a_ErrNo); - return Out; - } - - #endif // else _WIN32 -} - |