summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2021-12-17 07:56:12 +0100
committerMarc Mutz <marc.mutz@qt.io>2021-12-17 12:27:55 +0000
commit05c1895924f4f739a55b2d9927f5c0d848d2c136 (patch)
treeb09faee986aa154db5072de6aaf0aea890806e22 /src
parent38218494a65049b5f9da7a8aab012a969c7dac86 (diff)
downloadqtwebsockets-05c1895924f4f739a55b2d9927f5c0d848d2c136.tar.gz
Port QWebSocketProtocol::versionFromString() to QStringView
It's not public API, so there's no point in using QAnyStringView here. We control all callers. Pick-to: 6.3 Change-Id: I1ca9135b4fa7d435e5a21534842c002509f1b7ff Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/websockets/qwebsockethandshakerequest.cpp2
-rw-r--r--src/websockets/qwebsocketprotocol.cpp2
-rw-r--r--src/websockets/qwebsocketprotocol_p.h5
3 files changed, 5 insertions, 4 deletions
diff --git a/src/websockets/qwebsockethandshakerequest.cpp b/src/websockets/qwebsockethandshakerequest.cpp
index 0b1f8ae..3960d0f 100644
--- a/src/websockets/qwebsockethandshakerequest.cpp
+++ b/src/websockets/qwebsockethandshakerequest.cpp
@@ -288,7 +288,7 @@ void QWebSocketHandshakeRequest::readHandshake(QByteArrayView header, int maxHea
return;
}
const QWebSocketProtocol::Version ver =
- QWebSocketProtocol::versionFromString(version.trimmed().toString());
+ QWebSocketProtocol::versionFromString(version.trimmed());
m_versions << ver;
}
}
diff --git a/src/websockets/qwebsocketprotocol.cpp b/src/websockets/qwebsocketprotocol.cpp
index d0465f1..919807c 100644
--- a/src/websockets/qwebsocketprotocol.cpp
+++ b/src/websockets/qwebsocketprotocol.cpp
@@ -172,7 +172,7 @@ QT_BEGIN_NAMESPACE
\internal
*/
-QWebSocketProtocol::Version QWebSocketProtocol::versionFromString(const QString &versionString)
+QWebSocketProtocol::Version QWebSocketProtocol::versionFromString(QStringView versionString)
{
bool ok = false;
Version version = VersionUnknown;
diff --git a/src/websockets/qwebsocketprotocol_p.h b/src/websockets/qwebsocketprotocol_p.h
index 4a8d952..82d543f 100644
--- a/src/websockets/qwebsocketprotocol_p.h
+++ b/src/websockets/qwebsocketprotocol_p.h
@@ -54,9 +54,10 @@
#include <QtCore/qglobal.h>
#include "QtWebSockets/qwebsocketprotocol.h"
+#include <QtCore/qstringview.h>
+
QT_BEGIN_NAMESPACE
-class QString;
class QByteArray;
namespace QWebSocketProtocol
@@ -96,7 +97,7 @@ inline bool isCloseCodeValid(int closeCode)
}
inline Version currentVersion() { return VersionLatest; }
-Version Q_AUTOTEST_EXPORT versionFromString(const QString &versionString);
+Version Q_AUTOTEST_EXPORT versionFromString(QStringView versionString);
void Q_AUTOTEST_EXPORT mask(QByteArray *payload, quint32 maskingKey);
void Q_AUTOTEST_EXPORT mask(char *payload, quint64 size, quint32 maskingKey);