mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Fix variable name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183752 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4fbf663302
commit
9bd9f8e839
@ -768,32 +768,32 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Identify the magic in magic.
|
/// @brief Identify the magic in magic.
|
||||||
file_magic identify_magic(StringRef magic) {
|
file_magic identify_magic(StringRef Magic) {
|
||||||
if (magic.size() < 4)
|
if (Magic.size() < 4)
|
||||||
return file_magic::unknown;
|
return file_magic::unknown;
|
||||||
switch ((unsigned char)magic[0]) {
|
switch ((unsigned char)Magic[0]) {
|
||||||
case 0xDE: // 0x0B17C0DE = BC wraper
|
case 0xDE: // 0x0B17C0DE = BC wraper
|
||||||
if (magic[1] == (char)0xC0 && magic[2] == (char)0x17 &&
|
if (Magic[1] == (char)0xC0 && Magic[2] == (char)0x17 &&
|
||||||
magic[3] == (char)0x0B)
|
Magic[3] == (char)0x0B)
|
||||||
return file_magic::bitcode;
|
return file_magic::bitcode;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
if (magic[1] == 'C' && magic[2] == (char)0xC0 && magic[3] == (char)0xDE)
|
if (Magic[1] == 'C' && Magic[2] == (char)0xC0 && Magic[3] == (char)0xDE)
|
||||||
return file_magic::bitcode;
|
return file_magic::bitcode;
|
||||||
break;
|
break;
|
||||||
case '!':
|
case '!':
|
||||||
if (magic.size() >= 8)
|
if (Magic.size() >= 8)
|
||||||
if (memcmp(magic.data(),"!<arch>\n",8) == 0)
|
if (memcmp(Magic.data(),"!<arch>\n",8) == 0)
|
||||||
return file_magic::archive;
|
return file_magic::archive;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\177':
|
case '\177':
|
||||||
if (magic[1] == 'E' && magic[2] == 'L' && magic[3] == 'F') {
|
if (Magic[1] == 'E' && Magic[2] == 'L' && Magic[3] == 'F') {
|
||||||
bool Data2MSB = magic[5] == 2;
|
bool Data2MSB = Magic[5] == 2;
|
||||||
unsigned high = Data2MSB ? 16 : 17;
|
unsigned high = Data2MSB ? 16 : 17;
|
||||||
unsigned low = Data2MSB ? 17 : 16;
|
unsigned low = Data2MSB ? 17 : 16;
|
||||||
if (magic.size() >= 18 && magic[high] == 0)
|
if (Magic.size() >= 18 && Magic[high] == 0)
|
||||||
switch (magic[low]) {
|
switch (Magic[low]) {
|
||||||
default: break;
|
default: break;
|
||||||
case 1: return file_magic::elf_relocatable;
|
case 1: return file_magic::elf_relocatable;
|
||||||
case 2: return file_magic::elf_executable;
|
case 2: return file_magic::elf_executable;
|
||||||
@ -804,11 +804,11 @@ file_magic identify_magic(StringRef magic) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xCA:
|
case 0xCA:
|
||||||
if (magic[1] == char(0xFE) && magic[2] == char(0xBA) &&
|
if (Magic[1] == char(0xFE) && Magic[2] == char(0xBA) &&
|
||||||
magic[3] == char(0xBE)) {
|
Magic[3] == char(0xBE)) {
|
||||||
// This is complicated by an overlap with Java class files.
|
// This is complicated by an overlap with Java class files.
|
||||||
// See the Mach-O section in /usr/share/file/magic for details.
|
// See the Mach-O section in /usr/share/file/magic for details.
|
||||||
if (magic.size() >= 8 && magic[7] < 43)
|
if (Magic.size() >= 8 && Magic[7] < 43)
|
||||||
// FIXME: Universal Binary of any type.
|
// FIXME: Universal Binary of any type.
|
||||||
return file_magic::macho_dynamically_linked_shared_lib;
|
return file_magic::macho_dynamically_linked_shared_lib;
|
||||||
}
|
}
|
||||||
@ -821,16 +821,16 @@ file_magic identify_magic(StringRef magic) {
|
|||||||
case 0xCE:
|
case 0xCE:
|
||||||
case 0xCF: {
|
case 0xCF: {
|
||||||
uint16_t type = 0;
|
uint16_t type = 0;
|
||||||
if (magic[0] == char(0xFE) && magic[1] == char(0xED) &&
|
if (Magic[0] == char(0xFE) && Magic[1] == char(0xED) &&
|
||||||
magic[2] == char(0xFA) &&
|
Magic[2] == char(0xFA) &&
|
||||||
(magic[3] == char(0xCE) || magic[3] == char(0xCF))) {
|
(Magic[3] == char(0xCE) || Magic[3] == char(0xCF))) {
|
||||||
/* Native endian */
|
/* Native endian */
|
||||||
if (magic.size() >= 16) type = magic[14] << 8 | magic[15];
|
if (Magic.size() >= 16) type = Magic[14] << 8 | Magic[15];
|
||||||
} else if ((magic[0] == char(0xCE) || magic[0] == char(0xCF)) &&
|
} else if ((Magic[0] == char(0xCE) || Magic[0] == char(0xCF)) &&
|
||||||
magic[1] == char(0xFA) && magic[2] == char(0xED) &&
|
Magic[1] == char(0xFA) && Magic[2] == char(0xED) &&
|
||||||
magic[3] == char(0xFE)) {
|
Magic[3] == char(0xFE)) {
|
||||||
/* Reverse endian */
|
/* Reverse endian */
|
||||||
if (magic.size() >= 14) type = magic[13] << 8 | magic[12];
|
if (Magic.size() >= 14) type = Magic[13] << 8 | Magic[12];
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -853,27 +853,27 @@ file_magic identify_magic(StringRef magic) {
|
|||||||
case 0x66: // MPS R4000 Windows
|
case 0x66: // MPS R4000 Windows
|
||||||
case 0x50: // mc68K
|
case 0x50: // mc68K
|
||||||
case 0x4c: // 80386 Windows
|
case 0x4c: // 80386 Windows
|
||||||
if (magic[1] == 0x01)
|
if (Magic[1] == 0x01)
|
||||||
return file_magic::coff_object;
|
return file_magic::coff_object;
|
||||||
|
|
||||||
case 0x90: // PA-RISC Windows
|
case 0x90: // PA-RISC Windows
|
||||||
case 0x68: // mc68K Windows
|
case 0x68: // mc68K Windows
|
||||||
if (magic[1] == 0x02)
|
if (Magic[1] == 0x02)
|
||||||
return file_magic::coff_object;
|
return file_magic::coff_object;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x4d: // Possible MS-DOS stub on Windows PE file
|
case 0x4d: // Possible MS-DOS stub on Windows PE file
|
||||||
if (magic[1] == 0x5a) {
|
if (Magic[1] == 0x5a) {
|
||||||
uint32_t off =
|
uint32_t off =
|
||||||
*reinterpret_cast<const support::ulittle32_t*>(magic.data() + 0x3c);
|
*reinterpret_cast<const support::ulittle32_t*>(Magic.data() + 0x3c);
|
||||||
// PE/COFF file, either EXE or DLL.
|
// PE/COFF file, either EXE or DLL.
|
||||||
if (off < magic.size() && memcmp(magic.data() + off, "PE\0\0",4) == 0)
|
if (off < Magic.size() && memcmp(Magic.data() + off, "PE\0\0",4) == 0)
|
||||||
return file_magic::pecoff_executable;
|
return file_magic::pecoff_executable;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x64: // x86-64 Windows.
|
case 0x64: // x86-64 Windows.
|
||||||
if (magic[1] == char(0x86))
|
if (Magic[1] == char(0x86))
|
||||||
return file_magic::coff_object;
|
return file_magic::coff_object;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user