summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurlrecode.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-07-23 13:50:34 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-07-27 11:25:49 +0200
commitd3c8757731d0b0d9e7a6448f1d1c21997136a19d (patch)
treed9393c862c2456b86c3a77bd1cc783b0aa01382d /src/corelib/io/qurlrecode.cpp
parentf144507829a39f9327ac1abe99c18e5f79e7ebcf (diff)
Purge redundant recoding of URL fragments from QByteArray
QUrl::fromEncodedComponent_helper() only existed to support some old methods deprecated since 5.0, that I recently removed. It was the only caller of qt_urlRecodeByteArray() aside from that function's own autotest. Both were private. Task-number: QTBUG-85700 Change-Id: I5d09fd44e768847ce51a1ae7043150922cb5314c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib/io/qurlrecode.cpp')
-rw-r--r--src/corelib/io/qurlrecode.cpp48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp
index ad23588978..2ac335cf5c 100644
--- a/src/corelib/io/qurlrecode.cpp
+++ b/src/corelib/io/qurlrecode.cpp
@@ -695,52 +695,4 @@ qt_urlRecode(QString &appendTo, QStringView in,
encoding, actionTable, false);
}
-// qstring.cpp
-bool qt_is_ascii(const char *&ptr, const char *end) noexcept;
-
-/*!
- \internal
- \since 5.0
-
- \a ba contains an 8-bit form of the component and it might be
- percent-encoded already. We can't use QString::fromUtf8 because it might
- contain non-UTF8 sequences. We can't use QByteArray::toPercentEncoding
- because it might already contain percent-encoded sequences. We can't use
- qt_urlRecode because it needs UTF-16 input.
-*/
-Q_AUTOTEST_EXPORT
-QString qt_urlRecodeByteArray(const QByteArray &ba)
-{
- if (ba.isNull())
- return QString();
-
- // scan ba for anything above or equal to 0x80
- // control points below 0x20 are fine in QString
- const char *in = ba.constData();
- const char *const end = ba.constEnd();
- if (qt_is_ascii(in, end)) {
- // no non-ASCII found, we're safe to convert to QString
- return QString::fromLatin1(ba, ba.size());
- }
-
- // we found something that we need to encode
- QByteArray intermediate = ba;
- intermediate.resize(ba.size() * 3 - (in - ba.constData()));
- uchar *out = reinterpret_cast<uchar *>(intermediate.data() + (in - ba.constData()));
- for ( ; in < end; ++in) {
- if (*in & 0x80) {
- // encode
- *out++ = '%';
- *out++ = encodeNibble(uchar(*in) >> 4);
- *out++ = encodeNibble(uchar(*in) & 0xf);
- } else {
- // keep
- *out++ = uchar(*in);
- }
- }
-
- // now it's safe to call fromLatin1
- return QString::fromLatin1(intermediate, out - reinterpret_cast<uchar *>(intermediate.data()));
-}
-
QT_END_NAMESPACE