diff options
Diffstat (limited to 'src/common/misc.cpp')
| -rw-r--r-- | src/common/misc.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/common/misc.cpp b/src/common/misc.cpp index d2a049b63..7be2235b0 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cstddef> | 5 | #include <cstddef> |
| 6 | |||
| 7 | #ifdef _WIN32 | 6 | #ifdef _WIN32 |
| 8 | #include <windows.h> | 7 | #include <windows.h> |
| 9 | #else | 8 | #else |
| @@ -12,23 +11,21 @@ | |||
| 12 | #endif | 11 | #endif |
| 13 | 12 | ||
| 14 | // Neither Android nor OS X support TLS | 13 | // Neither Android nor OS X support TLS |
| 15 | #if defined(__APPLE__) || (ANDROID && __clang__) | 14 | #if defined(__APPLE__) || (ANDROID && __clang__) |
| 16 | #define __thread | 15 | #define __thread |
| 17 | #endif | 16 | #endif |
| 18 | 17 | ||
| 19 | // Generic function to get last error message. | 18 | // Generic function to get last error message. |
| 20 | // Call directly after the command or use the error num. | 19 | // Call directly after the command or use the error num. |
| 21 | // This function might change the error code. | 20 | // This function might change the error code. |
| 22 | const char* GetLastErrorMsg() | 21 | const char* GetLastErrorMsg() { |
| 23 | { | ||
| 24 | static const size_t buff_size = 255; | 22 | static const size_t buff_size = 255; |
| 25 | 23 | ||
| 26 | #ifdef _WIN32 | 24 | #ifdef _WIN32 |
| 27 | static __declspec(thread) char err_str[buff_size] = {}; | 25 | static __declspec(thread) char err_str[buff_size] = {}; |
| 28 | 26 | ||
| 29 | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), | 27 | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), |
| 30 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | 28 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err_str, buff_size, nullptr); |
| 31 | err_str, buff_size, nullptr); | ||
| 32 | #else | 29 | #else |
| 33 | static __thread char err_str[buff_size] = {}; | 30 | static __thread char err_str[buff_size] = {}; |
| 34 | 31 | ||