mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Fix isBytecodeFile to correctly recognized compressed bytecode too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17655 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9195f37c5f
commit
4b82681c65
@ -242,10 +242,13 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
|
||||
|
||||
bool
|
||||
Path::isBytecodeFile() const {
|
||||
if (readable()) {
|
||||
return hasMagicNumber("llvm");
|
||||
}
|
||||
return false;
|
||||
char buffer[ 4];
|
||||
buffer[0] = 0;
|
||||
std::ifstream f(path.c_str());
|
||||
f.read(buffer, 4);
|
||||
if (f.bad())
|
||||
ThrowErrno("can't read file signature");
|
||||
return 0 == memcmp(buffer,"llvc",4) || 0 == memcmp(buffer,"llvm",4);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -242,10 +242,13 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
|
||||
|
||||
bool
|
||||
Path::isBytecodeFile() const {
|
||||
if (readable()) {
|
||||
return hasMagicNumber("llvm");
|
||||
}
|
||||
return false;
|
||||
char buffer[ 4];
|
||||
buffer[0] = 0;
|
||||
std::ifstream f(path.c_str());
|
||||
f.read(buffer, 4);
|
||||
if (f.bad())
|
||||
ThrowErrno("can't read file signature");
|
||||
return 0 == memcmp(buffer,"llvc",4) || 0 == memcmp(buffer,"llvm",4);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user