diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-11 09:58:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-14 14:30:35 +0000 |
commit | f11862a05591452bdad9c1abd244288a2964a036 (patch) | |
tree | 7e18dede3ecf0dfa6a9797dceee4367c3aee4de0 /src | |
parent | c5f63b60330c05a5b70d5f5f42565f32227f161b (diff) | |
download | qtwebsockets-f11862a05591452bdad9c1abd244288a2964a036.tar.gz |
rsv1-3 should be bool instead of int
And reorded the data members of QWebSocketFrame to save some space.
Change-Id: I6fdaf74f344ac84e5a3f19883309455503a7ec4c
Reviewed-by: Luca Niccoli <lultimouomo@gmail.com>
Reviewed-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/websockets/qwebsocketframe.cpp | 54 | ||||
-rw-r--r-- | src/websockets/qwebsocketframe_p.h | 15 |
2 files changed, 22 insertions, 47 deletions
diff --git a/src/websockets/qwebsocketframe.cpp b/src/websockets/qwebsocketframe.cpp index d533921..b76fa5c 100644 --- a/src/websockets/qwebsocketframe.cpp +++ b/src/websockets/qwebsocketframe.cpp @@ -61,14 +61,14 @@ QT_BEGIN_NAMESPACE QWebSocketFrame::QWebSocketFrame() : m_closeCode(QWebSocketProtocol::CloseCodeNormal), m_closeReason(), - m_isFinalFrame(true), m_mask(0), - m_rsv1(0), - m_rsv2(0), - m_rsv3(0), m_opCode(QWebSocketProtocol::OpCodeReservedC), m_length(0), m_payload(), + m_isFinalFrame(true), + m_rsv1(false), + m_rsv2(false), + m_rsv3(false), m_isValid(false) { } @@ -79,14 +79,14 @@ QWebSocketFrame::QWebSocketFrame() : QWebSocketFrame::QWebSocketFrame(const QWebSocketFrame &other) : m_closeCode(other.m_closeCode), m_closeReason(other.m_closeReason), - m_isFinalFrame(other.m_isFinalFrame), m_mask(other.m_mask), - m_rsv1(other.m_rsv1), - m_rsv2(other.m_rsv2), - m_rsv3(other.m_rsv3), m_opCode(other.m_opCode), m_length(other.m_length), m_payload(other.m_payload), + m_isFinalFrame(other.m_isFinalFrame), + m_rsv1(other.m_rsv1), + m_rsv2(other.m_rsv2), + m_rsv3(other.m_rsv3), m_isValid(other.m_isValid) { } @@ -118,14 +118,14 @@ QWebSocketFrame &QWebSocketFrame::operator =(const QWebSocketFrame &other) QWebSocketFrame::QWebSocketFrame(QWebSocketFrame &&other) : m_closeCode(qMove(other.m_closeCode)), m_closeReason(qMove(other.m_closeReason)), - m_isFinalFrame(qMove(other.m_isFinalFrame)), m_mask(qMove(other.m_mask)), - m_rsv1(qMove(other.m_rsv1)), - m_rsv2(qMove(other.m_rsv2)), - m_rsv3(qMove(other.m_rsv3)), m_opCode(qMove(other.m_opCode)), m_length(qMove(other.m_length)), m_payload(qMove(other.m_payload)), + m_isFinalFrame(qMove(other.m_isFinalFrame)), + m_rsv1(qMove(other.m_rsv1)), + m_rsv2(qMove(other.m_rsv2)), + m_rsv3(qMove(other.m_rsv3)), m_isValid(qMove(other.m_isValid)) {} @@ -239,30 +239,6 @@ quint32 QWebSocketFrame::mask() const /*! \internal */ -int QWebSocketFrame::rsv1() const -{ - return m_rsv1; -} - -/*! - \internal - */ -int QWebSocketFrame::rsv2() const -{ - return m_rsv2; -} - -/*! - \internal - */ -int QWebSocketFrame::rsv3() const -{ - return m_rsv3; -} - -/*! - \internal - */ QWebSocketProtocol::OpCode QWebSocketFrame::opCode() const { return m_opCode; @@ -287,9 +263,9 @@ void QWebSocketFrame::clear() m_closeReason.clear(); m_isFinalFrame = true; m_mask = 0; - m_rsv1 = 0; - m_rsv2 = 0; - m_rsv3 = 0; + m_rsv1 = false; + m_rsv2 = false; + m_rsv3 = false; m_opCode = QWebSocketProtocol::OpCodeReservedC; m_length = 0; m_payload.clear(); diff --git a/src/websockets/qwebsocketframe_p.h b/src/websockets/qwebsocketframe_p.h index 131775b..b0c1ab2 100644 --- a/src/websockets/qwebsocketframe_p.h +++ b/src/websockets/qwebsocketframe_p.h @@ -75,9 +75,9 @@ public: bool isContinuationFrame() const; bool hasMask() const; quint32 mask() const; //returns 0 if no mask - int rsv1() const; - int rsv2() const; - int rsv3() const; + inline bool rsv1() const { return m_rsv1; } + inline bool rsv2() const { return m_rsv2; } + inline bool rsv3() const { return m_rsv3; } QWebSocketProtocol::OpCode opCode() const; QByteArray payload() const; @@ -90,16 +90,15 @@ public: private: QWebSocketProtocol::CloseCode m_closeCode; QString m_closeReason; - bool m_isFinalFrame; quint32 m_mask; - int m_rsv1; - int m_rsv2; - int m_rsv3; QWebSocketProtocol::OpCode m_opCode; - quint8 m_length; QByteArray m_payload; + bool m_isFinalFrame; + bool m_rsv1; + bool m_rsv2; + bool m_rsv3; bool m_isValid; enum ProcessingState |