diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-13 21:53:07 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-06-22 20:12:41 +0000 |
commit | cad7100fda1b27ba56c4d9efc6bceba62859dfbc (patch) | |
tree | 942ff836a94aab364ae8c408dcfa44d8808c8134 /src/network/access/qnetworkdiskcache.cpp | |
parent | c699daeceb4448c4545a67ffdba27bcb3b994114 (diff) |
QByteArray: add compare() with case sensitivity options
Need to do the same for startsWith() and endsWith(). indexOf() is a lot
harder.
[ChangeLog][QtCore][QByteArray] Added compare(), which takes
Qt::CaseSensitivity as one of the parameters. This function is more
efficient than using toLower() or toUpper() and then comparing.
Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qnetworkdiskcache.cpp')
-rw-r--r-- | src/network/access/qnetworkdiskcache.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index c9d658225e..df2e4902a4 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -189,7 +189,7 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) const auto headers = metaData.rawHeaders(); for (const auto &header : headers) { - if (header.first.toLower() == "content-length") { + if (header.first.compare("content-length", Qt::CaseInsensitive) == 0) { const qint64 size = header.second.toLongLong(); if (size > (maximumCacheSize() * 3)/4) return 0; @@ -642,7 +642,7 @@ bool QCacheItem::canCompress() const bool typeOk = false; const auto headers = metaData.rawHeaders(); for (const auto &header : headers) { - if (header.first.toLower() == "content-length") { + if (header.first.compare("content-length", Qt::CaseInsensitive) == 0) { qint64 size = header.second.toLongLong(); if (size > MAX_COMPRESSION_SIZE) return false; @@ -650,7 +650,7 @@ bool QCacheItem::canCompress() const sizeOk = true; } - if (header.first.toLower() == "content-type") { + if (header.first.compare("content-type", Qt::CaseInsensitive) == 0) { QByteArray type = header.second; if (type.startsWith("text/") || (type.startsWith("application/") |