QUrl::adjusted: remove unnecessary temporary variable
We don't need to QUrlPrivate::appendPath() to a temporary variable under QUrl::FullyEncoded mode and then setPath(). We can simply ask appendPath() to write to the destination variable once and for all, so long as we take care to ask it to use the encoding form that setPath() uses (QUrl::PrettyDecoded, which is 0x0). That avoids the side trip through FullyEncoded mode. Pick-to: 6.8 Change-Id: I7908b9cf75742db07145fffd9499ce3b79492fdb Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 7ed94ef2b510a51d81dbe8aa4700dc8a283b21aa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
01ff6e19f7
commit
65768082fe
@ -2895,11 +2895,10 @@ QUrl QUrl::adjusted(QUrl::FormattingOptions options) const
|
||||
that.setFragment(QString());
|
||||
if (options & RemovePath) {
|
||||
that.setPath(QString());
|
||||
} else if (options & (StripTrailingSlash | RemoveFilename | NormalizePathSegments)) {
|
||||
} else if (auto pathOpts = options & (StripTrailingSlash | RemoveFilename | NormalizePathSegments)) {
|
||||
that.detach();
|
||||
QString path;
|
||||
d->appendPath(path, options | FullyEncoded, QUrlPrivate::Path);
|
||||
that.d->setPath(path, 0, path.size());
|
||||
that.d->path.resize(0);
|
||||
d->appendPath(that.d->path, pathOpts, QUrlPrivate::Path);
|
||||
}
|
||||
if (that.d->isLocalFile() && that.d->path.startsWith(u'/')) {
|
||||
// ensure absolute file URLs have an empty authority to comply with the
|
||||
|
Loading…
x
Reference in New Issue
Block a user