summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_win.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-05-22 16:49:01 +0200
committerLars Knoll <lars.knoll@qt.io>2020-06-12 15:50:17 +0200
commit4d31ddf5730ad3eed59331811218b26284438cef (patch)
tree979df749241b7df2716fb1885ba464d6f530670d /src/corelib/io/qfilesystemengine_win.cpp
parent5caf7ef3b1c67cc65efd21d2341955230a6ed43c (diff)
Port QDir, QFile from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I7feb5c12eb5a8504c34292e0da75332b5ba9ef20 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_win.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 4c1b9f87c2..6e5e19e12f 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -306,7 +306,7 @@ static QString readSymLink(const QFileSystemEntry &link)
result = result.mid(4);
// cut off UNC in addition when the link points at a UNC share
// in which case we need to prepend another backslash to get \\server\share
- if (result.leftRef(3) == QLatin1String("UNC")) {
+ if (QStringView{result}.left(3) == QLatin1String("UNC")) {
result.replace(0, 3, QLatin1Char('\\'));
}
}
@@ -378,7 +378,7 @@ static QString readLink(const QFileSystemEntry &link)
static bool uncShareExists(const QString &server)
{
// This code assumes the UNC path is always like \\?\UNC\server...
- const QVector<QStringRef> parts = server.splitRef(QLatin1Char('\\'), Qt::SkipEmptyParts);
+ const auto parts = QStringView{server}.split(QLatin1Char('\\'), Qt::SkipEmptyParts);
if (parts.count() >= 3) {
QStringList shares;
if (QFileSystemEngine::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(2), &shares))
@@ -1195,7 +1195,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
if (removeEmptyParents) {
dirName = QDir::toNativeSeparators(QDir::cleanPath(dirName));
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
- const QStringRef chunkRef = dirName.leftRef(slash);
+ const auto chunkRef = QStringView{dirName}.left(slash);
if (chunkRef.length() == 2 && chunkRef.at(0).isLetter() && chunkRef.at(1) == QLatin1Char(':'))
break;
const QString chunk = chunkRef.toString();