[llvm] r183831 - Remove sys::CopyFile.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jun 12 07:16:52 PDT 2013
Author: rafael
Date: Wed Jun 12 09:16:52 2013
New Revision: 183831
URL: http://llvm.org/viewvc/llvm-project?rev=183831&view=rev
Log:
Remove sys::CopyFile.
Modified:
llvm/trunk/include/llvm/Support/PathV1.h
llvm/trunk/lib/Support/Unix/Path.inc
llvm/trunk/lib/Support/Windows/Path.inc
Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=183831&r1=183830&r2=183831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Wed Jun 12 09:16:52 2013
@@ -592,12 +592,6 @@ namespace sys {
/// @}
};
- /// This function can be used to copy the file specified by Src to the
- /// file specified by Dest. If an error occurs, Dest is removed.
- /// @returns true if an error occurs, false otherwise
- /// @brief Copy one file to another.
- bool CopyFile(const Path& Dest, const Path& Src, std::string* ErrMsg);
-
/// This is the OS-specific path separator: a colon on Unix or a semicolon
/// on Windows.
extern const char PathSeparator;
Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=183831&r1=183830&r2=183831&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Wed Jun 12 09:16:52 2013
@@ -667,53 +667,6 @@ Path::setStatusInfoOnDisk(const FileStat
}
bool
-sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
- int inFile = -1;
- int outFile = -1;
- inFile = ::open(Src.c_str(), O_RDONLY);
- if (inFile == -1)
- return MakeErrMsg(ErrMsg, Src.str() +
- ": can't open source file to copy");
-
- outFile = ::open(Dest.c_str(), O_WRONLY|O_CREAT, 0666);
- if (outFile == -1) {
- ::close(inFile);
- return MakeErrMsg(ErrMsg, Dest.str() +
- ": can't create destination file for copy");
- }
-
- char Buffer[16*1024];
- while (ssize_t Amt = ::read(inFile, Buffer, 16*1024)) {
- if (Amt == -1) {
- if (errno != EINTR && errno != EAGAIN) {
- ::close(inFile);
- ::close(outFile);
- return MakeErrMsg(ErrMsg, Src.str()+": can't read source file");
- }
- } else {
- char *BufPtr = Buffer;
- while (Amt) {
- ssize_t AmtWritten = ::write(outFile, BufPtr, Amt);
- if (AmtWritten == -1) {
- if (errno != EINTR && errno != EAGAIN) {
- ::close(inFile);
- ::close(outFile);
- return MakeErrMsg(ErrMsg, Dest.str() +
- ": can't write destination file");
- }
- } else {
- Amt -= AmtWritten;
- BufPtr += AmtWritten;
- }
- }
- }
- }
- ::close(inFile);
- ::close(outFile);
- return false;
-}
-
-bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
bool Exists;
if (reuse_current && (fs::exists(path, Exists) || !Exists))
Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=183831&r1=183830&r2=183831&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Wed Jun 12 09:16:52 2013
@@ -21,7 +21,6 @@
#include <malloc.h>
// We need to undo a macro defined in Windows.h, otherwise we won't compile:
-#undef CopyFile
#undef GetCurrentDirectory
// Windows happily accepts either forward or backward slashes, though any path
@@ -730,16 +729,6 @@ Path::setStatusInfoOnDisk(const FileStat
return false;
}
-bool
-CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg) {
- // 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))
- return MakeErrMsg(ErrMsg, "Can't copy '" + Src.str() +
- "' to '" + Dest.str() + "': ");
- return false;
-}
-
bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
bool Exists;
More information about the llvm-commits
mailing list