summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurlquery.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-03-30 10:31:37 -0300
committerQt by Nokia <qt-info@nokia.com>2012-04-11 23:31:59 +0200
commit0441b2d4c332e0ae6e5ca52878985b826e8f68ca (patch)
tree5bddf1fa3aa8712be806b0356101127654710047 /src/corelib/io/qurlquery.cpp
parent9af551f7ab55d86ae0cca645bb7a86933b00d75c (diff)
Merge QUrl::DecodeAllDelimiters and QUrl::DecodeUnambiguousDelimiters
There's little value in having the DecodeUnambiguousDelimiters option since neither QUrl nor QUrlQuery can return values that are ambiguous in that particular context, ever. This option could be used to encode a character if, when placed in a URL, it would need to be encoded. Such cases are hash (#) or question marks (?) in the path component, or slashes (/) and at signs (@) in the userinfo. However, we don't need two enums for that, since there are no other characters that can appear in either form. Still, leave two bits for this enum. In the future, if we want to split the gen-delims from the sub-delims, we are able to. Change-Id: If5416b524680eb67dd4abbe7d072ca0ef7218506 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/corelib/io/qurlquery.cpp')
-rw-r--r--src/corelib/io/qurlquery.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 85180a2d72..c0b90dd587 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -208,7 +208,7 @@ inline QString QUrlQueryPrivate::recodeFromUser(const QString &input) const
// note: duplicated in setQuery()
QString output;
if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
- QUrl::DecodeUnicode | QUrl::DecodeAllDelimiters | QUrl::DecodeSpaces,
+ QUrl::MostDecoded,
prettyDecodedActions))
return output;
return input;
@@ -216,7 +216,7 @@ inline QString QUrlQueryPrivate::recodeFromUser(const QString &input) const
inline bool idempotentRecodeToUser(QUrl::ComponentFormattingOptions encoding)
{
- return encoding == QUrl::PrettyDecoded || encoding == (QUrl::PrettyDecoded | QUrl::DecodeAllDelimiters);
+ return encoding == QUrl::PrettyDecoded;
}
inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::ComponentFormattingOptions encoding) const
@@ -226,13 +226,10 @@ inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::Compon
if (idempotentRecodeToUser(encoding))
return input;
- bool decodeUnambiguous = encoding & QUrl::DecodeUnambiguousDelimiters;
- encoding &= ~QUrl::DecodeAllDelimiters;
-
- if (decodeUnambiguous) {
+ if (encoding & QUrl::DecodeDelimiters) {
QString output;
if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
- encoding | QUrl::DecodeAllDelimiters, prettyDecodedActions))
+ encoding, prettyDecodedActions))
return output;
return input;
}
@@ -270,7 +267,7 @@ void QUrlQueryPrivate::setQuery(const QString &query)
QString key;
if (!qt_urlRecode(key, begin, delimiter,
- QUrl::DecodeUnicode | QUrl::DecodeAllDelimiters | QUrl::DecodeSpaces,
+ QUrl::MostDecoded,
prettyDecodedActions))
key = QString(begin, delimiter - begin);
@@ -283,7 +280,7 @@ void QUrlQueryPrivate::setQuery(const QString &query)
} else {
QString value;
if (!qt_urlRecode(value, delimiter + 1, pos,
- QUrl::DecodeUnicode | QUrl::DecodeAllDelimiters | QUrl::DecodeSpaces,
+ QUrl::MostDecoded,
prettyDecodedActions))
value = QString(delimiter + 1, pos - delimiter - 1);
itemList.append(qMakePair(key, value));
@@ -469,10 +466,9 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
decode('#'), // 3
0
};
- if (encoding & QUrl::DecodeAllDelimiters) {
+ if (encoding & QUrl::DecodeDelimiters) {
// full decoding: we only encode the characters above
tableActions[3] = 0;
- encoding |= QUrl::DecodeAllDelimiters;
} else {
tableActions[3] = encode('#');
}