diff options
author | David Faure <faure@kde.org> | 2012-02-01 12:06:18 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-02 06:57:25 +0100 |
commit | 42db8b2df643ca46b5c096f8e0951ef158a9c687 (patch) | |
tree | 4fb0b14d2e89bc33e1a7c896c9c5af0dfe7a8c2d | |
parent | f42f82f435d738339ad85c1380d1167338517247 (diff) | |
download | qtxmlpatterns-42db8b2df643ca46b5c096f8e0951ef158a9c687.tar.gz |
Fix QUrl handling after QUrl changes.
toString() is fine for most usages but here the result is made part of XML
bits, so toEncoded() is necessary so that '<' and '>' are percent-encoded.
Change-Id: I41832cefe3ae12cab13531f17095d0804a2e86d9
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
-rw-r--r-- | src/xmlpatterns/data/qanyuri.cpp | 5 | ||||
-rw-r--r-- | src/xmlpatterns/data/qatomicvalue.cpp | 2 | ||||
-rw-r--r-- | src/xmlpatterns/environment/qgenericstaticcontext.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qxmlquery/tst_qxmlquery.cpp | 4 | ||||
-rw-r--r-- | tools/xmlpatterns/main.cpp | 2 | ||||
-rw-r--r-- | tools/xmlpatterns/qapplicationargumentparser.cpp | 2 |
6 files changed, 7 insertions, 10 deletions
diff --git a/src/xmlpatterns/data/qanyuri.cpp b/src/xmlpatterns/data/qanyuri.cpp index 5d82baf..4a51364 100644 --- a/src/xmlpatterns/data/qanyuri.cpp +++ b/src/xmlpatterns/data/qanyuri.cpp @@ -60,14 +60,15 @@ AnyURI::Ptr AnyURI::fromValue(const QString &value) AnyURI::Ptr AnyURI::fromValue(const QUrl &uri) { - return AnyURI::Ptr(new AnyURI(uri.toString())); + return AnyURI::Ptr(new AnyURI(QString::fromLatin1(uri.toEncoded()))); } AnyURI::Ptr AnyURI::resolveURI(const QString &relative, const QString &base) { const QUrl urlBase(base); - return AnyURI::fromValue(urlBase.resolved(relative).toString()); + const QUrl uri(urlBase.resolved(relative)); + return AnyURI::fromValue(uri); } ItemType::Ptr AnyURI::type() const diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp index c12bfa7..cc8f207 100644 --- a/src/xmlpatterns/data/qatomicvalue.cpp +++ b/src/xmlpatterns/data/qatomicvalue.cpp @@ -146,7 +146,7 @@ Item AtomicValue::toXDM(const QVariant &value) * have to let it be an xs:string. Calling QVariant::toString() * on a QVariant that contains a QUrl returns, surprisingly, * an empty string. */ - return AtomicString::fromValue(value.toUrl().toString()); + return AtomicString::fromValue(QString::fromLatin1(value.toUrl().toEncoded())); } case QVariant::ByteArray: return HexBinary::fromValue(value.toByteArray()); diff --git a/src/xmlpatterns/environment/qgenericstaticcontext.cpp b/src/xmlpatterns/environment/qgenericstaticcontext.cpp index dae32ff..4430e45 100644 --- a/src/xmlpatterns/environment/qgenericstaticcontext.cpp +++ b/src/xmlpatterns/environment/qgenericstaticcontext.cpp @@ -62,7 +62,7 @@ GenericStaticContext::GenericStaticContext(const NamePool::Ptr &np, , m_defaultFunctionNamespace(CommonNamespaces::XFN) , m_orderingEmptySequence(Greatest) , m_orderingMode(Ordered) - , m_defaultCollation(QUrl::fromEncoded(CommonNamespaces::UNICODE_COLLATION)) + , m_defaultCollation(QUrl(QLatin1String(CommonNamespaces::UNICODE_COLLATION))) , m_baseURI(aBaseURI) , m_messageHandler(handler) , m_preserveMode(Preserve) diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 9c8461c..27f3964 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -2020,10 +2020,6 @@ void tst_QXmlQuery::fnDocNetworkAccessSuccess() const QVERIFY(buffer.open(QIODevice::WriteOnly)); QXmlSerializer serializer(query, &buffer); - - // these tests with data: URL fail since QUrl change e650dd3b6d8212d2c54ddb4a50558b508d0bf2b9 - QEXPECT_FAIL("data scheme with ASCII", "QTBUG-23953, fails", Abort); - QEXPECT_FAIL("data scheme with ASCII no MIME type", "QTBUG-23953, fails", Abort); QVERIFY(query.evaluateTo(&serializer)); QCOMPARE(result, expectedOutput); diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp index 8b661eb..171c6e5 100644 --- a/tools/xmlpatterns/main.cpp +++ b/tools/xmlpatterns/main.cpp @@ -222,7 +222,7 @@ static inline QUrl finalizeURI(const QApplicationArgumentParser &parser, const QString stringURI(parser.value(arg).toString()); if(parser.has(isURI)) - userURI = QUrl::fromEncoded(stringURI.toLatin1()); + userURI = QUrl(stringURI); else userURI = QUrl::fromLocalFile(stringURI); } diff --git a/tools/xmlpatterns/qapplicationargumentparser.cpp b/tools/xmlpatterns/qapplicationargumentparser.cpp index 04ff1df..0e2e4ed 100644 --- a/tools/xmlpatterns/qapplicationargumentparser.cpp +++ b/tools/xmlpatterns/qapplicationargumentparser.cpp @@ -833,7 +833,7 @@ QVariant QApplicationArgumentParser::convertToValue(const QApplicationArgument & } case QVariant::Url: { - const QUrl result(QUrl::fromEncoded(input.toLatin1())); + const QUrl result(input); if(result.isValid()) return QVariant(result); |