1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:27:44 +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

@ -45,7 +45,7 @@ Cmap::Subtable::Platform Cmap::Subtable::platform_id() const
case 4:
return Platform::Custom;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -71,7 +71,7 @@ Cmap::Subtable::Format Cmap::Subtable::format() const
case 14:
return Format::UnicodeVariationSequences;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -89,7 +89,7 @@ Optional<Cmap::Subtable> Cmap::subtable(u32 index) const
u16 platform_id = be_u16(m_slice.offset_pointer(record_offset));
u16 encoding_id = be_u16(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_EncodingID));
u32 subtable_offset = be_u32(m_slice.offset_pointer(record_offset + (u32)Offsets::EncodingRecord_Offset));
ASSERT(subtable_offset < m_slice.size());
VERIFY(subtable_offset < m_slice.size());
auto subtable_slice = ReadonlyBytes(m_slice.offset_pointer(subtable_offset), m_slice.size() - subtable_offset);
return Subtable(subtable_slice, platform_id, encoding_id);
}
@ -128,7 +128,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const
return (codepoint + delta) & 0xffff;
}
u32 glyph_offset = (u32)Table4Offsets::GlyphOffsetConstBase + segcount_x2 * 3 + offset + range + (codepoint - start_codepoint) * 2;
ASSERT(glyph_offset + 2 <= m_slice.size());
VERIFY(glyph_offset + 2 <= m_slice.size());
return (be_u16(m_slice.offset_pointer(glyph_offset)) + delta) & 0xffff;
}
return 0;
@ -137,7 +137,7 @@ u32 Cmap::Subtable::glyph_id_for_codepoint_table_4(u32 codepoint) const
u32 Cmap::Subtable::glyph_id_for_codepoint_table_12(u32 codepoint) const
{
u32 num_groups = be_u32(m_slice.offset_pointer((u32)Table12Offsets::NumGroups));
ASSERT(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups);
VERIFY(m_slice.size() >= (u32)Table12Sizes::Header + (u32)Table12Sizes::Record * num_groups);
for (u32 offset = 0; offset < num_groups * (u32)Table12Sizes::Record; offset += (u32)Table12Sizes::Record) {
u32 start_codepoint = be_u32(m_slice.offset_pointer((u32)Table12Offsets::Record_StartCode + offset));
if (codepoint < start_codepoint) {

View file

@ -117,7 +117,7 @@ IndexToLocFormat Head::index_to_loc_format() const
case 1:
return IndexToLocFormat::Offset32;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -207,7 +207,7 @@ String Name::string_for_id(NameId id) const
GlyphHorizontalMetrics Hmtx::get_glyph_horizontal_metrics(u32 glyph_id) const
{
ASSERT(glyph_id < m_num_glyphs);
VERIFY(glyph_id < m_num_glyphs);
if (glyph_id < m_number_of_h_metrics) {
auto offset = glyph_id * (u32)Sizes::LongHorMetric;
u16 advance_width = be_u16(m_slice.offset_pointer(offset));

View file

@ -273,8 +273,8 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1)
return;
}
ASSERT(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height());
ASSERT(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height());
VERIFY(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height());
VERIFY(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height());
// If we're on the same Y, there's no need to draw
if (p0.y() == p1.y()) {
@ -356,14 +356,14 @@ Optional<Loca> Loca::from_slice(const ReadonlyBytes& slice, u32 num_glyphs, Inde
u32 Loca::get_glyph_offset(u32 glyph_id) const
{
ASSERT(glyph_id < m_num_glyphs);
VERIFY(glyph_id < m_num_glyphs);
switch (m_index_to_loc_format) {
case IndexToLocFormat::Offset16:
return ((u32)be_u16(m_slice.offset_pointer(glyph_id * 2))) * 2;
case IndexToLocFormat::Offset32:
return be_u32(m_slice.offset_pointer(glyph_id * 4));
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -428,7 +428,7 @@ void Glyf::Glyph::raster_inner(Rasterizer& rasterizer, Gfx::AffineTransform& aff
contour_size = current_contour_end - last_contour_end;
last_contour_end = current_contour_end;
auto opt_item = point_iterator.next();
ASSERT(opt_item.has_value());
VERIFY(opt_item.has_value());
contour_start = opt_item.value().point;
path.move_to(contour_start.value());
contour_size--;
@ -506,7 +506,7 @@ RefPtr<Gfx::Bitmap> Glyf::Glyph::raster_simple(float x_scale, float y_scale) con
Glyf::Glyph Glyf::glyph(u32 offset) const
{
ASSERT(m_slice.size() >= offset + (u32)Sizes::GlyphHeader);
VERIFY(m_slice.size() >= offset + (u32)Sizes::GlyphHeader);
i16 num_contours = be_i16(m_slice.offset_pointer(offset));
i16 xmin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::XMin));
i16 ymin = be_i16(m_slice.offset_pointer(offset + (u32)Offsets::YMin));

View file

@ -91,7 +91,7 @@ public:
case Type::Composite:
return raster_composite(x_scale, y_scale, glyph_callback);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
int ascender() const { return m_ymax; }
int descender() const { return m_ymin; }