mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Don't bother checking canRead() before calling getMagicNumber();
getMagicNumber() does its own error checking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
55e9717e59
commit
130de9c0b4
@ -136,26 +136,23 @@ sys::IdentifyFileType(const char *magic, unsigned length) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isArchive() const {
|
Path::isArchive() const {
|
||||||
if (canRead())
|
return hasMagicNumber("!<arch>\012");
|
||||||
return hasMagicNumber("!<arch>\012");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isDynamicLibrary() const {
|
Path::isDynamicLibrary() const {
|
||||||
if (canRead()) {
|
std::string Magic;
|
||||||
std::string Magic;
|
if (getMagicNumber(Magic, 64))
|
||||||
if (getMagicNumber(Magic, 64))
|
switch (IdentifyFileType(Magic.c_str(),
|
||||||
switch (IdentifyFileType(Magic.c_str(),
|
static_cast<unsigned>(Magic.length()))) {
|
||||||
static_cast<unsigned>(Magic.length()))) {
|
default: return false;
|
||||||
default: return false;
|
case Mach_O_FixedVirtualMemorySharedLib_FileType:
|
||||||
case Mach_O_FixedVirtualMemorySharedLib_FileType:
|
case Mach_O_DynamicallyLinkedSharedLib_FileType:
|
||||||
case Mach_O_DynamicallyLinkedSharedLib_FileType:
|
case Mach_O_DynamicallyLinkedSharedLibStub_FileType:
|
||||||
case Mach_O_DynamicallyLinkedSharedLibStub_FileType:
|
case ELF_SharedObject_FileType:
|
||||||
case ELF_SharedObject_FileType:
|
case COFF_FileType: return true;
|
||||||
case COFF_FileType: return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user