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