Support/FileSystem: Fix copy_file implementation to use toNullTerminatedStringRef
authorMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 1 Dec 2010 20:37:42 +0000 (20:37 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 1 Dec 2010 20:37:42 +0000 (20:37 +0000)
instead of toStringRef. The file system APIs need c strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120601 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Unix/PathV2.inc
lib/Support/Windows/PathV2.inc

index d12cd1647ede708ad787a8917c76e8f9f3efd3f1..0fa4b87cff2e2fc75e1c13ede489239c7787b98c 100644 (file)
@@ -71,8 +71,8 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) {
  // Get arguments.
   SmallString<128> from_storage;
   SmallString<128> to_storage;
-  StringRef f = from.toStringRef(from_storage);
-  StringRef t = to.toStringRef(to_storage);
+  StringRef f = from.toNullTerminatedStringRef(from_storage);
+  StringRef t = to.toNullTerminatedStringRef(to_storage);
 
   const size_t buf_sz = 32768;
   char buffer[buf_sz];
index cb80731c1c3cd9afce6dea76d421ce2abbf73248..b1f8ae00d3d197316acc140c2f42bfcd133bf733 100644 (file)
@@ -104,8 +104,8 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) {
   // Get arguments.
   SmallString<128> from_storage;
   SmallString<128> to_storage;
-  StringRef f = from.toStringRef(from_storage);
-  StringRef t = to.toStringRef(to_storage);
+  StringRef f = from.toNullTerminatedStringRef(from_storage);
+  StringRef t = to.toNullTerminatedStringRef(to_storage);
 
   // Convert to utf-16.
   SmallVector<wchar_t, 128> wide_from;