diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-11-18 12:08:49 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-11-19 16:28:44 +0100 |
commit | 14b0e2fb1eec68d145176ee5de3570a0abff8dc1 (patch) | |
tree | a1bd9747bc9d4dc26fc61c4670baf7e19449989a /src/corelib/global | |
parent | cde562cf6d65a3ad64fa6afd6014be74febdf912 (diff) |
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>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 |
1 files 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(); |