From 3e45c3ed9070209f0114391eb8293fdb4134f14b Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 5 Sep 2021 01:00:46 -0700 Subject: Userland: Switch static_assert of type sizes to AK::AssertSize --- Userland/DevTools/UserspaceEmulator/SoftFPU.h | 2 +- Userland/Libraries/LibGfx/BitmapFont.cpp | 2 +- Userland/Libraries/LibGfx/ICOLoader.cpp | 4 ++-- Userland/Libraries/LibGfx/PNGLoader.cpp | 4 ++-- Userland/Utilities/ntpquery.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Userland') diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.h b/Userland/DevTools/UserspaceEmulator/SoftFPU.h index ff4cfd40d8..b5b8b9672b 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.h +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.h @@ -28,7 +28,7 @@ union MMX { i16x4 v16u; i32x2 v32u; }; -static_assert(sizeof(MMX) == sizeof(u64)); +static_assert(AssertSize()); class SoftFPU final { public: diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index 6a0da2fd3e..875a13ddda 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -29,7 +29,7 @@ struct [[gnu::packed]] FontFileHeader { u16 unused; }; -static_assert(sizeof(FontFileHeader) == 80); +static_assert(AssertSize()); NonnullRefPtr BitmapFont::clone() const { diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index 2bb9d26cc5..cc0ee6dc05 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -23,7 +23,7 @@ struct ICONDIR { u16 must_be_1 = 0; u16 image_count = 0; }; -static_assert(sizeof(ICONDIR) == 6); +static_assert(AssertSize()); struct ICONDIRENTRY { u8 width; @@ -35,7 +35,7 @@ struct ICONDIRENTRY { u32 size; u32 offset; }; -static_assert(sizeof(ICONDIRENTRY) == 16); +static_assert(AssertSize()); struct [[gnu::packed]] BMPFILEHEADER { u8 signature[2]; diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index af507efa35..2f3512a831 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -36,7 +36,7 @@ struct PNG_IHDR { u8 interlace_method { 0 }; }; -static_assert(sizeof(PNG_IHDR) == 13); +static_assert(AssertSize()); struct Scanline { u8 filter { 0 }; @@ -211,7 +211,7 @@ union [[gnu::packed]] Pixel { u8 a; }; }; -static_assert(sizeof(Pixel) == 4); +static_assert(AssertSize()); template ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* dummy_scanline_data) diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp index a4c36ae616..e764853354 100644 --- a/Userland/Utilities/ntpquery.cpp +++ b/Userland/Utilities/ntpquery.cpp @@ -46,7 +46,7 @@ struct [[gnu::packed]] NtpPacket { uint8_t version_number() const { return (li_vn_mode >> 3) & 7; } uint8_t mode() const { return li_vn_mode & 7; } }; -static_assert(sizeof(NtpPacket) == 48); +static_assert(AssertSize()); // NTP measures time in seconds since 1900-01-01, POSIX in seconds since 1970-01-01. // 1900 wasn't a leap year, so there are 70/4 leap years between 1900 and 1970. -- cgit v1.2.3