[llvm-commits] CVS: llvm/lib/System/Win32/Path.cpp

Jeff Cohen jeffc at jolt-lang.org
Thu Dec 23 18:38:45 PST 2004



Changes in directory llvm/lib/System/Win32:

Path.cpp updated: 1.22 -> 1.23
---
Log message:

Fix VC++ compilation error

---
Diffs of the changes:  (+7 -2)

Index: llvm/lib/System/Win32/Path.cpp
diff -u llvm/lib/System/Win32/Path.cpp:1.22 llvm/lib/System/Win32/Path.cpp:1.23
--- llvm/lib/System/Win32/Path.cpp:1.22	Thu Dec 23 16:14:32 2004
+++ llvm/lib/System/Win32/Path.cpp	Thu Dec 23 20:38:34 2004
@@ -23,6 +23,9 @@
 #include <fstream>
 #include <malloc.h>
 
+// We need to undo a macro defined in Windows.h, otherwise we won't compile:
+#undef CopyFile
+
 static void FlipBackSlashes(std::string& s) {
   for (size_t i = 0; i < s.size(); i++)
     if (s[i] == '\\')
@@ -574,13 +577,15 @@
 
 void 
 sys::CopyFile(const sys::Path &Dest, const sys::Path &Src) {
-  if (!::CopyFile(Src.c_str(), Dest.c_str(), false))
+  // Can't use CopyFile macro defined in Windows.h because it would mess up the
+  // above line.  We use the expansion it would have in a non-UNICODE build.
+  if (!::CopyFileA(Src.c_str(), Dest.c_str(), false))
     ThrowError("Can't copy '" + Src.toString() + 
                "' to '" + Dest.toString() + "'");
 }
 
 void 
-Path::makeUnique( bool reuse_current ) {
+Path::makeUnique(bool reuse_current) {
   if (reuse_current && !exists())
     return; // File doesn't exist already, just use it!
 






More information about the llvm-commits mailing list