From 1fce09125cb46c91407668ca29915c450a482811 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sat, 11 Dec 2004 00:14:15 +0000 Subject: Path::get -> Path::toString git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18785 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Archive/Archive.cpp | 14 +++++++------- lib/Archive/ArchiveReader.cpp | 14 +++++++------- lib/Archive/ArchiveWriter.cpp | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 22 deletions(-) (limited to 'lib/Archive') 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& 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& symbols, if (mbr->isBytecode() || mbr->isCompressedBytecode()) { // Get the symbols std::vector 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& 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 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 -- cgit v1.1