summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-02-24 18:38:17 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-02-24 23:29:48 +0000
commit8b5651eb41954cbcbcb3ddd66179711dac0bc1df (patch)
tree987ce6ef0fbbd33517231c78806f4953f93afa45
parent3376e67abe3a1ae5b3293b9c71b51e477c026b83 (diff)
QtNetwork: don't use Boyer-Moore for single-character needles
Using Boyer-Moore for single-character search strings makes no sense since there can be no skipping beyond the normal sequential search anyway. So, port to QByteArray::indexOf(char). Change-Id: I848e2ceea5ceafd0ebae402798b410f682348a75 Reviewed-by: Richard J. Moore <rich@kde.org>
-rw-r--r--src/network/access/qhttpnetworkreply.cpp8
-rw-r--r--src/network/ssl/qsslkey_p.cpp7
2 files changed, 4 insertions, 11 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index eda9dac745..f4510c3498 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkreply_p.h"
#include "qhttpnetworkconnection_p.h"
-#include <qbytearraymatcher.h>
-
#ifndef QT_NO_HTTP
#ifndef QT_NO_SSL
@@ -611,11 +609,9 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)
{
// see rfc2616, sec 4 for information about HTTP/1.1 headers.
// allows relaxed parsing here, accepts both CRLF & LF line endings
- const QByteArrayMatcher lf("\n");
- const QByteArrayMatcher colon(":");
int i = 0;
while (i < header.count()) {
- int j = colon.indexIn(header, i); // field-name
+ int j = header.indexOf(':', i); // field-name
if (j == -1)
break;
const QByteArray field = header.mid(i, j - i).trimmed();
@@ -623,7 +619,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)
// any number of LWS is allowed before and after the value
QByteArray value;
do {
- i = lf.indexIn(header, j);
+ i = header.indexOf('\n', j);
if (i == -1)
break;
if (!value.isEmpty())
diff --git a/src/network/ssl/qsslkey_p.cpp b/src/network/ssl/qsslkey_p.cpp
index f26b178d0e..34f664093c 100644
--- a/src/network/ssl/qsslkey_p.cpp
+++ b/src/network/ssl/qsslkey_p.cpp
@@ -61,7 +61,6 @@
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
-#include <QtCore/qbytearraymatcher.h>
#include <QtCore/qiodevice.h>
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
@@ -191,11 +190,9 @@ QByteArray QSslKeyPrivate::derFromPem(const QByteArray &pem, QMap<QByteArray, QB
if (der.contains("Proc-Type:")) {
// taken from QHttpNetworkReplyPrivate::parseHeader
- const QByteArrayMatcher lf("\n");
- const QByteArrayMatcher colon(":");
int i = 0;
while (i < der.count()) {
- int j = colon.indexIn(der, i); // field-name
+ int j = der.indexOf(':', i); // field-name
if (j == -1)
break;
const QByteArray field = der.mid(i, j - i).trimmed();
@@ -203,7 +200,7 @@ QByteArray QSslKeyPrivate::derFromPem(const QByteArray &pem, QMap<QByteArray, QB
// any number of LWS is allowed before and after the value
QByteArray value;
do {
- i = lf.indexIn(der, j);
+ i = der.indexOf('\n', j);
if (i == -1)
break;
if (!value.isEmpty())