Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316144 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Oct 19, 2017
1 parent 4179daa commit 9db44d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/BinaryFormat/Magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ file_magic llvm::identify_magic(StringRef Magic) {
if (startswith(Magic, "MZ") && Magic.size() >= 0x3c + 4) {
uint32_t off = read32le(Magic.data() + 0x3c);
// PE/COFF file, either EXE or DLL.
if (off + sizeof(COFF::PEMagic) <= Magic.size() &&
memcmp(Magic.data() + off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0)
if (Magic.substr(off).startswith(
StringRef(COFF::PEMagic, sizeof(COFF::PEMagic))))
return file_magic::pecoff_executable;
}
break;
Expand Down

0 comments on commit 9db44d0

Please sign in to comment.