QUrl::resolved: remove the lambda in removeDotsFromPath()
I had made this change but didn't push it. Amends commit 09055d7211b1f8ba9fdec141a1e919faee1c1676 Change-Id: I8a96935cf6c742259c9dfffd17e8fc87d41dd891 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
06caefaacc
commit
01fbb883ad
@ -1545,25 +1545,22 @@ static void removeDotsFromPath(QString *path)
|
|||||||
|
|
||||||
// Scan the input for a "." or ".." segment. If there isn't any, then we
|
// Scan the input for a "." or ".." segment. If there isn't any, then we
|
||||||
// don't need to modify this path at all.
|
// don't need to modify this path at all.
|
||||||
qsizetype modidx = [&] {
|
qsizetype i = 0, n = path->size();
|
||||||
bool lastWasSlash = true;
|
for (bool lastWasSlash = true; i < n; ++i) {
|
||||||
for (qsizetype i = 0, n = path->size(); i < n; ++i) {
|
if (lastWasSlash && in[i] == u'.') {
|
||||||
if (lastWasSlash && in[i] == u'.') {
|
if (i + 1 == n || in[i + 1] == u'/')
|
||||||
if (i + 1 == n || in[i + 1] == u'/')
|
break;
|
||||||
return i;
|
if (in[i + 1] == u'.' && (i + 2 == n || in[i + 2] == u'/'))
|
||||||
if (in[i + 1] == u'.' && (i + 2 == n || in[i + 2] == u'/'))
|
break;
|
||||||
return i;
|
|
||||||
}
|
|
||||||
lastWasSlash = in[i] == u'/';
|
|
||||||
}
|
}
|
||||||
return qsizetype(-1);
|
lastWasSlash = in[i] == u'/';
|
||||||
}();
|
}
|
||||||
if (modidx < 0)
|
if (i == n)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QChar *out = path->data();
|
QChar *out = path->data();
|
||||||
const QChar *end = out + path->size();
|
const QChar *end = out + path->size();
|
||||||
out += modidx;
|
out += i;
|
||||||
in = out;
|
in = out;
|
||||||
|
|
||||||
// We implement a modified algorithm compared to RFC 3986, for efficiency.
|
// We implement a modified algorithm compared to RFC 3986, for efficiency.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user