diff options
author | Zachary Turner <zturner@google.com> | 2016-03-22 17:58:09 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-03-22 17:58:09 +0000 |
commit | 190fadcdb245707011e31b69a24bd6bba7c93ab5 (patch) | |
tree | 4448dbd3327aa3e5244a448d70ceb1b7a2f45be1 /lldb/source/Core/ConnectionSharedMemory.cpp | |
parent | 6feeb6554e271e308238750078b178ff1e83c15c (diff) | |
download | bcm5719-llvm-190fadcdb245707011e31b69a24bd6bba7c93ab5.tar.gz bcm5719-llvm-190fadcdb245707011e31b69a24bd6bba7c93ab5.zip |
Unicode support on Win32.
Win32 API calls that are Unicode aware require wide character
strings, but LLDB uses UTF8 everywhere. This patch does conversions
wherever necessary when passing strings into and out of Win32 API
calls.
Patch by Cameron
Differential Revision: http://reviews.llvm.org/D17107
Reviewed By: zturner, amccarth
llvm-svn: 264074
Diffstat (limited to 'lldb/source/Core/ConnectionSharedMemory.cpp')
-rw-r--r-- | lldb/source/Core/ConnectionSharedMemory.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lldb/source/Core/ConnectionSharedMemory.cpp b/lldb/source/Core/ConnectionSharedMemory.cpp index bf64b29d063..707644d36b1 100644 --- a/lldb/source/Core/ConnectionSharedMemory.cpp +++ b/lldb/source/Core/ConnectionSharedMemory.cpp @@ -32,6 +32,8 @@ #include "lldb/Core/Communication.h" #include "lldb/Core/Log.h" +#include "llvm/Support/ConvertUTF.h" + using namespace lldb; using namespace lldb_private; @@ -135,18 +137,18 @@ ConnectionSharedMemory::Open (bool create, const char *name, size_t size, Error m_name.assign (name); #ifdef _WIN32 - HANDLE handle; - if (create) { - handle = CreateFileMapping( - INVALID_HANDLE_VALUE, - nullptr, - PAGE_READWRITE, - llvm::Hi_32(size), - llvm::Lo_32(size), - name); + HANDLE handle = INVALID_HANDLE_VALUE; + std::wstring wname; + if (llvm::ConvertUTF8toWide(name, wname)) + { + if (create) + { + handle = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, llvm::Hi_32(size), + llvm::Lo_32(size), wname.c_str()); + } + else + handle = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, wname.c_str()); } - else - handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name); m_fd = _open_osfhandle((intptr_t)handle, 0); #else |