1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Everywhere: Rename ASSERT => VERIFY

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
This commit is contained in:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -67,8 +67,8 @@ Utf8CodepointIterator Utf8View::end() const
size_t Utf8View::byte_offset_of(const Utf8CodepointIterator& it) const
{
ASSERT(it.m_ptr >= begin_ptr());
ASSERT(it.m_ptr <= end_ptr());
VERIFY(it.m_ptr >= begin_ptr());
VERIFY(it.m_ptr <= end_ptr());
return it.m_ptr - begin_ptr();
}
@ -162,15 +162,15 @@ bool Utf8CodepointIterator::operator!=(const Utf8CodepointIterator& other) const
Utf8CodepointIterator& Utf8CodepointIterator::operator++()
{
ASSERT(m_length > 0);
VERIFY(m_length > 0);
size_t code_point_length_in_bytes = 0;
u32 value;
bool first_byte_makes_sense = decode_first_byte(*m_ptr, code_point_length_in_bytes, value);
ASSERT(first_byte_makes_sense);
VERIFY(first_byte_makes_sense);
ASSERT(code_point_length_in_bytes <= m_length);
VERIFY(code_point_length_in_bytes <= m_length);
m_ptr += code_point_length_in_bytes;
m_length -= code_point_length_in_bytes;
@ -179,17 +179,17 @@ Utf8CodepointIterator& Utf8CodepointIterator::operator++()
size_t Utf8CodepointIterator::code_point_length_in_bytes() const
{
ASSERT(m_length > 0);
VERIFY(m_length > 0);
size_t code_point_length_in_bytes = 0;
u32 value;
bool first_byte_makes_sense = decode_first_byte(*m_ptr, code_point_length_in_bytes, value);
ASSERT(first_byte_makes_sense);
VERIFY(first_byte_makes_sense);
return code_point_length_in_bytes;
}
u32 Utf8CodepointIterator::operator*() const
{
ASSERT(m_length > 0);
VERIFY(m_length > 0);
u32 code_point_value_so_far = 0;
size_t code_point_length_in_bytes = 0;
@ -197,13 +197,13 @@ u32 Utf8CodepointIterator::operator*() const
bool first_byte_makes_sense = decode_first_byte(m_ptr[0], code_point_length_in_bytes, code_point_value_so_far);
if (!first_byte_makes_sense)
dbgln("First byte doesn't make sense, bytes: {}", StringView { (const char*)m_ptr, m_length });
ASSERT(first_byte_makes_sense);
VERIFY(first_byte_makes_sense);
if (code_point_length_in_bytes > m_length)
dbgln("Not enough bytes (need {}, have {}), first byte is: {:#02x}, '{}'", code_point_length_in_bytes, m_length, m_ptr[0], (const char*)m_ptr);
ASSERT(code_point_length_in_bytes <= m_length);
VERIFY(code_point_length_in_bytes <= m_length);
for (size_t offset = 1; offset < code_point_length_in_bytes; offset++) {
ASSERT(m_ptr[offset] >> 6 == 2);
VERIFY(m_ptr[offset] >> 6 == 2);
code_point_value_so_far <<= 6;
code_point_value_so_far |= m_ptr[offset] & 63;
}