[llvm-commits] [llvm] r123595 - in /llvm/trunk/lib/Archive: Archive.cpp ArchiveWriter.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Sun Jan 16 13:13:51 PST 2011
Author: mspencer
Date: Sun Jan 16 15:13:51 2011
New Revision: 123595
URL: http://llvm.org/viewvc/llvm-project?rev=123595&view=rev
Log:
UnRevert "Revert the archive part of "Support/PathV2: Add identify_magic.""
This reverts commit dd103021a889a986a181ce36ed7b0e8dc9b645e1.
Modified:
llvm/trunk/lib/Archive/Archive.cpp
llvm/trunk/lib/Archive/ArchiveWriter.cpp
Modified: llvm/trunk/lib/Archive/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=123595&r1=123594&r2=123595&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/Archive.cpp (original)
+++ llvm/trunk/lib/Archive/Archive.cpp Sun Jan 16 15:13:51 2011
@@ -116,11 +116,10 @@
// Get the signature and status info
const char* signature = (const char*) data;
- std::string magic;
+ SmallString<4> magic;
if (!signature) {
- path.getMagicNumber(magic,4);
+ sys::fs::get_magic(path.str(), magic.capacity(), magic);
signature = magic.c_str();
- std::string err;
const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
if (FSinfo)
info = *FSinfo;
Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=123595&r1=123594&r2=123595&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Sun Jan 16 15:13:51 2011
@@ -181,9 +181,11 @@
flags |= ArchiveMember::HasPathFlag;
if (hasSlash || filePath.str().length() > 15)
flags |= ArchiveMember::HasLongFilenameFlag;
- std::string magic;
- mbr->path.getMagicNumber(magic,4);
- switch (sys::IdentifyFileType(magic.c_str(),4)) {
+
+ sys::LLVMFileType type;
+ if (sys::fs::identify_magic(mbr->path.str(), type))
+ type = sys::Unknown_FileType;
+ switch (type) {
case sys::Bitcode_FileType:
flags |= ArchiveMember::BitcodeFlag;
break;
More information about the llvm-commits
mailing list