QUrl: remove old commented out code for normalized().

adjusted(NormalizePathSegments) does this.

Change-Id: I4b17c39174b5c04edac8d51e5fef8cd052db4b3f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2013-07-13 14:22:30 +02:00 committed by The Qt Project
parent a7bc4e8494
commit 02afd94ef4

View File

@ -1603,87 +1603,6 @@ inline void QUrlPrivate::validate() const
}
}
}
inline const QByteArray &QUrlPrivate::normalized() const
{
if (QURL_HASFLAG(stateFlags, QUrlPrivate::Normalized))
return encodedNormalized;
QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
QURL_SETFLAG(that->stateFlags, QUrlPrivate::Normalized);
QUrlPrivate tmp = *this;
tmp.scheme = tmp.scheme.toLower();
tmp.host = tmp.canonicalHost();
// ensure the encoded and normalized parts of the URL
tmp.ensureEncodedParts();
if (tmp.encodedUserName.contains('%'))
q_normalizePercentEncoding(&tmp.encodedUserName, userNameExcludeChars);
if (tmp.encodedPassword.contains('%'))
q_normalizePercentEncoding(&tmp.encodedPassword, passwordExcludeChars);
if (tmp.encodedFragment.contains('%'))
q_normalizePercentEncoding(&tmp.encodedFragment, fragmentExcludeChars);
if (tmp.encodedPath.contains('%')) {
// the path is a bit special:
// the slashes shouldn't be encoded or decoded.
// They should remain exactly like they are right now
//
// treat the path as a slash-separated sequence of pchar
QByteArray result;
result.reserve(tmp.encodedPath.length());
if (tmp.encodedPath.startsWith('/'))
result.append('/');
const char *data = tmp.encodedPath.constData();
int lastSlash = 0;
int nextSlash;
do {
++lastSlash;
nextSlash = tmp.encodedPath.indexOf('/', lastSlash);
int len;
if (nextSlash == -1)
len = tmp.encodedPath.length() - lastSlash;
else
len = nextSlash - lastSlash;
if (memchr(data + lastSlash, '%', len)) {
// there's at least one percent before the next slash
QByteArray block = QByteArray(data + lastSlash, len);
q_normalizePercentEncoding(&block, pathExcludeChars);
result.append(block);
} else {
// no percents in this path segment, append wholesale
result.append(data + lastSlash, len);
}
// append the slash too, if it's there
if (nextSlash != -1)
result.append('/');
lastSlash = nextSlash;
} while (lastSlash != -1);
tmp.encodedPath = result;
}
if (!tmp.scheme.isEmpty()) // relative test
removeDotsFromPath(&tmp.encodedPath);
int qLen = tmp.query.length();
for (int i = 0; i < qLen; i++) {
if (qLen - i > 2 && tmp.query.at(i) == '%') {
++i;
tmp.query[i] = qToLower(tmp.query.at(i));
++i;
tmp.query[i] = qToLower(tmp.query.at(i));
}
}
encodedNormalized = tmp.toEncoded();
return encodedNormalized;
}
#endif
/*!