1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

LibWebSocket: Fix confusion about sizeof(size_t) on 64-bit platforms

sizeof(size_t) is 8 on 64-bit platforms, not 64.
This commit is contained in:
Andreas Kling 2021-09-18 12:51:31 +02:00
parent 00895a5789
commit f82c4c4137

View file

@ -493,7 +493,7 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo
TODO();
} else if (payload.size() > NumericLimits<u16>::max()) {
// Send (the 'mask' flag + 127) + the 8-byte payload length
if constexpr (sizeof(size_t) >= 64) {
if constexpr (sizeof(size_t) >= 8) {
u8 payload_length[9] = {
(u8)((has_mask ? 0x80 : 0x00) | 127),
(u8)((payload.size() >> 56) & 0xff),