diff options
author | David Faure <faure@kde.org> | 2012-05-14 14:48:23 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-14 17:36:50 +0200 |
commit | feb212e1e5f64111ed061b474bb2e6b8c3886acb (patch) | |
tree | ad4ad6d9f51f337de8316a15e94cc2534ce8c946 /src/corelib/io | |
parent | 28aa3324de22fa6bdbbed2fd5536fadf761666dc (diff) |
QUrl: a url with a fragment or query, and one without, are different.
Fix operator== and operator< so that a URL with an empty fragment
or query, is not treated as equal to a URL without any fragment or query.
This restores the Qt4 behavior on this particular issue.
Change-Id: Ie989f37353fb13c791b1d558d638d2e8a5b5d1b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qurl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 3e711b12ec..07024d3ba8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2356,10 +2356,16 @@ bool QUrl::operator <(const QUrl &url) const if (cmp != 0) return cmp < 0; + if (d->hasQuery() != url.d->hasQuery()) + return url.d->hasQuery(); + cmp = d->query.compare(url.d->query); if (cmp != 0) return cmp < 0; + if (d->hasFragment() != url.d->hasFragment()) + return url.d->hasFragment(); + cmp = d->fragment.compare(url.d->fragment); return cmp < 0; } @@ -2376,7 +2382,8 @@ bool QUrl::operator ==(const QUrl &url) const return url.d->isEmpty(); if (!url.d) return d->isEmpty(); - return d->scheme == url.d->scheme && + return d->sectionIsPresent == url.d->sectionIsPresent && + d->scheme == url.d->scheme && d->userName == url.d->userName && d->password == url.d->password && d->host == url.d->host && |