From 14b0e2fb1eec68d145176ee5de3570a0abff8dc1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 18 Nov 2021 12:08:49 +0100 Subject: [PATCH] Prefer QBAV over raw char * form of qt_configure_strs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 3b831e71af..97232d8120 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -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();