From 2f52afda8e77429c00029f94e887ed37dfb4e584 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Tue, 3 Mar 2020 17:26:53 +0100 Subject: QLibraryInfo: avoid unneeded conversion for path prefix Ammends 4ac872639e. Change return type for getPrefix to eliminate toLatin1/fromLocal8bit conversion of initial value for relocatable prefix to preserve not-latin1 characters and return valid prefix path. Fixes: QTBUG-81462 Change-Id: I15cfa49e9e440e257b04dd31803cd1478f3b07f5 Reviewed-by: Alexandru Croitor Reviewed-by: Joerg Bornemann --- src/corelib/global/qlibraryinfo.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7d6beaf9c2..acc73389ed 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -661,7 +661,7 @@ static QString getHostPrefixFromHostBinDir() #endif #ifndef QT_BUILD_QMAKE_BOOTSTRAP -static const char *getPrefix( +static QString getPrefix( #ifdef QT_BUILD_QMAKE QLibraryInfo::PathGroup group #endif @@ -670,15 +670,13 @@ static const char *getPrefix( #if defined(QT_BUILD_QMAKE) # if QT_CONFIGURE_CROSSBUILD if (group == QLibraryInfo::DevicePaths) - return QT_CONFIGURE_PREFIX_PATH; + return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); # endif - static QByteArray extPrefixPath = getExtPrefixFromHostBinDir().toLatin1(); - return extPrefixPath.constData(); + return getExtPrefixFromHostBinDir(); #elif QT_CONFIG(relocatable) - static QByteArray prefixPath = getRelocatablePrefix().toLatin1(); - return prefixPath.constData(); + return getRelocatablePrefix(); #else - return QT_CONFIGURE_PREFIX_PATH; + return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); #endif } #endif // QT_BUILD_QMAKE_BOOTSTRAP @@ -794,7 +792,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) if (!fromConf) { const char * volatile path = 0; if (loc == PrefixPath) { - path = getPrefix( + ret = getPrefix( #ifdef QT_BUILD_QMAKE group #endif -- cgit v1.2.3