diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-11 00:14:15 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-11 00:14:15 +0000 |
commit | 1fce09125cb46c91407668ca29915c450a482811 (patch) | |
tree | 9a221a439d7dc3ec57b8fa6cf345b90b6198d883 /lib | |
parent | 357cf5439a5e0ad49245dc75798b6490d67834fd (diff) | |
download | external_llvm-1fce09125cb46c91407668ca29915c450a482811.zip external_llvm-1fce09125cb46c91407668ca29915c450a482811.tar.gz external_llvm-1fce09125cb46c91407668ca29915c450a482811.tar.bz2 |
Path::get -> Path::toString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Archive/Archive.cpp | 14 | ||||
-rw-r--r-- | lib/Archive/ArchiveReader.cpp | 14 | ||||
-rw-r--r-- | lib/Archive/ArchiveWriter.cpp | 18 | ||||
-rw-r--r-- | lib/Bytecode/Archive/Archive.cpp | 14 | ||||
-rw-r--r-- | lib/Bytecode/Archive/ArchiveReader.cpp | 14 | ||||
-rw-r--r-- | lib/Bytecode/Archive/ArchiveWriter.cpp | 18 | ||||
-rw-r--r-- | lib/Bytecode/Reader/ReaderWrappers.cpp | 3 | ||||
-rw-r--r-- | lib/System/Unix/MappedFile.cpp | 8 | ||||
-rw-r--r-- | lib/System/Unix/MappedFile.inc | 8 | ||||
-rw-r--r-- | lib/System/Unix/Path.cpp | 15 | ||||
-rw-r--r-- | lib/System/Unix/Path.inc | 15 | ||||
-rw-r--r-- | lib/System/Unix/Program.cpp | 11 | ||||
-rw-r--r-- | lib/System/Unix/Program.inc | 11 | ||||
-rw-r--r-- | lib/System/Unix/Signals.cpp | 2 | ||||
-rw-r--r-- | lib/System/Unix/Signals.inc | 2 |
15 files changed, 92 insertions, 75 deletions
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp index 8e40590..2d79bd6 100644 --- a/lib/Archive/Archive.cpp +++ b/lib/Archive/Archive.cpp @@ -26,7 +26,7 @@ ArchiveMember::getMemberSize() const { // If it has a long filename, include the name length if (hasLongFilename()) - result += path.get().length() + 1; + result += path.toString().length() + 1; // If its now odd lengthed, include the padding byte if (result % 2 != 0 ) @@ -66,38 +66,38 @@ void ArchiveMember::replaceWith(const sys::Path& newFile) { path = newFile; // SVR4 symbol tables have an empty name - if (path.get() == ARFILE_SVR4_SYMTAB_NAME) + if (path.toString() == ARFILE_SVR4_SYMTAB_NAME) flags |= SVR4SymbolTableFlag; else flags &= ~SVR4SymbolTableFlag; // BSD4.4 symbol tables have a special name - if (path.get() == ARFILE_BSD4_SYMTAB_NAME) + if (path.toString() == ARFILE_BSD4_SYMTAB_NAME) flags |= BSD4SymbolTableFlag; else flags &= ~BSD4SymbolTableFlag; // LLVM symbol tables have a very specific name - if (path.get() == ARFILE_LLVM_SYMTAB_NAME) + if (path.toString() == ARFILE_LLVM_SYMTAB_NAME) flags |= LLVMSymbolTableFlag; else flags &= ~LLVMSymbolTableFlag; // String table name - if (path.get() == ARFILE_STRTAB_NAME) + if (path.toString() == ARFILE_STRTAB_NAME) flags |= StringTableFlag; else flags &= ~StringTableFlag; // If it has a slash then it has a path - bool hasSlash = path.get().find('/') != std::string::npos; + bool hasSlash = path.toString().find('/') != std::string::npos; if (hasSlash) flags |= HasPathFlag; else flags &= ~HasPathFlag; // If it has a slash or its over 15 chars then its a long filename format - if (hasSlash || path.get().length() > 15) + if (hasSlash || path.toString().length() > 15) flags |= HasLongFilenameFlag; else flags &= ~HasLongFilenameFlag; diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index 34b36a6..b00487f 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -295,8 +295,8 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) { for (iterator I=begin(), E=end(); I != E; ++I) { if (I->isBytecode() || I->isCompressedBytecode()) { - std::string FullMemberName = archPath.get() + - "(" + I->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + + "(" + I->getPath().toString() + ")"; Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(), I->getSize(), FullMemberName, ErrMessage); if (!M) @@ -407,8 +407,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) { ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); // Now, load the bytecode module to get the ModuleProvider - std::string FullMemberName = archPath.get() + "(" + - mbr->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + "(" + + mbr->getPath().toString() + ")"; ModuleProvider* mp = getBytecodeBufferModuleProvider( (const unsigned char*) mbr->getData(), mbr->getSize(), FullMemberName, 0); @@ -446,8 +446,8 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols, if (mbr->isBytecode() || mbr->isCompressedBytecode()) { // Get the symbols std::vector<std::string> symbols; - std::string FullMemberName = archPath.get() + "(" + - mbr->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + "(" + + mbr->getPath().toString() + ")"; ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At, mbr->getSize(), FullMemberName, symbols); @@ -462,7 +462,7 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols, modules.insert(std::make_pair(offset, std::make_pair(MP, mbr))); } else { throw std::string("Can't parse bytecode member: ") + - mbr->getPath().get(); + mbr->getPath().toString(); } } diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp index 21be628..64c2567 100644 --- a/lib/Archive/ArchiveWriter.cpp +++ b/lib/Archive/ArchiveWriter.cpp @@ -94,7 +94,7 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr, memcpy(hdr.date,buffer,12); // Get rid of trailing blanks in the name - std::string mbrPath = mbr.getPath().get(); + std::string mbrPath = mbr.getPath().toString(); size_t mbrLen = mbrPath.length(); while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') { mbrPath.erase(mbrLen-1,1); @@ -162,10 +162,10 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where) { mbr->path.getStatusInfo(mbr->info); unsigned flags = 0; - bool hasSlash = filePath.get().find('/') != std::string::npos; + bool hasSlash = filePath.toString().find('/') != std::string::npos; if (hasSlash) flags |= ArchiveMember::HasPathFlag; - if (hasSlash || filePath.get().length() > 15) + if (hasSlash || filePath.toString().length() > 15) flags |= ArchiveMember::HasLongFilenameFlag; std::string magic; mbr->path.getMagicNumber(magic,4); @@ -212,7 +212,8 @@ Archive::writeMember( if (CreateSymbolTable && (member.isBytecode() || member.isCompressedBytecode())) { std::vector<std::string> symbols; - std::string FullMemberName = archPath.get() + "(" + member.getPath().get() + std::string FullMemberName = archPath.toString() + "(" + + member.getPath().toString() + ")"; ModuleProvider* MP = GetBytecodeSymbols( (const unsigned char*)data,fSize,FullMemberName, symbols); @@ -235,7 +236,7 @@ Archive::writeMember( delete MP; } else { throw std::string("Can't parse bytecode member: ") + - member.getPath().get(); + member.getPath().toString(); } } @@ -281,7 +282,8 @@ Archive::writeMember( // Write the long filename if its long if (writeLongName) { - ARFile.write(member.getPath().get().data(),member.getPath().get().length()); + ARFile.write(member.getPath().toString().data(), + member.getPath().toString().length()); } // Make sure we write the compressed bytecode magic number if we should. @@ -378,7 +380,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Check for errors opening or creating archive file. if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) { - throw std::string("Error opening archive file: ") + archPath.get(); + throw std::string("Error opening archive file: ") + archPath.toString(); } // If we're creating a symbol table, reset it now @@ -414,7 +416,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Open the final file to write and check it. std::ofstream FinalFile(archPath.c_str()); if ( !FinalFile.is_open() || FinalFile.bad() ) { - throw std::string("Error opening archive file: ") + archPath.get(); + throw std::string("Error opening archive file: ") + archPath.toString(); } // Write the file magic number diff --git a/lib/Bytecode/Archive/Archive.cpp b/lib/Bytecode/Archive/Archive.cpp index 8e40590..2d79bd6 100644 --- a/lib/Bytecode/Archive/Archive.cpp +++ b/lib/Bytecode/Archive/Archive.cpp @@ -26,7 +26,7 @@ ArchiveMember::getMemberSize() const { // If it has a long filename, include the name length if (hasLongFilename()) - result += path.get().length() + 1; + result += path.toString().length() + 1; // If its now odd lengthed, include the padding byte if (result % 2 != 0 ) @@ -66,38 +66,38 @@ void ArchiveMember::replaceWith(const sys::Path& newFile) { path = newFile; // SVR4 symbol tables have an empty name - if (path.get() == ARFILE_SVR4_SYMTAB_NAME) + if (path.toString() == ARFILE_SVR4_SYMTAB_NAME) flags |= SVR4SymbolTableFlag; else flags &= ~SVR4SymbolTableFlag; // BSD4.4 symbol tables have a special name - if (path.get() == ARFILE_BSD4_SYMTAB_NAME) + if (path.toString() == ARFILE_BSD4_SYMTAB_NAME) flags |= BSD4SymbolTableFlag; else flags &= ~BSD4SymbolTableFlag; // LLVM symbol tables have a very specific name - if (path.get() == ARFILE_LLVM_SYMTAB_NAME) + if (path.toString() == ARFILE_LLVM_SYMTAB_NAME) flags |= LLVMSymbolTableFlag; else flags &= ~LLVMSymbolTableFlag; // String table name - if (path.get() == ARFILE_STRTAB_NAME) + if (path.toString() == ARFILE_STRTAB_NAME) flags |= StringTableFlag; else flags &= ~StringTableFlag; // If it has a slash then it has a path - bool hasSlash = path.get().find('/') != std::string::npos; + bool hasSlash = path.toString().find('/') != std::string::npos; if (hasSlash) flags |= HasPathFlag; else flags &= ~HasPathFlag; // If it has a slash or its over 15 chars then its a long filename format - if (hasSlash || path.get().length() > 15) + if (hasSlash || path.toString().length() > 15) flags |= HasLongFilenameFlag; else flags &= ~HasLongFilenameFlag; diff --git a/lib/Bytecode/Archive/ArchiveReader.cpp b/lib/Bytecode/Archive/ArchiveReader.cpp index 34b36a6..b00487f 100644 --- a/lib/Bytecode/Archive/ArchiveReader.cpp +++ b/lib/Bytecode/Archive/ArchiveReader.cpp @@ -295,8 +295,8 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) { for (iterator I=begin(), E=end(); I != E; ++I) { if (I->isBytecode() || I->isCompressedBytecode()) { - std::string FullMemberName = archPath.get() + - "(" + I->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + + "(" + I->getPath().toString() + ")"; Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(), I->getSize(), FullMemberName, ErrMessage); if (!M) @@ -407,8 +407,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) { ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); // Now, load the bytecode module to get the ModuleProvider - std::string FullMemberName = archPath.get() + "(" + - mbr->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + "(" + + mbr->getPath().toString() + ")"; ModuleProvider* mp = getBytecodeBufferModuleProvider( (const unsigned char*) mbr->getData(), mbr->getSize(), FullMemberName, 0); @@ -446,8 +446,8 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols, if (mbr->isBytecode() || mbr->isCompressedBytecode()) { // Get the symbols std::vector<std::string> symbols; - std::string FullMemberName = archPath.get() + "(" + - mbr->getPath().get() + ")"; + std::string FullMemberName = archPath.toString() + "(" + + mbr->getPath().toString() + ")"; ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At, mbr->getSize(), FullMemberName, symbols); @@ -462,7 +462,7 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols, modules.insert(std::make_pair(offset, std::make_pair(MP, mbr))); } else { throw std::string("Can't parse bytecode member: ") + - mbr->getPath().get(); + mbr->getPath().toString(); } } diff --git a/lib/Bytecode/Archive/ArchiveWriter.cpp b/lib/Bytecode/Archive/ArchiveWriter.cpp index 21be628..64c2567 100644 --- a/lib/Bytecode/Archive/ArchiveWriter.cpp +++ b/lib/Bytecode/Archive/ArchiveWriter.cpp @@ -94,7 +94,7 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr, memcpy(hdr.date,buffer,12); // Get rid of trailing blanks in the name - std::string mbrPath = mbr.getPath().get(); + std::string mbrPath = mbr.getPath().toString(); size_t mbrLen = mbrPath.length(); while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') { mbrPath.erase(mbrLen-1,1); @@ -162,10 +162,10 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where) { mbr->path.getStatusInfo(mbr->info); unsigned flags = 0; - bool hasSlash = filePath.get().find('/') != std::string::npos; + bool hasSlash = filePath.toString().find('/') != std::string::npos; if (hasSlash) flags |= ArchiveMember::HasPathFlag; - if (hasSlash || filePath.get().length() > 15) + if (hasSlash || filePath.toString().length() > 15) flags |= ArchiveMember::HasLongFilenameFlag; std::string magic; mbr->path.getMagicNumber(magic,4); @@ -212,7 +212,8 @@ Archive::writeMember( if (CreateSymbolTable && (member.isBytecode() || member.isCompressedBytecode())) { std::vector<std::string> symbols; - std::string FullMemberName = archPath.get() + "(" + member.getPath().get() + std::string FullMemberName = archPath.toString() + "(" + + member.getPath().toString() + ")"; ModuleProvider* MP = GetBytecodeSymbols( (const unsigned char*)data,fSize,FullMemberName, symbols); @@ -235,7 +236,7 @@ Archive::writeMember( delete MP; } else { throw std::string("Can't parse bytecode member: ") + - member.getPath().get(); + member.getPath().toString(); } } @@ -281,7 +282,8 @@ Archive::writeMember( // Write the long filename if its long if (writeLongName) { - ARFile.write(member.getPath().get().data(),member.getPath().get().length()); + ARFile.write(member.getPath().toString().data(), + member.getPath().toString().length()); } // Make sure we write the compressed bytecode magic number if we should. @@ -378,7 +380,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Check for errors opening or creating archive file. if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) { - throw std::string("Error opening archive file: ") + archPath.get(); + throw std::string("Error opening archive file: ") + archPath.toString(); } // If we're creating a symbol table, reset it now @@ -414,7 +416,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Open the final file to write and check it. std::ofstream FinalFile(archPath.c_str()); if ( !FinalFile.is_open() || FinalFile.bad() ) { - throw std::string("Error opening archive file: ") + archPath.get(); + throw std::string("Error opening archive file: ") + archPath.toString(); } // Write the file magic number diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp index b8c8b4a..fccbbe7 100644 --- a/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/lib/Bytecode/Reader/ReaderWrappers.cpp @@ -374,7 +374,8 @@ void getSymbols(Module*M, std::vector<std::string>& symbols) { bool llvm::GetBytecodeSymbols(const sys::Path& fName, std::vector<std::string>& symbols) { try { - std::auto_ptr<ModuleProvider> AMP( getBytecodeModuleProvider(fName.get())); + std::auto_ptr<ModuleProvider> AMP( + getBytecodeModuleProvider(fName.toString())); // Get the module from the provider Module* M = AMP->materializeModule(); diff --git a/lib/System/Unix/MappedFile.cpp b/lib/System/Unix/MappedFile.cpp index 0e03a04..1c9622d 100644 --- a/lib/System/Unix/MappedFile.cpp +++ b/lib/System/Unix/MappedFile.cpp @@ -44,17 +44,17 @@ void MappedFile::initialize() { if (info_->fd_ < 0) { delete info_; info_ = 0; - ThrowErrno(std::string("Can't open file: ") + path_.get()); + ThrowErrno(std::string("Can't open file: ") + path_.toString()); } struct stat sbuf; if(::fstat(info_->fd_, &info_->sbuf_) < 0) { ::close(info_->fd_); delete info_; info_ = 0; - ThrowErrno(std::string("Can't stat file: ") + path_.get()); + ThrowErrno(std::string("Can't stat file: ") + path_.toString()); } } else { - throw std::string("Can't open file: ") + path_.get(); + throw std::string("Can't open file: ") + path_.toString(); } } @@ -103,7 +103,7 @@ void* MappedFile::map() { base_ = ::mmap(0, map_size, prot, flags, info_->fd_, 0); if (base_ == MAP_FAILED) - ThrowErrno(std::string("Can't map file:") + path_.get()); + ThrowErrno(std::string("Can't map file:") + path_.toString()); } return base_; } diff --git a/lib/System/Unix/MappedFile.inc b/lib/System/Unix/MappedFile.inc index 0e03a04..1c9622d 100644 --- a/lib/System/Unix/MappedFile.inc +++ b/lib/System/Unix/MappedFile.inc @@ -44,17 +44,17 @@ void MappedFile::initialize() { if (info_->fd_ < 0) { delete info_; info_ = 0; - ThrowErrno(std::string("Can't open file: ") + path_.get()); + ThrowErrno(std::string("Can't open file: ") + path_.toString()); } struct stat sbuf; if(::fstat(info_->fd_, &info_->sbuf_) < 0) { ::close(info_->fd_); delete info_; info_ = 0; - ThrowErrno(std::string("Can't stat file: ") + path_.get()); + ThrowErrno(std::string("Can't stat file: ") + path_.toString()); } } else { - throw std::string("Can't open file: ") + path_.get(); + throw std::string("Can't open file: ") + path_.toString(); } } @@ -103,7 +103,7 @@ void* MappedFile::map() { base_ = ::mmap(0, map_size, prot, flags, info_->fd_, 0); if (base_ == MAP_FAILED) - ThrowErrno(std::string("Can't map file:") + path_.get()); + ThrowErrno(std::string("Can't map file:") + path_.toString()); } return base_; } diff --git a/lib/System/Unix/Path.cpp b/lib/System/Unix/Path.cpp index 5d2a4b6..d3e4d96 100644 --- a/lib/System/Unix/Path.cpp +++ b/lib/System/Unix/Path.cpp @@ -21,7 +21,6 @@ #include "Unix.h" #include <sys/stat.h> #include <fcntl.h> -#include <fstream> #include <utime.h> #include <dirent.h> @@ -192,10 +191,13 @@ bool Path::isBytecodeFile() const { char buffer[ 4]; buffer[0] = 0; - std::ifstream f(path.c_str()); - f.read(buffer, 4); - if (f.bad()) - ThrowErrno("can't read file signature"); + int fd = ::open(path.c_str(),O_RDONLY); + if (fd < 0) + return false; + ssize_t bytes_read = ::read(fd, buffer, 4); + ::close(fd); + if (4 != bytes_read) + return false; return (buffer[0] == 'l' && buffer[1] == 'l' && buffer[2] == 'v' && (buffer[3] == 'c' || buffer[3] == 'm')); @@ -522,7 +524,8 @@ bool Path::renameFile(const Path& newName) { if (!isFile()) return false; if (0 != rename(path.c_str(), newName.c_str())) - ThrowErrno(std::string("can't rename ") + path + " as " + newName.get()); + ThrowErrno(std::string("can't rename ") + path + " as " + + newName.toString()); return true; } diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 5d2a4b6..d3e4d96 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -21,7 +21,6 @@ #include "Unix.h" #include <sys/stat.h> #include <fcntl.h> -#include <fstream> #include <utime.h> #include <dirent.h> @@ -192,10 +191,13 @@ bool Path::isBytecodeFile() const { char buffer[ 4]; buffer[0] = 0; - std::ifstream f(path.c_str()); - f.read(buffer, 4); - if (f.bad()) - ThrowErrno("can't read file signature"); + int fd = ::open(path.c_str(),O_RDONLY); + if (fd < 0) + return false; + ssize_t bytes_read = ::read(fd, buffer, 4); + ::close(fd); + if (4 != bytes_read) + return false; return (buffer[0] == 'l' && buffer[1] == 'l' && buffer[2] == 'v' && (buffer[3] == 'c' || buffer[3] == 'm')); @@ -522,7 +524,8 @@ bool Path::renameFile(const Path& newName) { if (!isFile()) return false; if (0 != rename(path.c_str(), newName.c_str())) - ThrowErrno(std::string("can't rename ") + path + " as " + newName.get()); + ThrowErrno(std::string("can't rename ") + path + " as " + + newName.toString()); return true; } diff --git a/lib/System/Unix/Program.cpp b/lib/System/Unix/Program.cpp index 18fcafe..ae53720 100644 --- a/lib/System/Unix/Program.cpp +++ b/lib/System/Unix/Program.cpp @@ -81,7 +81,7 @@ int Program::ExecuteAndWait(const Path& path, const std::vector<std::string>& args) { if (!path.executable()) - throw path.get() + " is not executable"; + throw path.toString() + " is not executable"; #ifdef HAVE_SYS_WAIT_H // Create local versions of the parameters that can be passed into execve() @@ -98,7 +98,8 @@ Program::ExecuteAndWait(const Path& path, switch (fork()) { // An error occured: Return to the caller. case -1: - ThrowErrno(std::string("Couldn't execute program '") + path.get() + "'"); + ThrowErrno(std::string("Couldn't execute program '") + path.toString() + + "'"); break; // Child process: Execute the program. @@ -116,13 +117,15 @@ Program::ExecuteAndWait(const Path& path, // Parent process: Wait for the child process to terminate. int status; if ((::wait (&status)) == -1) - ThrowErrno(std::string("Failed waiting for program '") + path.get() + "'"); + ThrowErrno(std::string("Failed waiting for program '") + path.toString() + + "'"); // If the program exited normally with a zero exit status, return success! if (WIFEXITED (status)) return WEXITSTATUS(status); else if (WIFSIGNALED(status)) - throw std::string("Program '") + path.get() + "' received terminating signal."; + throw std::string("Program '") + path.toString() + + "' received terminating signal."; else return 0; diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 18fcafe..ae53720 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -81,7 +81,7 @@ int Program::ExecuteAndWait(const Path& path, const std::vector<std::string>& args) { if (!path.executable()) - throw path.get() + " is not executable"; + throw path.toString() + " is not executable"; #ifdef HAVE_SYS_WAIT_H // Create local versions of the parameters that can be passed into execve() @@ -98,7 +98,8 @@ Program::ExecuteAndWait(const Path& path, switch (fork()) { // An error occured: Return to the caller. case -1: - ThrowErrno(std::string("Couldn't execute program '") + path.get() + "'"); + ThrowErrno(std::string("Couldn't execute program '") + path.toString() + + "'"); break; // Child process: Execute the program. @@ -116,13 +117,15 @@ Program::ExecuteAndWait(const Path& path, // Parent process: Wait for the child process to terminate. int status; if ((::wait (&status)) == -1) - ThrowErrno(std::string("Failed waiting for program '") + path.get() + "'"); + ThrowErrno(std::string("Failed waiting for program '") + path.toString() + + "'"); // If the program exited normally with a zero exit status, return success! if (WIFEXITED (status)) return WEXITSTATUS(status); else if (WIFSIGNALED(status)) - throw std::string("Program '") + path.get() + "' received terminating signal."; + throw std::string("Program '") + path.toString() + + "' received terminating signal."; else return 0; diff --git a/lib/System/Unix/Signals.cpp b/lib/System/Unix/Signals.cpp index 88e8766..8a3eee1 100644 --- a/lib/System/Unix/Signals.cpp +++ b/lib/System/Unix/Signals.cpp @@ -138,7 +138,7 @@ void sys::RemoveFileOnSignal(const sys::Path &Filename) { if (FilesToRemove == 0) FilesToRemove = new std::vector<std::string>; - FilesToRemove->push_back(Filename.get()); + FilesToRemove->push_back(Filename.toString()); std::for_each(IntSigs, IntSigsEnd, RegisterHandler); std::for_each(KillSigs, KillSigsEnd, RegisterHandler); diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc index 88e8766..8a3eee1 100644 --- a/lib/System/Unix/Signals.inc +++ b/lib/System/Unix/Signals.inc @@ -138,7 +138,7 @@ void sys::RemoveFileOnSignal(const sys::Path &Filename) { if (FilesToRemove == 0) FilesToRemove = new std::vector<std::string>; - FilesToRemove->push_back(Filename.get()); + FilesToRemove->push_back(Filename.toString()); std::for_each(IntSigs, IntSigsEnd, RegisterHandler); std::for_each(KillSigs, KillSigsEnd, RegisterHandler); |