mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
Notes:
sideshowbarker
2024-07-17 16:21:09 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/086969277e Pull-request: https://github.com/SerenityOS/serenity/pull/12321 Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/bgianfo ✅
1665 changed files with 8479 additions and 8479 deletions
12
AK/Atomic.h
12
AK/Atomic.h
|
@ -146,9 +146,9 @@ class Atomic {
|
|||
|
||||
public:
|
||||
Atomic() noexcept = default;
|
||||
Atomic& operator=(const Atomic&) volatile = delete;
|
||||
Atomic& operator=(Atomic const&) volatile = delete;
|
||||
Atomic& operator=(Atomic&&) volatile = delete;
|
||||
Atomic(const Atomic&) = delete;
|
||||
Atomic(Atomic const&) = delete;
|
||||
Atomic(Atomic&&) = delete;
|
||||
|
||||
constexpr Atomic(T val) noexcept
|
||||
|
@ -215,9 +215,9 @@ class Atomic<T, DefaultMemoryOrder> {
|
|||
|
||||
public:
|
||||
Atomic() noexcept = default;
|
||||
Atomic& operator=(const Atomic&) volatile = delete;
|
||||
Atomic& operator=(Atomic const&) volatile = delete;
|
||||
Atomic& operator=(Atomic&&) volatile = delete;
|
||||
Atomic(const Atomic&) = delete;
|
||||
Atomic(Atomic const&) = delete;
|
||||
Atomic(Atomic&&) = delete;
|
||||
|
||||
constexpr Atomic(T val) noexcept
|
||||
|
@ -346,9 +346,9 @@ class Atomic<T*, DefaultMemoryOrder> {
|
|||
|
||||
public:
|
||||
Atomic() noexcept = default;
|
||||
Atomic& operator=(const Atomic&) volatile = delete;
|
||||
Atomic& operator=(Atomic const&) volatile = delete;
|
||||
Atomic& operator=(Atomic&&) volatile = delete;
|
||||
Atomic(const Atomic&) = delete;
|
||||
Atomic(Atomic const&) = delete;
|
||||
Atomic(Atomic&&) = delete;
|
||||
|
||||
constexpr Atomic(T* val) noexcept
|
||||
|
|
|
@ -17,8 +17,8 @@ private:
|
|||
friend T;
|
||||
constexpr Badge() = default;
|
||||
|
||||
Badge(const Badge&) = delete;
|
||||
Badge& operator=(const Badge&) = delete;
|
||||
Badge(Badge const&) = delete;
|
||||
Badge& operator=(Badge const&) = delete;
|
||||
|
||||
Badge(Badge&&) = delete;
|
||||
Badge& operator=(Badge&&) = delete;
|
||||
|
|
|
@ -126,10 +126,10 @@ String encode_base64(ReadonlyBytes input)
|
|||
const u8 index2 = ((in1 << 2) | (in2 >> 6)) & 0x3f;
|
||||
const u8 index3 = in2 & 0x3f;
|
||||
|
||||
const char out0 = alphabet[index0];
|
||||
const char out1 = alphabet[index1];
|
||||
const char out2 = is_16bit ? '=' : alphabet[index2];
|
||||
const char out3 = is_8bit ? '=' : alphabet[index3];
|
||||
char const out0 = alphabet[index0];
|
||||
char const out1 = alphabet[index1];
|
||||
char const out2 = is_16bit ? '=' : alphabet[index2];
|
||||
char const out3 = is_8bit ? '=' : alphabet[index3];
|
||||
|
||||
output.append(out0);
|
||||
output.append(out1);
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_next_byte.has_value()) {
|
||||
const auto bit = (m_next_byte.value() >> m_bit_offset) & 1;
|
||||
auto const bit = (m_next_byte.value() >> m_bit_offset) & 1;
|
||||
result |= bit << nread;
|
||||
++nread;
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
nread += 8;
|
||||
m_next_byte.clear();
|
||||
} else {
|
||||
const auto bit = (m_next_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
auto const bit = (m_next_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
result <<= 1;
|
||||
result |= bit;
|
||||
++nread;
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
return 0;
|
||||
|
||||
size_t count;
|
||||
const u8* first = &m_data[start / 8];
|
||||
const u8* last = &m_data[(start + len) / 8];
|
||||
u8 const* first = &m_data[start / 8];
|
||||
u8 const* last = &m_data[(start + len) / 8];
|
||||
u8 byte = *first;
|
||||
byte &= bitmask_first_byte[start % 8];
|
||||
if (first == last) {
|
||||
|
@ -64,19 +64,19 @@ public:
|
|||
count += popcount(byte);
|
||||
}
|
||||
if (++first < last) {
|
||||
const size_t* ptr_large = (const size_t*)(((FlatPtr)first + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1));
|
||||
if ((const u8*)ptr_large > last)
|
||||
ptr_large = (const size_t*)last;
|
||||
while (first < (const u8*)ptr_large) {
|
||||
size_t const* ptr_large = (size_t const*)(((FlatPtr)first + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1));
|
||||
if ((u8 const*)ptr_large > last)
|
||||
ptr_large = (size_t const*)last;
|
||||
while (first < (u8 const*)ptr_large) {
|
||||
count += popcount(*first);
|
||||
first++;
|
||||
}
|
||||
const size_t* last_large = (const size_t*)((FlatPtr)last & ~(sizeof(size_t) - 1));
|
||||
size_t const* last_large = (size_t const*)((FlatPtr)last & ~(sizeof(size_t) - 1));
|
||||
while (ptr_large < last_large) {
|
||||
count += popcount(*ptr_large);
|
||||
ptr_large++;
|
||||
}
|
||||
for (first = (const u8*)ptr_large; first < last; first++)
|
||||
for (first = (u8 const*)ptr_large; first < last; first++)
|
||||
count += popcount(*first);
|
||||
}
|
||||
}
|
||||
|
@ -88,24 +88,24 @@ public:
|
|||
|
||||
[[nodiscard]] bool is_null() const { return m_data == nullptr; }
|
||||
|
||||
[[nodiscard]] const u8* data() const { return m_data; }
|
||||
[[nodiscard]] u8 const* data() const { return m_data; }
|
||||
|
||||
template<bool VALUE>
|
||||
Optional<size_t> find_one_anywhere(size_t hint = 0) const
|
||||
{
|
||||
VERIFY(hint < m_size);
|
||||
const u8* end = &m_data[m_size / 8];
|
||||
u8 const* end = &m_data[m_size / 8];
|
||||
|
||||
for (;;) {
|
||||
// We will use hint as what it is: a hint. Because we try to
|
||||
// scan over entire 32 bit words, we may start searching before
|
||||
// the hint!
|
||||
const size_t* ptr_large = (const size_t*)((FlatPtr)&m_data[hint / 8] & ~(sizeof(size_t) - 1));
|
||||
if ((const u8*)ptr_large < &m_data[0]) {
|
||||
size_t const* ptr_large = (size_t const*)((FlatPtr)&m_data[hint / 8] & ~(sizeof(size_t) - 1));
|
||||
if ((u8 const*)ptr_large < &m_data[0]) {
|
||||
ptr_large++;
|
||||
|
||||
// m_data isn't aligned, check first bytes
|
||||
size_t start_ptr_large = (const u8*)ptr_large - &m_data[0];
|
||||
size_t start_ptr_large = (u8 const*)ptr_large - &m_data[0];
|
||||
size_t i = 0;
|
||||
u8 byte = VALUE ? 0x00 : 0xff;
|
||||
while (i < start_ptr_large && m_data[i] == byte)
|
||||
|
@ -120,14 +120,14 @@ public:
|
|||
}
|
||||
|
||||
size_t val_large = VALUE ? 0x0 : NumericLimits<size_t>::max();
|
||||
const size_t* end_large = (const size_t*)((FlatPtr)end & ~(sizeof(size_t) - 1));
|
||||
size_t const* end_large = (size_t const*)((FlatPtr)end & ~(sizeof(size_t) - 1));
|
||||
while (ptr_large < end_large && *ptr_large == val_large)
|
||||
ptr_large++;
|
||||
|
||||
if (ptr_large == end_large) {
|
||||
// We didn't find anything, check the remaining few bytes (if any)
|
||||
u8 byte = VALUE ? 0x00 : 0xff;
|
||||
size_t i = (const u8*)ptr_large - &m_data[0];
|
||||
size_t i = (u8 const*)ptr_large - &m_data[0];
|
||||
size_t byte_count = m_size / 8;
|
||||
VERIFY(i <= byte_count);
|
||||
while (i < byte_count && m_data[i] == byte)
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
return {}; // We already checked from the beginning
|
||||
|
||||
// Try scanning before the hint
|
||||
end = (const u8*)((FlatPtr)&m_data[hint / 8] & ~(sizeof(size_t) - 1));
|
||||
end = (u8 const*)((FlatPtr)&m_data[hint / 8] & ~(sizeof(size_t) - 1));
|
||||
hint = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
if constexpr (!VALUE)
|
||||
val_large = ~val_large;
|
||||
VERIFY(val_large != 0);
|
||||
return ((const u8*)ptr_large - &m_data[0]) * 8 + bit_scan_forward(val_large) - 1;
|
||||
return ((u8 const*)ptr_large - &m_data[0]) * 8 + bit_scan_forward(val_large) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,34 +18,34 @@ struct ByteReader {
|
|||
__builtin_memcpy(addr, &value, sizeof(T));
|
||||
}
|
||||
template<typename T>
|
||||
requires(IsTriviallyConstructible<T>) static void load(const u8* addr, T& value)
|
||||
requires(IsTriviallyConstructible<T>) static void load(u8 const* addr, T& value)
|
||||
{
|
||||
__builtin_memcpy(&value, addr, sizeof(T));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static T* load_pointer(const u8* address)
|
||||
static T* load_pointer(u8 const* address)
|
||||
{
|
||||
FlatPtr value;
|
||||
load<FlatPtr>(address, value);
|
||||
return reinterpret_cast<T*>(value);
|
||||
}
|
||||
|
||||
static u16 load16(const u8* address)
|
||||
static u16 load16(u8 const* address)
|
||||
{
|
||||
u16 value;
|
||||
load(address, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
static u32 load32(const u8* address)
|
||||
static u32 load32(u8 const* address)
|
||||
{
|
||||
u32 value;
|
||||
load(address, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
static u64 load64(const u8* address)
|
||||
static u64 load64(u8 const* address)
|
||||
{
|
||||
u64 value;
|
||||
load(address, value);
|
||||
|
|
44
AK/Checked.h
44
AK/Checked.h
|
@ -127,7 +127,7 @@ public:
|
|||
m_value = value;
|
||||
}
|
||||
|
||||
constexpr Checked(const Checked&) = default;
|
||||
constexpr Checked(Checked const&) = default;
|
||||
|
||||
constexpr Checked(Checked&& other)
|
||||
: m_value(exchange(other.m_value, 0))
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
constexpr Checked& operator=(const Checked& other) = default;
|
||||
constexpr Checked& operator=(Checked const& other) = default;
|
||||
|
||||
constexpr Checked& operator=(Checked&& other)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
m_value /= other;
|
||||
}
|
||||
|
||||
constexpr Checked& operator+=(const Checked& other)
|
||||
constexpr Checked& operator+=(Checked const& other)
|
||||
{
|
||||
m_overflow |= other.m_overflow;
|
||||
add(other.value());
|
||||
|
@ -212,7 +212,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
constexpr Checked& operator-=(const Checked& other)
|
||||
constexpr Checked& operator-=(Checked const& other)
|
||||
{
|
||||
m_overflow |= other.m_overflow;
|
||||
sub(other.value());
|
||||
|
@ -225,7 +225,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
constexpr Checked& operator*=(const Checked& other)
|
||||
constexpr Checked& operator*=(Checked const& other)
|
||||
{
|
||||
m_overflow |= other.m_overflow;
|
||||
mul(other.value());
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
constexpr Checked& operator/=(const Checked& other)
|
||||
constexpr Checked& operator/=(Checked const& other)
|
||||
{
|
||||
m_overflow |= other.m_overflow;
|
||||
div(other.value());
|
||||
|
@ -319,7 +319,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
constexpr Checked<T> operator+(const Checked<T>& a, const Checked<T>& b)
|
||||
constexpr Checked<T> operator+(Checked<T> const& a, Checked<T> const& b)
|
||||
{
|
||||
Checked<T> c { a };
|
||||
c.add(b.value());
|
||||
|
@ -327,7 +327,7 @@ constexpr Checked<T> operator+(const Checked<T>& a, const Checked<T>& b)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr Checked<T> operator-(const Checked<T>& a, const Checked<T>& b)
|
||||
constexpr Checked<T> operator-(Checked<T> const& a, Checked<T> const& b)
|
||||
{
|
||||
Checked<T> c { a };
|
||||
c.sub(b.value());
|
||||
|
@ -335,7 +335,7 @@ constexpr Checked<T> operator-(const Checked<T>& a, const Checked<T>& b)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr Checked<T> operator*(const Checked<T>& a, const Checked<T>& b)
|
||||
constexpr Checked<T> operator*(Checked<T> const& a, Checked<T> const& b)
|
||||
{
|
||||
Checked<T> c { a };
|
||||
c.mul(b.value());
|
||||
|
@ -343,7 +343,7 @@ constexpr Checked<T> operator*(const Checked<T>& a, const Checked<T>& b)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr Checked<T> operator/(const Checked<T>& a, const Checked<T>& b)
|
||||
constexpr Checked<T> operator/(Checked<T> const& a, Checked<T> const& b)
|
||||
{
|
||||
Checked<T> c { a };
|
||||
c.div(b.value());
|
||||
|
@ -351,73 +351,73 @@ constexpr Checked<T> operator/(const Checked<T>& a, const Checked<T>& b)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator<(const Checked<T>& a, T b)
|
||||
constexpr bool operator<(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() < b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator>(const Checked<T>& a, T b)
|
||||
constexpr bool operator>(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() > b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator>=(const Checked<T>& a, T b)
|
||||
constexpr bool operator>=(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() >= b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator<=(const Checked<T>& a, T b)
|
||||
constexpr bool operator<=(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() <= b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator==(const Checked<T>& a, T b)
|
||||
constexpr bool operator==(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() == b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator!=(const Checked<T>& a, T b)
|
||||
constexpr bool operator!=(Checked<T> const& a, T b)
|
||||
{
|
||||
return a.value() != b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator<(T a, const Checked<T>& b)
|
||||
constexpr bool operator<(T a, Checked<T> const& b)
|
||||
{
|
||||
return a < b.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator>(T a, const Checked<T>& b)
|
||||
constexpr bool operator>(T a, Checked<T> const& b)
|
||||
{
|
||||
return a > b.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator>=(T a, const Checked<T>& b)
|
||||
constexpr bool operator>=(T a, Checked<T> const& b)
|
||||
{
|
||||
return a >= b.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator<=(T a, const Checked<T>& b)
|
||||
constexpr bool operator<=(T a, Checked<T> const& b)
|
||||
{
|
||||
return a <= b.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator==(T a, const Checked<T>& b)
|
||||
constexpr bool operator==(T a, Checked<T> const& b)
|
||||
{
|
||||
return a == b.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool operator!=(T a, const Checked<T>& b)
|
||||
constexpr bool operator!=(T a, Checked<T> const& b)
|
||||
{
|
||||
return a != b.value();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ template<typename... Args>
|
|||
void compiletime_fail(Args...);
|
||||
|
||||
template<size_t N>
|
||||
consteval auto extract_used_argument_index(const char (&fmt)[N], size_t specifier_start_index, size_t specifier_end_index, size_t& next_implicit_argument_index)
|
||||
consteval auto extract_used_argument_index(char const (&fmt)[N], size_t specifier_start_index, size_t specifier_end_index, size_t& next_implicit_argument_index)
|
||||
{
|
||||
struct {
|
||||
size_t index_value { 0 };
|
||||
|
@ -69,7 +69,7 @@ consteval auto extract_used_argument_index(const char (&fmt)[N], size_t specifie
|
|||
|
||||
// FIXME: We should rather parse these format strings at compile-time if possible.
|
||||
template<size_t N>
|
||||
consteval auto count_fmt_params(const char (&fmt)[N])
|
||||
consteval auto count_fmt_params(char const (&fmt)[N])
|
||||
{
|
||||
struct {
|
||||
// FIXME: Switch to variable-sized storage whenever we can come up with one :)
|
||||
|
@ -118,7 +118,7 @@ consteval auto count_fmt_params(const char (&fmt)[N])
|
|||
if (result.total_used_last_format_specifier_start_count == 0)
|
||||
compiletime_fail("Format-String Checker internal error: Expected location information");
|
||||
|
||||
const auto specifier_start_index = result.last_format_specifier_start[--result.total_used_last_format_specifier_start_count];
|
||||
auto const specifier_start_index = result.last_format_specifier_start[--result.total_used_last_format_specifier_start_count];
|
||||
|
||||
if (result.total_used_argument_count >= result.used_arguments.size())
|
||||
compiletime_fail("Format-String Checker internal error: Too many format arguments in format string");
|
||||
|
@ -146,7 +146,7 @@ namespace AK::Format::Detail {
|
|||
template<typename... Args>
|
||||
struct CheckedFormatString {
|
||||
template<size_t N>
|
||||
consteval CheckedFormatString(const char (&fmt)[N])
|
||||
consteval CheckedFormatString(char const (&fmt)[N])
|
||||
: m_string { fmt }
|
||||
{
|
||||
#ifdef ENABLE_COMPILETIME_FORMAT_CHECK
|
||||
|
@ -165,7 +165,7 @@ struct CheckedFormatString {
|
|||
private:
|
||||
#ifdef ENABLE_COMPILETIME_FORMAT_CHECK
|
||||
template<size_t N, size_t param_count>
|
||||
consteval static bool check_format_parameter_consistency(const char (&fmt)[N])
|
||||
consteval static bool check_format_parameter_consistency(char const (&fmt)[N])
|
||||
{
|
||||
auto check = count_fmt_params<N>(fmt);
|
||||
if (check.unclosed_braces != 0)
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
template<typename U = T>
|
||||
void enqueue_begin(U&& value)
|
||||
{
|
||||
const auto new_head = (this->m_head - 1 + Capacity) % Capacity;
|
||||
auto const new_head = (this->m_head - 1 + Capacity) % Capacity;
|
||||
auto& slot = this->elements()[new_head];
|
||||
if (this->m_size == Capacity)
|
||||
slot.~T();
|
||||
|
|
|
@ -18,7 +18,7 @@ class CircularDuplexStream : public AK::DuplexStream {
|
|||
public:
|
||||
size_t write(ReadonlyBytes bytes) override
|
||||
{
|
||||
const auto nwritten = min(bytes.size(), Capacity - m_queue.size());
|
||||
auto const nwritten = min(bytes.size(), Capacity - m_queue.size());
|
||||
|
||||
for (size_t idx = 0; idx < nwritten; ++idx)
|
||||
m_queue.enqueue(bytes[idx]);
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto nwritten = write(bytes);
|
||||
auto const nwritten = write(bytes);
|
||||
VERIFY(nwritten == bytes.size());
|
||||
return true;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
if (has_any_error())
|
||||
return 0;
|
||||
|
||||
const auto nread = min(bytes.size(), m_queue.size());
|
||||
auto const nread = min(bytes.size(), m_queue.size());
|
||||
|
||||
for (size_t idx = 0; idx < nread; ++idx)
|
||||
bytes[idx] = m_queue.dequeue();
|
||||
|
@ -59,10 +59,10 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
const auto nread = min(bytes.size(), seekback);
|
||||
auto const nread = min(bytes.size(), seekback);
|
||||
|
||||
for (size_t idx = 0; idx < nread; ++idx) {
|
||||
const auto index = (m_total_written - seekback + idx) % Capacity;
|
||||
auto const index = (m_total_written - seekback + idx) % Capacity;
|
||||
bytes[idx] = m_queue.m_storage[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
class ConstIterator {
|
||||
public:
|
||||
bool operator!=(const ConstIterator& other) { return m_index != other.m_index; }
|
||||
bool operator!=(ConstIterator const& other) { return m_index != other.m_index; }
|
||||
ConstIterator& operator++()
|
||||
{
|
||||
++m_index;
|
||||
|
@ -81,12 +81,12 @@ public:
|
|||
|
||||
private:
|
||||
friend class CircularQueue;
|
||||
ConstIterator(const CircularQueue& queue, const size_t index)
|
||||
ConstIterator(CircularQueue const& queue, const size_t index)
|
||||
: m_queue(queue)
|
||||
, m_index(index)
|
||||
{
|
||||
}
|
||||
const CircularQueue& m_queue;
|
||||
CircularQueue const& m_queue;
|
||||
size_t m_index { 0 };
|
||||
};
|
||||
|
||||
|
|
36
AK/Complex.h
36
AK/Complex.h
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T>& operator=(const Complex<U>& other)
|
||||
constexpr Complex<T>& operator=(Complex<U> const& other)
|
||||
{
|
||||
m_real = other.real();
|
||||
m_imag = other.imag();
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator+=(const Complex<U>& x)
|
||||
constexpr Complex<T> operator+=(Complex<U> const& x)
|
||||
{
|
||||
m_real += x.real();
|
||||
m_imag += x.imag();
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator-=(const Complex<U>& x)
|
||||
constexpr Complex<T> operator-=(Complex<U> const& x)
|
||||
{
|
||||
m_real -= x.real();
|
||||
m_imag -= x.imag();
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator*=(const Complex<U>& x)
|
||||
constexpr Complex<T> operator*=(Complex<U> const& x)
|
||||
{
|
||||
const T real = m_real;
|
||||
m_real = real * x.real() - m_imag * x.imag();
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator/=(const Complex<U>& x)
|
||||
constexpr Complex<T> operator/=(Complex<U> const& x)
|
||||
{
|
||||
const T real = m_real;
|
||||
const T divisor = x.real() * x.real() + x.imag() * x.imag();
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator+(const Complex<U>& a)
|
||||
constexpr Complex<T> operator+(Complex<U> const& a)
|
||||
{
|
||||
Complex<T> x = *this;
|
||||
x += a;
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator-(const Complex<U>& a)
|
||||
constexpr Complex<T> operator-(Complex<U> const& a)
|
||||
{
|
||||
Complex<T> x = *this;
|
||||
x -= a;
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator*(const Complex<U>& a)
|
||||
constexpr Complex<T> operator*(Complex<U> const& a)
|
||||
{
|
||||
Complex<T> x = *this;
|
||||
x *= a;
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator/(const Complex<U>& a)
|
||||
constexpr Complex<T> operator/(Complex<U> const& a)
|
||||
{
|
||||
Complex<T> x = *this;
|
||||
x /= a;
|
||||
|
@ -206,13 +206,13 @@ public:
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr bool operator==(const Complex<U>& a) const
|
||||
constexpr bool operator==(Complex<U> const& a) const
|
||||
{
|
||||
return (this->real() == a.real()) && (this->imag() == a.imag());
|
||||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr bool operator!=(const Complex<U>& a) const
|
||||
constexpr bool operator!=(Complex<U> const& a) const
|
||||
{
|
||||
return !(*this == a);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ private:
|
|||
|
||||
// reverse associativity operators for scalars
|
||||
template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator+(const U& b, const Complex<T>& a)
|
||||
constexpr Complex<T> operator+(const U& b, Complex<T> const& a)
|
||||
{
|
||||
Complex<T> x = a;
|
||||
x += b;
|
||||
|
@ -242,7 +242,7 @@ constexpr Complex<T> operator+(const U& b, const Complex<T>& a)
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator-(const U& b, const Complex<T>& a)
|
||||
constexpr Complex<T> operator-(const U& b, Complex<T> const& a)
|
||||
{
|
||||
Complex<T> x = a;
|
||||
x -= b;
|
||||
|
@ -250,7 +250,7 @@ constexpr Complex<T> operator-(const U& b, const Complex<T>& a)
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator*(const U& b, const Complex<T>& a)
|
||||
constexpr Complex<T> operator*(const U& b, Complex<T> const& a)
|
||||
{
|
||||
Complex<T> x = a;
|
||||
x *= b;
|
||||
|
@ -258,7 +258,7 @@ constexpr Complex<T> operator*(const U& b, const Complex<T>& a)
|
|||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator/(const U& b, const Complex<T>& a)
|
||||
constexpr Complex<T> operator/(const U& b, Complex<T> const& a)
|
||||
{
|
||||
Complex<T> x = a;
|
||||
x /= b;
|
||||
|
@ -272,15 +272,15 @@ template<AK::Concepts::Arithmetic T>
|
|||
static constinit Complex<T> complex_imag_unit = Complex<T>((T)0, (T)1);
|
||||
|
||||
template<AK::Concepts::Arithmetic T, AK::Concepts::Arithmetic U>
|
||||
static constexpr bool approx_eq(const Complex<T>& a, const Complex<U>& b, const double margin = 0.000001)
|
||||
static constexpr bool approx_eq(Complex<T> const& a, Complex<U> const& b, double const margin = 0.000001)
|
||||
{
|
||||
const auto x = const_cast<Complex<T>&>(a) - const_cast<Complex<U>&>(b);
|
||||
auto const x = const_cast<Complex<T>&>(a) - const_cast<Complex<U>&>(b);
|
||||
return x.magnitude() <= margin;
|
||||
}
|
||||
|
||||
// complex version of exp()
|
||||
template<AK::Concepts::Arithmetic T>
|
||||
static constexpr Complex<T> cexp(const Complex<T>& a)
|
||||
static constexpr Complex<T> cexp(Complex<T> const& a)
|
||||
{
|
||||
// FIXME: this can probably be faster and not use so many "expensive" trigonometric functions
|
||||
return exp(a.real()) * Complex<T>(cos(a.imag()), sin(a.imag()));
|
||||
|
|
|
@ -63,11 +63,11 @@ public:
|
|||
constexpr T& value() { return m_value; }
|
||||
|
||||
// Always implemented: identity.
|
||||
constexpr bool operator==(const Self& other) const
|
||||
constexpr bool operator==(Self const& other) const
|
||||
{
|
||||
return this->m_value == other.m_value;
|
||||
}
|
||||
constexpr bool operator!=(const Self& other) const
|
||||
constexpr bool operator!=(Self const& other) const
|
||||
{
|
||||
return this->m_value != other.m_value;
|
||||
}
|
||||
|
@ -101,22 +101,22 @@ public:
|
|||
}
|
||||
|
||||
// Only implemented when `Cmp` is true:
|
||||
constexpr bool operator>(const Self& other) const
|
||||
constexpr bool operator>(Self const& other) const
|
||||
{
|
||||
static_assert(Cmp, "'a>b' is only available for DistinctNumeric types with 'Cmp'.");
|
||||
return this->m_value > other.m_value;
|
||||
}
|
||||
constexpr bool operator<(const Self& other) const
|
||||
constexpr bool operator<(Self const& other) const
|
||||
{
|
||||
static_assert(Cmp, "'a<b' is only available for DistinctNumeric types with 'Cmp'.");
|
||||
return this->m_value < other.m_value;
|
||||
}
|
||||
constexpr bool operator>=(const Self& other) const
|
||||
constexpr bool operator>=(Self const& other) const
|
||||
{
|
||||
static_assert(Cmp, "'a>=b' is only available for DistinctNumeric types with 'Cmp'.");
|
||||
return this->m_value >= other.m_value;
|
||||
}
|
||||
constexpr bool operator<=(const Self& other) const
|
||||
constexpr bool operator<=(Self const& other) const
|
||||
{
|
||||
static_assert(Cmp, "'a<=b' is only available for DistinctNumeric types with 'Cmp'.");
|
||||
return this->m_value <= other.m_value;
|
||||
|
@ -140,34 +140,34 @@ public:
|
|||
static_assert(Flags, "'~a' is only available for DistinctNumeric types with 'Flags'.");
|
||||
return ~this->m_value;
|
||||
}
|
||||
constexpr Self operator&(const Self& other) const
|
||||
constexpr Self operator&(Self const& other) const
|
||||
{
|
||||
static_assert(Flags, "'a&b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
return this->m_value & other.m_value;
|
||||
}
|
||||
constexpr Self operator|(const Self& other) const
|
||||
constexpr Self operator|(Self const& other) const
|
||||
{
|
||||
static_assert(Flags, "'a|b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
return this->m_value | other.m_value;
|
||||
}
|
||||
constexpr Self operator^(const Self& other) const
|
||||
constexpr Self operator^(Self const& other) const
|
||||
{
|
||||
static_assert(Flags, "'a^b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
return this->m_value ^ other.m_value;
|
||||
}
|
||||
constexpr Self& operator&=(const Self& other)
|
||||
constexpr Self& operator&=(Self const& other)
|
||||
{
|
||||
static_assert(Flags, "'a&=b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
this->m_value &= other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator|=(const Self& other)
|
||||
constexpr Self& operator|=(Self const& other)
|
||||
{
|
||||
static_assert(Flags, "'a|=b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
this->m_value |= other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator^=(const Self& other)
|
||||
constexpr Self& operator^=(Self const& other)
|
||||
{
|
||||
static_assert(Flags, "'a^=b' is only available for DistinctNumeric types with 'Flags'.");
|
||||
this->m_value ^= other.m_value;
|
||||
|
@ -176,23 +176,23 @@ public:
|
|||
|
||||
// Only implemented when `Shift` is true:
|
||||
// TODO: Should this take `int` instead?
|
||||
constexpr Self operator<<(const Self& other) const
|
||||
constexpr Self operator<<(Self const& other) const
|
||||
{
|
||||
static_assert(Shift, "'a<<b' is only available for DistinctNumeric types with 'Shift'.");
|
||||
return this->m_value << other.m_value;
|
||||
}
|
||||
constexpr Self operator>>(const Self& other) const
|
||||
constexpr Self operator>>(Self const& other) const
|
||||
{
|
||||
static_assert(Shift, "'a>>b' is only available for DistinctNumeric types with 'Shift'.");
|
||||
return this->m_value >> other.m_value;
|
||||
}
|
||||
constexpr Self& operator<<=(const Self& other)
|
||||
constexpr Self& operator<<=(Self const& other)
|
||||
{
|
||||
static_assert(Shift, "'a<<=b' is only available for DistinctNumeric types with 'Shift'.");
|
||||
this->m_value <<= other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator>>=(const Self& other)
|
||||
constexpr Self& operator>>=(Self const& other)
|
||||
{
|
||||
static_assert(Shift, "'a>>=b' is only available for DistinctNumeric types with 'Shift'.");
|
||||
this->m_value >>= other.m_value;
|
||||
|
@ -200,12 +200,12 @@ public:
|
|||
}
|
||||
|
||||
// Only implemented when `Arith` is true:
|
||||
constexpr Self operator+(const Self& other) const
|
||||
constexpr Self operator+(Self const& other) const
|
||||
{
|
||||
static_assert(Arith, "'a+b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return this->m_value + other.m_value;
|
||||
}
|
||||
constexpr Self operator-(const Self& other) const
|
||||
constexpr Self operator-(Self const& other) const
|
||||
{
|
||||
static_assert(Arith, "'a-b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return this->m_value - other.m_value;
|
||||
|
@ -220,46 +220,46 @@ public:
|
|||
static_assert(Arith, "'-a' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return -this->m_value;
|
||||
}
|
||||
constexpr Self operator*(const Self& other) const
|
||||
constexpr Self operator*(Self const& other) const
|
||||
{
|
||||
static_assert(Arith, "'a*b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return this->m_value * other.m_value;
|
||||
}
|
||||
constexpr Self operator/(const Self& other) const
|
||||
constexpr Self operator/(Self const& other) const
|
||||
{
|
||||
static_assert(Arith, "'a/b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return this->m_value / other.m_value;
|
||||
}
|
||||
constexpr Self operator%(const Self& other) const
|
||||
constexpr Self operator%(Self const& other) const
|
||||
{
|
||||
static_assert(Arith, "'a%b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
return this->m_value % other.m_value;
|
||||
}
|
||||
constexpr Self& operator+=(const Self& other)
|
||||
constexpr Self& operator+=(Self const& other)
|
||||
{
|
||||
static_assert(Arith, "'a+=b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
this->m_value += other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator-=(const Self& other)
|
||||
constexpr Self& operator-=(Self const& other)
|
||||
{
|
||||
static_assert(Arith, "'a+=b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
this->m_value += other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator*=(const Self& other)
|
||||
constexpr Self& operator*=(Self const& other)
|
||||
{
|
||||
static_assert(Arith, "'a*=b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
this->m_value *= other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator/=(const Self& other)
|
||||
constexpr Self& operator/=(Self const& other)
|
||||
{
|
||||
static_assert(Arith, "'a/=b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
this->m_value /= other.m_value;
|
||||
return *this;
|
||||
}
|
||||
constexpr Self& operator%=(const Self& other)
|
||||
constexpr Self& operator%=(Self const& other)
|
||||
{
|
||||
static_assert(Arith, "'a%=b' is only available for DistinctNumeric types with 'Arith'.");
|
||||
this->m_value %= other.m_value;
|
||||
|
@ -292,7 +292,7 @@ struct Formatter<DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>> :
|
|||
template<typename T, typename X, auto... Args>
|
||||
struct Traits<AK::DistinctNumeric<T, X, Args...>> : public GenericTraits<AK::DistinctNumeric<T, X, Args...>> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static constexpr auto hash(const DistinctNumeric<T, X, Args...>& d) { return Traits<T>::hash(d.value()); }
|
||||
static constexpr auto hash(DistinctNumeric<T, X, Args...> const& d) { return Traits<T>::hash(d.value()); }
|
||||
};
|
||||
|
||||
using AK::DistinctNumeric;
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace AK {
|
|||
template<typename ListType, typename ElementType>
|
||||
class DoublyLinkedListIterator {
|
||||
public:
|
||||
bool operator!=(const DoublyLinkedListIterator& other) const { return m_node != other.m_node; }
|
||||
bool operator==(const DoublyLinkedListIterator& other) const { return m_node == other.m_node; }
|
||||
bool operator!=(DoublyLinkedListIterator const& other) const { return m_node != other.m_node; }
|
||||
bool operator==(DoublyLinkedListIterator const& other) const { return m_node == other.m_node; }
|
||||
DoublyLinkedListIterator& operator++()
|
||||
{
|
||||
m_node = m_node->next;
|
||||
|
|
|
@ -89,7 +89,7 @@ template<typename T>
|
|||
class [[gnu::packed]] LittleEndian {
|
||||
public:
|
||||
friend InputStream& operator>><T>(InputStream&, LittleEndian<T>&);
|
||||
friend OutputStream& operator<<<T>(OutputStream&, LittleEndian<T>);
|
||||
friend OutputStream& operator<< <T>(OutputStream&, LittleEndian<T>);
|
||||
|
||||
constexpr LittleEndian() = default;
|
||||
|
||||
|
@ -117,7 +117,7 @@ template<typename T>
|
|||
class [[gnu::packed]] BigEndian {
|
||||
public:
|
||||
friend InputStream& operator>><T>(InputStream&, BigEndian<T>&);
|
||||
friend OutputStream& operator<<<T>(OutputStream&, BigEndian<T>);
|
||||
friend OutputStream& operator<< <T>(OutputStream&, BigEndian<T>);
|
||||
|
||||
constexpr BigEndian() = default;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
// the compiler will inline this anyway and therefore not generate any duplicate code.
|
||||
|
||||
template<size_t N>
|
||||
static ErrorOr<FixedArray<T>> try_create(T(&&array)[N])
|
||||
static ErrorOr<FixedArray<T>> try_create(T (&&array)[N])
|
||||
{
|
||||
if (N == 0)
|
||||
return FixedArray<T>();
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
namespace AK {
|
||||
|
||||
struct FlyStringImplTraits : public Traits<StringImpl*> {
|
||||
static unsigned hash(const StringImpl* s) { return s ? s->hash() : 0; }
|
||||
static bool equals(const StringImpl* a, const StringImpl* b)
|
||||
static unsigned hash(StringImpl const* s) { return s ? s->hash() : 0; }
|
||||
static bool equals(StringImpl const* a, StringImpl const* b)
|
||||
{
|
||||
VERIFY(a);
|
||||
VERIFY(b);
|
||||
|
@ -36,7 +36,7 @@ void FlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl)
|
|||
fly_impls().remove(&impl);
|
||||
}
|
||||
|
||||
FlyString::FlyString(const String& string)
|
||||
FlyString::FlyString(String const& string)
|
||||
{
|
||||
if (string.is_null())
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ FlyString FlyString::to_lowercase() const
|
|||
return String(*m_impl).to_lowercase();
|
||||
}
|
||||
|
||||
bool FlyString::operator==(const String& other) const
|
||||
bool FlyString::operator==(String const& other) const
|
||||
{
|
||||
return m_impl == other.impl() || view() == other.view();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ bool FlyString::operator==(StringView string) const
|
|||
return view() == string;
|
||||
}
|
||||
|
||||
bool FlyString::operator==(const char* string) const
|
||||
bool FlyString::operator==(char const* string) const
|
||||
{
|
||||
return view() == string;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace AK {
|
|||
class FlyString {
|
||||
public:
|
||||
FlyString() = default;
|
||||
FlyString(const FlyString& other)
|
||||
FlyString(FlyString const& other)
|
||||
: m_impl(other.impl())
|
||||
{
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ public:
|
|||
: m_impl(move(other.m_impl))
|
||||
{
|
||||
}
|
||||
FlyString(const String&);
|
||||
FlyString(String const&);
|
||||
FlyString(StringView);
|
||||
FlyString(const char* string)
|
||||
FlyString(char const* string)
|
||||
: FlyString(static_cast<String>(string))
|
||||
{
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
return string;
|
||||
}
|
||||
|
||||
FlyString& operator=(const FlyString& other)
|
||||
FlyString& operator=(FlyString const& other)
|
||||
{
|
||||
m_impl = other.m_impl;
|
||||
return *this;
|
||||
|
@ -52,20 +52,20 @@ public:
|
|||
bool is_empty() const { return !m_impl || !m_impl->length(); }
|
||||
bool is_null() const { return !m_impl; }
|
||||
|
||||
bool operator==(const FlyString& other) const { return m_impl == other.m_impl; }
|
||||
bool operator!=(const FlyString& other) const { return m_impl != other.m_impl; }
|
||||
bool operator==(FlyString const& other) const { return m_impl == other.m_impl; }
|
||||
bool operator!=(FlyString const& other) const { return m_impl != other.m_impl; }
|
||||
|
||||
bool operator==(const String&) const;
|
||||
bool operator!=(const String& string) const { return !(*this == string); }
|
||||
bool operator==(String const&) const;
|
||||
bool operator!=(String const& string) const { return !(*this == string); }
|
||||
|
||||
bool operator==(StringView) const;
|
||||
bool operator!=(StringView string) const { return !(*this == string); }
|
||||
|
||||
bool operator==(const char*) const;
|
||||
bool operator!=(const char* string) const { return !(*this == string); }
|
||||
bool operator==(char const*) const;
|
||||
bool operator!=(char const* string) const { return !(*this == string); }
|
||||
|
||||
const StringImpl* impl() const { return m_impl; }
|
||||
const char* characters() const { return m_impl ? m_impl->characters() : nullptr; }
|
||||
StringImpl const* impl() const { return m_impl; }
|
||||
char const* characters() const { return m_impl ? m_impl->characters() : nullptr; }
|
||||
size_t length() const { return m_impl ? m_impl->length() : 0; }
|
||||
|
||||
ALWAYS_INLINE u32 hash() const { return m_impl ? m_impl->existing_hash() : 0; }
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
|
||||
template<>
|
||||
struct Traits<FlyString> : public GenericTraits<FlyString> {
|
||||
static unsigned hash(const FlyString& s) { return s.hash(); }
|
||||
static unsigned hash(FlyString const& s) { return s.hash(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ static constexpr size_t convert_unsigned_to_string(u64 value, Array<u8, 128>& bu
|
|||
{
|
||||
VERIFY(base >= 2 && base <= 16);
|
||||
|
||||
constexpr const char* lowercase_lookup = "0123456789abcdef";
|
||||
constexpr const char* uppercase_lookup = "0123456789ABCDEF";
|
||||
constexpr char const* lowercase_lookup = "0123456789abcdef";
|
||||
constexpr char const* uppercase_lookup = "0123456789ABCDEF";
|
||||
|
||||
if (value == 0) {
|
||||
buffer[0] = '0';
|
||||
|
@ -77,7 +77,7 @@ static constexpr size_t convert_unsigned_to_string(u64 value, Array<u8, 128>& bu
|
|||
|
||||
ErrorOr<void> vformat_impl(TypeErasedFormatParams& params, FormatBuilder& builder, FormatParser& parser)
|
||||
{
|
||||
const auto literal = parser.consume_literal();
|
||||
auto const literal = parser.consume_literal();
|
||||
TRY(builder.put_literal(literal));
|
||||
|
||||
FormatParser::FormatSpecifier specifier;
|
||||
|
@ -105,7 +105,7 @@ FormatParser::FormatParser(StringView input)
|
|||
}
|
||||
StringView FormatParser::consume_literal()
|
||||
{
|
||||
const auto begin = tell();
|
||||
auto const begin = tell();
|
||||
|
||||
while (!is_eof()) {
|
||||
if (consume_specific("{{"))
|
||||
|
@ -146,7 +146,7 @@ bool FormatParser::consume_specifier(FormatSpecifier& specifier)
|
|||
specifier.index = use_next_index;
|
||||
|
||||
if (consume_specific(':')) {
|
||||
const auto begin = tell();
|
||||
auto const begin = tell();
|
||||
|
||||
size_t level = 1;
|
||||
while (level > 0) {
|
||||
|
@ -212,8 +212,8 @@ ErrorOr<void> FormatBuilder::put_string(
|
|||
size_t max_width,
|
||||
char fill)
|
||||
{
|
||||
const auto used_by_string = min(max_width, value.length());
|
||||
const auto used_by_padding = max(min_width, used_by_string) - used_by_string;
|
||||
auto const used_by_string = min(max_width, value.length());
|
||||
auto const used_by_padding = max(min_width, used_by_string) - used_by_string;
|
||||
|
||||
if (used_by_string < value.length())
|
||||
value = value.substring_view(0, used_by_string);
|
||||
|
@ -222,8 +222,8 @@ ErrorOr<void> FormatBuilder::put_string(
|
|||
TRY(m_builder.try_append(value));
|
||||
TRY(put_padding(fill, used_by_padding));
|
||||
} else if (align == Align::Center) {
|
||||
const auto used_by_left_padding = used_by_padding / 2;
|
||||
const auto used_by_right_padding = ceil_div<size_t, size_t>(used_by_padding, 2);
|
||||
auto const used_by_left_padding = used_by_padding / 2;
|
||||
auto const used_by_right_padding = ceil_div<size_t, size_t>(used_by_padding, 2);
|
||||
|
||||
TRY(put_padding(fill, used_by_left_padding));
|
||||
TRY(m_builder.try_append(value));
|
||||
|
@ -252,7 +252,7 @@ ErrorOr<void> FormatBuilder::put_u64(
|
|||
|
||||
Array<u8, 128> buffer;
|
||||
|
||||
const auto used_by_digits = convert_unsigned_to_string(value, buffer, base, upper_case);
|
||||
auto const used_by_digits = convert_unsigned_to_string(value, buffer, base, upper_case);
|
||||
|
||||
size_t used_by_prefix = 0;
|
||||
if (align == Align::Right && zero_pad) {
|
||||
|
@ -273,10 +273,10 @@ ErrorOr<void> FormatBuilder::put_u64(
|
|||
}
|
||||
}
|
||||
|
||||
const auto used_by_field = used_by_prefix + used_by_digits;
|
||||
const auto used_by_padding = max(used_by_field, min_width) - used_by_field;
|
||||
auto const used_by_field = used_by_prefix + used_by_digits;
|
||||
auto const used_by_padding = max(used_by_field, min_width) - used_by_field;
|
||||
|
||||
const auto put_prefix = [&]() -> ErrorOr<void> {
|
||||
auto const put_prefix = [&]() -> ErrorOr<void> {
|
||||
if (is_negative)
|
||||
TRY(m_builder.try_append('-'));
|
||||
else if (sign_mode == SignMode::Always)
|
||||
|
@ -302,28 +302,28 @@ ErrorOr<void> FormatBuilder::put_u64(
|
|||
return {};
|
||||
};
|
||||
|
||||
const auto put_digits = [&]() -> ErrorOr<void> {
|
||||
auto const put_digits = [&]() -> ErrorOr<void> {
|
||||
for (size_t i = 0; i < used_by_digits; ++i)
|
||||
TRY(m_builder.try_append(buffer[i]));
|
||||
return {};
|
||||
};
|
||||
|
||||
if (align == Align::Left) {
|
||||
const auto used_by_right_padding = used_by_padding;
|
||||
auto const used_by_right_padding = used_by_padding;
|
||||
|
||||
TRY(put_prefix());
|
||||
TRY(put_digits());
|
||||
TRY(put_padding(fill, used_by_right_padding));
|
||||
} else if (align == Align::Center) {
|
||||
const auto used_by_left_padding = used_by_padding / 2;
|
||||
const auto used_by_right_padding = ceil_div<size_t, size_t>(used_by_padding, 2);
|
||||
auto const used_by_left_padding = used_by_padding / 2;
|
||||
auto const used_by_right_padding = ceil_div<size_t, size_t>(used_by_padding, 2);
|
||||
|
||||
TRY(put_padding(fill, used_by_left_padding));
|
||||
TRY(put_prefix());
|
||||
TRY(put_digits());
|
||||
TRY(put_padding(fill, used_by_right_padding));
|
||||
} else if (align == Align::Right) {
|
||||
const auto used_by_left_padding = used_by_padding;
|
||||
auto const used_by_left_padding = used_by_padding;
|
||||
|
||||
if (zero_pad) {
|
||||
TRY(put_prefix());
|
||||
|
@ -349,7 +349,7 @@ ErrorOr<void> FormatBuilder::put_i64(
|
|||
char fill,
|
||||
SignMode sign_mode)
|
||||
{
|
||||
const auto is_negative = value < 0;
|
||||
auto const is_negative = value < 0;
|
||||
value = is_negative ? -value : value;
|
||||
|
||||
TRY(put_u64(static_cast<u64>(value), base, prefix, upper_case, zero_pad, align, min_width, fill, sign_mode, is_negative));
|
||||
|
@ -702,7 +702,7 @@ ErrorOr<void> Formatter<T>::format(FormatBuilder& builder, T value)
|
|||
m_mode = Mode::String;
|
||||
|
||||
Formatter<StringView> formatter { *this };
|
||||
return formatter.format(builder, StringView { reinterpret_cast<const char*>(&value), 1 });
|
||||
return formatter.format(builder, StringView { reinterpret_cast<char const*>(&value), 1 });
|
||||
}
|
||||
|
||||
if (m_precision.has_value())
|
||||
|
@ -854,8 +854,8 @@ void vout(FILE* file, StringView fmtstr, TypeErasedFormatParams& params, bool ne
|
|||
if (newline)
|
||||
builder.append('\n');
|
||||
|
||||
const auto string = builder.string_view();
|
||||
const auto retval = ::fwrite(string.characters_without_null_termination(), 1, string.length(), file);
|
||||
auto const string = builder.string_view();
|
||||
auto const retval = ::fwrite(string.characters_without_null_termination(), 1, string.length(), file);
|
||||
if (static_cast<size_t>(retval) != string.length()) {
|
||||
auto error = ferror(file);
|
||||
dbgln("vout() failed ({} written out of {}), error was {} ({})", retval, string.length(), error, strerror(error));
|
||||
|
@ -912,7 +912,7 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
MUST(vformat(builder, fmtstr, params));
|
||||
builder.append('\n');
|
||||
|
||||
const auto string = builder.string_view();
|
||||
auto const string = builder.string_view();
|
||||
|
||||
#ifdef __serenity__
|
||||
# ifdef KERNEL
|
||||
|
@ -949,7 +949,7 @@ void vdmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
MUST(vformat(builder, fmtstr, params));
|
||||
builder.append('\n');
|
||||
|
||||
const auto string = builder.string_view();
|
||||
auto const string = builder.string_view();
|
||||
kernelputstr(string.characters_without_null_termination(), string.length());
|
||||
}
|
||||
|
||||
|
@ -971,7 +971,7 @@ void v_critical_dmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
MUST(vformat(builder, fmtstr, params));
|
||||
builder.append('\n');
|
||||
|
||||
const auto string = builder.string_view();
|
||||
auto const string = builder.string_view();
|
||||
kernelcriticalputstr(string.characters_without_null_termination(), string.length());
|
||||
}
|
||||
|
||||
|
|
54
AK/Format.h
54
AK/Format.h
|
@ -94,21 +94,21 @@ struct TypeErasedParameter {
|
|||
{
|
||||
switch (type) {
|
||||
case TypeErasedParameter::Type::UInt8:
|
||||
return visitor(*static_cast<const u8*>(value));
|
||||
return visitor(*static_cast<u8 const*>(value));
|
||||
case TypeErasedParameter::Type::UInt16:
|
||||
return visitor(*static_cast<const u16*>(value));
|
||||
return visitor(*static_cast<u16 const*>(value));
|
||||
case TypeErasedParameter::Type::UInt32:
|
||||
return visitor(*static_cast<const u32*>(value));
|
||||
return visitor(*static_cast<u32 const*>(value));
|
||||
case TypeErasedParameter::Type::UInt64:
|
||||
return visitor(*static_cast<const u64*>(value));
|
||||
return visitor(*static_cast<u64 const*>(value));
|
||||
case TypeErasedParameter::Type::Int8:
|
||||
return visitor(*static_cast<const i8*>(value));
|
||||
return visitor(*static_cast<i8 const*>(value));
|
||||
case TypeErasedParameter::Type::Int16:
|
||||
return visitor(*static_cast<const i16*>(value));
|
||||
return visitor(*static_cast<i16 const*>(value));
|
||||
case TypeErasedParameter::Type::Int32:
|
||||
return visitor(*static_cast<const i32*>(value));
|
||||
return visitor(*static_cast<i32 const*>(value));
|
||||
case TypeErasedParameter::Type::Int64:
|
||||
return visitor(*static_cast<const i64*>(value));
|
||||
return visitor(*static_cast<i64 const*>(value));
|
||||
default:
|
||||
TODO();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ struct TypeErasedParameter {
|
|||
|
||||
// FIXME: Getters and setters.
|
||||
|
||||
const void* value;
|
||||
void const* value;
|
||||
Type type;
|
||||
ErrorOr<void> (*formatter)(TypeErasedFormatParams&, FormatBuilder&, FormatParser&, void const* value);
|
||||
};
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
size_t width,
|
||||
char fill = ' ');
|
||||
|
||||
const StringBuilder& builder() const
|
||||
StringBuilder const& builder() const
|
||||
{
|
||||
return m_builder;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
ErrorOr<void> __format_value(TypeErasedFormatParams& params, FormatBuilder& builder, FormatParser& parser, const void* value)
|
||||
ErrorOr<void> __format_value(TypeErasedFormatParams& params, FormatBuilder& builder, FormatParser& parser, void const* value)
|
||||
{
|
||||
Formatter<T> formatter;
|
||||
|
||||
|
@ -263,7 +263,7 @@ class VariadicFormatParams : public TypeErasedFormatParams {
|
|||
public:
|
||||
static_assert(sizeof...(Parameters) <= max_format_arguments);
|
||||
|
||||
explicit VariadicFormatParams(const Parameters&... parameters)
|
||||
explicit VariadicFormatParams(Parameters const&... parameters)
|
||||
: m_data({ TypeErasedParameter { ¶meters, TypeErasedParameter::get_type<Parameters>(), __format_value<Parameters> }... })
|
||||
{
|
||||
this->set_parameters(m_data);
|
||||
|
@ -396,8 +396,8 @@ struct Formatter<Bytes> : Formatter<ReadonlyBytes> {
|
|||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<const char*> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, const char* value)
|
||||
struct Formatter<char const*> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, char const* value)
|
||||
{
|
||||
if (m_mode == Mode::Pointer) {
|
||||
Formatter<FlatPtr> formatter { *this };
|
||||
|
@ -407,14 +407,14 @@ struct Formatter<const char*> : Formatter<StringView> {
|
|||
}
|
||||
};
|
||||
template<>
|
||||
struct Formatter<char*> : Formatter<const char*> {
|
||||
struct Formatter<char*> : Formatter<char const*> {
|
||||
};
|
||||
template<size_t Size>
|
||||
struct Formatter<char[Size]> : Formatter<const char*> {
|
||||
struct Formatter<char[Size]> : Formatter<char const*> {
|
||||
};
|
||||
template<size_t Size>
|
||||
struct Formatter<unsigned char[Size]> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, const unsigned char* value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, unsigned char const* value)
|
||||
{
|
||||
if (m_mode == Mode::Pointer) {
|
||||
Formatter<FlatPtr> formatter { *this };
|
||||
|
@ -535,14 +535,14 @@ ErrorOr<void> vformat(StringBuilder&, StringView fmtstr, TypeErasedFormatParams&
|
|||
void vout(FILE*, StringView fmtstr, TypeErasedFormatParams&, bool newline = false);
|
||||
|
||||
template<typename... Parameters>
|
||||
void out(FILE* file, CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
void out(FILE* file, CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
vout(file, fmtstr.view(), variadic_format_params);
|
||||
}
|
||||
|
||||
template<typename... Parameters>
|
||||
void outln(FILE* file, CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
void outln(FILE* file, CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
vout(file, fmtstr.view(), variadic_format_params, true);
|
||||
|
@ -551,10 +551,10 @@ void outln(FILE* file, CheckedFormatString<Parameters...>&& fmtstr, const Parame
|
|||
inline void outln(FILE* file) { fputc('\n', file); }
|
||||
|
||||
template<typename... Parameters>
|
||||
void out(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { out(stdout, move(fmtstr), parameters...); }
|
||||
void out(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) { out(stdout, move(fmtstr), parameters...); }
|
||||
|
||||
template<typename... Parameters>
|
||||
void outln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { outln(stdout, move(fmtstr), parameters...); }
|
||||
void outln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) { outln(stdout, move(fmtstr), parameters...); }
|
||||
|
||||
inline void outln() { outln(stdout); }
|
||||
|
||||
|
@ -565,13 +565,13 @@ inline void outln() { outln(stdout); }
|
|||
} while (0)
|
||||
|
||||
template<typename... Parameters>
|
||||
void warn(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
void warn(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
out(stderr, move(fmtstr), parameters...);
|
||||
}
|
||||
|
||||
template<typename... Parameters>
|
||||
void warnln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { outln(stderr, move(fmtstr), parameters...); }
|
||||
void warnln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) { outln(stderr, move(fmtstr), parameters...); }
|
||||
|
||||
inline void warnln() { outln(stderr); }
|
||||
|
||||
|
@ -586,7 +586,7 @@ inline void warnln() { outln(stderr); }
|
|||
void vdbgln(StringView fmtstr, TypeErasedFormatParams&);
|
||||
|
||||
template<typename... Parameters>
|
||||
void dbgln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
void dbgln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
vdbgln(fmtstr.view(), variadic_format_params);
|
||||
|
@ -600,7 +600,7 @@ void set_debug_enabled(bool);
|
|||
void vdmesgln(StringView fmtstr, TypeErasedFormatParams&);
|
||||
|
||||
template<typename... Parameters>
|
||||
void dmesgln(CheckedFormatString<Parameters...>&& fmt, const Parameters&... parameters)
|
||||
void dmesgln(CheckedFormatString<Parameters...>&& fmt, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
vdmesgln(fmt.view(), variadic_format_params);
|
||||
|
@ -611,7 +611,7 @@ void v_critical_dmesgln(StringView fmtstr, TypeErasedFormatParams&);
|
|||
// be very careful to not cause any allocations here, since we could be in
|
||||
// a very unstable situation
|
||||
template<typename... Parameters>
|
||||
void critical_dmesgln(CheckedFormatString<Parameters...>&& fmt, const Parameters&... parameters)
|
||||
void critical_dmesgln(CheckedFormatString<Parameters...>&& fmt, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
v_critical_dmesgln(fmt.view(), variadic_format_params);
|
||||
|
@ -656,7 +656,7 @@ struct FormatString {
|
|||
template<>
|
||||
struct Formatter<FormatString> : Formatter<StringView> {
|
||||
template<typename... Parameters>
|
||||
ErrorOr<void> format(FormatBuilder& builder, StringView fmtstr, const Parameters&... parameters)
|
||||
ErrorOr<void> format(FormatBuilder& builder, StringView fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_params { parameters... };
|
||||
return vformat(builder, fmtstr, variadic_format_params);
|
||||
|
|
|
@ -69,7 +69,7 @@ StringView GenericLexer::consume_until(char stop)
|
|||
}
|
||||
|
||||
// Consume and return characters until the string `stop` is found
|
||||
StringView GenericLexer::consume_until(const char* stop)
|
||||
StringView GenericLexer::consume_until(char const* stop)
|
||||
{
|
||||
size_t start = m_index;
|
||||
while (!is_eof() && !next_is(stop))
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
constexpr bool next_is(const char* expected) const
|
||||
constexpr bool next_is(char const* expected) const
|
||||
{
|
||||
for (size_t i = 0; expected[i] != '\0'; ++i)
|
||||
if (peek(i) != expected[i])
|
||||
|
@ -84,13 +84,13 @@ public:
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
bool consume_specific(const String& next)
|
||||
bool consume_specific(String const& next)
|
||||
{
|
||||
return consume_specific(StringView { next });
|
||||
}
|
||||
#endif
|
||||
|
||||
constexpr bool consume_specific(const char* next)
|
||||
constexpr bool consume_specific(char const* next)
|
||||
{
|
||||
return consume_specific(StringView { next });
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
StringView consume_all();
|
||||
StringView consume_line();
|
||||
StringView consume_until(char);
|
||||
StringView consume_until(const char*);
|
||||
StringView consume_until(char const*);
|
||||
StringView consume_until(StringView);
|
||||
StringView consume_quoted_string(char escape_char = 0);
|
||||
#ifndef KERNEL
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
ignore();
|
||||
}
|
||||
|
||||
constexpr void ignore_until(const char* stop)
|
||||
constexpr void ignore_until(char const* stop)
|
||||
{
|
||||
while (!is_eof() && !next_is(stop)) {
|
||||
++m_index;
|
||||
|
|
|
@ -21,7 +21,7 @@ constexpr unsigned int_hash(u32 key)
|
|||
|
||||
constexpr unsigned double_hash(u32 key)
|
||||
{
|
||||
const unsigned magic = 0xBA5EDB01;
|
||||
unsigned const magic = 0xBA5EDB01;
|
||||
if (key == magic)
|
||||
return 0u;
|
||||
if (key == 0u)
|
||||
|
@ -53,7 +53,7 @@ constexpr unsigned ptr_hash(FlatPtr ptr)
|
|||
return int_hash(ptr);
|
||||
}
|
||||
|
||||
inline unsigned ptr_hash(const void* ptr)
|
||||
inline unsigned ptr_hash(void const* ptr)
|
||||
{
|
||||
return ptr_hash(FlatPtr(ptr));
|
||||
}
|
||||
|
|
13
AK/HashMap.h
13
AK/HashMap.h
|
@ -22,8 +22,8 @@ private:
|
|||
};
|
||||
|
||||
struct EntryTraits {
|
||||
static unsigned hash(const Entry& entry) { return KeyTraits::hash(entry.key); }
|
||||
static bool equals(const Entry& a, const Entry& b) { return KeyTraits::equals(a.key, b.key); }
|
||||
static unsigned hash(Entry const& entry) { return KeyTraits::hash(entry.key); }
|
||||
static bool equals(Entry const& a, Entry const& b) { return KeyTraits::equals(a.key, b.key); }
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -152,7 +152,8 @@ public:
|
|||
}
|
||||
|
||||
template<Concepts::HashCompatible<K> Key>
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::PeekType> get(const Key& key) const requires(!IsPointer<typename Traits<V>::PeekType>)
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::PeekType> get(Key const& key)
|
||||
const requires(!IsPointer<typename Traits<V>::PeekType>)
|
||||
{
|
||||
auto it = find(key);
|
||||
if (it == end())
|
||||
|
@ -161,7 +162,8 @@ public:
|
|||
}
|
||||
|
||||
template<Concepts::HashCompatible<K> Key>
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::ConstPeekType> get(const Key& key) const requires(IsPointer<typename Traits<V>::PeekType>)
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::ConstPeekType> get(Key const& key)
|
||||
const requires(IsPointer<typename Traits<V>::PeekType>)
|
||||
{
|
||||
auto it = find(key);
|
||||
if (it == end())
|
||||
|
@ -170,7 +172,8 @@ public:
|
|||
}
|
||||
|
||||
template<Concepts::HashCompatible<K> Key>
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::PeekType> get(const Key& key) requires(!IsConst<typename Traits<V>::PeekType>)
|
||||
requires(IsSame<KeyTraits, Traits<K>>) Optional<typename Traits<V>::PeekType> get(Key const& key)
|
||||
requires(!IsConst<typename Traits<V>::PeekType>)
|
||||
{
|
||||
auto it = find(key);
|
||||
if (it == end())
|
||||
|
|
|
@ -57,8 +57,8 @@ class HashTableIterator {
|
|||
friend HashTableType;
|
||||
|
||||
public:
|
||||
bool operator==(const HashTableIterator& other) const { return m_bucket == other.m_bucket; }
|
||||
bool operator!=(const HashTableIterator& other) const { return m_bucket != other.m_bucket; }
|
||||
bool operator==(HashTableIterator const& other) const { return m_bucket == other.m_bucket; }
|
||||
bool operator!=(HashTableIterator const& other) const { return m_bucket != other.m_bucket; }
|
||||
T& operator*() { return *m_bucket->slot(); }
|
||||
T* operator->() { return m_bucket->slot(); }
|
||||
void operator++() { skip_to_next(); }
|
||||
|
@ -90,8 +90,8 @@ class OrderedHashTableIterator {
|
|||
friend OrderedHashTableType;
|
||||
|
||||
public:
|
||||
bool operator==(const OrderedHashTableIterator& other) const { return m_bucket == other.m_bucket; }
|
||||
bool operator!=(const OrderedHashTableIterator& other) const { return m_bucket != other.m_bucket; }
|
||||
bool operator==(OrderedHashTableIterator const& other) const { return m_bucket == other.m_bucket; }
|
||||
bool operator!=(OrderedHashTableIterator const& other) const { return m_bucket != other.m_bucket; }
|
||||
T& operator*() { return *m_bucket->slot(); }
|
||||
T* operator->() { return m_bucket->slot(); }
|
||||
void operator++() { m_bucket = m_bucket->next; }
|
||||
|
@ -156,14 +156,14 @@ public:
|
|||
kfree_sized(m_buckets, size_in_bytes(m_capacity));
|
||||
}
|
||||
|
||||
HashTable(const HashTable& other)
|
||||
HashTable(HashTable const& other)
|
||||
{
|
||||
rehash(other.capacity());
|
||||
for (auto& it : other)
|
||||
set(it);
|
||||
}
|
||||
|
||||
HashTable& operator=(const HashTable& other)
|
||||
HashTable& operator=(HashTable const& other)
|
||||
{
|
||||
HashTable temporary(other);
|
||||
swap(*this, temporary);
|
||||
|
|
|
@ -21,11 +21,11 @@ ErrorOr<ByteBuffer> decode_hex(StringView input)
|
|||
auto output = TRY(ByteBuffer::create_zeroed(input.length() / 2));
|
||||
|
||||
for (size_t i = 0; i < input.length() / 2; ++i) {
|
||||
const auto c1 = decode_hex_digit(input[i * 2]);
|
||||
auto const c1 = decode_hex_digit(input[i * 2]);
|
||||
if (c1 >= 16)
|
||||
return Error::from_string_literal("Hex string contains invalid digit");
|
||||
|
||||
const auto c2 = decode_hex_digit(input[i * 2 + 1]);
|
||||
auto const c2 = decode_hex_digit(input[i * 2 + 1]);
|
||||
if (c2 >= 16)
|
||||
return Error::from_string_literal("Hex string contains invalid digit");
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
if (string.is_null())
|
||||
return {};
|
||||
|
||||
const auto parts = string.split_view('.');
|
||||
auto const parts = string.split_view('.');
|
||||
|
||||
u32 a {};
|
||||
u32 b {};
|
||||
|
@ -122,8 +122,8 @@ public:
|
|||
constexpr in_addr_t to_in_addr_t() const { return m_data; }
|
||||
constexpr u32 to_u32() const { return m_data; }
|
||||
|
||||
constexpr bool operator==(const IPv4Address& other) const = default;
|
||||
constexpr bool operator!=(const IPv4Address& other) const = default;
|
||||
constexpr bool operator==(IPv4Address const& other) const = default;
|
||||
constexpr bool operator!=(IPv4Address const& other) const = default;
|
||||
|
||||
constexpr bool is_zero() const
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
{
|
||||
NetworkOrdered<u32> address(m_data);
|
||||
constexpr auto bits_per_byte = 8;
|
||||
const auto bits_to_shift = bits_per_byte * int(subnet);
|
||||
auto const bits_to_shift = bits_per_byte * int(subnet);
|
||||
return (m_data >> bits_to_shift) & 0x0000'00FF;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ static_assert(sizeof(IPv4Address) == 4);
|
|||
|
||||
template<>
|
||||
struct Traits<IPv4Address> : public GenericTraits<IPv4Address> {
|
||||
static constexpr unsigned hash(const IPv4Address& address) { return int_hash(address.to_u32()); }
|
||||
static constexpr unsigned hash(IPv4Address const& address) { return int_hash(address.to_u32()); }
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
|
|
|
@ -75,8 +75,8 @@ public:
|
|||
auto operator->() const { return m_value; }
|
||||
T& operator*() { return *m_value; }
|
||||
auto operator->() { return m_value; }
|
||||
bool operator==(const Iterator& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(const Iterator& other) const { return !(*this == other); }
|
||||
bool operator==(Iterator const& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(Iterator const& other) const { return !(*this == other); }
|
||||
Iterator& operator++()
|
||||
{
|
||||
m_value = IntrusiveList<T, Container, member>::next(m_value);
|
||||
|
@ -103,8 +103,8 @@ public:
|
|||
auto operator->() const { return m_value; }
|
||||
T& operator*() { return *m_value; }
|
||||
auto operator->() { return m_value; }
|
||||
bool operator==(const ReverseIterator& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(const ReverseIterator& other) const { return !(*this == other); }
|
||||
bool operator==(ReverseIterator const& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(ReverseIterator const& other) const { return !(*this == other); }
|
||||
ReverseIterator& operator++()
|
||||
{
|
||||
m_value = IntrusiveList<T, Container, member>::prev(m_value);
|
||||
|
@ -129,8 +129,8 @@ public:
|
|||
|
||||
const T& operator*() const { return *m_value; }
|
||||
auto operator->() const { return m_value; }
|
||||
bool operator==(const ConstIterator& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(const ConstIterator& other) const { return !(*this == other); }
|
||||
bool operator==(ConstIterator const& other) const { return other.m_value == m_value; }
|
||||
bool operator!=(ConstIterator const& other) const { return !(*this == other); }
|
||||
ConstIterator& operator++()
|
||||
{
|
||||
m_value = IntrusiveList<T, Container, member>::next(m_value);
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
class BaseIterator {
|
||||
public:
|
||||
BaseIterator() = default;
|
||||
bool operator!=(const BaseIterator& other) const { return m_node != other.m_node; }
|
||||
bool operator!=(BaseIterator const& other) const { return m_node != other.m_node; }
|
||||
BaseIterator& operator++()
|
||||
{
|
||||
if (!m_node)
|
||||
|
|
|
@ -58,12 +58,12 @@ public:
|
|||
ALWAYS_INLINE constexpr ValueType const* operator->() const { return &m_container[m_index]; }
|
||||
ALWAYS_INLINE constexpr ValueType* operator->() { return &m_container[m_index]; }
|
||||
|
||||
SimpleIterator& operator=(const SimpleIterator& other)
|
||||
SimpleIterator& operator=(SimpleIterator const& other)
|
||||
{
|
||||
m_index = other.m_index;
|
||||
return *this;
|
||||
}
|
||||
SimpleIterator(const SimpleIterator& obj) = default;
|
||||
SimpleIterator(SimpleIterator const& obj) = default;
|
||||
|
||||
private:
|
||||
static constexpr SimpleIterator begin(Container& container) { return { container, 0 }; }
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
JsonArraySerializer(const JsonArraySerializer&) = delete;
|
||||
JsonArraySerializer(JsonArraySerializer const&) = delete;
|
||||
|
||||
~JsonArraySerializer()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
ErrorOr<void> add(const JsonValue& value)
|
||||
ErrorOr<void> add(JsonValue const& value)
|
||||
{
|
||||
TRY(begin_item());
|
||||
value.serialize(m_builder);
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
ErrorOr<void> add(const String& value)
|
||||
ErrorOr<void> add(String const& value)
|
||||
{
|
||||
TRY(begin_item());
|
||||
if constexpr (IsLegacyBuilder<Builder>) {
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
ErrorOr<void> add(const char* value)
|
||||
ErrorOr<void> add(char const* value)
|
||||
{
|
||||
TRY(begin_item());
|
||||
if constexpr (IsLegacyBuilder<Builder>) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
JsonObjectSerializer(const JsonObjectSerializer&) = delete;
|
||||
JsonObjectSerializer(JsonObjectSerializer const&) = delete;
|
||||
|
||||
~JsonObjectSerializer()
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
ErrorOr<void> add(StringView key, const JsonValue& value)
|
||||
ErrorOr<void> add(StringView key, JsonValue const& value)
|
||||
{
|
||||
TRY(begin_item(key));
|
||||
value.serialize(m_builder);
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
ErrorOr<void> add(StringView key, const String& value)
|
||||
ErrorOr<void> add(StringView key, String const& value)
|
||||
{
|
||||
TRY(begin_item(key));
|
||||
if constexpr (IsLegacyBuilder<Builder>) {
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
ErrorOr<void> add(StringView key, const char* value)
|
||||
ErrorOr<void> add(StringView key, char const* value)
|
||||
{
|
||||
TRY(begin_item(key));
|
||||
if constexpr (IsLegacyBuilder<Builder>) {
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace AK {
|
|||
JsonPathElement JsonPathElement::any_array_element { Kind::AnyIndex };
|
||||
JsonPathElement JsonPathElement::any_object_element { Kind::AnyKey };
|
||||
|
||||
JsonValue JsonPath::resolve(const JsonValue& top_root) const
|
||||
JsonValue JsonPath::resolve(JsonValue const& top_root) const
|
||||
{
|
||||
auto root = top_root;
|
||||
for (auto const& element : *this) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
}
|
||||
|
||||
Kind kind() const { return m_kind; }
|
||||
const String& key() const
|
||||
String const& key() const
|
||||
{
|
||||
VERIFY(m_kind == Kind::Key);
|
||||
return m_key;
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
static JsonPathElement any_array_element;
|
||||
static JsonPathElement any_object_element;
|
||||
|
||||
bool operator==(const JsonPathElement& other) const
|
||||
bool operator==(JsonPathElement const& other) const
|
||||
{
|
||||
switch (other.kind()) {
|
||||
case Kind::Key:
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const JsonPathElement& other) const
|
||||
bool operator!=(JsonPathElement const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
|
||||
class JsonPath : public Vector<JsonPathElement> {
|
||||
public:
|
||||
JsonValue resolve(const JsonValue&) const;
|
||||
JsonValue resolve(JsonValue const&) const;
|
||||
String to_string() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ JsonValue::JsonValue(Type type)
|
|||
{
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const JsonValue& other)
|
||||
JsonValue::JsonValue(JsonValue const& other)
|
||||
{
|
||||
copy_from(other);
|
||||
}
|
||||
|
||||
JsonValue& JsonValue::operator=(const JsonValue& other)
|
||||
JsonValue& JsonValue::operator=(JsonValue const& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
clear();
|
||||
|
@ -34,7 +34,7 @@ JsonValue& JsonValue::operator=(const JsonValue& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
void JsonValue::copy_from(const JsonValue& other)
|
||||
void JsonValue::copy_from(JsonValue const& other)
|
||||
{
|
||||
m_type = other.m_type;
|
||||
switch (m_type) {
|
||||
|
@ -71,7 +71,7 @@ JsonValue& JsonValue::operator=(JsonValue&& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool JsonValue::equals(const JsonValue& other) const
|
||||
bool JsonValue::equals(JsonValue const& other) const
|
||||
{
|
||||
if (is_null() && other.is_null())
|
||||
return true;
|
||||
|
@ -155,7 +155,7 @@ JsonValue::JsonValue(long long unsigned value)
|
|||
m_value.as_u64 = value;
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const char* cstring)
|
||||
JsonValue::JsonValue(char const* cstring)
|
||||
: JsonValue(String(cstring))
|
||||
{
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ JsonValue::JsonValue(bool value)
|
|||
m_value.as_bool = value;
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const String& value)
|
||||
JsonValue::JsonValue(String const& value)
|
||||
{
|
||||
if (value.is_null()) {
|
||||
m_type = Type::Null;
|
||||
|
@ -190,13 +190,13 @@ JsonValue::JsonValue(StringView value)
|
|||
{
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const JsonObject& value)
|
||||
JsonValue::JsonValue(JsonObject const& value)
|
||||
: m_type(Type::Object)
|
||||
{
|
||||
m_value.as_object = new JsonObject(value);
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const JsonArray& value)
|
||||
JsonValue::JsonValue(JsonArray const& value)
|
||||
: m_type(Type::Array)
|
||||
{
|
||||
m_value.as_array = new JsonArray(value);
|
||||
|
|
|
@ -38,10 +38,10 @@ public:
|
|||
explicit JsonValue(Type = Type::Null);
|
||||
~JsonValue() { clear(); }
|
||||
|
||||
JsonValue(const JsonValue&);
|
||||
JsonValue(JsonValue const&);
|
||||
JsonValue(JsonValue&&);
|
||||
|
||||
JsonValue& operator=(const JsonValue&);
|
||||
JsonValue& operator=(JsonValue const&);
|
||||
JsonValue& operator=(JsonValue&&);
|
||||
|
||||
JsonValue(int);
|
||||
|
@ -55,13 +55,13 @@ public:
|
|||
JsonValue(double);
|
||||
#endif
|
||||
JsonValue(bool);
|
||||
JsonValue(const char*);
|
||||
JsonValue(char const*);
|
||||
#ifndef KERNEL
|
||||
JsonValue(const String&);
|
||||
JsonValue(String const&);
|
||||
#endif
|
||||
JsonValue(StringView);
|
||||
JsonValue(const JsonArray&);
|
||||
JsonValue(const JsonObject&);
|
||||
JsonValue(JsonArray const&);
|
||||
JsonValue(JsonObject const&);
|
||||
|
||||
JsonValue(JsonArray&&);
|
||||
JsonValue(JsonObject&&);
|
||||
|
@ -163,13 +163,13 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
const JsonObject& as_object() const
|
||||
JsonObject const& as_object() const
|
||||
{
|
||||
VERIFY(is_object());
|
||||
return *m_value.as_object;
|
||||
}
|
||||
|
||||
const JsonArray& as_array() const
|
||||
JsonArray const& as_array() const
|
||||
{
|
||||
VERIFY(is_array());
|
||||
return *m_value.as_array;
|
||||
|
@ -240,11 +240,11 @@ public:
|
|||
return default_value;
|
||||
}
|
||||
|
||||
bool equals(const JsonValue& other) const;
|
||||
bool equals(JsonValue const& other) const;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
void copy_from(const JsonValue&);
|
||||
void copy_from(JsonValue const&);
|
||||
|
||||
Type m_type { Type::Null };
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ struct LEB128 {
|
|||
return false;
|
||||
|
||||
ValueType masked_byte = byte & ~(1 << 7);
|
||||
const bool shift_too_large_for_result = (num_bytes * 7 > sizeof(ValueType) * 8) && (masked_byte != 0);
|
||||
bool const shift_too_large_for_result = (num_bytes * 7 > sizeof(ValueType) * 8) && (masked_byte != 0);
|
||||
if (shift_too_large_for_result)
|
||||
return false;
|
||||
|
||||
const bool shift_too_large_for_byte = ((masked_byte << (num_bytes * 7)) >> (num_bytes * 7)) != masked_byte;
|
||||
bool const shift_too_large_for_byte = ((masked_byte << (num_bytes * 7)) >> (num_bytes * 7)) != masked_byte;
|
||||
if (shift_too_large_for_byte)
|
||||
return false;
|
||||
|
||||
|
@ -83,11 +83,11 @@ struct LEB128 {
|
|||
|
||||
// note: 64 bit assumptions!
|
||||
u64 masked_byte = byte & ~(1 << 7);
|
||||
const bool shift_too_large_for_result = (num_bytes * 7 >= 64) && (masked_byte != ((temp < 0) ? 0x7Fu : 0u));
|
||||
bool const shift_too_large_for_result = (num_bytes * 7 >= 64) && (masked_byte != ((temp < 0) ? 0x7Fu : 0u));
|
||||
if (shift_too_large_for_result)
|
||||
return false;
|
||||
|
||||
const bool shift_too_large_for_byte = (num_bytes * 7) == 63 && masked_byte != 0x00 && masked_byte != 0x7Fu;
|
||||
bool const shift_too_large_for_byte = (num_bytes * 7) == 63 && masked_byte != 0x00 && masked_byte != 0x7Fu;
|
||||
if (shift_too_large_for_byte)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
constexpr ~MACAddress() = default;
|
||||
|
||||
constexpr const u8& operator[](unsigned i) const
|
||||
constexpr u8 const& operator[](unsigned i) const
|
||||
{
|
||||
VERIFY(i < s_mac_address_length);
|
||||
return m_data[i];
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
return m_data[i];
|
||||
}
|
||||
|
||||
constexpr bool operator==(const MACAddress& other) const
|
||||
constexpr bool operator==(MACAddress const& other) const
|
||||
{
|
||||
for (auto i = 0u; i < m_data.size(); ++i) {
|
||||
if (m_data[i] != other.m_data[i]) {
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
if (string.is_null())
|
||||
return {};
|
||||
|
||||
const auto parts = string.split_view(":");
|
||||
auto const parts = string.split_view(":");
|
||||
if (parts.size() != 6)
|
||||
return {};
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
constexpr bool is_zero() const
|
||||
{
|
||||
return all_of(m_data, [](const auto octet) { return octet == 0; });
|
||||
return all_of(m_data, [](auto const octet) { return octet == 0; });
|
||||
}
|
||||
|
||||
void copy_to(Bytes destination) const
|
||||
|
@ -112,7 +112,7 @@ namespace AK {
|
|||
|
||||
template<>
|
||||
struct Traits<MACAddress> : public GenericTraits<MACAddress> {
|
||||
static unsigned hash(const MACAddress& address) { return string_hash((const char*)&address, sizeof(address)); }
|
||||
static unsigned hash(MACAddress const& address) { return string_hash((char const*)&address, sizeof(address)); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
20
AK/MemMem.h
20
AK/MemMem.h
|
@ -15,7 +15,7 @@
|
|||
namespace AK {
|
||||
|
||||
namespace Detail {
|
||||
constexpr const void* bitap_bitwise(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length)
|
||||
constexpr void const* bitap_bitwise(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
|
||||
{
|
||||
VERIFY(needle_length < 32);
|
||||
|
||||
|
@ -28,14 +28,14 @@ constexpr const void* bitap_bitwise(const void* haystack, size_t haystack_length
|
|||
needle_mask[i] = 0xffffffff;
|
||||
|
||||
for (size_t i = 0; i < needle_length; ++i)
|
||||
needle_mask[((const u8*)needle)[i]] &= ~(0x00000001 << i);
|
||||
needle_mask[((u8 const*)needle)[i]] &= ~(0x00000001 << i);
|
||||
|
||||
for (size_t i = 0; i < haystack_length; ++i) {
|
||||
lookup |= needle_mask[((const u8*)haystack)[i]];
|
||||
lookup |= needle_mask[((u8 const*)haystack)[i]];
|
||||
lookup <<= 1;
|
||||
|
||||
if (0 == (lookup & (0x00000001 << needle_length)))
|
||||
return ((const u8*)haystack) + i - needle_length + 1;
|
||||
return ((u8 const*)haystack) + i - needle_length + 1;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -43,7 +43,7 @@ constexpr const void* bitap_bitwise(const void* haystack, size_t haystack_length
|
|||
}
|
||||
|
||||
template<typename HaystackIterT>
|
||||
inline Optional<size_t> memmem(const HaystackIterT& haystack_begin, const HaystackIterT& haystack_end, Span<const u8> needle) requires(requires { (*haystack_begin).data(); (*haystack_begin).size(); })
|
||||
inline Optional<size_t> memmem(HaystackIterT const& haystack_begin, HaystackIterT const& haystack_end, Span<const u8> needle) requires(requires { (*haystack_begin).data(); (*haystack_begin).size(); })
|
||||
{
|
||||
auto prepare_kmp_partial_table = [&] {
|
||||
Vector<int, 64> table;
|
||||
|
@ -100,7 +100,7 @@ inline Optional<size_t> memmem(const HaystackIterT& haystack_begin, const Haysta
|
|||
return {};
|
||||
}
|
||||
|
||||
inline Optional<size_t> memmem_optional(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length)
|
||||
inline Optional<size_t> memmem_optional(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
|
||||
{
|
||||
if (needle_length == 0)
|
||||
return 0;
|
||||
|
@ -122,15 +122,15 @@ inline Optional<size_t> memmem_optional(const void* haystack, size_t haystack_le
|
|||
}
|
||||
|
||||
// Fallback to KMP.
|
||||
Array<Span<const u8>, 1> spans { Span<const u8> { (const u8*)haystack, haystack_length } };
|
||||
return memmem(spans.begin(), spans.end(), { (const u8*)needle, needle_length });
|
||||
Array<Span<const u8>, 1> spans { Span<const u8> { (u8 const*)haystack, haystack_length } };
|
||||
return memmem(spans.begin(), spans.end(), { (u8 const*)needle, needle_length });
|
||||
}
|
||||
|
||||
inline const void* memmem(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length)
|
||||
inline void const* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
|
||||
{
|
||||
auto offset = memmem_optional(haystack, haystack_length, needle, needle_length);
|
||||
if (offset.has_value())
|
||||
return ((const u8*)haystack) + offset.value();
|
||||
return ((u8 const*)haystack) + offset.value();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# include <string.h>
|
||||
#endif
|
||||
|
||||
ALWAYS_INLINE void fast_u32_copy(u32* dest, const u32* src, size_t count)
|
||||
ALWAYS_INLINE void fast_u32_copy(u32* dest, u32 const* src, size_t count)
|
||||
{
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
asm volatile(
|
||||
|
@ -58,10 +58,10 @@ inline void secure_zero(void* ptr, size_t size)
|
|||
// guarded against potential timing attacks.
|
||||
//
|
||||
// See OpenBSD's timingsafe_memcmp for more advanced implementations.
|
||||
inline bool timing_safe_compare(const void* b1, const void* b2, size_t len)
|
||||
inline bool timing_safe_compare(void const* b1, void const* b2, size_t len)
|
||||
{
|
||||
auto* c1 = static_cast<const char*>(b1);
|
||||
auto* c2 = static_cast<const char*>(b2);
|
||||
auto* c1 = static_cast<char const*>(b1);
|
||||
auto* c2 = static_cast<char const*>(b2);
|
||||
|
||||
u8 res = 0;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
if (has_any_error())
|
||||
return 0;
|
||||
|
||||
const auto count = min(bytes.size(), remaining());
|
||||
auto const count = min(bytes.size(), remaining());
|
||||
__builtin_memcpy(bytes.data(), m_bytes.data() + m_offset, count);
|
||||
m_offset += count;
|
||||
return count;
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
size_t write(ReadonlyBytes bytes) override
|
||||
{
|
||||
const auto nwritten = bytes.copy_trimmed_to(m_bytes.slice(m_offset));
|
||||
auto const nwritten = bytes.copy_trimmed_to(m_bytes.slice(m_offset));
|
||||
m_offset += nwritten;
|
||||
return nwritten;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
size_t fill_to_end(u8 value)
|
||||
{
|
||||
const auto nwritten = m_bytes.slice(m_offset).fill(value);
|
||||
auto const nwritten = m_bytes.slice(m_offset).fill(value);
|
||||
m_offset += nwritten;
|
||||
return nwritten;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
ReadonlyBytes bytes() const { return { data(), size() }; }
|
||||
Bytes bytes() { return { data(), size() }; }
|
||||
|
||||
const u8* data() const { return m_bytes.data(); }
|
||||
u8 const* data() const { return m_bytes.data(); }
|
||||
u8* data() { return m_bytes.data(); }
|
||||
|
||||
size_t size() const { return m_offset; }
|
||||
|
@ -186,8 +186,8 @@ public:
|
|||
{
|
||||
size_t nread = 0;
|
||||
while (bytes.size() - nread > 0 && m_write_offset - m_read_offset - nread > 0) {
|
||||
const auto chunk_index = (m_read_offset - m_base_offset + nread) / chunk_size;
|
||||
const auto chunk_bytes = m_chunks[chunk_index].bytes().slice((m_read_offset + nread) % chunk_size).trim(m_write_offset - m_read_offset - nread);
|
||||
auto const chunk_index = (m_read_offset - m_base_offset + nread) / chunk_size;
|
||||
auto const chunk_bytes = m_chunks[chunk_index].bytes().slice((m_read_offset + nread) % chunk_size).trim(m_write_offset - m_read_offset - nread);
|
||||
nread += chunk_bytes.copy_trimmed_to(bytes.slice(nread));
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
if (has_any_error())
|
||||
return 0;
|
||||
|
||||
const auto nread = read_without_consuming(bytes);
|
||||
auto const nread = read_without_consuming(bytes);
|
||||
|
||||
m_read_offset += nread;
|
||||
try_discard_chunks();
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
// FIXME: Handle possible OOM situation.
|
||||
auto buffer = ByteBuffer::create_uninitialized(size()).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
const auto nread = read_without_consuming(buffer);
|
||||
auto const nread = read_without_consuming(buffer);
|
||||
VERIFY(nread == buffer.size());
|
||||
|
||||
return buffer;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#define AK_MAKE_NONCOPYABLE(c) \
|
||||
private: \
|
||||
c(const c&) = delete; \
|
||||
c& operator=(const c&) = delete
|
||||
c(c const&) = delete; \
|
||||
c& operator=(c const&) = delete
|
||||
|
||||
#define AK_MAKE_NONMOVABLE(c) \
|
||||
private: \
|
||||
|
|
|
@ -57,25 +57,25 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
NonnullOwnPtr(const NonnullOwnPtr&) = delete;
|
||||
NonnullOwnPtr(NonnullOwnPtr const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr(const NonnullOwnPtr<U>&) = delete;
|
||||
NonnullOwnPtr& operator=(const NonnullOwnPtr&) = delete;
|
||||
NonnullOwnPtr(NonnullOwnPtr<U> const&) = delete;
|
||||
NonnullOwnPtr& operator=(NonnullOwnPtr const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr& operator=(const NonnullOwnPtr<U>&) = delete;
|
||||
NonnullOwnPtr& operator=(NonnullOwnPtr<U> const&) = delete;
|
||||
|
||||
template<typename U, typename PtrTraits = RefPtrTraits<U>>
|
||||
NonnullOwnPtr(const RefPtr<U, PtrTraits>&) = delete;
|
||||
NonnullOwnPtr(RefPtr<U, PtrTraits> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr(const NonnullRefPtr<U>&) = delete;
|
||||
NonnullOwnPtr(NonnullRefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr(const WeakPtr<U>&) = delete;
|
||||
NonnullOwnPtr(WeakPtr<U> const&) = delete;
|
||||
template<typename U, typename PtrTraits = RefPtrTraits<U>>
|
||||
NonnullOwnPtr& operator=(const RefPtr<U, PtrTraits>&) = delete;
|
||||
NonnullOwnPtr& operator=(RefPtr<U, PtrTraits> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr& operator=(const NonnullRefPtr<U>&) = delete;
|
||||
NonnullOwnPtr& operator=(NonnullRefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullOwnPtr& operator=(const WeakPtr<U>&) = delete;
|
||||
NonnullOwnPtr& operator=(WeakPtr<U> const&) = delete;
|
||||
|
||||
NonnullOwnPtr& operator=(NonnullOwnPtr&& other)
|
||||
{
|
||||
|
@ -178,8 +178,8 @@ template<typename T>
|
|||
struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
|
||||
using PeekType = T*;
|
||||
using ConstPeekType = const T*;
|
||||
static unsigned hash(const NonnullOwnPtr<T>& p) { return ptr_hash((FlatPtr)p.ptr()); }
|
||||
static bool equals(const NonnullOwnPtr<T>& a, const NonnullOwnPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
static unsigned hash(NonnullOwnPtr<T> const& p) { return ptr_hash((FlatPtr)p.ptr()); }
|
||||
static bool equals(NonnullOwnPtr<T> const& a, NonnullOwnPtr<T> const& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
|
|
|
@ -22,8 +22,8 @@ public:
|
|||
: Base(static_cast<Base&&>(other))
|
||||
{
|
||||
}
|
||||
NonnullPtrVector(const Vector<PtrType>& other)
|
||||
: Base(static_cast<const Base&>(other))
|
||||
NonnullPtrVector(Vector<PtrType> const& other)
|
||||
: Base(static_cast<Base const&>(other))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
ALWAYS_INLINE constexpr auto in_reverse() const { return ReverseWrapper::in_reverse(*this); }
|
||||
|
||||
ALWAYS_INLINE PtrType& ptr_at(size_t index) { return Base::at(index); }
|
||||
ALWAYS_INLINE const PtrType& ptr_at(size_t index) const { return Base::at(index); }
|
||||
ALWAYS_INLINE PtrType const& ptr_at(size_t index) const { return Base::at(index); }
|
||||
|
||||
ALWAYS_INLINE T& at(size_t index) { return *Base::at(index); }
|
||||
ALWAYS_INLINE const T& at(size_t index) const { return *Base::at(index); }
|
||||
|
|
|
@ -104,16 +104,16 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
NonnullRefPtr(const OwnPtr<U>&) = delete;
|
||||
NonnullRefPtr(OwnPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullRefPtr& operator=(const OwnPtr<U>&) = delete;
|
||||
NonnullRefPtr& operator=(OwnPtr<U> const&) = delete;
|
||||
|
||||
template<typename U>
|
||||
NonnullRefPtr(const RefPtr<U>&) = delete;
|
||||
NonnullRefPtr(RefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
NonnullRefPtr& operator=(const RefPtr<U>&) = delete;
|
||||
NonnullRefPtr(const RefPtr<T>&) = delete;
|
||||
NonnullRefPtr& operator=(const RefPtr<T>&) = delete;
|
||||
NonnullRefPtr& operator=(RefPtr<U> const&) = delete;
|
||||
NonnullRefPtr(RefPtr<T> const&) = delete;
|
||||
NonnullRefPtr& operator=(RefPtr<T> const&) = delete;
|
||||
|
||||
NonnullRefPtr& operator=(NonnullRefPtr const& other)
|
||||
{
|
||||
|
@ -270,8 +270,8 @@ template<typename T>
|
|||
struct Traits<NonnullRefPtr<T>> : public GenericTraits<NonnullRefPtr<T>> {
|
||||
using PeekType = T*;
|
||||
using ConstPeekType = const T*;
|
||||
static unsigned hash(const NonnullRefPtr<T>& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(const NonnullRefPtr<T>& a, const NonnullRefPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
static unsigned hash(NonnullRefPtr<T> const& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(NonnullRefPtr<T> const& a, NonnullRefPtr<T> const& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
using AK::adopt_ref;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace AK {
|
||||
|
||||
// FIXME: Remove this hackery once printf() supports floats.
|
||||
static String number_string_with_one_decimal(u64 number, u64 unit, const char* suffix)
|
||||
static String number_string_with_one_decimal(u64 number, u64 unit, char const* suffix)
|
||||
{
|
||||
int decimal = (number % unit) * 10 / unit;
|
||||
return String::formatted("{}.{} {}", number / unit, decimal, suffix);
|
||||
|
|
28
AK/OwnPtr.h
28
AK/OwnPtr.h
|
@ -47,29 +47,29 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
OwnPtr(const OwnPtr&) = delete;
|
||||
OwnPtr(OwnPtr const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr(const OwnPtr<U>&) = delete;
|
||||
OwnPtr& operator=(const OwnPtr&) = delete;
|
||||
OwnPtr(OwnPtr<U> const&) = delete;
|
||||
OwnPtr& operator=(OwnPtr const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr& operator=(const OwnPtr<U>&) = delete;
|
||||
OwnPtr& operator=(OwnPtr<U> const&) = delete;
|
||||
|
||||
template<typename U>
|
||||
OwnPtr(const NonnullOwnPtr<U>&) = delete;
|
||||
OwnPtr(NonnullOwnPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr& operator=(const NonnullOwnPtr<U>&) = delete;
|
||||
OwnPtr& operator=(NonnullOwnPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr(const RefPtr<U>&) = delete;
|
||||
OwnPtr(RefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr(const NonnullRefPtr<U>&) = delete;
|
||||
OwnPtr(NonnullRefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr(const WeakPtr<U>&) = delete;
|
||||
OwnPtr(WeakPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr& operator=(const RefPtr<U>&) = delete;
|
||||
OwnPtr& operator=(RefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr& operator=(const NonnullRefPtr<U>&) = delete;
|
||||
OwnPtr& operator=(NonnullRefPtr<U> const&) = delete;
|
||||
template<typename U>
|
||||
OwnPtr& operator=(const WeakPtr<U>&) = delete;
|
||||
OwnPtr& operator=(WeakPtr<U> const&) = delete;
|
||||
|
||||
OwnPtr& operator=(OwnPtr&& other)
|
||||
{
|
||||
|
@ -232,8 +232,8 @@ template<typename T>
|
|||
struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
|
||||
using PeekType = T*;
|
||||
using ConstPeekType = const T*;
|
||||
static unsigned hash(const OwnPtr<T>& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(const OwnPtr<T>& a, const OwnPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
static unsigned hash(OwnPtr<T> const& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(OwnPtr<T> const& a, OwnPtr<T> const& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <wchar.h>
|
||||
|
||||
#ifdef __serenity__
|
||||
extern "C" size_t strlen(const char*);
|
||||
extern "C" size_t strlen(char const*);
|
||||
#else
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
@ -24,8 +24,8 @@ namespace PrintfImplementation {
|
|||
template<typename PutChFunc, typename T, typename CharType>
|
||||
ALWAYS_INLINE int print_hex(PutChFunc putch, CharType*& bufptr, T number, bool upper_case, bool alternate_form, bool left_pad, bool zero_pad, u32 field_width, bool has_precision, u32 precision)
|
||||
{
|
||||
constexpr const char* printf_hex_digits_lower = "0123456789abcdef";
|
||||
constexpr const char* printf_hex_digits_upper = "0123456789ABCDEF";
|
||||
constexpr char const* printf_hex_digits_lower = "0123456789abcdef";
|
||||
constexpr char const* printf_hex_digits_upper = "0123456789ABCDEF";
|
||||
|
||||
u32 digits = 0;
|
||||
for (T n = number; n > 0; n >>= 4)
|
||||
|
@ -331,104 +331,104 @@ struct ModifierState {
|
|||
|
||||
template<typename PutChFunc, typename ArgumentListRefT, template<typename T, typename U = ArgumentListRefT> typename NextArgument, typename CharType = char>
|
||||
struct PrintfImpl {
|
||||
ALWAYS_INLINE PrintfImpl(PutChFunc& putch, CharType*& bufptr, const int& nwritten)
|
||||
ALWAYS_INLINE PrintfImpl(PutChFunc& putch, CharType*& bufptr, int const& nwritten)
|
||||
: m_bufptr(bufptr)
|
||||
, m_nwritten(nwritten)
|
||||
, m_putch(putch)
|
||||
{
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int format_s(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_s(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
// FIXME: Narrow characters should be converted to wide characters on the fly and vice versa.
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wprintf.html
|
||||
#ifndef KERNEL
|
||||
if (state.long_qualifiers) {
|
||||
const wchar_t* sp = NextArgument<const wchar_t*>()(ap);
|
||||
wchar_t const* sp = NextArgument<wchar_t const*>()(ap);
|
||||
if (!sp)
|
||||
sp = L"(null)";
|
||||
return print_string(m_putch, m_bufptr, sp, wcslen(sp), state.left_pad, state.field_width, state.dot, state.precision, state.has_precision);
|
||||
}
|
||||
#endif
|
||||
const char* sp = NextArgument<const char*>()(ap);
|
||||
char const* sp = NextArgument<char const*>()(ap);
|
||||
if (!sp)
|
||||
sp = "(null)";
|
||||
return print_string(m_putch, m_bufptr, sp, strlen(sp), state.left_pad, state.field_width, state.dot, state.precision, state.has_precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_d(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_d(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
if (state.long_qualifiers >= 2)
|
||||
return print_i64(m_putch, m_bufptr, NextArgument<i64>()(ap), state.always_sign, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
|
||||
return print_signed_number(m_putch, m_bufptr, NextArgument<int>()(ap), state.always_sign, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_i(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_i(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return format_d(state, ap);
|
||||
}
|
||||
ALWAYS_INLINE int format_u(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_u(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
if (state.long_qualifiers >= 2)
|
||||
return print_decimal(m_putch, m_bufptr, NextArgument<u64>()(ap), false, false, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
return print_decimal(m_putch, m_bufptr, NextArgument<u32>()(ap), false, false, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_Q(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_Q(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_decimal(m_putch, m_bufptr, NextArgument<u64>()(ap), false, false, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_q(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_q(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<u64>()(ap), false, false, state.left_pad, state.zero_pad, 16, false, 1);
|
||||
}
|
||||
ALWAYS_INLINE int format_g(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_g(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return format_f(state, ap);
|
||||
}
|
||||
ALWAYS_INLINE int format_f(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_f(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_double(m_putch, m_bufptr, NextArgument<double>()(ap), state.always_sign, state.left_pad, state.zero_pad, state.field_width, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_o(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_o(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_octal_number(m_putch, m_bufptr, NextArgument<u32>()(ap), state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_x(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_x(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
if (state.long_qualifiers >= 2)
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<u64>()(ap), false, state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<u32>()(ap), false, state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_X(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_X(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
if (state.long_qualifiers >= 2)
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<u64>()(ap), true, state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<u32>()(ap), true, state.alternate_form, state.left_pad, state.zero_pad, state.field_width, state.has_precision, state.precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_n(const ModifierState&, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_n(ModifierState const&, ArgumentListRefT ap) const
|
||||
{
|
||||
*NextArgument<int*>()(ap) = m_nwritten;
|
||||
return 0;
|
||||
}
|
||||
ALWAYS_INLINE int format_p(const ModifierState&, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_p(ModifierState const&, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<FlatPtr>()(ap), false, true, false, true, 8, false, 1);
|
||||
}
|
||||
ALWAYS_INLINE int format_P(const ModifierState&, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_P(ModifierState const&, ArgumentListRefT ap) const
|
||||
{
|
||||
return print_hex(m_putch, m_bufptr, NextArgument<FlatPtr>()(ap), true, true, false, true, 8, false, 1);
|
||||
}
|
||||
ALWAYS_INLINE int format_percent(const ModifierState&, ArgumentListRefT) const
|
||||
ALWAYS_INLINE int format_percent(ModifierState const&, ArgumentListRefT) const
|
||||
{
|
||||
m_putch(m_bufptr, '%');
|
||||
return 1;
|
||||
}
|
||||
ALWAYS_INLINE int format_c(const ModifierState& state, ArgumentListRefT ap) const
|
||||
ALWAYS_INLINE int format_c(ModifierState const& state, ArgumentListRefT ap) const
|
||||
{
|
||||
char c = NextArgument<int>()(ap);
|
||||
return print_string(m_putch, m_bufptr, &c, 1, state.left_pad, state.field_width, state.dot, state.precision, state.has_precision);
|
||||
}
|
||||
ALWAYS_INLINE int format_unrecognized(CharType format_op, const CharType* fmt, const ModifierState&, ArgumentListRefT) const
|
||||
ALWAYS_INLINE int format_unrecognized(CharType format_op, CharType const* fmt, ModifierState const&, ArgumentListRefT) const
|
||||
{
|
||||
dbgln("printf_internal: Unimplemented format specifier {} (fmt: {})", format_op, fmt);
|
||||
return 0;
|
||||
|
@ -436,7 +436,7 @@ struct PrintfImpl {
|
|||
|
||||
protected:
|
||||
CharType*& m_bufptr;
|
||||
const int& m_nwritten;
|
||||
int const& m_nwritten;
|
||||
PutChFunc& m_putch;
|
||||
};
|
||||
|
||||
|
@ -454,14 +454,14 @@ struct VaArgNextArgument {
|
|||
break;
|
||||
|
||||
template<typename PutChFunc, template<typename T, typename U, template<typename X, typename Y> typename V, typename C = char> typename Impl = PrintfImpl, typename ArgumentListT = va_list, template<typename T, typename V = decltype(declval<ArgumentListT&>())> typename NextArgument = VaArgNextArgument, typename CharType = char>
|
||||
ALWAYS_INLINE int printf_internal(PutChFunc putch, IdentityType<CharType>* buffer, const CharType*& fmt, ArgumentListT ap)
|
||||
ALWAYS_INLINE int printf_internal(PutChFunc putch, IdentityType<CharType>* buffer, CharType const*& fmt, ArgumentListT ap)
|
||||
{
|
||||
int ret = 0;
|
||||
CharType* bufptr = buffer;
|
||||
|
||||
Impl<PutChFunc, ArgumentListT&, NextArgument, CharType> impl { putch, bufptr, ret };
|
||||
|
||||
for (const CharType* p = fmt; *p; ++p) {
|
||||
for (CharType const* p = fmt; *p; ++p) {
|
||||
ModifierState state;
|
||||
if (*p == '%' && *(p + 1)) {
|
||||
one_more:
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
T const* operator->() const { return *this; }
|
||||
|
||||
operator T*() { return reinterpret_cast<T*>(static_cast<FlatPtr>(m_ptr)); }
|
||||
operator T const *() const { return reinterpret_cast<T const*>(static_cast<FlatPtr>(m_ptr)); }
|
||||
operator T const*() const { return reinterpret_cast<T const*>(static_cast<FlatPtr>(m_ptr)); }
|
||||
|
||||
T& operator[](size_t index) { return static_cast<T*>(*this)[index]; }
|
||||
T const& operator[](size_t index) const { return static_cast<T const*>(*this)[index]; }
|
||||
|
|
|
@ -404,7 +404,7 @@ template<typename TreeType, typename ElementType>
|
|||
class RedBlackTreeIterator {
|
||||
public:
|
||||
RedBlackTreeIterator() = default;
|
||||
bool operator!=(const RedBlackTreeIterator& other) const { return m_node != other.m_node; }
|
||||
bool operator!=(RedBlackTreeIterator const& other) const { return m_node != other.m_node; }
|
||||
RedBlackTreeIterator& operator++()
|
||||
{
|
||||
if (!m_node)
|
||||
|
|
12
AK/RefPtr.h
12
AK/RefPtr.h
|
@ -264,8 +264,8 @@ public:
|
|||
bool operator==(std::nullptr_t) const { return is_null(); }
|
||||
bool operator!=(std::nullptr_t) const { return !is_null(); }
|
||||
|
||||
bool operator==(const RefPtr& other) const { return as_ptr() == other.as_ptr(); }
|
||||
bool operator!=(const RefPtr& other) const { return as_ptr() != other.as_ptr(); }
|
||||
bool operator==(RefPtr const& other) const { return as_ptr() == other.as_ptr(); }
|
||||
bool operator!=(RefPtr const& other) const { return as_ptr() != other.as_ptr(); }
|
||||
|
||||
bool operator==(RefPtr& other) { return as_ptr() == other.as_ptr(); }
|
||||
bool operator!=(RefPtr& other) { return as_ptr() != other.as_ptr(); }
|
||||
|
@ -305,18 +305,18 @@ template<typename T>
|
|||
struct Traits<RefPtr<T>> : public GenericTraits<RefPtr<T>> {
|
||||
using PeekType = T*;
|
||||
using ConstPeekType = const T*;
|
||||
static unsigned hash(const RefPtr<T>& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(const RefPtr<T>& a, const RefPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
static unsigned hash(RefPtr<T> const& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(RefPtr<T> const& a, RefPtr<T> const& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
inline NonnullRefPtr<T> static_ptr_cast(const NonnullRefPtr<U>& ptr)
|
||||
inline NonnullRefPtr<T> static_ptr_cast(NonnullRefPtr<U> const& ptr)
|
||||
{
|
||||
return NonnullRefPtr<T>(static_cast<const T&>(*ptr));
|
||||
}
|
||||
|
||||
template<typename T, typename U, typename PtrTraits = RefPtrTraits<T>>
|
||||
inline RefPtr<T> static_ptr_cast(const RefPtr<U>& ptr)
|
||||
inline RefPtr<T> static_ptr_cast(RefPtr<U> const& ptr)
|
||||
{
|
||||
return RefPtr<T, PtrTraits>(static_cast<const T*>(ptr.ptr()));
|
||||
}
|
||||
|
|
10
AK/Result.h
10
AK/Result.h
|
@ -17,7 +17,7 @@ public:
|
|||
using ValueType = ValueT;
|
||||
using ErrorType = ErrorT;
|
||||
|
||||
Result(const ValueType& res)
|
||||
Result(ValueType const& res)
|
||||
: m_result(res)
|
||||
{
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Result(const ErrorType& error)
|
||||
Result(ErrorType const& error)
|
||||
: m_error(error)
|
||||
{
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
}
|
||||
|
||||
Result(Result&& other) = default;
|
||||
Result(const Result& other) = default;
|
||||
Result(Result const& other) = default;
|
||||
~Result() = default;
|
||||
|
||||
ValueType& value()
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
using ValueType = void;
|
||||
using ErrorType = ErrorT;
|
||||
|
||||
Result(const ErrorType& error)
|
||||
Result(ErrorType const& error)
|
||||
: m_error(error)
|
||||
{
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
Result() = default;
|
||||
Result(Result&& other) = default;
|
||||
Result(const Result& other) = default;
|
||||
Result(Result const& other) = default;
|
||||
~Result() = default;
|
||||
|
||||
// For compatibility with TRY().
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
ALWAYS_INLINE constexpr ValueType const* operator->() const { return &m_container[m_index]; }
|
||||
ALWAYS_INLINE constexpr ValueType* operator->() { return &m_container[m_index]; }
|
||||
|
||||
SimpleReverseIterator& operator=(const SimpleReverseIterator& other)
|
||||
SimpleReverseIterator& operator=(SimpleReverseIterator const& other)
|
||||
{
|
||||
m_index = other.m_index;
|
||||
return *this;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace AK {
|
|||
template<bool = true>
|
||||
class ScopeLogger {
|
||||
public:
|
||||
ScopeLogger(StringView extra, const SourceLocation& location = SourceLocation::current())
|
||||
ScopeLogger(StringView extra, SourceLocation const& location = SourceLocation::current())
|
||||
: m_location(location)
|
||||
, m_extra(extra)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ template<typename ListType, typename ElementType>
|
|||
class SinglyLinkedListIterator {
|
||||
public:
|
||||
SinglyLinkedListIterator() = default;
|
||||
bool operator!=(const SinglyLinkedListIterator& other) const { return m_node != other.m_node; }
|
||||
bool operator!=(SinglyLinkedListIterator const& other) const { return m_node != other.m_node; }
|
||||
SinglyLinkedListIterator& operator++()
|
||||
{
|
||||
if (m_removed)
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
|
||||
public:
|
||||
SinglyLinkedList() = default;
|
||||
SinglyLinkedList(const SinglyLinkedList& other) = delete;
|
||||
SinglyLinkedList(SinglyLinkedList const& other) = delete;
|
||||
SinglyLinkedList(SinglyLinkedList&& other)
|
||||
: m_head(other.m_head)
|
||||
, m_tail(other.m_tail)
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
other.m_head = nullptr;
|
||||
other.m_tail = nullptr;
|
||||
}
|
||||
SinglyLinkedList& operator=(const SinglyLinkedList& other) = delete;
|
||||
SinglyLinkedList& operator=(SinglyLinkedList const& other) = delete;
|
||||
SinglyLinkedList& operator=(SinglyLinkedList&&) = delete;
|
||||
|
||||
~SinglyLinkedList() { clear(); }
|
||||
|
@ -239,10 +239,10 @@ public:
|
|||
|
||||
private:
|
||||
Node* head() { return m_head; }
|
||||
const Node* head() const { return m_head; }
|
||||
Node const* head() const { return m_head; }
|
||||
|
||||
Node* tail() { return m_tail; }
|
||||
const Node* tail() const { return m_tail; }
|
||||
Node const* tail() const { return m_tail; }
|
||||
|
||||
Node* m_head { nullptr };
|
||||
Node* m_tail { nullptr };
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
, m_closing(closing)
|
||||
{
|
||||
}
|
||||
explicit SourceGenerator(StringBuilder& builder, const MappingType& mapping, char opening = '@', char closing = '@')
|
||||
explicit SourceGenerator(StringBuilder& builder, MappingType const& mapping, char opening = '@', char closing = '@')
|
||||
: m_builder(builder)
|
||||
, m_mapping(mapping)
|
||||
, m_opening(opening)
|
||||
|
@ -58,14 +58,14 @@ public:
|
|||
while (!lexer.is_eof()) {
|
||||
// FIXME: It is a bit inconvenient, that 'consume_until' also consumes the 'stop' character, this makes
|
||||
// the method less generic because there is no way to check if the 'stop' character ever appeared.
|
||||
const auto consume_until_without_consuming_stop_character = [&](char stop) {
|
||||
auto const consume_until_without_consuming_stop_character = [&](char stop) {
|
||||
return lexer.consume_while([&](char ch) { return ch != stop; });
|
||||
};
|
||||
|
||||
m_builder.append(consume_until_without_consuming_stop_character(m_opening));
|
||||
|
||||
if (lexer.consume_specific(m_opening)) {
|
||||
const auto placeholder = consume_until_without_consuming_stop_character(m_closing);
|
||||
auto const placeholder = consume_until_without_consuming_stop_character(m_closing);
|
||||
|
||||
if (!lexer.consume_specific(m_closing))
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
[[nodiscard]] constexpr StringView filename() const { return StringView(m_file); }
|
||||
[[nodiscard]] constexpr u32 line_number() const { return m_line; }
|
||||
|
||||
[[nodiscard]] static constexpr SourceLocation current(const char* const file = __builtin_FILE(), u32 line = __builtin_LINE(), const char* const function = __builtin_FUNCTION())
|
||||
[[nodiscard]] static constexpr SourceLocation current(char const* const file = __builtin_FILE(), u32 line = __builtin_LINE(), char const* const function = __builtin_FUNCTION())
|
||||
{
|
||||
return SourceLocation(file, line, function);
|
||||
}
|
||||
|
@ -27,15 +27,15 @@ public:
|
|||
constexpr SourceLocation() = default;
|
||||
|
||||
private:
|
||||
constexpr SourceLocation(const char* const file, u32 line, const char* const function)
|
||||
constexpr SourceLocation(char const* const file, u32 line, char const* const function)
|
||||
: m_function(function)
|
||||
, m_file(file)
|
||||
, m_line(line)
|
||||
{
|
||||
}
|
||||
|
||||
const char* const m_function { nullptr };
|
||||
const char* const m_file { nullptr };
|
||||
char const* const m_function { nullptr };
|
||||
char const* const m_file { nullptr };
|
||||
const u32 m_line { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -75,19 +75,19 @@ constexpr SizeType array_size(T (&)[N])
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T min(const T& a, const IdentityType<T>& b)
|
||||
constexpr T min(const T& a, IdentityType<T> const& b)
|
||||
{
|
||||
return b < a ? b : a;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T max(const T& a, const IdentityType<T>& b)
|
||||
constexpr T max(const T& a, IdentityType<T> const& b)
|
||||
{
|
||||
return a < b ? b : a;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T clamp(const T& value, const IdentityType<T>& min, const IdentityType<T>& max)
|
||||
constexpr T clamp(const T& value, IdentityType<T> const& min, IdentityType<T> const& max)
|
||||
{
|
||||
VERIFY(max >= min);
|
||||
if (value > max)
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
bool String::operator==(const FlyString& fly_string) const
|
||||
bool String::operator==(FlyString const& fly_string) const
|
||||
{
|
||||
return m_impl == fly_string.impl() || view() == fly_string.view();
|
||||
}
|
||||
|
||||
bool String::operator==(const String& other) const
|
||||
bool String::operator==(String const& other) const
|
||||
{
|
||||
return m_impl == other.impl() || view() == other.view();
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ bool String::operator==(StringView other) const
|
|||
return view() == other;
|
||||
}
|
||||
|
||||
bool String::operator<(const String& other) const
|
||||
bool String::operator<(String const& other) const
|
||||
{
|
||||
return view() < other.view();
|
||||
}
|
||||
|
||||
bool String::operator>(const String& other) const
|
||||
bool String::operator>(String const& other) const
|
||||
{
|
||||
return view() > other.view();
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ Vector<StringView> String::split_view(Function<bool(char)> separator, bool keep_
|
|||
return v;
|
||||
}
|
||||
|
||||
Vector<StringView> String::split_view(const char separator, bool keep_empty) const
|
||||
Vector<StringView> String::split_view(char const separator, bool keep_empty) const
|
||||
{
|
||||
return split_view([separator](char ch) { return ch == separator; }, keep_empty);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ String escape_html_entities(StringView html)
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
String::String(const FlyString& string)
|
||||
String::String(FlyString const& string)
|
||||
: m_impl(string.impl())
|
||||
{
|
||||
}
|
||||
|
@ -387,27 +387,27 @@ String String::to_titlecase() const
|
|||
return StringUtils::to_titlecase(*this);
|
||||
}
|
||||
|
||||
bool operator<(const char* characters, const String& string)
|
||||
bool operator<(char const* characters, String const& string)
|
||||
{
|
||||
return string.view() > characters;
|
||||
}
|
||||
|
||||
bool operator>=(const char* characters, const String& string)
|
||||
bool operator>=(char const* characters, String const& string)
|
||||
{
|
||||
return string.view() <= characters;
|
||||
}
|
||||
|
||||
bool operator>(const char* characters, const String& string)
|
||||
bool operator>(char const* characters, String const& string)
|
||||
{
|
||||
return string.view() < characters;
|
||||
}
|
||||
|
||||
bool operator<=(const char* characters, const String& string)
|
||||
bool operator<=(char const* characters, String const& string)
|
||||
{
|
||||
return string.view() >= characters;
|
||||
}
|
||||
|
||||
bool String::operator==(const char* cstring) const
|
||||
bool String::operator==(char const* cstring) const
|
||||
{
|
||||
return view() == cstring;
|
||||
}
|
||||
|
|
68
AK/String.h
68
AK/String.h
|
@ -48,7 +48,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
String(const String& other)
|
||||
String(String const& other)
|
||||
: m_impl(const_cast<String&>(other).m_impl)
|
||||
{
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
String(const char* cstring, ShouldChomp shouldChomp = NoChomp)
|
||||
String(char const* cstring, ShouldChomp shouldChomp = NoChomp)
|
||||
: m_impl(StringImpl::create(cstring, shouldChomp))
|
||||
{
|
||||
}
|
||||
|
||||
String(const char* cstring, size_t length, ShouldChomp shouldChomp = NoChomp)
|
||||
String(char const* cstring, size_t length, ShouldChomp shouldChomp = NoChomp)
|
||||
: m_impl(StringImpl::create(cstring, length, shouldChomp))
|
||||
{
|
||||
}
|
||||
|
@ -73,12 +73,12 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
String(const StringImpl& impl)
|
||||
String(StringImpl const& impl)
|
||||
: m_impl(const_cast<StringImpl&>(impl))
|
||||
{
|
||||
}
|
||||
|
||||
String(const StringImpl* impl)
|
||||
String(StringImpl const* impl)
|
||||
: m_impl(const_cast<StringImpl*>(impl))
|
||||
{
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
String(const FlyString&);
|
||||
String(FlyString const&);
|
||||
|
||||
[[nodiscard]] static String repeated(char, size_t count);
|
||||
[[nodiscard]] static String repeated(StringView, size_t count);
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
[[nodiscard]] static String roman_number_from(size_t value);
|
||||
|
||||
template<class SeparatorType, class CollectionType>
|
||||
[[nodiscard]] static String join(const SeparatorType& separator, const CollectionType& collection, StringView fmtstr = "{}"sv)
|
||||
[[nodiscard]] static String join(SeparatorType const& separator, CollectionType const& collection, StringView fmtstr = "{}"sv)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.join(separator, collection, fmtstr);
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
[[nodiscard]] ALWAYS_INLINE bool is_empty() const { return length() == 0; }
|
||||
[[nodiscard]] ALWAYS_INLINE size_t length() const { return m_impl ? m_impl->length() : 0; }
|
||||
// Includes NUL-terminator, if non-nullptr.
|
||||
[[nodiscard]] ALWAYS_INLINE const char* characters() const { return m_impl ? m_impl->characters() : nullptr; }
|
||||
[[nodiscard]] ALWAYS_INLINE char const* characters() const { return m_impl ? m_impl->characters() : nullptr; }
|
||||
|
||||
[[nodiscard]] bool copy_characters_to_buffer(char* buffer, size_t buffer_size) const;
|
||||
|
||||
|
@ -181,13 +181,13 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE const char& operator[](size_t i) const
|
||||
[[nodiscard]] ALWAYS_INLINE char const& operator[](size_t i) const
|
||||
{
|
||||
VERIFY(!is_null());
|
||||
return (*m_impl)[i];
|
||||
}
|
||||
|
||||
using ConstIterator = SimpleIterator<const String, const char>;
|
||||
using ConstIterator = SimpleIterator<const String, char const>;
|
||||
|
||||
[[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
|
||||
[[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); }
|
||||
|
@ -197,27 +197,27 @@ public:
|
|||
[[nodiscard]] bool starts_with(char) const;
|
||||
[[nodiscard]] bool ends_with(char) const;
|
||||
|
||||
bool operator==(const String&) const;
|
||||
bool operator!=(const String& other) const { return !(*this == other); }
|
||||
bool operator==(String const&) const;
|
||||
bool operator!=(String const& other) const { return !(*this == other); }
|
||||
|
||||
bool operator==(StringView) const;
|
||||
bool operator!=(StringView other) const { return !(*this == other); }
|
||||
|
||||
bool operator==(const FlyString&) const;
|
||||
bool operator!=(const FlyString& other) const { return !(*this == other); }
|
||||
bool operator==(FlyString const&) const;
|
||||
bool operator!=(FlyString const& other) const { return !(*this == other); }
|
||||
|
||||
bool operator<(const String&) const;
|
||||
bool operator<(const char*) const;
|
||||
bool operator>=(const String& other) const { return !(*this < other); }
|
||||
bool operator>=(const char* other) const { return !(*this < other); }
|
||||
bool operator<(String const&) const;
|
||||
bool operator<(char const*) const;
|
||||
bool operator>=(String const& other) const { return !(*this < other); }
|
||||
bool operator>=(char const* other) const { return !(*this < other); }
|
||||
|
||||
bool operator>(const String&) const;
|
||||
bool operator>(const char*) const;
|
||||
bool operator<=(const String& other) const { return !(*this > other); }
|
||||
bool operator<=(const char* other) const { return !(*this > other); }
|
||||
bool operator>(String const&) const;
|
||||
bool operator>(char const*) const;
|
||||
bool operator<=(String const& other) const { return !(*this > other); }
|
||||
bool operator<=(char const* other) const { return !(*this > other); }
|
||||
|
||||
bool operator==(const char* cstring) const;
|
||||
bool operator!=(const char* cstring) const { return !(*this == cstring); }
|
||||
bool operator==(char const* cstring) const;
|
||||
bool operator!=(char const* cstring) const { return !(*this == cstring); }
|
||||
|
||||
[[nodiscard]] String isolated_copy() const;
|
||||
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
}
|
||||
|
||||
[[nodiscard]] StringImpl* impl() { return m_impl.ptr(); }
|
||||
[[nodiscard]] const StringImpl* impl() const { return m_impl.ptr(); }
|
||||
[[nodiscard]] StringImpl const* impl() const { return m_impl.ptr(); }
|
||||
|
||||
String& operator=(String&& other)
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
String& operator=(const String& other)
|
||||
String& operator=(String const& other)
|
||||
{
|
||||
if (this != &other)
|
||||
m_impl = const_cast<String&>(other).m_impl;
|
||||
|
@ -265,17 +265,17 @@ public:
|
|||
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
||||
|
||||
template<typename BufferType>
|
||||
[[nodiscard]] static String copy(const BufferType& buffer, ShouldChomp should_chomp = NoChomp)
|
||||
[[nodiscard]] static String copy(BufferType const& buffer, ShouldChomp should_chomp = NoChomp)
|
||||
{
|
||||
if (buffer.is_empty())
|
||||
return empty();
|
||||
return String((const char*)buffer.data(), buffer.size(), should_chomp);
|
||||
return String((char const*)buffer.data(), buffer.size(), should_chomp);
|
||||
}
|
||||
|
||||
[[nodiscard]] static String vformatted(StringView fmtstr, TypeErasedFormatParams&);
|
||||
|
||||
template<typename... Parameters>
|
||||
[[nodiscard]] static String formatted(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
[[nodiscard]] static String formatted(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
VariadicFormatParams variadic_format_parameters { parameters... };
|
||||
return vformatted(fmtstr.view(), variadic_format_parameters);
|
||||
|
@ -320,7 +320,7 @@ private:
|
|||
|
||||
template<>
|
||||
struct Traits<String> : public GenericTraits<String> {
|
||||
static unsigned hash(const String& s) { return s.impl() ? s.impl()->hash() : 0; }
|
||||
static unsigned hash(String const& s) { return s.impl() ? s.impl()->hash() : 0; }
|
||||
};
|
||||
|
||||
struct CaseInsensitiveStringTraits : public Traits<String> {
|
||||
|
@ -328,10 +328,10 @@ struct CaseInsensitiveStringTraits : public Traits<String> {
|
|||
static bool equals(String const& a, String const& b) { return a.equals_ignoring_case(b); }
|
||||
};
|
||||
|
||||
bool operator<(const char*, const String&);
|
||||
bool operator>=(const char*, const String&);
|
||||
bool operator>(const char*, const String&);
|
||||
bool operator<=(const char*, const String&);
|
||||
bool operator<(char const*, String const&);
|
||||
bool operator>=(char const*, String const&);
|
||||
bool operator>(char const*, String const&);
|
||||
bool operator<=(char const*, String const&);
|
||||
|
||||
String escape_html_entities(StringView html);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ NonnullRefPtr<StringImpl> StringImpl::create_uninitialized(size_t length, char*&
|
|||
return new_stringimpl;
|
||||
}
|
||||
|
||||
RefPtr<StringImpl> StringImpl::create(const char* cstring, size_t length, ShouldChomp should_chomp)
|
||||
RefPtr<StringImpl> StringImpl::create(char const* cstring, size_t length, ShouldChomp should_chomp)
|
||||
{
|
||||
if (!cstring)
|
||||
return nullptr;
|
||||
|
@ -73,7 +73,7 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, size_t length, Should
|
|||
return new_stringimpl;
|
||||
}
|
||||
|
||||
RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldChomp)
|
||||
RefPtr<StringImpl> StringImpl::create(char const* cstring, ShouldChomp shouldChomp)
|
||||
{
|
||||
if (!cstring)
|
||||
return nullptr;
|
||||
|
@ -86,7 +86,7 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldCho
|
|||
|
||||
RefPtr<StringImpl> StringImpl::create(ReadonlyBytes bytes, ShouldChomp shouldChomp)
|
||||
{
|
||||
return StringImpl::create(reinterpret_cast<const char*>(bytes.data()), bytes.size(), shouldChomp);
|
||||
return StringImpl::create(reinterpret_cast<char const*>(bytes.data()), bytes.size(), shouldChomp);
|
||||
}
|
||||
|
||||
RefPtr<StringImpl> StringImpl::create_lowercased(char const* cstring, size_t length)
|
||||
|
|
|
@ -25,8 +25,8 @@ size_t allocation_size_for_stringimpl(size_t length);
|
|||
class StringImpl : public RefCounted<StringImpl> {
|
||||
public:
|
||||
static NonnullRefPtr<StringImpl> create_uninitialized(size_t length, char*& buffer);
|
||||
static RefPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp);
|
||||
static RefPtr<StringImpl> create(const char* cstring, size_t length, ShouldChomp = NoChomp);
|
||||
static RefPtr<StringImpl> create(char const* cstring, ShouldChomp = NoChomp);
|
||||
static RefPtr<StringImpl> create(char const* cstring, size_t length, ShouldChomp = NoChomp);
|
||||
static RefPtr<StringImpl> create(ReadonlyBytes, ShouldChomp = NoChomp);
|
||||
static RefPtr<StringImpl> create_lowercased(char const* cstring, size_t length);
|
||||
static RefPtr<StringImpl> create_uppercased(char const* cstring, size_t length);
|
||||
|
@ -45,18 +45,18 @@ public:
|
|||
|
||||
size_t length() const { return m_length; }
|
||||
// Includes NUL-terminator.
|
||||
const char* characters() const { return &m_inline_buffer[0]; }
|
||||
char const* characters() const { return &m_inline_buffer[0]; }
|
||||
|
||||
ALWAYS_INLINE ReadonlyBytes bytes() const { return { characters(), length() }; }
|
||||
ALWAYS_INLINE StringView view() const { return { characters(), length() }; }
|
||||
|
||||
const char& operator[](size_t i) const
|
||||
char const& operator[](size_t i) const
|
||||
{
|
||||
VERIFY(i < m_length);
|
||||
return characters()[i];
|
||||
}
|
||||
|
||||
bool operator==(const StringImpl& other) const
|
||||
bool operator==(StringImpl const& other) const
|
||||
{
|
||||
if (length() != other.length())
|
||||
return false;
|
||||
|
|
|
@ -37,11 +37,11 @@ bool matches(StringView str, StringView mask, CaseSensitivity case_sensitivity,
|
|||
return true;
|
||||
}
|
||||
|
||||
const char* string_ptr = str.characters_without_null_termination();
|
||||
const char* string_start = str.characters_without_null_termination();
|
||||
const char* string_end = string_ptr + str.length();
|
||||
const char* mask_ptr = mask.characters_without_null_termination();
|
||||
const char* mask_end = mask_ptr + mask.length();
|
||||
char const* string_ptr = str.characters_without_null_termination();
|
||||
char const* string_start = str.characters_without_null_termination();
|
||||
char const* string_end = string_ptr + str.length();
|
||||
char const* mask_ptr = mask.characters_without_null_termination();
|
||||
char const* mask_end = mask_ptr + mask.length();
|
||||
|
||||
while (string_ptr < string_end && mask_ptr < mask_end) {
|
||||
auto string_start_ptr = string_ptr;
|
||||
|
@ -92,7 +92,7 @@ Optional<T> convert_to_int(StringView str, TrimWhitespace trim_whitespace)
|
|||
|
||||
T sign = 1;
|
||||
size_t i = 0;
|
||||
const auto characters = string.characters_without_null_termination();
|
||||
auto const characters = string.characters_without_null_termination();
|
||||
|
||||
if (characters[0] == '-' || characters[0] == '+') {
|
||||
if (string.length() == 1)
|
||||
|
@ -132,7 +132,7 @@ Optional<T> convert_to_uint(StringView str, TrimWhitespace trim_whitespace)
|
|||
return {};
|
||||
|
||||
T value = 0;
|
||||
const auto characters = string.characters_without_null_termination();
|
||||
auto const characters = string.characters_without_null_termination();
|
||||
|
||||
for (size_t i = 0; i < string.length(); i++) {
|
||||
if (characters[i] < '0' || characters[i] > '9')
|
||||
|
@ -165,7 +165,7 @@ Optional<T> convert_to_uint_from_hex(StringView str, TrimWhitespace trim_whitesp
|
|||
return {};
|
||||
|
||||
T value = 0;
|
||||
const auto count = string.length();
|
||||
auto const count = string.length();
|
||||
const T upper_bound = NumericLimits<T>::max();
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
|
@ -204,7 +204,7 @@ Optional<T> convert_to_uint_from_octal(StringView str, TrimWhitespace trim_white
|
|||
return {};
|
||||
|
||||
T value = 0;
|
||||
const auto count = string.length();
|
||||
auto const count = string.length();
|
||||
const T upper_bound = NumericLimits<T>::max();
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
|
|
|
@ -37,11 +37,11 @@ struct MaskSpan {
|
|||
size_t start;
|
||||
size_t length;
|
||||
|
||||
bool operator==(const MaskSpan& other) const
|
||||
bool operator==(MaskSpan const& other) const
|
||||
{
|
||||
return start == other.start && length == other.length;
|
||||
}
|
||||
bool operator!=(const MaskSpan& other) const
|
||||
bool operator!=(MaskSpan const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
|
|
@ -20,26 +20,26 @@
|
|||
namespace AK {
|
||||
|
||||
#ifndef KERNEL
|
||||
StringView::StringView(const String& string)
|
||||
StringView::StringView(String const& string)
|
||||
: m_characters(string.characters())
|
||||
, m_length(string.length())
|
||||
{
|
||||
}
|
||||
|
||||
StringView::StringView(const FlyString& string)
|
||||
StringView::StringView(FlyString const& string)
|
||||
: m_characters(string.characters())
|
||||
, m_length(string.length())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
StringView::StringView(const ByteBuffer& buffer)
|
||||
: m_characters((const char*)buffer.data())
|
||||
StringView::StringView(ByteBuffer const& buffer)
|
||||
: m_characters((char const*)buffer.data())
|
||||
, m_length(buffer.size())
|
||||
{
|
||||
}
|
||||
|
||||
Vector<StringView> StringView::split_view(const char separator, bool keep_empty) const
|
||||
Vector<StringView> StringView::split_view(char const separator, bool keep_empty) const
|
||||
{
|
||||
StringView seperator_view { &separator, 1 };
|
||||
return split_view(seperator_view, keep_empty);
|
||||
|
@ -166,7 +166,7 @@ String StringView::to_titlecase_string() const
|
|||
|
||||
StringView StringView::substring_view_starting_from_substring(StringView substring) const
|
||||
{
|
||||
const char* remaining_characters = substring.characters_without_null_termination();
|
||||
char const* remaining_characters = substring.characters_without_null_termination();
|
||||
VERIFY(remaining_characters >= m_characters);
|
||||
VERIFY(remaining_characters <= m_characters + m_length);
|
||||
size_t remaining_length = m_length - (remaining_characters - m_characters);
|
||||
|
@ -175,7 +175,7 @@ StringView StringView::substring_view_starting_from_substring(StringView substri
|
|||
|
||||
StringView StringView::substring_view_starting_after_substring(StringView substring) const
|
||||
{
|
||||
const char* remaining_characters = substring.characters_without_null_termination() + substring.length();
|
||||
char const* remaining_characters = substring.characters_without_null_termination() + substring.length();
|
||||
VERIFY(remaining_characters >= m_characters);
|
||||
VERIFY(remaining_characters <= m_characters + m_length);
|
||||
size_t remaining_length = m_length - (remaining_characters - m_characters);
|
||||
|
@ -209,7 +209,7 @@ template Optional<long> StringView::to_uint() const;
|
|||
template Optional<long long> StringView::to_uint() const;
|
||||
|
||||
#ifndef KERNEL
|
||||
bool StringView::operator==(const String& string) const
|
||||
bool StringView::operator==(String const& string) const
|
||||
{
|
||||
return *this == string.view();
|
||||
}
|
||||
|
|
|
@ -20,34 +20,34 @@ namespace AK {
|
|||
class StringView {
|
||||
public:
|
||||
ALWAYS_INLINE constexpr StringView() = default;
|
||||
ALWAYS_INLINE constexpr StringView(const char* characters, size_t length)
|
||||
ALWAYS_INLINE constexpr StringView(char const* characters, size_t length)
|
||||
: m_characters(characters)
|
||||
, m_length(length)
|
||||
{
|
||||
if (!is_constant_evaluated())
|
||||
VERIFY(!Checked<uintptr_t>::addition_would_overflow((uintptr_t)characters, length));
|
||||
}
|
||||
ALWAYS_INLINE StringView(const unsigned char* characters, size_t length)
|
||||
: m_characters((const char*)characters)
|
||||
ALWAYS_INLINE StringView(unsigned char const* characters, size_t length)
|
||||
: m_characters((char const*)characters)
|
||||
, m_length(length)
|
||||
{
|
||||
VERIFY(!Checked<uintptr_t>::addition_would_overflow((uintptr_t)characters, length));
|
||||
}
|
||||
ALWAYS_INLINE constexpr StringView(const char* cstring)
|
||||
ALWAYS_INLINE constexpr StringView(char const* cstring)
|
||||
: m_characters(cstring)
|
||||
, m_length(cstring ? __builtin_strlen(cstring) : 0)
|
||||
{
|
||||
}
|
||||
ALWAYS_INLINE StringView(ReadonlyBytes bytes)
|
||||
: m_characters(reinterpret_cast<const char*>(bytes.data()))
|
||||
: m_characters(reinterpret_cast<char const*>(bytes.data()))
|
||||
, m_length(bytes.size())
|
||||
{
|
||||
}
|
||||
|
||||
StringView(const ByteBuffer&);
|
||||
StringView(ByteBuffer const&);
|
||||
#ifndef KERNEL
|
||||
StringView(const String&);
|
||||
StringView(const FlyString&);
|
||||
StringView(String const&);
|
||||
StringView(FlyString const&);
|
||||
#endif
|
||||
|
||||
explicit StringView(ByteBuffer&&) = delete;
|
||||
|
@ -67,9 +67,9 @@ public:
|
|||
|
||||
[[nodiscard]] ReadonlyBytes bytes() const { return { m_characters, m_length }; }
|
||||
|
||||
constexpr const char& operator[](size_t index) const { return m_characters[index]; }
|
||||
constexpr char const& operator[](size_t index) const { return m_characters[index]; }
|
||||
|
||||
using ConstIterator = SimpleIterator<const StringView, const char>;
|
||||
using ConstIterator = SimpleIterator<const StringView, char const>;
|
||||
|
||||
[[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
|
||||
[[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); }
|
||||
|
@ -192,14 +192,14 @@ public:
|
|||
[[nodiscard]] StringView substring_view_starting_from_substring(StringView substring) const;
|
||||
[[nodiscard]] StringView substring_view_starting_after_substring(StringView substring) const;
|
||||
|
||||
constexpr bool operator==(const char* cstring) const
|
||||
constexpr bool operator==(char const* cstring) const
|
||||
{
|
||||
if (is_null())
|
||||
return cstring == nullptr;
|
||||
if (!cstring)
|
||||
return false;
|
||||
// NOTE: `m_characters` is not guaranteed to be null-terminated, but `cstring` is.
|
||||
const char* cp = cstring;
|
||||
char const* cp = cstring;
|
||||
for (size_t i = 0; i < m_length; ++i) {
|
||||
if (*cp == '\0')
|
||||
return false;
|
||||
|
@ -209,13 +209,13 @@ public:
|
|||
return *cp == '\0';
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const char* cstring) const
|
||||
constexpr bool operator!=(char const* cstring) const
|
||||
{
|
||||
return !(*this == cstring);
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
bool operator==(const String&) const;
|
||||
bool operator==(String const&) const;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] constexpr int compare(StringView other) const
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
|
||||
private:
|
||||
friend class String;
|
||||
const char* m_characters { nullptr };
|
||||
char const* m_characters { nullptr };
|
||||
size_t m_length { 0 };
|
||||
};
|
||||
|
||||
|
@ -321,7 +321,7 @@ struct CaseInsensitiveStringViewTraits : public Traits<StringView> {
|
|||
# define AK_STRING_VIEW_LITERAL_CONSTEVAL consteval
|
||||
#endif
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(const char* cstring, size_t length)
|
||||
[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(char const* cstring, size_t length)
|
||||
{
|
||||
return AK::StringView(cstring, length);
|
||||
}
|
||||
|
|
16
AK/Time.cpp
16
AK/Time.cpp
|
@ -182,7 +182,7 @@ timeval Time::to_timeval() const
|
|||
return { static_cast<time_t>(m_seconds), static_cast<suseconds_t>(m_nanoseconds) / 1000 };
|
||||
}
|
||||
|
||||
Time Time::operator+(const Time& other) const
|
||||
Time Time::operator+(Time const& other) const
|
||||
{
|
||||
VERIFY(m_nanoseconds < 1'000'000'000);
|
||||
VERIFY(other.m_nanoseconds < 1'000'000'000);
|
||||
|
@ -222,13 +222,13 @@ Time Time::operator+(const Time& other) const
|
|||
return Time { new_secs.value(), new_nsecs };
|
||||
}
|
||||
|
||||
Time& Time::operator+=(const Time& other)
|
||||
Time& Time::operator+=(Time const& other)
|
||||
{
|
||||
*this = *this + other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Time Time::operator-(const Time& other) const
|
||||
Time Time::operator-(Time const& other) const
|
||||
{
|
||||
VERIFY(m_nanoseconds < 1'000'000'000);
|
||||
VERIFY(other.m_nanoseconds < 1'000'000'000);
|
||||
|
@ -247,28 +247,28 @@ Time Time::operator-(const Time& other) const
|
|||
return Time { (m_seconds + 0x4000'0000'0000'0000) + 0x4000'0000'0000'0000, m_nanoseconds };
|
||||
}
|
||||
|
||||
Time& Time::operator-=(const Time& other)
|
||||
Time& Time::operator-=(Time const& other)
|
||||
{
|
||||
*this = *this - other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Time::operator<(const Time& other) const
|
||||
bool Time::operator<(Time const& other) const
|
||||
{
|
||||
return m_seconds < other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds < other.m_nanoseconds);
|
||||
}
|
||||
|
||||
bool Time::operator<=(const Time& other) const
|
||||
bool Time::operator<=(Time const& other) const
|
||||
{
|
||||
return m_seconds < other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds <= other.m_nanoseconds);
|
||||
}
|
||||
|
||||
bool Time::operator>(const Time& other) const
|
||||
bool Time::operator>(Time const& other) const
|
||||
{
|
||||
return m_seconds > other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds > other.m_nanoseconds);
|
||||
}
|
||||
|
||||
bool Time::operator>=(const Time& other) const
|
||||
bool Time::operator>=(Time const& other) const
|
||||
{
|
||||
return m_seconds > other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds >= other.m_nanoseconds);
|
||||
}
|
||||
|
|
38
AK/Time.h
38
AK/Time.h
|
@ -106,8 +106,8 @@ constexpr i64 seconds_since_epoch_to_year(i64 seconds)
|
|||
class Time {
|
||||
public:
|
||||
Time() = default;
|
||||
Time(const Time&) = default;
|
||||
Time& operator=(const Time&) = default;
|
||||
Time(Time const&) = default;
|
||||
Time& operator=(Time const&) = default;
|
||||
|
||||
Time(Time&& other)
|
||||
: m_seconds(exchange(other.m_seconds, 0))
|
||||
|
@ -218,16 +218,16 @@ public:
|
|||
[[nodiscard]] bool is_zero() const { return (m_seconds == 0) && (m_nanoseconds == 0); }
|
||||
[[nodiscard]] bool is_negative() const { return m_seconds < 0; }
|
||||
|
||||
bool operator==(const Time& other) const { return this->m_seconds == other.m_seconds && this->m_nanoseconds == other.m_nanoseconds; }
|
||||
bool operator!=(const Time& other) const { return !(*this == other); }
|
||||
Time operator+(const Time& other) const;
|
||||
Time& operator+=(const Time& other);
|
||||
Time operator-(const Time& other) const;
|
||||
Time& operator-=(const Time& other);
|
||||
bool operator<(const Time& other) const;
|
||||
bool operator<=(const Time& other) const;
|
||||
bool operator>(const Time& other) const;
|
||||
bool operator>=(const Time& other) const;
|
||||
bool operator==(Time const& other) const { return this->m_seconds == other.m_seconds && this->m_nanoseconds == other.m_nanoseconds; }
|
||||
bool operator!=(Time const& other) const { return !(*this == other); }
|
||||
Time operator+(Time const& other) const;
|
||||
Time& operator+=(Time const& other);
|
||||
Time operator-(Time const& other) const;
|
||||
Time& operator-=(Time const& other);
|
||||
bool operator<(Time const& other) const;
|
||||
bool operator<=(Time const& other) const;
|
||||
bool operator>(Time const& other) const;
|
||||
bool operator>=(Time const& other) const;
|
||||
|
||||
private:
|
||||
constexpr explicit Time(i64 seconds, u32 nanoseconds)
|
||||
|
@ -243,7 +243,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename TimevalType>
|
||||
inline void timeval_sub(const TimevalType& a, const TimevalType& b, TimevalType& result)
|
||||
inline void timeval_sub(TimevalType const& a, TimevalType const& b, TimevalType& result)
|
||||
{
|
||||
result.tv_sec = a.tv_sec - b.tv_sec;
|
||||
result.tv_usec = a.tv_usec - b.tv_usec;
|
||||
|
@ -254,7 +254,7 @@ inline void timeval_sub(const TimevalType& a, const TimevalType& b, TimevalType&
|
|||
}
|
||||
|
||||
template<typename TimevalType>
|
||||
inline void timeval_add(const TimevalType& a, const TimevalType& b, TimevalType& result)
|
||||
inline void timeval_add(TimevalType const& a, TimevalType const& b, TimevalType& result)
|
||||
{
|
||||
result.tv_sec = a.tv_sec + b.tv_sec;
|
||||
result.tv_usec = a.tv_usec + b.tv_usec;
|
||||
|
@ -265,7 +265,7 @@ inline void timeval_add(const TimevalType& a, const TimevalType& b, TimevalType&
|
|||
}
|
||||
|
||||
template<typename TimespecType>
|
||||
inline void timespec_sub(const TimespecType& a, const TimespecType& b, TimespecType& result)
|
||||
inline void timespec_sub(TimespecType const& a, TimespecType const& b, TimespecType& result)
|
||||
{
|
||||
result.tv_sec = a.tv_sec - b.tv_sec;
|
||||
result.tv_nsec = a.tv_nsec - b.tv_nsec;
|
||||
|
@ -276,7 +276,7 @@ inline void timespec_sub(const TimespecType& a, const TimespecType& b, TimespecT
|
|||
}
|
||||
|
||||
template<typename TimespecType>
|
||||
inline void timespec_add(const TimespecType& a, const TimespecType& b, TimespecType& result)
|
||||
inline void timespec_add(TimespecType const& a, TimespecType const& b, TimespecType& result)
|
||||
{
|
||||
result.tv_sec = a.tv_sec + b.tv_sec;
|
||||
result.tv_nsec = a.tv_nsec + b.tv_nsec;
|
||||
|
@ -287,7 +287,7 @@ inline void timespec_add(const TimespecType& a, const TimespecType& b, TimespecT
|
|||
}
|
||||
|
||||
template<typename TimespecType, typename TimevalType>
|
||||
inline void timespec_add_timeval(const TimespecType& a, const TimevalType& b, TimespecType& result)
|
||||
inline void timespec_add_timeval(TimespecType const& a, TimevalType const& b, TimespecType& result)
|
||||
{
|
||||
result.tv_sec = a.tv_sec + b.tv_sec;
|
||||
result.tv_nsec = a.tv_nsec + b.tv_usec * 1000;
|
||||
|
@ -298,14 +298,14 @@ inline void timespec_add_timeval(const TimespecType& a, const TimevalType& b, Ti
|
|||
}
|
||||
|
||||
template<typename TimevalType, typename TimespecType>
|
||||
inline void timeval_to_timespec(const TimevalType& tv, TimespecType& ts)
|
||||
inline void timeval_to_timespec(TimevalType const& tv, TimespecType& ts)
|
||||
{
|
||||
ts.tv_sec = tv.tv_sec;
|
||||
ts.tv_nsec = tv.tv_usec * 1000;
|
||||
}
|
||||
|
||||
template<typename TimespecType, typename TimevalType>
|
||||
inline void timespec_to_timeval(const TimespecType& ts, TimevalType& tv)
|
||||
inline void timespec_to_timeval(TimespecType const& ts, TimevalType& tv)
|
||||
{
|
||||
tv.tv_sec = ts.tv_sec;
|
||||
tv.tv_usec = ts.tv_nsec / 1000;
|
||||
|
|
23
AK/Trie.h
23
AK/Trie.h
|
@ -40,7 +40,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename It>
|
||||
BaseType& traverse_until_last_accessible_node(It& it, const It& end)
|
||||
BaseType& traverse_until_last_accessible_node(It& it, It const& end)
|
||||
{
|
||||
Trie* node = this;
|
||||
for (; it < end; ++it) {
|
||||
|
@ -53,17 +53,17 @@ public:
|
|||
}
|
||||
|
||||
template<typename It>
|
||||
const BaseType& traverse_until_last_accessible_node(It& it, const It& end) const { return const_cast<Trie*>(this)->traverse_until_last_accessible_node(it, end); }
|
||||
BaseType const& traverse_until_last_accessible_node(It& it, It const& end) const { return const_cast<Trie*>(this)->traverse_until_last_accessible_node(it, end); }
|
||||
|
||||
template<typename It>
|
||||
BaseType& traverse_until_last_accessible_node(const It& begin, const It& end)
|
||||
BaseType& traverse_until_last_accessible_node(It const& begin, It const& end)
|
||||
{
|
||||
auto it = begin;
|
||||
return const_cast<Trie*>(this)->traverse_until_last_accessible_node(it, end);
|
||||
}
|
||||
|
||||
template<typename It>
|
||||
const BaseType& traverse_until_last_accessible_node(const It& begin, const It& end) const
|
||||
BaseType const& traverse_until_last_accessible_node(It const& begin, It const& end) const
|
||||
{
|
||||
auto it = begin;
|
||||
return const_cast<Trie*>(this)->traverse_until_last_accessible_node(it, end);
|
||||
|
@ -71,10 +71,10 @@ public:
|
|||
|
||||
Optional<MetadataType> metadata() const requires(!IsNullPointer<MetadataType>) { return m_metadata; }
|
||||
void set_metadata(MetadataType metadata) requires(!IsNullPointer<MetadataType>) { m_metadata = move(metadata); }
|
||||
const MetadataType& metadata_value() const requires(!IsNullPointer<MetadataType>) { return m_metadata.value(); }
|
||||
MetadataType const& metadata_value() const requires(!IsNullPointer<MetadataType>) { return m_metadata.value(); }
|
||||
MetadataType& metadata_value() requires(!IsNullPointer<MetadataType>) { return m_metadata.value(); }
|
||||
|
||||
const ValueType& value() const { return m_value; }
|
||||
ValueType const& value() const { return m_value; }
|
||||
ValueType& value() { return m_value; }
|
||||
|
||||
ErrorOr<Trie*> ensure_child(ValueType value, Optional<MetadataType> metadata = {})
|
||||
|
@ -99,11 +99,10 @@ public:
|
|||
|
||||
template<typename It, typename ProvideMetadataFunction>
|
||||
ErrorOr<BaseType*> insert(
|
||||
It& it, const It& end, MetadataType metadata, ProvideMetadataFunction provide_missing_metadata) requires(!IsNullPointer<MetadataType>)
|
||||
It& it, It const& end, MetadataType metadata, ProvideMetadataFunction provide_missing_metadata) requires(!IsNullPointer<MetadataType>)
|
||||
{
|
||||
Trie* last_root_node = &traverse_until_last_accessible_node(it, end);
|
||||
auto invoke_provide_missing_metadata = [&]<typename... Ts>(Ts && ... args)->ErrorOr<Optional<MetadataType>>
|
||||
{
|
||||
auto invoke_provide_missing_metadata = [&]<typename... Ts>(Ts&&... args) -> ErrorOr<Optional<MetadataType>> {
|
||||
if constexpr (SameAs<MetadataType, decltype(provide_missing_metadata(forward<Ts>(args)...))>)
|
||||
return Optional<MetadataType>(provide_missing_metadata(forward<Ts>(args)...));
|
||||
else
|
||||
|
@ -120,7 +119,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename It>
|
||||
ErrorOr<BaseType*> insert(It& it, const It& end) requires(IsNullPointer<MetadataType>)
|
||||
ErrorOr<BaseType*> insert(It& it, It const& end) requires(IsNullPointer<MetadataType>)
|
||||
{
|
||||
Trie* last_root_node = &traverse_until_last_accessible_node(it, end);
|
||||
for (; it != end; ++it) {
|
||||
|
@ -134,14 +133,14 @@ public:
|
|||
|
||||
template<typename It, typename ProvideMetadataFunction>
|
||||
ErrorOr<BaseType*> insert(
|
||||
const It& begin, const It& end, MetadataType metadata, ProvideMetadataFunction provide_missing_metadata) requires(!IsNullPointer<MetadataType>)
|
||||
It const& begin, It const& end, MetadataType metadata, ProvideMetadataFunction provide_missing_metadata) requires(!IsNullPointer<MetadataType>)
|
||||
{
|
||||
auto it = begin;
|
||||
return insert(it, end, move(metadata), move(provide_missing_metadata));
|
||||
}
|
||||
|
||||
template<typename It>
|
||||
ErrorOr<BaseType*> insert(const It& begin, const It& end) requires(IsNullPointer<MetadataType>)
|
||||
ErrorOr<BaseType*> insert(It const& begin, It const& end) requires(IsNullPointer<MetadataType>)
|
||||
{
|
||||
auto it = begin;
|
||||
return insert(it, end);
|
||||
|
|
|
@ -122,7 +122,7 @@ struct Tuple : Detail::Tuple<Ts...> {
|
|||
{
|
||||
}
|
||||
|
||||
Tuple(const Tuple& other)
|
||||
Tuple(Tuple const& other)
|
||||
: Tuple(other, Indices())
|
||||
{
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ struct Tuple : Detail::Tuple<Ts...> {
|
|||
return *this;
|
||||
}
|
||||
|
||||
Tuple& operator=(const Tuple& other)
|
||||
Tuple& operator=(Tuple const& other)
|
||||
{
|
||||
set(other, Indices());
|
||||
return *this;
|
||||
|
@ -185,7 +185,7 @@ private:
|
|||
}
|
||||
|
||||
template<unsigned... Is>
|
||||
Tuple(const Tuple& other, IndexSequence<Is...>)
|
||||
Tuple(Tuple const& other, IndexSequence<Is...>)
|
||||
: Detail::Tuple<Ts...>(other.get<Is>()...)
|
||||
{
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ private:
|
|||
}
|
||||
|
||||
template<unsigned... Is>
|
||||
void set(const Tuple& other, IndexSequence<Is...>)
|
||||
void set(Tuple const& other, IndexSequence<Is...>)
|
||||
{
|
||||
((get<Is>() = other.get<Is>()), ...);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ constexpr u64 TiB = KiB * KiB * KiB * KiB;
|
|||
constexpr u64 PiB = KiB * KiB * KiB * KiB * KiB;
|
||||
constexpr u64 EiB = KiB * KiB * KiB * KiB * KiB * KiB;
|
||||
|
||||
namespace std { //NOLINT(cert-dcl58-cpp) nullptr_t must be in ::std:: for some analysis tools
|
||||
namespace std { // NOLINT(cert-dcl58-cpp) nullptr_t must be in ::std:: for some analysis tools
|
||||
using nullptr_t = decltype(nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class SourceLocation {
|
|||
AK_MAKE_NONCOPYABLE(SourceLocation);
|
||||
|
||||
public:
|
||||
const char* filename() const { return m_filename; }
|
||||
char const* filename() const { return m_filename; }
|
||||
u32 line() const { return m_line; }
|
||||
u32 column() const { return m_column; }
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const char* m_filename { nullptr };
|
||||
char const* m_filename { nullptr };
|
||||
u32 m_line { 0 };
|
||||
u32 m_column { 0 };
|
||||
};
|
||||
|
@ -65,7 +65,7 @@ enum TypeKind : u16 {
|
|||
|
||||
class TypeDescriptor {
|
||||
public:
|
||||
const char* name() const { return m_name; }
|
||||
char const* name() const { return m_name; }
|
||||
TypeKind kind() const { return (TypeKind)m_kind; }
|
||||
bool is_integer() const { return kind() == TypeKind::Integer; }
|
||||
bool is_signed() const { return m_info & 1; }
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
|
||||
struct InvalidValueData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& type;
|
||||
TypeDescriptor const& type;
|
||||
};
|
||||
|
||||
struct NonnullArgData {
|
||||
|
@ -95,29 +95,29 @@ struct NonnullReturnData {
|
|||
|
||||
struct OverflowData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& type;
|
||||
TypeDescriptor const& type;
|
||||
};
|
||||
|
||||
struct VLABoundData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& type;
|
||||
TypeDescriptor const& type;
|
||||
};
|
||||
|
||||
struct ShiftOutOfBoundsData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& lhs_type;
|
||||
const TypeDescriptor& rhs_type;
|
||||
TypeDescriptor const& lhs_type;
|
||||
TypeDescriptor const& rhs_type;
|
||||
};
|
||||
|
||||
struct OutOfBoundsData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& array_type;
|
||||
const TypeDescriptor& index_type;
|
||||
TypeDescriptor const& array_type;
|
||||
TypeDescriptor const& index_type;
|
||||
};
|
||||
|
||||
struct TypeMismatchData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& type;
|
||||
TypeDescriptor const& type;
|
||||
u8 log_alignment;
|
||||
u8 type_check_kind;
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ struct TypeMismatchData {
|
|||
struct AlignmentAssumptionData {
|
||||
SourceLocation location;
|
||||
SourceLocation assumption_location;
|
||||
const TypeDescriptor& type;
|
||||
TypeDescriptor const& type;
|
||||
};
|
||||
|
||||
struct UnreachableData {
|
||||
|
@ -134,8 +134,8 @@ struct UnreachableData {
|
|||
|
||||
struct ImplicitConversionData {
|
||||
SourceLocation location;
|
||||
const TypeDescriptor& from_type;
|
||||
const TypeDescriptor& to_type;
|
||||
TypeDescriptor const& from_type;
|
||||
TypeDescriptor const& to_type;
|
||||
/* ImplicitConversionCheckKind */ unsigned char kind;
|
||||
};
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
}
|
||||
Span<const u8> bytes() const
|
||||
{
|
||||
return Span<const u8>(reinterpret_cast<const u8*>(this), sizeof(R));
|
||||
return Span<const u8>(reinterpret_cast<u8 const*>(this), sizeof(R));
|
||||
}
|
||||
|
||||
template<Unsigned U>
|
||||
|
@ -417,7 +417,7 @@ public:
|
|||
return { lower, higher };
|
||||
}
|
||||
|
||||
constexpr R operator+(const bool& other) const
|
||||
constexpr R operator+(bool const& other) const
|
||||
{
|
||||
bool carry = false; // unused
|
||||
return addc((u8)other, carry);
|
||||
|
@ -429,7 +429,7 @@ public:
|
|||
return addc(other, carry);
|
||||
}
|
||||
|
||||
constexpr R operator-(const bool& other) const
|
||||
constexpr R operator-(bool const& other) const
|
||||
{
|
||||
bool carry = false; // unused
|
||||
return subc((u8)other, carry);
|
||||
|
@ -491,9 +491,9 @@ public:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdiv-by-zero"
|
||||
if (!divisor) {
|
||||
volatile int x = 1;
|
||||
volatile int y = 0;
|
||||
[[maybe_unused]] volatile int z = x / y;
|
||||
int volatile x = 1;
|
||||
int volatile y = 0;
|
||||
[[maybe_unused]] int volatile z = x / y;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
@ -796,13 +796,13 @@ private:
|
|||
|
||||
// reverse operators
|
||||
template<Unsigned U, Unsigned T>
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator<(const U a, const UFixedBigInt<T>& b) { return b >= a; }
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator<(const U a, UFixedBigInt<T> const& b) { return b >= a; }
|
||||
template<Unsigned U, Unsigned T>
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator>(const U a, const UFixedBigInt<T>& b) { return b <= a; }
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator>(const U a, UFixedBigInt<T> const& b) { return b <= a; }
|
||||
template<Unsigned U, Unsigned T>
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator<=(const U a, const UFixedBigInt<T>& b) { return b > a; }
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator<=(const U a, UFixedBigInt<T> const& b) { return b > a; }
|
||||
template<Unsigned U, Unsigned T>
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator>=(const U a, const UFixedBigInt<T>& b) { return b < a; }
|
||||
requires(sizeof(U) < sizeof(T) * 2) constexpr bool operator>=(const U a, UFixedBigInt<T> const& b) { return b < a; }
|
||||
|
||||
template<Unsigned T>
|
||||
struct Formatter<UFixedBigInt<T>> : StandardFormatter {
|
||||
|
|
|
@ -124,7 +124,7 @@ bool UUID::operator==(const UUID& other) const
|
|||
|
||||
bool UUID::is_zero() const
|
||||
{
|
||||
return all_of(m_uuid_buffer, [](const auto octet) { return octet == 0; });
|
||||
return all_of(m_uuid_buffer, [](auto const octet) { return octet == 0; });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ public:
|
|||
Userspace() = default;
|
||||
|
||||
// Disable default implementations that would use surprising integer promotion.
|
||||
bool operator==(const Userspace&) const = delete;
|
||||
bool operator<=(const Userspace&) const = delete;
|
||||
bool operator>=(const Userspace&) const = delete;
|
||||
bool operator<(const Userspace&) const = delete;
|
||||
bool operator>(const Userspace&) const = delete;
|
||||
bool operator==(Userspace const&) const = delete;
|
||||
bool operator<=(Userspace const&) const = delete;
|
||||
bool operator>=(Userspace const&) const = delete;
|
||||
bool operator<(Userspace const&) const = delete;
|
||||
bool operator>(Userspace const&) const = delete;
|
||||
|
||||
#ifdef KERNEL
|
||||
Userspace(FlatPtr ptr)
|
||||
|
@ -62,7 +62,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
inline Userspace<T> static_ptr_cast(const Userspace<U>& ptr)
|
||||
inline Userspace<T> static_ptr_cast(Userspace<U> const& ptr)
|
||||
{
|
||||
#ifdef KERNEL
|
||||
auto casted_ptr = static_cast<T>(ptr.unsafe_userspace_ptr());
|
||||
|
|
|
@ -21,11 +21,11 @@ public:
|
|||
Utf32CodePointIterator() = default;
|
||||
~Utf32CodePointIterator() = default;
|
||||
|
||||
bool operator==(const Utf32CodePointIterator& other) const
|
||||
bool operator==(Utf32CodePointIterator const& other) const
|
||||
{
|
||||
return m_ptr == other.m_ptr && m_length == other.m_length;
|
||||
}
|
||||
bool operator!=(const Utf32CodePointIterator& other) const
|
||||
bool operator!=(Utf32CodePointIterator const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
m_length--;
|
||||
return *this;
|
||||
}
|
||||
ssize_t operator-(const Utf32CodePointIterator& other) const
|
||||
ssize_t operator-(Utf32CodePointIterator const& other) const
|
||||
{
|
||||
return m_ptr - other.m_ptr;
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ public:
|
|||
bool done() const { return !m_length; }
|
||||
|
||||
private:
|
||||
Utf32CodePointIterator(const u32* ptr, size_t length)
|
||||
Utf32CodePointIterator(u32 const* ptr, size_t length)
|
||||
: m_ptr(ptr)
|
||||
, m_length((ssize_t)length)
|
||||
{
|
||||
}
|
||||
const u32* m_ptr { nullptr };
|
||||
u32 const* m_ptr { nullptr };
|
||||
ssize_t m_length { -1 };
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
using Iterator = Utf32CodePointIterator;
|
||||
|
||||
Utf32View() = default;
|
||||
Utf32View(const u32* code_points, size_t length)
|
||||
Utf32View(u32 const* code_points, size_t length)
|
||||
: m_code_points(code_points)
|
||||
, m_length(length)
|
||||
{
|
||||
|
@ -89,12 +89,12 @@ public:
|
|||
|
||||
u32 operator[](size_t index) const { return at(index); }
|
||||
|
||||
const u32* code_points() const { return m_code_points; }
|
||||
u32 const* code_points() const { return m_code_points; }
|
||||
bool is_empty() const { return m_length == 0; }
|
||||
bool is_null() const { return !m_code_points; }
|
||||
size_t length() const { return m_length; }
|
||||
|
||||
size_t iterator_offset(const Utf32CodePointIterator& it) const
|
||||
size_t iterator_offset(Utf32CodePointIterator const& it) const
|
||||
{
|
||||
VERIFY(it.m_ptr >= m_code_points);
|
||||
VERIFY(it.m_ptr < m_code_points + m_length);
|
||||
|
@ -110,16 +110,16 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const u32* begin_ptr() const
|
||||
u32 const* begin_ptr() const
|
||||
{
|
||||
return m_code_points;
|
||||
}
|
||||
const u32* end_ptr() const
|
||||
u32 const* end_ptr() const
|
||||
{
|
||||
return m_code_points + m_length;
|
||||
}
|
||||
|
||||
const u32* m_code_points { nullptr };
|
||||
u32 const* m_code_points { nullptr };
|
||||
size_t m_length { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Utf8CodePointIterator Utf8View::iterator_at_byte_offset(size_t byte_offset) cons
|
|||
return end();
|
||||
}
|
||||
|
||||
size_t Utf8View::byte_offset_of(const Utf8CodePointIterator& it) const
|
||||
size_t Utf8View::byte_offset_of(Utf8CodePointIterator const& it) const
|
||||
{
|
||||
VERIFY(it.m_ptr >= begin_ptr());
|
||||
VERIFY(it.m_ptr <= end_ptr());
|
||||
|
@ -129,7 +129,7 @@ size_t Utf8View::calculate_length() const
|
|||
return length;
|
||||
}
|
||||
|
||||
bool Utf8View::starts_with(const Utf8View& start) const
|
||||
bool Utf8View::starts_with(Utf8View const& start) const
|
||||
{
|
||||
if (start.is_empty())
|
||||
return true;
|
||||
|
@ -156,7 +156,7 @@ bool Utf8View::contains(u32 needle) const
|
|||
return false;
|
||||
}
|
||||
|
||||
Utf8View Utf8View::trim(const Utf8View& characters, TrimMode mode) const
|
||||
Utf8View Utf8View::trim(Utf8View const& characters, TrimMode mode) const
|
||||
{
|
||||
size_t substring_start = 0;
|
||||
size_t substring_length = byte_length();
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
// NOTE: This returns {} if the peek is at or past EOF.
|
||||
Optional<u32> peek(size_t offset = 0) const;
|
||||
|
||||
ssize_t operator-(const Utf8CodePointIterator& other) const
|
||||
ssize_t operator-(Utf8CodePointIterator const& other) const
|
||||
{
|
||||
return m_ptr - other.m_ptr;
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ public:
|
|||
Utf8CodePointIterator end() const { return { end_ptr(), 0 }; }
|
||||
Utf8CodePointIterator iterator_at_byte_offset(size_t) const;
|
||||
|
||||
const unsigned char* bytes() const { return begin_ptr(); }
|
||||
unsigned char const* bytes() const { return begin_ptr(); }
|
||||
size_t byte_length() const { return m_string.length(); }
|
||||
size_t byte_offset_of(const Utf8CodePointIterator&) const;
|
||||
size_t byte_offset_of(Utf8CodePointIterator const&) const;
|
||||
size_t byte_offset_of(size_t code_point_offset) const;
|
||||
|
||||
Utf8View substring_view(size_t byte_offset, size_t byte_length) const { return Utf8View { m_string.substring_view(byte_offset, byte_length) }; }
|
||||
|
@ -92,12 +92,12 @@ public:
|
|||
|
||||
bool is_empty() const { return m_string.is_empty(); }
|
||||
bool is_null() const { return m_string.is_null(); }
|
||||
bool starts_with(const Utf8View&) const;
|
||||
bool starts_with(Utf8View const&) const;
|
||||
bool contains(u32) const;
|
||||
|
||||
Utf8View trim(const Utf8View& characters, TrimMode mode = TrimMode::Both) const;
|
||||
Utf8View trim(Utf8View const& characters, TrimMode mode = TrimMode::Both) const;
|
||||
|
||||
size_t iterator_offset(const Utf8CodePointIterator& it) const
|
||||
size_t iterator_offset(Utf8CodePointIterator const& it) const
|
||||
{
|
||||
return byte_offset_of(it);
|
||||
}
|
||||
|
|
22
AK/Variant.h
22
AK/Variant.h
|
@ -62,7 +62,7 @@ struct Variant<IndexType, InitialIndex, F, Ts...> {
|
|||
Variant<IndexType, InitialIndex + 1, Ts...>::move_(old_id, old_data, new_data);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void copy_(IndexType old_id, const void* old_data, void* new_data)
|
||||
ALWAYS_INLINE static void copy_(IndexType old_id, void const* old_data, void* new_data)
|
||||
{
|
||||
if (old_id == current_index)
|
||||
new (new_data) F(*bit_cast<F const*>(old_data));
|
||||
|
@ -75,7 +75,7 @@ template<typename IndexType, IndexType InitialIndex>
|
|||
struct Variant<IndexType, InitialIndex> {
|
||||
ALWAYS_INLINE static void delete_(IndexType, void*) { }
|
||||
ALWAYS_INLINE static void move_(IndexType, void*, void*) { }
|
||||
ALWAYS_INLINE static void copy_(IndexType, const void*, void*) { }
|
||||
ALWAYS_INLINE static void copy_(IndexType, void const*, void*) { }
|
||||
};
|
||||
|
||||
template<typename IndexType, typename... Ts>
|
||||
|
@ -97,7 +97,7 @@ struct VisitImpl {
|
|||
}
|
||||
|
||||
template<typename Self, typename Visitor, IndexType CurrentIndex = 0>
|
||||
ALWAYS_INLINE static constexpr decltype(auto) visit(Self& self, IndexType id, const void* data, Visitor&& visitor) requires(CurrentIndex < sizeof...(Ts))
|
||||
ALWAYS_INLINE static constexpr decltype(auto) visit(Self& self, IndexType id, void const* data, Visitor&& visitor) requires(CurrentIndex < sizeof...(Ts))
|
||||
{
|
||||
using T = typename TypeList<Ts...>::template Type<CurrentIndex>;
|
||||
|
||||
|
@ -239,7 +239,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename... NewTs>
|
||||
Variant(const Variant<NewTs...>& old) requires((can_contain<NewTs>() && ...))
|
||||
Variant(Variant<NewTs...> const& old) requires((can_contain<NewTs>() && ...))
|
||||
: Variant(old.template downcast<Ts...>())
|
||||
{
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ public:
|
|||
}
|
||||
|
||||
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
|
||||
Variant(const Variant&) requires(!(IsCopyConstructible<Ts> && ...)) = delete;
|
||||
Variant(const Variant&) = default;
|
||||
Variant(Variant const&) requires(!(IsCopyConstructible<Ts> && ...)) = delete;
|
||||
Variant(Variant const&) = default;
|
||||
|
||||
Variant(Variant&&) requires(!(IsMoveConstructible<Ts> && ...)) = delete;
|
||||
Variant(Variant&&) = default;
|
||||
|
@ -263,14 +263,14 @@ public:
|
|||
~Variant() requires(!(IsDestructible<Ts> && ...)) = delete;
|
||||
~Variant() = default;
|
||||
|
||||
Variant& operator=(const Variant&) requires(!(IsCopyConstructible<Ts> && ...) || !(IsDestructible<Ts> && ...)) = delete;
|
||||
Variant& operator=(const Variant&) = default;
|
||||
Variant& operator=(Variant const&) requires(!(IsCopyConstructible<Ts> && ...) || !(IsDestructible<Ts> && ...)) = delete;
|
||||
Variant& operator=(Variant const&) = default;
|
||||
|
||||
Variant& operator=(Variant&&) requires(!(IsMoveConstructible<Ts> && ...) || !(IsDestructible<Ts> && ...)) = delete;
|
||||
Variant& operator=(Variant&&) = default;
|
||||
#endif
|
||||
|
||||
ALWAYS_INLINE Variant(const Variant& old)
|
||||
ALWAYS_INLINE Variant(Variant const& old)
|
||||
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
|
||||
requires(!(IsTriviallyCopyConstructible<Ts> && ...))
|
||||
#endif
|
||||
|
@ -303,7 +303,7 @@ public:
|
|||
Helper::delete_(m_index, m_data);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Variant& operator=(const Variant& other)
|
||||
ALWAYS_INLINE Variant& operator=(Variant const& other)
|
||||
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
|
||||
requires(!(IsTriviallyCopyConstructible<Ts> && ...) || !(IsTriviallyDestructible<Ts> && ...))
|
||||
#endif
|
||||
|
@ -418,7 +418,7 @@ public:
|
|||
Variant<NewTs...> downcast() const&
|
||||
{
|
||||
Variant<NewTs...> instance { Variant<NewTs...>::invalid_index, Detail::VariantConstructTag {} };
|
||||
visit([&](const auto& value) {
|
||||
visit([&](auto const& value) {
|
||||
if constexpr (Variant<NewTs...>::template can_contain<RemoveCVReference<decltype(value)>>())
|
||||
instance.set(value, Detail::VariantNoClearTag {});
|
||||
});
|
||||
|
|
12
AK/WeakPtr.h
12
AK/WeakPtr.h
|
@ -23,7 +23,7 @@ public:
|
|||
WeakPtr() = default;
|
||||
|
||||
template<typename U>
|
||||
WeakPtr(const WeakPtr<U>& other) requires(IsBaseOf<T, U>)
|
||||
WeakPtr(WeakPtr<U> const& other) requires(IsBaseOf<T, U>)
|
||||
: m_link(other.m_link)
|
||||
{
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
WeakPtr& operator=(const WeakPtr<U>& other) requires(IsBaseOf<T, U>)
|
||||
WeakPtr& operator=(WeakPtr<U> const& other) requires(IsBaseOf<T, U>)
|
||||
{
|
||||
if ((const void*)this != (const void*)&other)
|
||||
if ((void const*)this != (void const*)&other)
|
||||
m_link = other.m_link;
|
||||
return *this;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
WeakPtr& operator=(const RefPtr<U>& object) requires(IsBaseOf<T, U>)
|
||||
WeakPtr& operator=(RefPtr<U> const& object) requires(IsBaseOf<T, U>)
|
||||
{
|
||||
if (object)
|
||||
m_link = object->template make_weak_ptr<U>().take_link();
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
WeakPtr& operator=(const NonnullRefPtr<U>& object) requires(IsBaseOf<T, U>)
|
||||
WeakPtr& operator=(NonnullRefPtr<U> const& object) requires(IsBaseOf<T, U>)
|
||||
{
|
||||
m_link = object->template make_weak_ptr<U>().take_link();
|
||||
return *this;
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
[[nodiscard]] RefPtr<WeakLink> take_link() { return move(m_link); }
|
||||
|
||||
private:
|
||||
WeakPtr(const RefPtr<WeakLink>& link)
|
||||
WeakPtr(RefPtr<WeakLink> const& link)
|
||||
: m_link(link)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ void* operator new(size_t size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void* operator new(size_t size, const std::nothrow_t&) noexcept
|
||||
void* operator new(size_t size, std::nothrow_t const&) noexcept
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void* operator new[](size_t size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void* operator new[](size_t size, const std::nothrow_t&) noexcept
|
||||
void* operator new[](size_t size, std::nothrow_t const&) noexcept
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
|
10
AK/kstdio.h
10
AK/kstdio.h
|
@ -13,20 +13,20 @@
|
|||
# include <AK/Types.h>
|
||||
# include <stdarg.h>
|
||||
extern "C" {
|
||||
void dbgputstr(const char*, size_t);
|
||||
int sprintf(char* buf, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
void dbgputstr(char const*, size_t);
|
||||
int sprintf(char* buf, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
# include <stdio.h>
|
||||
inline void dbgputstr(const char* characters, size_t length)
|
||||
inline void dbgputstr(char const* characters, size_t length)
|
||||
{
|
||||
fwrite(characters, 1, length, stderr);
|
||||
}
|
||||
#endif
|
||||
template<size_t N>
|
||||
inline void dbgputstr(const char (&array)[N])
|
||||
inline void dbgputstr(char const (&array)[N])
|
||||
{
|
||||
return ::dbgputstr(array, N);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ struct [[gnu::packed]] InodeWatcherEvent {
|
|||
Type type { Type::Invalid };
|
||||
size_t name_length { 0 };
|
||||
// This is a VLA which is written during the read() from the descriptor.
|
||||
const char name[];
|
||||
char const name[];
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(InodeWatcherEvent::Type);
|
||||
|
|
|
@ -125,7 +125,7 @@ enum KeyCode : u8 {
|
|||
Key_Shift
|
||||
= Key_LeftShift,
|
||||
};
|
||||
const int key_code_count = Key_Menu;
|
||||
int const key_code_count = Key_Menu;
|
||||
|
||||
enum KeyModifier {
|
||||
Mod_None = 0x00,
|
||||
|
@ -155,7 +155,7 @@ struct KeyEvent {
|
|||
bool is_press() const { return flags & Is_Press; }
|
||||
};
|
||||
|
||||
inline const char* key_code_to_string(KeyCode key)
|
||||
inline char const* key_code_to_string(KeyCode key)
|
||||
{
|
||||
switch (key) {
|
||||
#define __ENUMERATE_KEY_CODE(name, ui_name) \
|
||||
|
|
|
@ -218,7 +218,7 @@ constexpr StringView to_string(Function function)
|
|||
|
||||
#ifdef __serenity__
|
||||
struct StringArgument {
|
||||
const char* characters;
|
||||
char const* characters;
|
||||
size_t length { 0 };
|
||||
};
|
||||
|
||||
|
@ -262,7 +262,7 @@ struct SC_poll_params {
|
|||
struct pollfd* fds;
|
||||
unsigned nfds;
|
||||
const struct timespec* timeout;
|
||||
const u32* sigmask;
|
||||
u32 const* sigmask;
|
||||
};
|
||||
|
||||
struct SC_clock_nanosleep_params {
|
||||
|
@ -288,7 +288,7 @@ struct SC_getsockopt_params {
|
|||
};
|
||||
|
||||
struct SC_setsockopt_params {
|
||||
const void* value;
|
||||
void const* value;
|
||||
int sockfd;
|
||||
int level;
|
||||
int option;
|
||||
|
@ -319,7 +319,7 @@ struct SC_futex_params {
|
|||
int futex_op;
|
||||
u32 val;
|
||||
union {
|
||||
const timespec* timeout;
|
||||
timespec const* timeout;
|
||||
uintptr_t val2;
|
||||
};
|
||||
u32* userspace_address2;
|
||||
|
@ -327,11 +327,11 @@ struct SC_futex_params {
|
|||
};
|
||||
|
||||
struct SC_setkeymap_params {
|
||||
const u32* map;
|
||||
const u32* shift_map;
|
||||
const u32* alt_map;
|
||||
const u32* altgr_map;
|
||||
const u32* shift_altgr_map;
|
||||
u32 const* map;
|
||||
u32 const* shift_map;
|
||||
u32 const* alt_map;
|
||||
u32 const* altgr_map;
|
||||
u32 const* shift_altgr_map;
|
||||
StringArgument map_name;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ struct VirGL3DResourceSpec {
|
|||
};
|
||||
|
||||
struct VirGLCommandBuffer {
|
||||
const u32* data;
|
||||
u32 const* data;
|
||||
u32 num_elems;
|
||||
};
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ void __asan_handle_no_return(void)
|
|||
{
|
||||
}
|
||||
|
||||
void __asan_before_dynamic_init(const char*);
|
||||
void __asan_before_dynamic_init(const char* /* module_name */)
|
||||
void __asan_before_dynamic_init(char const*);
|
||||
void __asan_before_dynamic_init(char const* /* module_name */)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ struct ProcessorMessage {
|
|||
} flush_tlb;
|
||||
};
|
||||
|
||||
volatile bool async;
|
||||
bool volatile async;
|
||||
|
||||
ProcessorMessageEntry* per_proc_entries;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Prekernel {
|
|||
void drop_to_exception_level_1();
|
||||
void init_prekernel_page_tables();
|
||||
|
||||
[[noreturn]] void panic(const char* msg);
|
||||
[[noreturn]] void panic(char const* msg);
|
||||
|
||||
[[noreturn]] void halt();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Prekernel {
|
||||
|
||||
[[noreturn]] void panic(const char* msg)
|
||||
[[noreturn]] void panic(char const* msg)
|
||||
{
|
||||
auto& uart = Prekernel::UART::the();
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
const u64* m_start;
|
||||
const u64* m_end;
|
||||
u64 const* m_start;
|
||||
u64 const* m_end;
|
||||
u64* m_current;
|
||||
};
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ static void activate_mmu()
|
|||
|
||||
// Enable MMU in the system control register
|
||||
Aarch64::SCTLR_EL1 sctlr_el1 = Aarch64::SCTLR_EL1::read();
|
||||
sctlr_el1.M = 1; //Enable MMU
|
||||
sctlr_el1.M = 1; // Enable MMU
|
||||
Aarch64::SCTLR_EL1::write(sctlr_el1);
|
||||
|
||||
Aarch64::Asm::flush();
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace Kernel {
|
|||
|
||||
class Thread;
|
||||
|
||||
//FIXME This needs to go behind some sort of platform abstraction
|
||||
// it is used between Thread and Processor.
|
||||
// FIXME This needs to go behind some sort of platform abstraction
|
||||
// it is used between Thread and Processor.
|
||||
struct [[gnu::aligned(16)]] FPUState
|
||||
{
|
||||
u8 buffer[512];
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
void send(u32 c);
|
||||
u32 receive();
|
||||
|
||||
void print_str(const char* s)
|
||||
void print_str(char const* s)
|
||||
{
|
||||
while (*s)
|
||||
send(*s++);
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
void print_hex(u64 n)
|
||||
{
|
||||
char buf[17];
|
||||
static const char* digits = "0123456789ABCDEF";
|
||||
static char const* digits = "0123456789ABCDEF";
|
||||
int i = 0;
|
||||
do {
|
||||
buf[i++] = digits[n % 16];
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
#include <Kernel/Arch/aarch64/UART.h>
|
||||
#include <Kernel/Arch/aarch64/Utils.h>
|
||||
|
||||
void Prekernel::dbgln(const char* text)
|
||||
void Prekernel::dbgln(char const* text)
|
||||
{
|
||||
auto& uart = Prekernel::UART::the();
|
||||
uart.print_str(text);
|
||||
uart.print_str("\r\n");
|
||||
}
|
||||
|
||||
void Prekernel::warnln(const char* text)
|
||||
void Prekernel::warnln(char const* text)
|
||||
{
|
||||
dbgln(text);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace Prekernel {
|
||||
|
||||
// FIXME: to be replaced by real implementation from AK/Format.h
|
||||
void dbgln(const char* text);
|
||||
void warnln(const char* text);
|
||||
void dbgln(char const* text);
|
||||
void warnln(char const* text);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ void dummy();
|
|||
void dummy() { }
|
||||
|
||||
// Assertions.h
|
||||
[[noreturn]] void __assertion_failed(const char*, const char*, unsigned, const char*);
|
||||
[[noreturn]] void __assertion_failed(char const*, char const*, unsigned, char const*);
|
||||
|
||||
[[noreturn]] void __assertion_failed(const char*, const char*, unsigned, const char*)
|
||||
[[noreturn]] void __assertion_failed(char const*, char const*, unsigned, char const*)
|
||||
{
|
||||
for (;;) { }
|
||||
}
|
||||
|
@ -58,20 +58,20 @@ ssize_t safe_strnlen(char const*, unsigned long, void*&) { return 0; }
|
|||
bool safe_memcpy(void*, void const*, unsigned long, void*&);
|
||||
bool safe_memcpy(void*, void const*, unsigned long, void*&) { return false; }
|
||||
|
||||
Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32*, u32&, u32);
|
||||
Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32*, u32&, u32) { return {}; }
|
||||
Optional<bool> safe_atomic_compare_exchange_relaxed(u32 volatile*, u32&, u32);
|
||||
Optional<bool> safe_atomic_compare_exchange_relaxed(u32 volatile*, u32&, u32) { return {}; }
|
||||
|
||||
Optional<u32> safe_atomic_load_relaxed(volatile u32*);
|
||||
Optional<u32> safe_atomic_load_relaxed(volatile u32*) { return {}; }
|
||||
Optional<u32> safe_atomic_load_relaxed(u32 volatile*);
|
||||
Optional<u32> safe_atomic_load_relaxed(u32 volatile*) { return {}; }
|
||||
|
||||
Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32*, u32);
|
||||
Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32*, u32) { return {}; }
|
||||
Optional<u32> safe_atomic_fetch_add_relaxed(u32 volatile*, u32);
|
||||
Optional<u32> safe_atomic_fetch_add_relaxed(u32 volatile*, u32) { return {}; }
|
||||
|
||||
Optional<u32> safe_atomic_exchange_relaxed(volatile u32*, u32);
|
||||
Optional<u32> safe_atomic_exchange_relaxed(volatile u32*, u32) { return {}; }
|
||||
Optional<u32> safe_atomic_exchange_relaxed(u32 volatile*, u32);
|
||||
Optional<u32> safe_atomic_exchange_relaxed(u32 volatile*, u32) { return {}; }
|
||||
|
||||
bool safe_atomic_store_relaxed(volatile u32*, u32);
|
||||
bool safe_atomic_store_relaxed(volatile u32*, u32) { return {}; }
|
||||
bool safe_atomic_store_relaxed(u32 volatile*, u32);
|
||||
bool safe_atomic_store_relaxed(u32 volatile*, u32) { return {}; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,12 @@ extern "C" {
|
|||
|
||||
FlatPtr kernel_mapping_base;
|
||||
|
||||
void kernelputstr(const char*, size_t);
|
||||
void kernelputstr(const char*, size_t) { }
|
||||
void kernelputstr(char const*, size_t);
|
||||
void kernelputstr(char const*, size_t) { }
|
||||
|
||||
void kernelcriticalputstr(const char*, size_t);
|
||||
void kernelcriticalputstr(const char*, size_t) { }
|
||||
void kernelcriticalputstr(char const*, size_t);
|
||||
void kernelcriticalputstr(char const*, size_t) { }
|
||||
|
||||
void kernelearlyputstr(const char*, size_t);
|
||||
void kernelearlyputstr(const char*, size_t) { }
|
||||
void kernelearlyputstr(char const*, size_t);
|
||||
void kernelearlyputstr(char const*, size_t) { }
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ extern "C" const u32 serenity_boot_logo_size;
|
|||
|
||||
static void draw_logo()
|
||||
{
|
||||
Prekernel::BootPPMParser logo_parser(reinterpret_cast<const u8*>(&serenity_boot_logo_start), serenity_boot_logo_size);
|
||||
Prekernel::BootPPMParser logo_parser(reinterpret_cast<u8 const*>(&serenity_boot_logo_start), serenity_boot_logo_size);
|
||||
if (!logo_parser.parse()) {
|
||||
Prekernel::warnln("Invalid boot logo.");
|
||||
return;
|
||||
|
|
|
@ -33,8 +33,8 @@ inline u32 get_iopl_from_eflags(u32 eflags)
|
|||
return (eflags & iopl_mask) >> 12;
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& get_gdtr();
|
||||
const DescriptorTablePointer& get_idtr();
|
||||
DescriptorTablePointer const& get_gdtr();
|
||||
DescriptorTablePointer const& get_idtr();
|
||||
|
||||
void handle_crash(RegisterState const&, char const* description, int signal, bool out_of_memory = false);
|
||||
|
||||
|
@ -48,7 +48,7 @@ constexpr FlatPtr page_base_of(FlatPtr address)
|
|||
return address & PAGE_MASK;
|
||||
}
|
||||
|
||||
inline FlatPtr page_base_of(const void* address)
|
||||
inline FlatPtr page_base_of(void const* address)
|
||||
{
|
||||
return page_base_of((FlatPtr)address);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ constexpr FlatPtr offset_in_page(FlatPtr address)
|
|||
return address & (~PAGE_MASK);
|
||||
}
|
||||
|
||||
inline FlatPtr offset_in_page(const void* address)
|
||||
inline FlatPtr offset_in_page(void const* address)
|
||||
{
|
||||
return offset_in_page((FlatPtr)address);
|
||||
}
|
||||
|
|
|
@ -133,12 +133,12 @@ public:
|
|||
|
||||
bool is_null() const { return m_address == 0; }
|
||||
|
||||
bool operator==(const IOAddress& other) const { return m_address == other.m_address; }
|
||||
bool operator!=(const IOAddress& other) const { return m_address != other.m_address; }
|
||||
bool operator>(const IOAddress& other) const { return m_address > other.m_address; }
|
||||
bool operator>=(const IOAddress& other) const { return m_address >= other.m_address; }
|
||||
bool operator<(const IOAddress& other) const { return m_address < other.m_address; }
|
||||
bool operator<=(const IOAddress& other) const { return m_address <= other.m_address; }
|
||||
bool operator==(IOAddress const& other) const { return m_address == other.m_address; }
|
||||
bool operator!=(IOAddress const& other) const { return m_address != other.m_address; }
|
||||
bool operator>(IOAddress const& other) const { return m_address > other.m_address; }
|
||||
bool operator>=(IOAddress const& other) const { return m_address >= other.m_address; }
|
||||
bool operator<(IOAddress const& other) const { return m_address < other.m_address; }
|
||||
bool operator<=(IOAddress const& other) const { return m_address <= other.m_address; }
|
||||
|
||||
private:
|
||||
u16 m_address { 0 };
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void clear() { m_raw = 0; }
|
||||
|
||||
u64 raw() const { return m_raw; }
|
||||
void copy_from(Badge<Memory::PageDirectory>, const PageDirectoryEntry& other) { m_raw = other.m_raw; }
|
||||
void copy_from(Badge<Memory::PageDirectory>, PageDirectoryEntry const& other) { m_raw = other.m_raw; }
|
||||
|
||||
enum Flags {
|
||||
Present = 1 << 0,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue