Stamp out tabs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeff Cohen 2005-07-08 05:02:13 +00:00
parent 8f0e8f2047
commit 85c716f83d
2 changed files with 19 additions and 20 deletions

View File

@ -509,7 +509,7 @@ Path::eraseSuffix() {
if (dotpos != std::string::npos) { if (dotpos != std::string::npos) {
if (slashpos == std::string::npos || dotpos > slashpos) { if (slashpos == std::string::npos || dotpos > slashpos) {
path.erase(dotpos, path.size()-dotpos); path.erase(dotpos, path.size()-dotpos);
return true; return true;
} }
} }
return false; return false;

View File

@ -49,7 +49,7 @@ Path::isValid() const {
return false; return false;
rootslash = 2; rootslash = 2;
} }
// Look for a UNC path, and if found adjust our notion of the root slash. // Look for a UNC path, and if found adjust our notion of the root slash.
if (len > 3 && path[0] == '/' && path[1] == '/') { if (len > 3 && path[0] == '/' && path[1] == '/') {
rootslash = path.find('/', 2); rootslash = path.find('/', 2);
@ -63,7 +63,7 @@ Path::isValid() const {
"\027\030\031\032\033\034\035\036\037") "\027\030\031\032\033\034\035\036\037")
!= std::string::npos) != std::string::npos)
return false; return false;
// Remove trailing slash, unless it's a root slash. // Remove trailing slash, unless it's a root slash.
if (len > rootslash+1 && path[len-1] == '/') if (len > rootslash+1 && path[len-1] == '/')
path.erase(--len); path.erase(--len);
@ -157,14 +157,14 @@ static void getPathList(const char*path, std::vector<sys::Path>& Paths) {
at = delim + 1; at = delim + 1;
delim = strchr(at, ';'); delim = strchr(at, ';');
} }
if (*at != 0) if (*at != 0)
if (tmpPath.set(std::string(at))) if (tmpPath.set(std::string(at)))
if (tmpPath.canRead()) if (tmpPath.canRead())
Paths.push_back(tmpPath); Paths.push_back(tmpPath);
} }
void void
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) { Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
Paths.push_back(sys::Path("C:\\WINDOWS\\SYSTEM32")); Paths.push_back(sys::Path("C:\\WINDOWS\\SYSTEM32"));
Paths.push_back(sys::Path("C:\\WINDOWS")); Paths.push_back(sys::Path("C:\\WINDOWS"));
@ -246,7 +246,7 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
return false; return false;
} }
bool bool
Path::isBytecodeFile() const { Path::isBytecodeFile() const {
std::string actualMagic; std::string actualMagic;
if (!getMagicNumber(actualMagic, 4)) if (!getMagicNumber(actualMagic, 4))
@ -364,11 +364,10 @@ Path::getDirectoryContents(std::set<Path>& result) const {
WIN32_FIND_DATA fd; WIN32_FIND_DATA fd;
std::string searchpath = path; std::string searchpath = path;
if (path.size() == 0 || searchpath[path.size()-1] == '/') if (path.size() == 0 || searchpath[path.size()-1] == '/')
searchpath += "*"; searchpath += "*";
else else
searchpath += "/*"; searchpath += "/*";
HANDLE h = FindFirstFile(searchpath.c_str(), &fd); HANDLE h = FindFirstFile(searchpath.c_str(), &fd);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) if (GetLastError() == ERROR_FILE_NOT_FOUND)
@ -414,7 +413,7 @@ Path::appendComponent(const std::string& name) {
std::string save(path); std::string save(path);
if (!path.empty()) { if (!path.empty()) {
size_t last = path.size() - 1; size_t last = path.size() - 1;
if (path[last] != '/') if (path[last] != '/')
path += '/'; path += '/';
} }
path += name; path += name;
@ -453,7 +452,7 @@ Path::eraseSuffix() {
if (dotpos != std::string::npos) { if (dotpos != std::string::npos) {
if (slashpos == std::string::npos || dotpos > slashpos) { if (slashpos == std::string::npos || dotpos > slashpos) {
path.erase(dotpos, path.size()-dotpos); path.erase(dotpos, path.size()-dotpos);
return true; return true;
} }
} }
return false; return false;
@ -466,7 +465,7 @@ Path::createDirectoryOnDisk(bool create_parents) {
char *pathname = reinterpret_cast<char *>(_alloca(len+2)); char *pathname = reinterpret_cast<char *>(_alloca(len+2));
path.copy(pathname, len); path.copy(pathname, len);
pathname[len] = 0; pathname[len] = 0;
// Make sure it ends with a slash. // Make sure it ends with a slash.
if (len == 0 || pathname[len - 1] != '/') { if (len == 0 || pathname[len - 1] != '/') {
pathname[len] = '/'; pathname[len] = '/';
@ -547,7 +546,7 @@ Path::eraseFromDisk(bool remove_contents) const {
return true; return true;
} else /* isDirectory() */ { } else /* isDirectory() */ {
// If it doesn't exist, we're done. // If it doesn't exist, we're done.
if (!exists()) if (!exists())
return true; return true;
char *pathname = reinterpret_cast<char *>(_alloca(path.length()+3)); char *pathname = reinterpret_cast<char *>(_alloca(path.length()+3));
@ -576,8 +575,8 @@ Path::eraseFromDisk(bool remove_contents) const {
if (strcmp(fd.cFileName, "..") == 0) if (strcmp(fd.cFileName, "..") == 0)
continue; continue;
Path aPath(path); Path aPath(path);
aPath.appendComponent(&fd.cFileName[0]); aPath.appendComponent(&fd.cFileName[0]);
list.push_back(aPath); list.push_back(aPath);
} while (FindNextFile(h, &fd)); } while (FindNextFile(h, &fd));
@ -588,7 +587,7 @@ Path::eraseFromDisk(bool remove_contents) const {
ThrowError(path + ": Can't read directory: "); ThrowError(path + ": Can't read directory: ");
} }
for (std::vector<Path>::iterator I = list.begin(); I != list.end(); for (std::vector<Path>::iterator I = list.begin(); I != list.end();
++I) { ++I) {
Path &aPath = *I; Path &aPath = *I;
aPath.eraseFromDisk(true); aPath.eraseFromDisk(true);
@ -637,7 +636,7 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
bool bool
Path::renamePathOnDisk(const Path& newName) { Path::renamePathOnDisk(const Path& newName) {
if (!MoveFile(path.c_str(), newName.c_str())) if (!MoveFile(path.c_str(), newName.c_str()))
ThrowError("Can't move '" + path + ThrowError("Can't move '" + path +
"' to '" + newName.path + "': "); "' to '" + newName.path + "': ");
return true; return true;
} }
@ -693,16 +692,16 @@ Path::setStatusInfoOnDisk(const StatusInfo& si) const {
return true; return true;
} }
void void
sys::CopyFile(const sys::Path &Dest, const sys::Path &Src) { sys::CopyFile(const sys::Path &Dest, const sys::Path &Src) {
// Can't use CopyFile macro defined in Windows.h because it would mess up the // 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. // above line. We use the expansion it would have in a non-UNICODE build.
if (!::CopyFileA(Src.c_str(), Dest.c_str(), false)) if (!::CopyFileA(Src.c_str(), Dest.c_str(), false))
ThrowError("Can't copy '" + Src.toString() + ThrowError("Can't copy '" + Src.toString() +
"' to '" + Dest.toString() + "': "); "' to '" + Dest.toString() + "': ");
} }
void void
Path::makeUnique(bool reuse_current) { Path::makeUnique(bool reuse_current) {
if (reuse_current && !exists()) if (reuse_current && !exists())
return; // File doesn't exist already, just use it! return; // File doesn't exist already, just use it!