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/Host/windows/ConnectionGenericFileWindows.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/Host/windows/ConnectionGenericFileWindows.cpp')
| -rw-r--r-- | lldb/source/Host/windows/ConnectionGenericFileWindows.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp index eebf3d4f633..9743ed48b8e 100644 --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -14,6 +14,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/ConvertUTF.h" using namespace lldb; using namespace lldb_private; @@ -138,7 +139,15 @@ ConnectionGenericFile::Connect(const char *s, Error *error_ptr) // Open the file for overlapped access. If it does not exist, create it. We open it overlapped // so that we can issue asynchronous reads and then use WaitForMultipleObjects to allow the read // to be interrupted by an event object. - m_file = ::CreateFile(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED, NULL); + std::wstring wpath; + if (!llvm::ConvertUTF8toWide(path, wpath)) + { + if (error_ptr) + error_ptr->SetError(1, eErrorTypeGeneric); + return eConnectionStatusError; + } + m_file = ::CreateFileW(wpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, + FILE_FLAG_OVERLAPPED, NULL); if (m_file == INVALID_HANDLE_VALUE) { if (error_ptr) |

