summaryrefslogtreecommitdiffstats
path: root/source/API/SBFileSpec.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
committeremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
commit8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch)
tree3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /source/API/SBFileSpec.cpp
parentd61b076ede88b56f3372a55e7d1eac6a9d717120 (diff)
downloadFreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip
FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'source/API/SBFileSpec.cpp')
-rw-r--r--source/API/SBFileSpec.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 8d63fc5..dd7435d 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -93,9 +93,8 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
{
llvm::SmallString<64> result(src_path);
lldb_private::FileSpec::Resolve (result);
- size_t result_length = std::min(dst_len-1, result.size());
- ::strncpy(dst_path, result.c_str(), result_length + 1);
- return result_length;
+ ::snprintf(dst_path, dst_len, "%s", result.c_str());
+ return std::min(dst_len-1, result.size());
}
const char *
@@ -120,18 +119,19 @@ SBFileSpec::GetFilename() const
const char *
SBFileSpec::GetDirectory() const
{
- const char *s = m_opaque_ap->GetDirectory().AsCString();
+ FileSpec directory{*m_opaque_ap};
+ directory.GetFilename().Clear();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (s)
+ if (directory)
log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"",
- static_cast<void*>(m_opaque_ap.get()), s);
+ static_cast<void*>(m_opaque_ap.get()), directory.GetCString());
else
log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL",
static_cast<void*>(m_opaque_ap.get()));
}
- return s;
+ return directory.GetCString();
}
void
OpenPOWER on IntegriCloud