summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiaye Wu <t-jiaywu@microsoft.com>2018-12-12 15:05:14 +0800
committerVladislav Vaintroub <wlad@mariadb.com>2018-12-12 12:36:28 +0100
commit9eadef013e77e1622c7c527a1cdfa6dcc2e906dd (patch)
tree37253df7a70db51a251641ae820c0ab734c49508
parentd956709b4be67f96a869d0854c75d10cd502172b (diff)
downloadmariadb-git-9eadef013e77e1622c7c527a1cdfa6dcc2e906dd.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' ```
-rw-r--r--include/my_global.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 816c9dd87c6..fd31de115c8 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1077,7 +1077,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;
}