Skip spurious .toLower() on returns of QUrl::scheme()

QUrl::setScheme() parses and canonicalises the scheme, so that
scheme() always returns a lower-case string anyway; no need to
.toLower() it.

Change-Id: Ied00814b63f159386a42552dcf06346ee56f9f97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
bb10
Edward Welbourne 2016-03-08 12:54:15 +01:00
parent c9210d392c
commit 6a2892bdef
6 changed files with 7 additions and 7 deletions

View File

@ -702,7 +702,7 @@ void TorrentView::dragMoveEvent(QDragMoveEvent *event)
{
// Accept file actions with a '.torrent' extension.
QUrl url(event->mimeData()->text());
if (url.isValid() && url.scheme().toLower() == "file"
if (url.isValid() && url.scheme() == "file"
&& url.path().toLower().endsWith(".torrent"))
event->acceptProposedAction();
}

View File

@ -122,7 +122,7 @@ static QByteArray makeCacheKey(QUrl &url, QNetworkProxy *proxy)
{
QString result;
QUrl copy = url;
QString scheme = copy.scheme().toLower();
QString scheme = copy.scheme();
bool isEncrypted = scheme == QLatin1String("https");
copy.setPort(copy.port(isEncrypted ? 443 : 80));
if (scheme == QLatin1String("preconnect-http")) {

View File

@ -1119,7 +1119,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
Q_D(QNetworkAccessManager);
bool isLocalFile = req.url().isLocalFile();
QString scheme = req.url().scheme().toLower();
QString scheme = req.url().scheme();
// fast path for GET on file:// URLs
// The QNetworkAccessFileBackend will right now only be used for PUT

View File

@ -218,7 +218,7 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const
Q_D(const QNetworkCookieJar);
const QDateTime now = QDateTime::currentDateTimeUtc();
QList<QNetworkCookie> result;
bool isEncrypted = url.scheme().toLower() == QLatin1String("https");
bool isEncrypted = url.scheme() == QLatin1String("https");
// scan our cookies for something that matches
QList<QNetworkCookie>::ConstIterator it = d->allCookies.constBegin(),

View File

@ -628,7 +628,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
httpRequest.setUrl(url);
httpRequest.setRedirectCount(newHttpRequest.maximumRedirectsAllowed());
QString scheme = url.scheme().toLower();
QString scheme = url.scheme();
bool ssl = (scheme == QLatin1String("https")
|| scheme == QLatin1String("preconnect-https"));
q->setAttribute(QNetworkRequest::ConnectionEncryptedAttribute, ssl);

View File

@ -634,7 +634,7 @@ QList<QByteArray> QMacPasteboardMimeFileUri::convertFromMime(const QString &mime
QUrl url = urls.at(i).toUrl();
if (url.scheme().isEmpty())
url.setScheme(QLatin1String("file"));
if (url.scheme().toLower() == QLatin1String("file")) {
if (url.scheme() == QLatin1String("file")) {
if (url.host().isEmpty())
url.setHost(QLatin1String("localhost"));
url.setPath(url.path().normalized(QString::NormalizationForm_D));
@ -713,7 +713,7 @@ QList<QByteArray> QMacPasteboardMimeUrl::convertFromMime(const QString &mime, QV
QUrl url = urls.at(i).toUrl();
if (url.scheme().isEmpty())
url.setScheme(QLatin1String("file"));
if (url.scheme().toLower() == QLatin1String("file")) {
if (url.scheme() == QLatin1String("file")) {
if (url.host().isEmpty())
url.setHost(QLatin1String("localhost"));
url.setPath(url.path().normalized(QString::NormalizationForm_D));