Lines Matching full:magic

981 /// @brief Identify the magic in magic.
982 file_magic identify_magic(StringRef Magic) { in identify_magic() argument
983 if (Magic.size() < 4) in identify_magic()
985 switch ((unsigned char)Magic[0]) { in identify_magic()
988 if (Magic[1] == (char)0x00 && Magic[2] == (char)0xff && in identify_magic()
989 Magic[3] == (char)0xff) { in identify_magic()
991 if (Magic.size() < MinSize) in identify_magic()
995 Magic.data() + offsetof(COFF::BigObjHeader, Version)); in identify_magic()
999 const char *Start = Magic.data() + offsetof(COFF::BigObjHeader, UUID); in identify_magic()
1006 if (Magic.size() >= sizeof(Expected) && in identify_magic()
1007 memcmp(Magic.data(), Expected, sizeof(Expected)) == 0) in identify_magic()
1010 if (Magic[1] == 0) in identify_magic()
1015 if (Magic[1] == (char)0xC0 && Magic[2] == (char)0x17 && in identify_magic()
1016 Magic[3] == (char)0x0B) in identify_magic()
1020 if (Magic[1] == 'C' && Magic[2] == (char)0xC0 && Magic[3] == (char)0xDE) in identify_magic()
1024 if (Magic.size() >= 8) in identify_magic()
1025 if (memcmp(Magic.data(), "!<arch>\n", 8) == 0 || in identify_magic()
1026 memcmp(Magic.data(), "!<thin>\n", 8) == 0) in identify_magic()
1031 if (Magic.size() >= 18 && Magic[1] == 'E' && Magic[2] == 'L' && in identify_magic()
1032 Magic[3] == 'F') { in identify_magic()
1033 bool Data2MSB = Magic[5] == 2; in identify_magic()
1036 if (Magic[high] == 0) in identify_magic()
1037 switch (Magic[low]) { in identify_magic()
1051 if (Magic[1] == char(0xFE) && Magic[2] == char(0xBA) && in identify_magic()
1052 (Magic[3] == char(0xBE) || Magic[3] == char(0xBF))) { in identify_magic()
1054 // See the Mach-O section in /usr/share/file/magic for details. in identify_magic()
1055 if (Magic.size() >= 8 && Magic[7] < 43) in identify_magic()
1060 // The two magic numbers for mach-o are: in identify_magic()
1067 if (Magic[0] == char(0xFE) && Magic[1] == char(0xED) && in identify_magic()
1068 Magic[2] == char(0xFA) && in identify_magic()
1069 (Magic[3] == char(0xCE) || Magic[3] == char(0xCF))) { in identify_magic()
1072 if (Magic[3] == char(0xCE)) in identify_magic()
1076 if (Magic.size() >= MinSize) in identify_magic()
1077 type = Magic[12] << 24 | Magic[13] << 12 | Magic[14] << 8 | Magic[15]; in identify_magic()
1078 } else if ((Magic[0] == char(0xCE) || Magic[0] == char(0xCF)) && in identify_magic()
1079 Magic[1] == char(0xFA) && Magic[2] == char(0xED) && in identify_magic()
1080 Magic[3] == char(0xFE)) { in identify_magic()
1083 if (Magic[0] == char(0xCE)) in identify_magic()
1087 if (Magic.size() >= MinSize) in identify_magic()
1088 type = Magic[15] << 24 | Magic[14] << 12 |Magic[13] << 8 | Magic[12]; in identify_magic()
1113 if (Magic[1] == 0x01) in identify_magic()
1118 if (Magic[1] == 0x02) in identify_magic()
1123 if (Magic[1] == 'Z') { in identify_magic()
1124 uint32_t off = read32le(Magic.data() + 0x3c); in identify_magic()
1126 if (off < Magic.size() && in identify_magic()
1127 memcmp(Magic.data()+off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0) in identify_magic()
1133 if (Magic[1] == char(0x86)) in identify_magic()