diff options
author | Jiaye Wu <t-jiaywu@microsoft.com> | 2018-12-11 21:17:39 +0800 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-12-11 17:01:18 +0100 |
commit | 8dc460b844dcb8a8ef70396bfaf932010076b9a3 (patch) | |
tree | 1948ffceb3d5fb557fefff7954e6a661a67677ba /include/my_global.h | |
parent | 1b31d8852c00b4bab6e6fe179b97db45ccb8d535 (diff) | |
download | mariadb-git-8dc460b844dcb8a8ef70396bfaf932010076b9a3.tar.gz |
Fix UNICODE issue of dlerror()
Current implementation is conflicting. If `UNICODE` is defined, `FormatMessage()` will be `FormatMessageW()`, and variable `win_errormsg` with type `char` can not be passed to it, which should be changed to `TCHAR` instead. Since we don't use UNICODE here, we can use `FormatMessageA()` directly to avoid conversion error.
```
my_global.h(1092): error C2664: 'DWORD FormatMessageW(D
WORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list *)' : cannot convert argument 5 from 'char [2048]' to 'LPWSTR'
```
Diffstat (limited to 'include/my_global.h')
-rw-r--r-- | include/my_global.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/my_global.h b/include/my_global.h index ea438e7171f..69b91f8b870 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1068,7 +1068,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */ static inline char *dlerror(void) { static char win_errormsg[2048]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), 0, win_errormsg, 2048, NULL); return win_errormsg; } |