Prefer QBAV over raw char * form of qt_configure_strs

Passing the QByteArrayView to QString::fromLocal8Bit() ensures we tell
it the size and saves a strlen(). Quite apart from avoiding some
misguided grumbles from compilers, this save searching for a '\0' when
we already know where it is.

Change-Id: I2e3f2edfb4d3bdf488374570567d1dd30641ebc3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2021-11-18 12:08:49 +01:00
parent cde562cf6d
commit 14b0e2fb1e

View File

@ -431,7 +431,7 @@ static QString getRelocatablePrefix()
// executable within the QT_HOST_BIN directory. We're detecting the latter case by checking
// whether there's an import library corresponding to our QtCore DLL in PREFIX/lib.
const QString libdir = QString::fromLocal8Bit(
qt_configure_strs[QLibraryInfo::LibrariesPath - 1]);
qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
const QLatin1Char slash('/');
#if defined(Q_CC_MINGW)
const QString implibPrefix = QStringLiteral("lib");
@ -463,7 +463,7 @@ static QString getRelocatablePrefix()
// See "Hardware capabilities" in the ld.so documentation and the Qt 5.3.0
// changelog regarding SSE2 support.
const QString libdir = QString::fromLocal8Bit(
qt_configure_strs[QLibraryInfo::LibrariesPath - 1]);
qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
QDir prefixDir(prefixPath);
while (!prefixDir.exists(libdir)) {
prefixDir.cdUp();