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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162921 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/File.cpp b/source/Host/common/File.cpp
index a84266f..ca0c223 100644
--- a/source/Host/common/File.cpp
+++ b/source/Host/common/File.cpp
@@ -538,7 +538,7 @@
 }
 
 Error
-File::Read (size_t &num_bytes, off_t &offset, DataBufferSP &data_buffer_sp)
+File::Read (size_t &num_bytes, off_t &offset, bool null_terminate, DataBufferSP &data_buffer_sp)
 {
     Error error;
     
@@ -557,7 +557,7 @@
                         num_bytes = bytes_left;
                         
                     std::auto_ptr<DataBufferHeap> data_heap_ap;
-                    data_heap_ap.reset(new DataBufferHeap(num_bytes, '\0'));
+                    data_heap_ap.reset(new DataBufferHeap(num_bytes + (null_terminate ? 1 : 0), '\0'));
                         
                     if (data_heap_ap.get())
                     {