diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2024-02-28 09:06:05 -0800 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2024-03-04 11:31:48 -0800 |
| commit | a6b4ff16b9f6ba7f93d55c0eedb5ef44f2d85c99 (patch) | |
| tree | 37495bf3d720bce7848369bc9c76708c0b1fcede /src/corelib/io/qdir.cpp | |
| parent | a14bba6803f674edede596eaeb5a46feed0f889e (diff) | |
Replace some QString::fromUtf16() with QStringView::toString()
The QStringView counterpart is somewhat faster because it doesn't go
through the UTF-16 codec in QUtf16::convertToUnicode(), which tries to
detect the BOM.
I've included QString::fromWCharArray in this because:
a) it's used extensively in Windows code
b) wide chars in memory probably don't have BOMs anyway
Change-Id: I01ec3c774d9943adb903fffd17b815be4d2ab8ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'src/corelib/io/qdir.cpp')
| -rw-r--r-- | src/corelib/io/qdir.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 2dcd119723d..fc5ba180727 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2353,7 +2353,7 @@ QString qt_normalizePathSegments(const QString &name, QDirPrivate::PathNormaliza // If path was not modified return the original value if (used == 0) return name; - return QString::fromUtf16(out + used, len - used); + return QStringView(out + used, len - used).toString(); } static QString qt_cleanPath(const QString &path, bool *ok) |
