mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +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:
parent
a103a85ae6
commit
d809637023
Notes:
sideshowbarker
2024-07-17 21:43:08 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/d8096370232 Pull-request: https://github.com/SerenityOS/serenity/pull/11587
4 changed files with 8 additions and 8 deletions
|
@ -199,7 +199,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|||
add_compile_options(-Wno-atomic-alignment)
|
||||
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
||||
add_compile_options(-Wno-null-pointer-subtraction)
|
||||
add_compile_options(-Wno-tautological-constant-out-of-range-compare)
|
||||
add_compile_options(-Wno-unneeded-internal-declaration)
|
||||
add_compile_options(-Wno-unused-but-set-variable)
|
||||
add_compile_options(-Wno-unused-const-variable)
|
||||
|
|
|
@ -63,8 +63,9 @@ bool FILE::flush()
|
|||
}
|
||||
if (m_mode & O_RDONLY) {
|
||||
// When open for reading, just drop the buffered data.
|
||||
VERIFY(m_buffer.buffered_size() <= NumericLimits<off_t>::max());
|
||||
off_t had_buffered = m_buffer.buffered_size();
|
||||
if constexpr (sizeof(size_t) >= sizeof(off_t))
|
||||
VERIFY(m_buffer.buffered_size() <= NumericLimits<off_t>::max());
|
||||
off_t had_buffered = static_cast<off_t>(m_buffer.buffered_size());
|
||||
m_buffer.drop();
|
||||
// Attempt to reset the underlying file position to what the user
|
||||
// expects.
|
||||
|
|
|
@ -346,7 +346,7 @@ public:
|
|||
{
|
||||
if (size_to_grow == 0)
|
||||
return true;
|
||||
auto new_size = m_data.size() + size_to_grow;
|
||||
u64 new_size = m_data.size() + size_to_grow;
|
||||
// Can't grow past 2^16 pages.
|
||||
if (new_size >= Constants::page_size * 65536)
|
||||
return false;
|
||||
|
|
|
@ -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] = {
|
||||
|
|
Loading…
Reference in a new issue