Commit 94ba1b8b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Abi: De-noise

* Remove QLatin1String except on return
* Remove unneeded qualifications

Change-Id: Ic7c928c7d53c03c398fddc7353dd9e08a125e701
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 46f39f56
...@@ -322,34 +322,34 @@ Abi::Abi(const Architecture &a, const OS &o, ...@@ -322,34 +322,34 @@ Abi::Abi(const Architecture &a, const OS &o,
m_architecture(a), m_os(o), m_osFlavor(of), m_binaryFormat(f), m_wordWidth(w) m_architecture(a), m_os(o), m_osFlavor(of), m_binaryFormat(f), m_wordWidth(w)
{ {
switch (m_os) { switch (m_os) {
case Abi::UnknownOS: case UnknownOS:
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::LinuxOS: case LinuxOS:
if (m_osFlavor < GenericLinuxFlavor || m_osFlavor > AndroidLinuxFlavor) if (m_osFlavor < GenericLinuxFlavor || m_osFlavor > AndroidLinuxFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::BsdOS: case BsdOS:
if (m_osFlavor < FreeBsdFlavor || m_osFlavor > OpenBsdFlavor) if (m_osFlavor < FreeBsdFlavor || m_osFlavor > OpenBsdFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::DarwinOS: case DarwinOS:
if (m_osFlavor < GenericDarwinFlavor || m_osFlavor > GenericDarwinFlavor) if (m_osFlavor < GenericDarwinFlavor || m_osFlavor > GenericDarwinFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::UnixOS: case UnixOS:
if (m_osFlavor < GenericUnixFlavor || m_osFlavor > SolarisUnixFlavor) if (m_osFlavor < GenericUnixFlavor || m_osFlavor > SolarisUnixFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::WindowsOS: case WindowsOS:
if (m_osFlavor < WindowsMsvc2005Flavor || m_osFlavor > WindowsCEFlavor) if (m_osFlavor < WindowsMsvc2005Flavor || m_osFlavor > WindowsCEFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case Abi::VxWorks: case VxWorks:
if (m_osFlavor != VxWorksFlavor) if (m_osFlavor != VxWorksFlavor)
m_osFlavor = VxWorksFlavor; m_osFlavor = VxWorksFlavor;
break; break;
case Abi::QnxOS: case QnxOS:
if (m_osFlavor != GenericQnxFlavor) if (m_osFlavor != GenericQnxFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
...@@ -360,105 +360,105 @@ Abi::Abi(const QString &abiString) : ...@@ -360,105 +360,105 @@ Abi::Abi(const QString &abiString) :
m_architecture(UnknownArchitecture), m_os(UnknownOS), m_architecture(UnknownArchitecture), m_os(UnknownOS),
m_osFlavor(UnknownFlavor), m_binaryFormat(UnknownFormat), m_wordWidth(0) m_osFlavor(UnknownFlavor), m_binaryFormat(UnknownFormat), m_wordWidth(0)
{ {
const QVector<QStringRef> abiParts = abiString.splitRef(QLatin1Char('-')); const QVector<QStringRef> abiParts = abiString.splitRef('-');
if (abiParts.count() >= 1) { if (abiParts.count() >= 1) {
if (abiParts.at(0) == QLatin1String("unknown")) if (abiParts.at(0) == "unknown")
m_architecture = UnknownArchitecture; m_architecture = UnknownArchitecture;
else if (abiParts.at(0) == QLatin1String("arm")) else if (abiParts.at(0) == "arm")
m_architecture = ArmArchitecture; m_architecture = ArmArchitecture;
else if (abiParts.at(0) == QLatin1String("aarch64")) else if (abiParts.at(0) == "aarch64")
m_architecture = ArmArchitecture; m_architecture = ArmArchitecture;
else if (abiParts.at(0) == QLatin1String("x86")) else if (abiParts.at(0) == "x86")
m_architecture = X86Architecture; m_architecture = X86Architecture;
else if (abiParts.at(0) == QLatin1String("mips")) else if (abiParts.at(0) == "mips")
m_architecture = MipsArchitecture; m_architecture = MipsArchitecture;
else if (abiParts.at(0) == QLatin1String("ppc")) else if (abiParts.at(0) == "ppc")
m_architecture = PowerPCArchitecture; m_architecture = PowerPCArchitecture;
else if (abiParts.at(0) == QLatin1String("itanium")) else if (abiParts.at(0) == "itanium")
m_architecture = ItaniumArchitecture; m_architecture = ItaniumArchitecture;
else if (abiParts.at(0) == QLatin1String("sh")) else if (abiParts.at(0) == "sh")
m_architecture = ShArchitecture; m_architecture = ShArchitecture;
else else
return; return;
} }
if (abiParts.count() >= 2) { if (abiParts.count() >= 2) {
if (abiParts.at(1) == QLatin1String("unknown")) if (abiParts.at(1) == "unknown")
m_os = UnknownOS; m_os = UnknownOS;
else if (abiParts.at(1) == QLatin1String("linux")) else if (abiParts.at(1) == "linux")
m_os = LinuxOS; m_os = LinuxOS;
else if (abiParts.at(1) == QLatin1String("bsd")) else if (abiParts.at(1) == "bsd")
m_os = BsdOS; m_os = BsdOS;
else if (abiParts.at(1) == QLatin1String("darwin") else if (abiParts.at(1) == "darwin"
|| abiParts.at(1) == QLatin1String("macos")) || abiParts.at(1) == "macos")
m_os = DarwinOS; m_os = DarwinOS;
else if (abiParts.at(1) == QLatin1String("unix")) else if (abiParts.at(1) == "unix")
m_os = UnixOS; m_os = UnixOS;
else if (abiParts.at(1) == QLatin1String("windows")) else if (abiParts.at(1) == "windows")
m_os = WindowsOS; m_os = WindowsOS;
else if (abiParts.at(1) == QLatin1String("vxworks")) else if (abiParts.at(1) == "vxworks")
m_os = VxWorks; m_os = VxWorks;
else if (abiParts.at(1) == QLatin1String("qnx")) else if (abiParts.at(1) == "qnx")
m_os = QnxOS; m_os = QnxOS;
else else
return; return;
} }
if (abiParts.count() >= 3) { if (abiParts.count() >= 3) {
if (abiParts.at(2) == QLatin1String("unknown")) if (abiParts.at(2) == "unknown")
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == LinuxOS) else if (abiParts.at(2) == "generic" && m_os == LinuxOS)
m_osFlavor = GenericLinuxFlavor; m_osFlavor = GenericLinuxFlavor;
else if (abiParts.at(2) == QLatin1String("android") && m_os == LinuxOS) else if (abiParts.at(2) == "android" && m_os == LinuxOS)
m_osFlavor = AndroidLinuxFlavor; m_osFlavor = AndroidLinuxFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == QnxOS) else if (abiParts.at(2) == "generic" && m_os == QnxOS)
m_osFlavor = GenericQnxFlavor; m_osFlavor = GenericQnxFlavor;
else if (abiParts.at(2) == QLatin1String("freebsd") && m_os == BsdOS) else if (abiParts.at(2) == "freebsd" && m_os == BsdOS)
m_osFlavor = FreeBsdFlavor; m_osFlavor = FreeBsdFlavor;
else if (abiParts.at(2) == QLatin1String("netbsd") && m_os == BsdOS) else if (abiParts.at(2) == "netbsd" && m_os == BsdOS)
m_osFlavor = NetBsdFlavor; m_osFlavor = NetBsdFlavor;
else if (abiParts.at(2) == QLatin1String("openbsd") && m_os == BsdOS) else if (abiParts.at(2) == "openbsd" && m_os == BsdOS)
m_osFlavor = OpenBsdFlavor; m_osFlavor = OpenBsdFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == DarwinOS) else if (abiParts.at(2) == "generic" && m_os == DarwinOS)
m_osFlavor = GenericDarwinFlavor; m_osFlavor = GenericDarwinFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == UnixOS) else if (abiParts.at(2) == "generic" && m_os == UnixOS)
m_osFlavor = GenericUnixFlavor; m_osFlavor = GenericUnixFlavor;
else if (abiParts.at(2) == QLatin1String("solaris") && m_os == UnixOS) else if (abiParts.at(2) == "solaris" && m_os == UnixOS)
m_osFlavor = SolarisUnixFlavor; m_osFlavor = SolarisUnixFlavor;
else if (abiParts.at(2) == QLatin1String("msvc2005") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2005" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2005Flavor; m_osFlavor = WindowsMsvc2005Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2008") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2008" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2008Flavor; m_osFlavor = WindowsMsvc2008Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2010") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2010" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2010Flavor; m_osFlavor = WindowsMsvc2010Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2012") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2012" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2012Flavor; m_osFlavor = WindowsMsvc2012Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2013") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2013" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2013Flavor; m_osFlavor = WindowsMsvc2013Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2015") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2015" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2015Flavor; m_osFlavor = WindowsMsvc2015Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2017") && m_os == WindowsOS) else if (abiParts.at(2) == "msvc2017" && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2017Flavor; m_osFlavor = WindowsMsvc2017Flavor;
else if (abiParts.at(2) == QLatin1String("msys") && m_os == WindowsOS) else if (abiParts.at(2) == "msys" && m_os == WindowsOS)
m_osFlavor = WindowsMSysFlavor; m_osFlavor = WindowsMSysFlavor;
else if (abiParts.at(2) == QLatin1String("ce") && m_os == WindowsOS) else if (abiParts.at(2) == "ce" && m_os == WindowsOS)
m_osFlavor = WindowsCEFlavor; m_osFlavor = WindowsCEFlavor;
else if (abiParts.at(2) == QLatin1String("vxworks") && m_os == VxWorks) else if (abiParts.at(2) == "vxworks" && m_os == VxWorks)
m_osFlavor = VxWorksFlavor; m_osFlavor = VxWorksFlavor;
else else
return; return;
} }
if (abiParts.count() >= 4) { if (abiParts.count() >= 4) {
if (abiParts.at(3) == QLatin1String("unknown")) if (abiParts.at(3) == "unknown")
m_binaryFormat = UnknownFormat; m_binaryFormat = UnknownFormat;
else if (abiParts.at(3) == QLatin1String("elf")) else if (abiParts.at(3) == "elf")
m_binaryFormat = ElfFormat; m_binaryFormat = ElfFormat;
else if (abiParts.at(3) == QLatin1String("pe")) else if (abiParts.at(3) == "pe")
m_binaryFormat = PEFormat; m_binaryFormat = PEFormat;
else if (abiParts.at(3) == QLatin1String("mach_o")) else if (abiParts.at(3) == "mach_o")
m_binaryFormat = MachOFormat; m_binaryFormat = MachOFormat;
else if (abiParts.at(3) == QLatin1String("qml_rt")) else if (abiParts.at(3) == "qml_rt")
m_binaryFormat = RuntimeQmlFormat; m_binaryFormat = RuntimeQmlFormat;
else else
return; return;
...@@ -466,7 +466,7 @@ Abi::Abi(const QString &abiString) : ...@@ -466,7 +466,7 @@ Abi::Abi(const QString &abiString) :
if (abiParts.count() >= 5) { if (abiParts.count() >= 5) {
const QStringRef &bits = abiParts.at(4); const QStringRef &bits = abiParts.at(4);
if (!bits.endsWith(QLatin1String("bit"))) if (!bits.endsWith("bit"))
return; return;
bool ok = false; bool ok = false;
...@@ -487,89 +487,89 @@ Abi Abi::abiFromTargetTriplet(const QString &triple) ...@@ -487,89 +487,89 @@ Abi Abi::abiFromTargetTriplet(const QString &triple)
if (machine.isEmpty()) if (machine.isEmpty())
return Abi(); return Abi();
const QVector<QStringRef> parts = machine.splitRef(QRegExp(QLatin1String("[ /-]"))); const QVector<QStringRef> parts = machine.splitRef(QRegExp("[ /-]"));
Abi::Architecture arch = Abi::UnknownArchitecture; Architecture arch = UnknownArchitecture;
Abi::OS os = Abi::UnknownOS; OS os = UnknownOS;
Abi::OSFlavor flavor = Abi::UnknownFlavor; OSFlavor flavor = UnknownFlavor;
Abi::BinaryFormat format = Abi::UnknownFormat; BinaryFormat format = UnknownFormat;
unsigned char width = 0; unsigned char width = 0;
int unknownCount = 0; int unknownCount = 0;
for (const QStringRef &p : parts) { for (const QStringRef &p : parts) {
if (p == QLatin1String("unknown") || p == QLatin1String("pc") || p == QLatin1String("none") if (p == "unknown" || p == "pc" || p == "none"
|| p == QLatin1String("gnu") || p == QLatin1String("uclibc") || p == "gnu" || p == "uclibc"
|| p == QLatin1String("86_64") || p == QLatin1String("redhat") || p == "86_64" || p == "redhat"
|| p == QLatin1String("gnueabi") || p == QLatin1String("w64")) { || p == "gnueabi" || p == "w64") {
continue; continue;
} else if (p == QLatin1String("i386") || p == QLatin1String("i486") || p == QLatin1String("i586") } else if (p == "i386" || p == "i486" || p == "i586"
|| p == QLatin1String("i686") || p == QLatin1String("x86")) { || p == "i686" || p == "x86") {
arch = Abi::X86Architecture; arch = X86Architecture;
width = 32; width = 32;
} else if (p.startsWith(QLatin1String("arm"))) { } else if (p.startsWith("arm")) {
arch = Abi::ArmArchitecture; arch = ArmArchitecture;
width = p.contains(QLatin1String("64")) ? 64 : 32; width = p.contains("64") ? 64 : 32;
} else if (p.startsWith(QLatin1String("aarch64"))) { } else if (p.startsWith("aarch64")) {
arch = Abi::ArmArchitecture; arch = ArmArchitecture;
width = 64; width = 64;
} else if (p.startsWith(QLatin1String("mips"))) { } else if (p.startsWith("mips")) {
arch = Abi::MipsArchitecture; arch = MipsArchitecture;
width = p.contains(QLatin1String("64")) ? 64 : 32; width = p.contains("64") ? 64 : 32;
} else if (p == QLatin1String("x86_64") || p == QLatin1String("amd64")) { } else if (p == "x86_64" || p == "amd64") {
arch = Abi::X86Architecture; arch = X86Architecture;
width = 64; width = 64;
} else if (p == QLatin1String("powerpc64")) { } else if (p == "powerpc64") {
arch = Abi::PowerPCArchitecture; arch = PowerPCArchitecture;
width = 64; width = 64;
} else if (p == QLatin1String("powerpc")) { } else if (p == "powerpc") {
arch = Abi::PowerPCArchitecture; arch = PowerPCArchitecture;
width = 32; width = 32;
} else if (p == QLatin1String("linux") || p == QLatin1String("linux6e")) { } else if (p == "linux" || p == "linux6e") {
os = Abi::LinuxOS; os = LinuxOS;
if (flavor == Abi::UnknownFlavor) if (flavor == UnknownFlavor)
flavor = Abi::GenericLinuxFlavor; flavor = GenericLinuxFlavor;
format = Abi::ElfFormat; format = ElfFormat;
} else if (p == QLatin1String("android")) { } else if (p == "android") {
flavor = Abi::AndroidLinuxFlavor; flavor = AndroidLinuxFlavor;
} else if (p == QLatin1String("androideabi")) { } else if (p == "androideabi") {
flavor = Abi::AndroidLinuxFlavor; flavor = AndroidLinuxFlavor;
} else if (p.startsWith(QLatin1String("freebsd"))) { } else if (p.startsWith("freebsd")) {
os = Abi::BsdOS; os = BsdOS;
if (flavor == Abi::UnknownFlavor) if (flavor == UnknownFlavor)
flavor = Abi::FreeBsdFlavor; flavor = FreeBsdFlavor;
format = Abi::ElfFormat; format = ElfFormat;
} else if (p.startsWith(QLatin1String("openbsd"))) { } else if (p.startsWith("openbsd")) {
os = Abi::BsdOS; os = BsdOS;
if (flavor == Abi::UnknownFlavor) if (flavor == UnknownFlavor)
flavor = Abi::OpenBsdFlavor; flavor = OpenBsdFlavor;
format = Abi::ElfFormat; format = ElfFormat;
} else if (p == QLatin1String("mingw32") || p == QLatin1String("win32") } else if (p == "mingw32" || p == "win32"
|| p == QLatin1String("mingw32msvc") || p == QLatin1String("msys") || p == "mingw32msvc" || p == "msys"
|| p == QLatin1String("cygwin") || p == QLatin1String("windows")) { || p == "cygwin" || p == "windows") {
arch = Abi::X86Architecture; arch = X86Architecture;
os = Abi::WindowsOS; os = WindowsOS;
flavor = Abi::WindowsMSysFlavor; flavor = WindowsMSysFlavor;
format = Abi::PEFormat; format = PEFormat;
} else if (p == QLatin1String("apple")) { } else if (p == "apple") {
os = Abi::DarwinOS; os = DarwinOS;
flavor = Abi::GenericDarwinFlavor; flavor = GenericDarwinFlavor;
format = Abi::MachOFormat; format = MachOFormat;
} else if (p == QLatin1String("darwin10")) { } else if (p == "darwin10") {
width = 64; width = 64;
} else if (p == QLatin1String("darwin9")) { } else if (p == "darwin9") {
width = 32; width = 32;
} else if (p == QLatin1String("gnueabi")) { } else if (p == "gnueabi") {
format = Abi::ElfFormat; format = ElfFormat;
} else if (p == QLatin1String("wrs")) { } else if (p == "wrs") {
continue; continue;
} else if (p == QLatin1String("vxworks")) { } else if (p == "vxworks") {
os = Abi::VxWorks; os = VxWorks;
flavor = Abi::VxWorksFlavor; flavor = VxWorksFlavor;
format = Abi::ElfFormat; format = ElfFormat;
} else if (p.startsWith(QLatin1String("qnx"))) { } else if (p.startsWith("qnx")) {
os = Abi::QnxOS; os = QnxOS;
flavor = Abi::GenericQnxFlavor; flavor = GenericQnxFlavor;
format = Abi::ElfFormat; format = ElfFormat;
} else { } else {
++unknownCount; ++unknownCount;
} }
...@@ -587,7 +587,7 @@ QString Abi::toString() const ...@@ -587,7 +587,7 @@ QString Abi::toString() const
dn << toString(m_binaryFormat); dn << toString(m_binaryFormat);
dn << toString(m_wordWidth); dn << toString(m_wordWidth);
return dn.join(QLatin1Char('-')); return dn.join('-');
} }
bool Abi::operator != (const Abi &other) const bool Abi::operator != (const Abi &other) const
...@@ -704,45 +704,45 @@ QString Abi::toString(const OS &o) ...@@ -704,45 +704,45 @@ QString Abi::toString(const OS &o)
QString Abi::toString(const OSFlavor &of) QString Abi::toString(const OSFlavor &of)
{ {
switch (of) { switch (of) {
case Abi::GenericLinuxFlavor: case GenericLinuxFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case Abi::AndroidLinuxFlavor: case AndroidLinuxFlavor:
return QLatin1String("android"); return QLatin1String("android");
case Abi::FreeBsdFlavor: case FreeBsdFlavor:
return QLatin1String("freebsd"); return QLatin1String("freebsd");
case Abi::NetBsdFlavor: case NetBsdFlavor:
return QLatin1String("netbsd"); return QLatin1String("netbsd");
case Abi::OpenBsdFlavor: case OpenBsdFlavor:
return QLatin1String("openbsd"); return QLatin1String("openbsd");
case Abi::GenericDarwinFlavor: case GenericDarwinFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case Abi::GenericUnixFlavor: case GenericUnixFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case Abi::SolarisUnixFlavor: case SolarisUnixFlavor:
return QLatin1String("solaris"); return QLatin1String("solaris");
case Abi::WindowsMsvc2005Flavor: case WindowsMsvc2005Flavor:
return QLatin1String("msvc2005"); return QLatin1String("msvc2005");
case Abi::WindowsMsvc2008Flavor: case WindowsMsvc2008Flavor:
return QLatin1String("msvc2008"); return QLatin1String("msvc2008");
case Abi::WindowsMsvc2010Flavor: case WindowsMsvc2010Flavor:
return QLatin1String("msvc2010"); return QLatin1String("msvc2010");
case Abi::WindowsMsvc2012Flavor: case WindowsMsvc2012Flavor:
return QLatin1String("msvc2012"); return QLatin1String("msvc2012");
case Abi::WindowsMsvc2013Flavor: case WindowsMsvc2013Flavor:
return QLatin1String("msvc2013"); return QLatin1String("msvc2013");
case Abi::WindowsMsvc2015Flavor: case WindowsMsvc2015Flavor:
return QLatin1String("msvc2015"); return QLatin1String("msvc2015");
case Abi::WindowsMsvc2017Flavor: case WindowsMsvc2017Flavor:
return QLatin1String("msvc2017"); return QLatin1String("msvc2017");
case Abi::WindowsMSysFlavor: case WindowsMSysFlavor:
return QLatin1String("msys"); return QLatin1String("msys");
case Abi::WindowsCEFlavor: case WindowsCEFlavor:
return QLatin1String("ce"); return QLatin1String("ce");
case Abi::VxWorksFlavor: case VxWorksFlavor:
return QLatin1String("vxworks"); return QLatin1String("vxworks");
case Abi::GenericQnxFlavor: case GenericQnxFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case Abi::UnknownFlavor: // fall through! case UnknownFlavor: // fall through!
default: default:
return QLatin1String("unknown"); return QLatin1String("unknown");
} }
...@@ -896,7 +896,7 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path) ...@@ -896,7 +896,7 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
const QString fileName = QString::fromLocal8Bit(data.mid(0, 16)); const QString fileName = QString::fromLocal8Bit(data.mid(0, 16));
quint64 fileNameOffset = 0; quint64 fileNameOffset = 0;
if (fileName.startsWith(QLatin1String("#1/"))) if (fileName.startsWith("#1/"))
fileNameOffset = fileName.midRef(3).toInt(); fileNameOffset = fileName.midRef(3).toInt();
const QString fileLength = QString::fromLatin1(data.mid(48, 10)); const QString fileLength = QString::fromLatin1(data.mid(48, 10));
...@@ -904,11 +904,10 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path) ...@@ -904,11 +904,10 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
offset += fileLength.toInt() + 60 /* header */; offset += fileLength.toInt() + 60 /* header */;
tmp.append(abiOf(data.mid(toSkip))); tmp.append(abiOf(data.mid(toSkip)));
if (tmp.isEmpty() && fileName == QLatin1String("/0 ")) if (tmp.isEmpty() && fileName == "/0 ")
tmp = parseCoffHeader(data.mid(toSkip, 20)); // This might be windws... tmp = parseCoffHeader(data.mid(toSkip, 20)); // This might be windws...
if (!tmp.isEmpty() if (!tmp.isEmpty() && tmp.at(0).binaryFormat() != MachOFormat)
&& tmp.at(0).binaryFormat() != Abi::MachOFormat)
break; break;
offset += (offset % 2); // ar is 2 byte aligned offset += (offset % 2); // ar is 2 byte aligned
...@@ -955,7 +954,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data() ...@@ -955,7 +954,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
QString prefix = QString::fromLocal8Bit(qgetenv("QTC_TEST_EXTRADATALOCATION")); QString prefix = QString::fromLocal8Bit(qgetenv("QTC_TEST_EXTRADATALOCATION"));
if (prefix.isEmpty()) if (prefix.isEmpty())
return; return;
prefix += QLatin1String("/projectexplorer/abi"); prefix += "/projectexplorer/abi";
QFileInfo fi(prefix); QFileInfo fi(prefix);
if (!fi.exists() || !fi.isDir()) if (!fi.exists() || !fi.isDir())
...@@ -1074,7 +1073,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary() ...@@ -1074,7 +1073,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(QStringList, abis); QFETCH(QStringList, abis);
QList<ProjectExplorer::Abi> result = Abi::abisOfBinary(Utils::FileName::fromString(file)); QList<Abi> result = Abi::abisOfBinary(Utils::FileName::fromString(file));
QCOMPARE(result.count(), abis.count()); QCOMPARE(result.count(), abis.count());
for (int i = 0; i < abis.count(); ++i) for (int i = 0; i < abis.count(); ++i)
QCOMPARE(result.at(i).toString(), abis.at(i)); QCOMPARE(result.at(i).toString(), abis.at(i));
...@@ -1082,7 +1081,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary() ...@@ -1082,7 +1081,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
void ProjectExplorer::ProjectExplorerPlugin::testFlavorForOs() void ProjectExplorer::ProjectExplorerPlugin::testFlavorForOs()
{ {
QList<QList<ProjectExplorer::Abi::OSFlavor> > flavorLists;