diff options
author | Olivier De Cannière <[email protected]> | 2024-10-30 15:30:36 +0100 |
---|---|---|
committer | Olivier De Cannière <[email protected]> | 2024-11-01 17:03:31 +0100 |
commit | 33a80b27b343fb02d365520a352843a84dd851fd (patch) | |
tree | e6be79fc0de098eeba3ce3a132dbbe466df18204 | |
parent | 179982a81a292bfe3f9dc16888f7c9777f1b2251 (diff) |
TestLib: Wrap raw strings in QStringLiteral for QT_NO_CAST_FROM_ASCII
This enables testing of qmltc with QT_NO_CAST_FROM_ASCII.
Pick-to: 6.8
Change-Id: I0a6655522b0edaa79dc606b70c263b83ad14ee0b
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
-rw-r--r-- | src/testlib/qemulationdetector_p.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/testlib/qemulationdetector_p.h b/src/testlib/qemulationdetector_p.h index a4b62818af9..f8fdb4d6512 100644 --- a/src/testlib/qemulationdetector_p.h +++ b/src/testlib/qemulationdetector_p.h @@ -63,11 +63,13 @@ static bool isReportedArchitectureX86(void); */ static bool isX86SpecificFileAvailable() { + using namespace Qt::StringLiterals; + // MTRR (Memory Type Range Registers) are a feature of the x86 architecture // and /proc/mtrr is only present (on Linux) for that family. // However, it's an optional kernel feature, so the absence of the file is // not sufficient to conclude we're on real hardware. - QFileInfo mtrr("/proc/mtrr"); + QFileInfo mtrr(u"/proc/mtrr"_s); if (mtrr.exists()) return true; return false; @@ -78,6 +80,8 @@ static bool isX86SpecificFileAvailable() */ static bool isReportedArchitectureX86(void) { + using namespace Qt::StringLiterals; + #if QT_CONFIG(process) && QT_CONFIG(regularexpression) QProcess unamer; QString machineString; @@ -85,14 +89,14 @@ static bool isReportedArchitectureX86(void) // Using syscall "uname" is not possible since that would be captured by // QEMU and result would be the architecture being emulated (e.g. armv7l). // By using QProcess we get the architecture used by the host. - unamer.start("uname -a"); + unamer.start(u"uname -a"_s); if (!unamer.waitForFinished()) { return false; } - machineString = unamer.readAll(); + machineString = QString::fromLocal8Bit(unamer.readAll()); // Is our current host cpu x86? - if (machineString.contains(QRegularExpression("i386|i686|x86"))) { + if (machineString.contains(QRegularExpression(u"i386|i686|x86"_s))) { return true; } #endif |