diff options
author | Greg Clayton <gclayton@apple.com> | 2012-08-30 18:15:10 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-08-30 18:15:10 +0000 |
commit | 0b0b512fd6eaa15626d0b1caad24ae66a79e8408 (patch) | |
tree | ec79472f787c96799b79d9d0556c20bf7e477278 /lldb/source/Interpreter/OptionValueFileSpec.cpp | |
parent | 738ea2590ffde414777efe26bffd27d97f5cc351 (diff) | |
download | llvm-0b0b512fd6eaa15626d0b1caad24ae66a79e8408.zip llvm-0b0b512fd6eaa15626d0b1caad24ae66a79e8408.tar.gz llvm-0b0b512fd6eaa15626d0b1caad24ae66a79e8408.tar.bz2 |
OptionValueFileSpec had an accessor to read the contents of the file and return the data. This can end up being used to get the string contents of a text file and could end up not being NULL terminated. I added accessors to get the file contents raw, or with a null terminator. Added the needed calls to make this happen in the FileSpec and File classes.
llvm-svn: 162921
Diffstat (limited to 'lldb/source/Interpreter/OptionValueFileSpec.cpp')
-rw-r--r-- | lldb/source/Interpreter/OptionValueFileSpec.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 3a1f26d..0360875 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -114,10 +114,15 @@ OptionValueFileSpec::AutoComplete (CommandInterpreter &interpreter, const lldb::DataBufferSP & -OptionValueFileSpec::GetFileContents() +OptionValueFileSpec::GetFileContents(bool null_terminate) { if (!m_data_sp && m_current_value) - m_data_sp = m_current_value.ReadFileContents(); + { + if (null_terminate) + m_data_sp = m_current_value.ReadFileContentsAsCString(); + else + m_data_sp = m_current_value.ReadFileContents(); + } return m_data_sp; } |