diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-03-30 17:48:42 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 23:32:26 +0200 |
commit | 1b7e9dba75f18342911bc6954be3e754322f091f (patch) | |
tree | 1dfb775910294ff8d02e60cfa9c2bf178baa6221 /src/corelib/io/qurlquery.cpp | |
parent | 997ac954abe8e4f7d9323f13a79989f277de8301 (diff) |
Change the component formatting enum values so the default is zero
By having the default value equal to zero, we follow the principle of
least surprise. For example, if we had
url.path()
and we refactored to
url.path(QUrl::DecodeSpaces)
Then instead of ensuring spaces are decoded, we make spaces the only
thing encoded (unicode, delimiters and reserved characters are
encoded).
Besides, modifying the default can only be used to encode something
that wasn't encoded previously, so having the enums as Encode makes
more sense.
As a side-effect, toEncoded() does not support any extra encoding
options.
Change-Id: I2624ec446e65c2d979e9ca2f81bd3db22b00bb13
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/corelib/io/qurlquery.cpp')
-rw-r--r-- | src/corelib/io/qurlquery.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index c0b90dd587..ccb03611f5 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -226,7 +226,7 @@ inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::Compon if (idempotentRecodeToUser(encoding)) return input; - if (encoding & QUrl::DecodeDelimiters) { + if (!(encoding & QUrl::EncodeDelimiters)) { QString output; if (qt_urlRecode(output, input.constData(), input.constData() + input.length(), encoding, prettyDecodedActions)) @@ -466,10 +466,7 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const decode('#'), // 3 0 }; - if (encoding & QUrl::DecodeDelimiters) { - // full decoding: we only encode the characters above - tableActions[3] = 0; - } else { + if (encoding & QUrl::EncodeDelimiters) { tableActions[3] = encode('#'); } |