1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Userland: Resolve tautological-constant-out-of-range-compare warnings

Stop comparing platform-specific sized integer types to max() values of
other interger types. Enable the warning everywhere.
This commit is contained in:
Andrew Kaster 2022-01-03 02:50:55 -07:00 committed by Brian Gianforcaro
parent a103a85ae6
commit d809637023
4 changed files with 8 additions and 8 deletions

View file

@ -488,10 +488,10 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo
m_impl->send(ReadonlyBytes(frame_head, 1));
// Section 5.1 : a client MUST mask all frames that it sends to the server
bool has_mask = true;
if (payload.size() > NumericLimits<u64>::max()) {
// FIXME: We can technically stream this via non-final packets.
TODO();
} else if (payload.size() > NumericLimits<u16>::max()) {
// FIXME: If the payload has a size > size_t max on a 32-bit platform, we could
// technically stream it via non-final packets. However, the size was already
// truncated earlier in the call stack when stuffing into a ReadonlyBytes
if (payload.size() > NumericLimits<u16>::max()) {
// Send (the 'mask' flag + 127) + the 8-byte payload length
if constexpr (sizeof(size_t) >= 8) {
u8 payload_length[9] = {