summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-01-16 19:56:42 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-01-16 19:56:42 +0000
commitdd103021a889a986a181ce36ed7b0e8dc9b645e1 (patch)
treed18bbad6fb168ec1bb34f6b8bdecc43f04fc712d
parent1c10db3da9bf7f268cefb6935067ea831c605d15 (diff)
Revert the archive part of "Support/PathV2: Add identify_magic."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123593 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Archive/Archive.cpp5
-rw-r--r--lib/Archive/ArchiveWriter.cpp8
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index 1eab27d3eba..3ee3cb25c5a 100644
--- a/lib/Archive/Archive.cpp
+++ b/lib/Archive/Archive.cpp
@@ -116,10 +116,11 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) {
// Get the signature and status info
const char* signature = (const char*) data;
- SmallString<4> magic;
+ std::string magic;
if (!signature) {
- sys::fs::get_magic(path.str(), magic.capacity(), magic);
+ path.getMagicNumber(magic,4);
signature = magic.c_str();
+ std::string err;
const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
if (FSinfo)
info = *FSinfo;
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 8fcc7aa29cc..07a9aaf4fdb 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -181,11 +181,9 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where,
flags |= ArchiveMember::HasPathFlag;
if (hasSlash || filePath.str().length() > 15)
flags |= ArchiveMember::HasLongFilenameFlag;
-
- sys::LLVMFileType type;
- if (sys::fs::identify_magic(mbr->path.str(), type))
- type = sys::Unknown_FileType;
- switch (type) {
+ std::string magic;
+ mbr->path.getMagicNumber(magic,4);
+ switch (sys::IdentifyFileType(magic.c_str(),4)) {
case sys::Bitcode_FileType:
flags |= ArchiveMember::BitcodeFlag;
break;