diff options
| author | Zachary Turner <zturner@google.com> | 2016-11-17 21:15:14 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-11-17 21:15:14 +0000 |
| commit | 3165945a419e4882b94f73f005f9ea4d3d10a985 (patch) | |
| tree | f8ecba9330545a9f0fa01053d2d237c46d85319f /lldb/source/Host/windows | |
| parent | ca9d83475e94b3b1649f6f76b4cd6c345ea0404b (diff) | |
| download | bcm5719-llvm-3165945a419e4882b94f73f005f9ea4d3d10a985.tar.gz bcm5719-llvm-3165945a419e4882b94f73f005f9ea4d3d10a985.zip | |
Convert Platform, Process, and Connection functions to StringRef.
All tests pass on Linux and Windows.
llvm-svn: 287259
Diffstat (limited to 'lldb/source/Host/windows')
| -rw-r--r-- | lldb/source/Host/windows/ConnectionGenericFileWindows.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp index 5a6637d5385..d13eb10c620 100644 --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -92,17 +92,17 @@ bool ConnectionGenericFile::IsConnected() const { return m_file && (m_file != INVALID_HANDLE_VALUE); } -lldb::ConnectionStatus ConnectionGenericFile::Connect(const char *s, +lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, Error *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf("%p ConnectionGenericFile::Connect (url = '%s')", - static_cast<void *>(this), s); + static_cast<void *>(this), path.str().c_str()); - if (strstr(s, "file://") != s) { + if (!path.consume_front("file://")) { if (error_ptr) error_ptr->SetErrorStringWithFormat("unsupported connection URL: '%s'", - s); + path.str().c_str()); return eConnectionStatusError; } @@ -112,13 +112,10 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(const char *s, return status; } - // file://PATH - const char *path = s + strlen("file://"); // 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. + // 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. std::wstring wpath; if (!llvm::ConvertUTF8toWide(path, wpath)) { if (error_ptr) @@ -135,7 +132,7 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(const char *s, } m_owns_file = true; - m_uri.assign(s); + m_uri.assign(path); return eConnectionStatusSuccess; } |

