From c6fff8b8559d1406cc7a914362c512fc9ea0a681 Mon Sep 17 00:00:00 2001 From: vil02 Date: Wed, 31 Jan 2024 21:12:49 +0100 Subject: [PATCH] style: use `auto` with `static_cast` --- api/ptr.hpp | 2 +- api/utf8.hpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/ptr.hpp b/api/ptr.hpp index 52a4e59b3..6c1a9a218 100644 --- a/api/ptr.hpp +++ b/api/ptr.hpp @@ -90,7 +90,7 @@ namespace jule #ifdef __JULE_DISABLE__REFERENCE_COUNTING return jule::Ptr::make(instance, nullptr); #else - jule::Uint *ref = new (std::nothrow) jule::Uint; + auto *ref = new (std::nothrow) jule::Uint; if (!ref) jule::panic(__JULE_ERROR__MEMORY_ALLOCATION_FAILED "\nruntime: memory allocation failed for reference counter of reference type"); diff --git a/api/utf8.hpp b/api/utf8.hpp index 8e488cbdd..aa1365391 100644 --- a/api/utf8.hpp +++ b/api/utf8.hpp @@ -346,7 +346,7 @@ namespace jule if (len < 1) return std::make_tuple(jule::UTF8_RUNE_ERROR, 0); - const jule::U8 s0 = static_cast(s[0]); + const auto s0 = static_cast(s[0]); const jule::U8 x = jule::utf8_first[s0]; if (x >= jule::UTF8_AS) { @@ -356,12 +356,12 @@ namespace jule 1); } - const jule::Int sz = static_cast(x & 7); + const auto sz = static_cast(x & 7); const struct jule::UTF8AcceptRange accept = jule::utf8_accept_ranges[x >> 4]; if (len < sz) return std::make_tuple(jule::UTF8_RUNE_ERROR, 1); - const jule::U8 s1 = static_cast(s[1]); + const auto s1 = static_cast(s[1]); if (s1 < accept.lo || accept.hi < s1) return std::make_tuple(jule::UTF8_RUNE_ERROR, 1); @@ -371,7 +371,7 @@ namespace jule static_cast(s1 & jule::UTF8_MASKX), 2); - const jule::U8 s2 = static_cast(s[2]); + const auto s2 = static_cast(s[2]); if (s2 < jule::UTF8_LOCB || jule::UTF8_HICB < s2) return std::make_tuple(jule::UTF8_RUNE_ERROR, 1); @@ -382,7 +382,7 @@ namespace jule static_cast(s2 & jule::UTF8_MASKX), 3); - const jule::U8 s3 = static_cast(s[3]); + const auto s3 = static_cast(s[3]); if (s3 < jule::UTF8_LOCB || jule::UTF8_HICB < s3) return std::make_tuple(jule::UTF8_RUNE_ERROR, 1); @@ -398,7 +398,7 @@ namespace jule if (static_cast(r) <= jule::UTF8_RUNE1_MAX) return std::vector({static_cast(r)}); - const jule::U32 i = static_cast(r); + const auto i = static_cast(r); if (i < jule::UTF8_RUNE2_MAX) { return std::vector({static_cast(jule::UTF8_T2 | static_cast(r >> 6)),