diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-04-16 19:54:52 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-04-16 18:48:04 +0000 |
commit | 28dcb7101e0038007bf9c2e1e17f9588b5264943 (patch) | |
tree | 666317b3c7f66c4de3a6f1db68ae102d39f0c236 /src | |
parent | be6b27aaa1ce2d9cdd93e005dafb62fa81c5cdc0 (diff) |
QFileSystemEngine: optimize from...(qgetenv())
Use the QByteArray overload, which no longer calls strlen(),
but uses the QByteArray length.
No danger of embedded NULs, because environment variables
cannot contain NULs.
Change-Id: I33fe479adfce2624c7042608e8e0a5c5b54a85db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemengine_win.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 221cea3bea..5cca3c323e 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1218,7 +1218,7 @@ QString QFileSystemEngine::rootPath() ret = QDir::fromNativeSeparators(QString::fromWCharArray(finalWinPath.GetRawBuffer(nullptr))); #else - QString ret = QString::fromLatin1(qgetenv("SystemDrive").constData()); + QString ret = QString::fromLatin1(qgetenv("SystemDrive")); if (ret.isEmpty()) ret = QLatin1String("c:"); ret.append(QLatin1Char('/')); @@ -1253,12 +1253,12 @@ QString QFileSystemEngine::homePath() } #endif if (ret.isEmpty() || !QFile::exists(ret)) { - ret = QString::fromLocal8Bit(qgetenv("USERPROFILE").constData()); + ret = QString::fromLocal8Bit(qgetenv("USERPROFILE")); if (ret.isEmpty() || !QFile::exists(ret)) { - ret = QString::fromLocal8Bit(qgetenv("HOMEDRIVE").constData()) - + QString::fromLocal8Bit(qgetenv("HOMEPATH").constData()); + ret = QString::fromLocal8Bit(qgetenv("HOMEDRIVE")) + + QString::fromLocal8Bit(qgetenv("HOMEPATH")); if (ret.isEmpty() || !QFile::exists(ret)) { - ret = QString::fromLocal8Bit(qgetenv("HOME").constData()); + ret = QString::fromLocal8Bit(qgetenv("HOME")); if (ret.isEmpty() || !QFile::exists(ret)) { #if defined(Q_OS_WINCE) ret = QLatin1String("\\My Documents"); |