aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_websocket.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-01-18 14:33:06 +0000
committerGravatar Sadie Powell2022-01-18 14:33:06 +0000
commit40035385c6ecee61de82b18ff5f823a1ef4db871 (patch)
treea705ad2f3097b2e1310e5e579078f5e54234681c /src/modules/m_websocket.cpp
parentUse C++11-style initialisation for the entity map in httpd_stats. (diff)
Add constexpr to the initialisation of various const static fields.
Diffstat (limited to 'src/modules/m_websocket.cpp')
-rw-r--r--src/modules/m_websocket.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp
index 139abd59d..ef06c81b9 100644
--- a/src/modules/m_websocket.cpp
+++ b/src/modules/m_websocket.cpp
@@ -28,9 +28,9 @@
#define UTF_CPP_CPLUSPLUS 199711L
#include <unchecked.h>
-static const char MagicGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
-static const char newline[] = "\r\n";
-static const char whitespace[] = " \t";
+static constexpr char MagicGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+static constexpr char newline[] = "\r\n";
+static constexpr char whitespace[] = " \t";
static dynamic_reference_nocheck<HashProvider>* sha1;
struct WebSocketConfig final
@@ -138,16 +138,16 @@ class WebSocketHook final
STATE_ESTABLISHED
};
- static const unsigned char WS_MASKBIT = (1 << 7);
- static const unsigned char WS_FINBIT = (1 << 7);
- static const unsigned char WS_PAYLOAD_LENGTH_MAGIC_LARGE = 126;
- static const unsigned char WS_PAYLOAD_LENGTH_MAGIC_HUGE = 127;
- static const size_t WS_MAX_PAYLOAD_LENGTH_SMALL = 125;
- static const size_t WS_MAX_PAYLOAD_LENGTH_LARGE = 65535;
- static const size_t MAXHEADERSIZE = sizeof(uint64_t) + 2;
+ static constexpr unsigned char WS_MASKBIT = (1 << 7);
+ static constexpr unsigned char WS_FINBIT = (1 << 7);
+ static constexpr unsigned char WS_PAYLOAD_LENGTH_MAGIC_LARGE = 126;
+ static constexpr unsigned char WS_PAYLOAD_LENGTH_MAGIC_HUGE = 127;
+ static constexpr size_t WS_MAX_PAYLOAD_LENGTH_SMALL = 125;
+ static constexpr size_t WS_MAX_PAYLOAD_LENGTH_LARGE = 65535;
+ static constexpr size_t MAXHEADERSIZE = sizeof(uint64_t) + 2;
// Clients sending ping or pong frames faster than this are killed
- static const time_t MINPINGPONGDELAY = 10;
+ static constexpr time_t MINPINGPONGDELAY = 10;
State state = STATE_HTTPREQ;
time_t lastpingpong = 0;