diff options
Diffstat (limited to 'src/corelib/io/qurlquery.cpp')
-rw-r--r-- | src/corelib/io/qurlquery.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index ce8ed6414d..3cf2b1e5eb 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE improperly-encoded strings are passed to the setter or query methods, QUrlQuery will attempt to recover instead of failing. That is to say, all functions in this class parse their string arguments as if the - {{QUrl::TolerantMode}} decoding mode was specified. + QUrl::TolerantMode decoding mode was specified. Application code should strive to always ensure proper encoding and not rely on TolerantMode parsing fixing the strings. Notably, all user input must be @@ -401,7 +401,11 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList; - return false; + + const QUrlQueryPrivate *x = d ? d.data() : other.d.data(); + return x->valueDelimiter == defaultQueryValueDelimiter() && + x->pairDelimiter == defaultQueryPairDelimiter() && + x->itemList.isEmpty(); } /*! @@ -515,7 +519,7 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const { int size = 0; for ( ; it != end; ++it) - size += it->first.length() + 1 + it->second.length() + 1; + size += it->first.size() + 1 + it->second.size() + 1; result.reserve(size + size / 4); } @@ -630,7 +634,7 @@ QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingO QList<QPair<QString, QString> > result; Map::const_iterator it = d->itemList.constBegin(); Map::const_iterator end = d->itemList.constEnd(); - result.reserve(d->itemList.count()); + result.reserve(d->itemList.size()); for ( ; it != end; ++it) result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding)); |