mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
Everywhere: Use east const in more places
These changes are compatible with clang-format 16 and will be mandatory when we eventually bump clang-format version. So, since there are no real downsides, let's commit them now.
This commit is contained in:
parent
5ef6df79ed
commit
5ed7cd6e32
Notes:
sideshowbarker
2024-07-16 23:38:54 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/5ed7cd6e32 Pull-request: https://github.com/SerenityOS/serenity/pull/24014
175 changed files with 353 additions and 353 deletions
|
@ -28,7 +28,7 @@ struct Array {
|
|||
constexpr static size_t size() { return Size; }
|
||||
constexpr T const& operator[](size_t index) const { return __data[index]; }
|
||||
constexpr T& operator[](size_t index) { return __data[index]; }
|
||||
using ConstIterator = SimpleIterator<const Array, T const>;
|
||||
using ConstIterator = SimpleIterator<Array const, T const>;
|
||||
using Iterator = SimpleIterator<Array, T>;
|
||||
|
||||
constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
private:
|
||||
friend class CircularQueue;
|
||||
ConstIterator(CircularQueue const& queue, const size_t index)
|
||||
ConstIterator(CircularQueue const& queue, size_t const index)
|
||||
: m_queue(queue)
|
||||
, m_index(index)
|
||||
{
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator*=(Complex<U> const& x)
|
||||
{
|
||||
const T real = m_real;
|
||||
T const real = m_real;
|
||||
m_real = real * x.real() - m_imag * x.imag();
|
||||
m_imag = real * x.imag() + m_imag * x.real();
|
||||
return *this;
|
||||
|
@ -122,8 +122,8 @@ public:
|
|||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr Complex<T> operator/=(Complex<U> const& x)
|
||||
{
|
||||
const T real = m_real;
|
||||
const T divisor = x.real() * x.real() + x.imag() * x.imag();
|
||||
T const real = m_real;
|
||||
T const divisor = x.real() * x.real() + x.imag() * x.imag();
|
||||
m_real = (real * x.real() + m_imag * x.imag()) / divisor;
|
||||
m_imag = (m_imag * x.real() - x.real() * x.imag()) / divisor;
|
||||
return *this;
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
Iterator begin() { return Iterator(m_head); }
|
||||
Iterator end() { return Iterator::universal_end(); }
|
||||
|
||||
using ConstIterator = DoublyLinkedListIterator<const DoublyLinkedList, T const>;
|
||||
using ConstIterator = DoublyLinkedListIterator<DoublyLinkedList const, T const>;
|
||||
friend ConstIterator;
|
||||
ConstIterator begin() const { return ConstIterator(m_head); }
|
||||
ConstIterator end() const { return ConstIterator::universal_end(); }
|
||||
|
|
|
@ -95,9 +95,9 @@ static_assert(AssertSize<FloatExtractor<f32>, sizeof(f32)>());
|
|||
template<size_t S, size_t E, size_t M>
|
||||
requires(S <= 1 && E >= 1 && M >= 1 && (S + E + M) <= 64) class FloatingPointBits final {
|
||||
public:
|
||||
static const size_t signbit = S;
|
||||
static const size_t exponentbits = E;
|
||||
static const size_t mantissabits = M;
|
||||
static size_t const signbit = S;
|
||||
static size_t const exponentbits = E;
|
||||
static size_t const mantissabits = M;
|
||||
|
||||
template<typename T>
|
||||
requires(IsIntegral<T> && IsUnsigned<T> && sizeof(T) <= 8) constexpr FloatingPointBits(T bits)
|
||||
|
|
|
@ -280,8 +280,8 @@ public:
|
|||
}
|
||||
|
||||
using ConstIterator = Conditional<IsOrdered,
|
||||
OrderedHashTableIterator<const HashTable, const T, BucketType const>,
|
||||
HashTableIterator<const HashTable, const T, BucketType const>>;
|
||||
OrderedHashTableIterator<HashTable const, T const, BucketType const>,
|
||||
HashTableIterator<HashTable const, T const, BucketType const>>;
|
||||
|
||||
[[nodiscard]] ConstIterator begin() const
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ ErrorOr<ByteBuffer> decode_hex(StringView input)
|
|||
}
|
||||
|
||||
#ifdef KERNEL
|
||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> encode_hex(const ReadonlyBytes input)
|
||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> encode_hex(ReadonlyBytes const input)
|
||||
{
|
||||
StringBuilder output(input.size() * 2);
|
||||
|
||||
|
@ -45,7 +45,7 @@ ErrorOr<NonnullOwnPtr<Kernel::KString>> encode_hex(const ReadonlyBytes input)
|
|||
return Kernel::KString::try_create(output.string_view());
|
||||
}
|
||||
#else
|
||||
ByteString encode_hex(const ReadonlyBytes input)
|
||||
ByteString encode_hex(ReadonlyBytes const input)
|
||||
{
|
||||
StringBuilder output(input.size() * 2);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
m_data = (d << 24) | (c << 16) | (b << 8) | a;
|
||||
}
|
||||
|
||||
constexpr IPv4Address(const u8 data[4])
|
||||
constexpr IPv4Address(u8 const data[4])
|
||||
{
|
||||
m_data = (u32(data[3]) << 24) | (u32(data[2]) << 16) | (u32(data[1]) << 8) | u32(data[0]);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
constexpr u32 octet(const SubnetClass subnet) const
|
||||
constexpr u32 octet(SubnetClass const subnet) const
|
||||
{
|
||||
constexpr auto bits_per_byte = 8;
|
||||
auto const bits_to_shift = bits_per_byte * int(subnet);
|
||||
|
|
|
@ -17,7 +17,7 @@ u32 get_random_uniform(u32 max_bounds)
|
|||
// `arc4random() % max_bounds` would be insufficient. Here we compute the last number of the
|
||||
// last "full group". Note that if max_bounds is a divisor of UINT32_MAX,
|
||||
// then we end up with UINT32_MAX:
|
||||
const u32 max_usable = UINT32_MAX - (static_cast<u64>(UINT32_MAX) + 1) % max_bounds;
|
||||
u32 const max_usable = UINT32_MAX - (static_cast<u64>(UINT32_MAX) + 1) % max_bounds;
|
||||
auto random_value = get_random<u32>();
|
||||
for (int i = 0; i < 20 && random_value > max_usable; ++i) {
|
||||
// By chance we picked a value from the incomplete group. Note that this group has size at
|
||||
|
@ -34,7 +34,7 @@ u64 get_random_uniform_64(u64 max_bounds)
|
|||
{
|
||||
// Uses the same algorithm as `get_random_uniform`,
|
||||
// by replacing u64 with u128 and u32 with u64.
|
||||
const u64 max_usable = UINT64_MAX - static_cast<u64>((static_cast<u128>(UINT64_MAX) + 1) % max_bounds);
|
||||
u64 const max_usable = UINT64_MAX - static_cast<u64>((static_cast<u128>(UINT64_MAX) + 1) % max_bounds);
|
||||
auto random_value = get_random<u64>();
|
||||
for (int i = 0; i < 20 && random_value > max_usable; ++i) {
|
||||
random_value = get_random<u64>();
|
||||
|
|
|
@ -505,7 +505,7 @@ public:
|
|||
Iterator end() { return {}; }
|
||||
Iterator begin_from(K key) { return Iterator(static_cast<Node*>(BaseTree::find(this->m_root, key))); }
|
||||
|
||||
using ConstIterator = RedBlackTreeIterator<const RedBlackTree, V const>;
|
||||
using ConstIterator = RedBlackTreeIterator<RedBlackTree const, V const>;
|
||||
friend ConstIterator;
|
||||
ConstIterator begin() const { return ConstIterator(static_cast<Node*>(this->m_minimum)); }
|
||||
ConstIterator end() const { return {}; }
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
Iterator begin() { return Iterator(m_head); }
|
||||
Iterator end() { return {}; }
|
||||
|
||||
using ConstIterator = SinglyLinkedListIterator<const SinglyLinkedList, T const>;
|
||||
using ConstIterator = SinglyLinkedListIterator<SinglyLinkedList const, T const>;
|
||||
friend ConstIterator;
|
||||
ConstIterator begin() const { return ConstIterator(m_head); }
|
||||
ConstIterator end() const { return {}; }
|
||||
|
|
12
AK/Trie.h
12
AK/Trie.h
|
@ -183,13 +183,13 @@ public:
|
|||
TRY(state.try_empend(false, m_children.begin(), m_children.end()));
|
||||
|
||||
auto invoke = [&](auto& current_node) -> ErrorOr<IterationDecision> {
|
||||
if constexpr (VoidFunction<Fn, const BaseType&>) {
|
||||
callback(static_cast<const BaseType&>(current_node));
|
||||
if constexpr (VoidFunction<Fn, BaseType const&>) {
|
||||
callback(static_cast<BaseType const&>(current_node));
|
||||
return IterationDecision::Continue;
|
||||
} else if constexpr (IsSpecializationOf<decltype(callback(declval<const BaseType&>())), ErrorOr>) {
|
||||
return callback(static_cast<const BaseType&>(current_node));
|
||||
} else if constexpr (IteratorFunction<Fn, const BaseType&>) {
|
||||
return callback(static_cast<const BaseType&>(current_node));
|
||||
} else if constexpr (IsSpecializationOf<decltype(callback(declval<BaseType const&>())), ErrorOr>) {
|
||||
return callback(static_cast<BaseType const&>(current_node));
|
||||
} else if constexpr (IteratorFunction<Fn, BaseType const&>) {
|
||||
return callback(static_cast<BaseType const&>(current_node));
|
||||
} else {
|
||||
static_assert(DependentFalse<Fn>, "Invalid iterator function type signature");
|
||||
}
|
||||
|
|
|
@ -180,12 +180,12 @@ static_assert(explode_byte(0x80) == static_cast<FlatPtr>(0x8080808080808080ull))
|
|||
static_assert(explode_byte(0x7f) == static_cast<FlatPtr>(0x7f7f7f7f7f7f7f7full));
|
||||
static_assert(explode_byte(0) == 0);
|
||||
|
||||
constexpr size_t align_up_to(const size_t value, const size_t alignment)
|
||||
constexpr size_t align_up_to(size_t const value, size_t const alignment)
|
||||
{
|
||||
return (value + (alignment - 1)) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
constexpr size_t align_down_to(const size_t value, const size_t alignment)
|
||||
constexpr size_t align_down_to(size_t const value, size_t const alignment)
|
||||
{
|
||||
return value & ~(alignment - 1);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
}
|
||||
|
||||
template<UFixedInt T, size_t n>
|
||||
requires((assumed_bit_size<T> * n) <= bit_size) constexpr UFixedBigInt(const T (&value)[n])
|
||||
requires((assumed_bit_size<T> * n) <= bit_size) constexpr UFixedBigInt(T const (&value)[n])
|
||||
{
|
||||
size_t offset = 0;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ void operator delete[](void* ptr, size_t) noexcept
|
|||
// This is usually provided by libstdc++ in most cases, and the kernel has its own definition in
|
||||
// Kernel/Heap/kmalloc.cpp. If neither of those apply, the following should suffice to not fail during linking.
|
||||
namespace AK_REPLACED_STD_NAMESPACE {
|
||||
const nothrow_t nothrow;
|
||||
nothrow_t const nothrow;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,9 +22,9 @@ inline bool time_page_supports(clockid_t clock_id)
|
|||
}
|
||||
|
||||
struct TimePage {
|
||||
volatile u32 update1;
|
||||
u32 volatile update1;
|
||||
struct timespec clocks[CLOCK_ID_COUNT];
|
||||
volatile u32 update2;
|
||||
u32 volatile update2;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
|
||||
#include <AK/Types.h>
|
||||
|
||||
typedef volatile u64 kcov_pc_t;
|
||||
typedef u64 volatile kcov_pc_t;
|
||||
#define KCOV_ENTRY_SIZE sizeof(kcov_pc_t)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
static const cc_t ttydefchars[NCCS] = {
|
||||
static cc_t const ttydefchars[NCCS] = {
|
||||
[VINTR] = CINTR,
|
||||
[VQUIT] = CQUIT,
|
||||
[VERASE] = CERASE,
|
||||
|
|
|
@ -192,7 +192,7 @@ private:
|
|||
// FIXME: On aarch64, once there is code in place to differentiate IRQs from synchronous exceptions (syscalls),
|
||||
// this member should be incremented. Also this member shouldn't be a FlatPtr.
|
||||
FlatPtr m_in_irq { 0 };
|
||||
volatile u32 m_in_critical;
|
||||
u32 volatile m_in_critical;
|
||||
// NOTE: Since these variables are accessed with atomic magic on x86 (through GP with a single load instruction),
|
||||
// they need to be FlatPtrs or everything becomes highly unsound and breaks. They are actually just booleans.
|
||||
FlatPtr m_in_scheduler;
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
~SmapDisabler();
|
||||
|
||||
private:
|
||||
const FlatPtr m_flags;
|
||||
FlatPtr const m_flags;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static void wait_for_reply(MMIO& mmio)
|
|||
bool Mailbox::send_queue(void* queue, u32 queue_size) const
|
||||
{
|
||||
// According to Raspberry Pi specs this is the only channel implemented.
|
||||
const u32 channel = ARM_TO_VIDEOCORE_CHANNEL;
|
||||
u32 const channel = ARM_TO_VIDEOCORE_CHANNEL;
|
||||
|
||||
auto message_header = reinterpret_cast<MessageHeader*>(queue);
|
||||
message_header->set_queue_size(queue_size);
|
||||
|
|
|
@ -105,7 +105,7 @@ ErrorOr<size_t> MiniUART::write(Kernel::OpenFileDescription& description, u64, K
|
|||
return EAGAIN;
|
||||
|
||||
return buffer.read_buffered<128>(size, [&](ReadonlyBytes bytes) {
|
||||
for (const auto& byte : bytes)
|
||||
for (auto const& byte : bytes)
|
||||
put_char(byte);
|
||||
return bytes.size();
|
||||
});
|
||||
|
|
|
@ -34,10 +34,10 @@ public:
|
|||
u16 flags() const { return m_flags; }
|
||||
|
||||
private:
|
||||
const u8 m_bus;
|
||||
const u8 m_source;
|
||||
const u32 m_global_system_interrupt;
|
||||
const u16 m_flags;
|
||||
u8 const m_bus;
|
||||
u8 const m_source;
|
||||
u32 const m_global_system_interrupt;
|
||||
u16 const m_flags;
|
||||
};
|
||||
|
||||
class InterruptManagement {
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Kernel {
|
||||
struct [[gnu::packed]] ioapic_mmio_regs {
|
||||
volatile u32 select;
|
||||
u32 volatile select;
|
||||
u32 reserved[3];
|
||||
volatile u32 window;
|
||||
u32 volatile window;
|
||||
};
|
||||
|
||||
class PCIInterruptOverrideMetadata {
|
||||
|
@ -28,13 +28,13 @@ public:
|
|||
u16 ioapic_interrupt_pin() const { return m_ioapic_interrupt_pin; }
|
||||
|
||||
private:
|
||||
const u8 m_bus_id;
|
||||
const u8 m_polarity;
|
||||
const u8 m_trigger_mode;
|
||||
const u8 m_pci_interrupt_pin;
|
||||
const u8 m_pci_device_number;
|
||||
const u32 m_ioapic_id;
|
||||
const u16 m_ioapic_interrupt_pin;
|
||||
u8 const m_bus_id;
|
||||
u8 const m_polarity;
|
||||
u8 const m_trigger_mode;
|
||||
u8 const m_pci_interrupt_pin;
|
||||
u8 const m_pci_device_number;
|
||||
u32 const m_ioapic_id;
|
||||
u16 const m_ioapic_interrupt_pin;
|
||||
};
|
||||
|
||||
class IOAPIC final : public IRQController {
|
||||
|
|
|
@ -44,10 +44,10 @@ UNMAP_AFTER_INIT bool APICTimer::calibrate(HardwareTimerBase& calibration_source
|
|||
size_t ticks_in_100ms { 0 };
|
||||
Atomic<size_t, AK::memory_order_relaxed> calibration_ticks { 0 };
|
||||
#ifdef APIC_TIMER_MEASURE_CPU_CLOCK
|
||||
volatile u64 start_tsc { 0 }, end_tsc { 0 };
|
||||
u64 volatile start_tsc { 0 }, end_tsc { 0 };
|
||||
#endif
|
||||
volatile u64 start_reference { 0 }, end_reference { 0 };
|
||||
volatile u32 start_apic_count { 0 }, end_apic_count { 0 };
|
||||
u64 volatile start_reference { 0 }, end_reference { 0 };
|
||||
u32 volatile start_apic_count { 0 }, end_apic_count { 0 };
|
||||
bool query_reference { false };
|
||||
} state;
|
||||
|
||||
|
|
|
@ -46,26 +46,26 @@ enum class TimerConfiguration : u32 {
|
|||
|
||||
struct [[gnu::packed]] HPETRegister {
|
||||
union {
|
||||
volatile u64 full;
|
||||
u64 volatile full;
|
||||
struct {
|
||||
volatile u32 low;
|
||||
volatile u32 high;
|
||||
u32 volatile low;
|
||||
u32 volatile high;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] TimerStructure {
|
||||
volatile u32 capabilities;
|
||||
volatile u32 interrupt_routing;
|
||||
u32 volatile capabilities;
|
||||
u32 volatile interrupt_routing;
|
||||
HPETRegister comparator_value;
|
||||
volatile u64 fsb_interrupt_route;
|
||||
u64 volatile fsb_interrupt_route;
|
||||
u64 reserved;
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] HPETCapabilityRegister {
|
||||
// Note: We must do a 32 bit access to offsets 0x0, or 0x4 only, according to HPET spec.
|
||||
volatile u32 attributes;
|
||||
volatile u32 main_counter_tick_period;
|
||||
u32 volatile attributes;
|
||||
u32 volatile main_counter_tick_period;
|
||||
u64 reserved;
|
||||
};
|
||||
|
||||
|
|
|
@ -337,9 +337,9 @@ public:
|
|||
void write32(size_t offset, u32 value) const;
|
||||
|
||||
private:
|
||||
const Address m_address;
|
||||
const CapabilityID m_id;
|
||||
const u8 m_ptr;
|
||||
Address const m_address;
|
||||
CapabilityID const m_id;
|
||||
u8 const m_ptr;
|
||||
};
|
||||
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, ClassCode);
|
||||
|
|
|
@ -202,21 +202,21 @@ struct OperationalRegisters {
|
|||
// 2.3.4 FRINDEX - Frame Index Register
|
||||
// Note: We use `volatile` to ensure 32 bit writes
|
||||
// Note: Only up to 14 bits are actually used, and the last 3 bits must never be `000` or `111`
|
||||
volatile u32 frame_index;
|
||||
u32 volatile frame_index;
|
||||
|
||||
// 2.3.5 CTRLDSSEGMENT - Control Data Structure Segment Register
|
||||
// Note: We use `volatile` to ensure 32 bit writes
|
||||
// Note: Upper 32 bits of periodic-frame- and asynchronous-list pointers
|
||||
volatile u32 segment_selector;
|
||||
u32 volatile segment_selector;
|
||||
|
||||
// 2.3.6 PERIODICLISTBASE - Periodic Frame List Base Address Register
|
||||
// Note: We use `volatile` to ensure 32 bit writes
|
||||
// Note: Page-aligned addresses only
|
||||
volatile u32 frame_list_base_address;
|
||||
u32 volatile frame_list_base_address;
|
||||
// 2.3.7 ASYNCLISTADDR - Current Asynchronous List Address Register
|
||||
// Note: We use `volatile` to ensure 32 bit writes
|
||||
// Note: 32 byte (cache-line) aligned addresses only
|
||||
volatile u32 next_asynchronous_list_address;
|
||||
u32 volatile next_asynchronous_list_address;
|
||||
|
||||
u32 _padding[9];
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ struct alignas(16) TransferDescriptor final {
|
|||
|
||||
private:
|
||||
u32 m_link_ptr; // Points to another Queue Head or Transfer Descriptor
|
||||
volatile u32 m_control_status; // Control and status field
|
||||
u32 volatile m_control_status; // Control and status field
|
||||
u32 m_token; // Contains all information required to fill in a USB Start Token
|
||||
u32 m_buffer_ptr; // Points to a data buffer for this transaction (i.e what we want to send or recv)
|
||||
|
||||
|
@ -367,7 +367,7 @@ struct alignas(16) QueueHead {
|
|||
|
||||
private:
|
||||
u32 m_link_ptr { 0 }; // Pointer to the next horizontal object that the controller will execute after this one
|
||||
volatile u32 m_element_link_ptr { 0 }; // Pointer to the first data object in the queue (can be modified by hw)
|
||||
u32 volatile m_element_link_ptr { 0 }; // Pointer to the first data object in the queue (can be modified by hw)
|
||||
|
||||
// This structure pointer will be ignored by the controller, but we can use it for configuration and bookkeeping
|
||||
QueueHeadBookkeeping* m_bookkeeping { nullptr };
|
||||
|
|
|
@ -87,8 +87,8 @@ private:
|
|||
QueueDeviceItem rings[];
|
||||
};
|
||||
|
||||
const u16 m_queue_size;
|
||||
const u16 m_notify_offset;
|
||||
u16 const m_queue_size;
|
||||
u16 const m_notify_offset;
|
||||
u16 m_free_buffers;
|
||||
u16 m_free_head { 0 };
|
||||
u16 m_used_tail { 0 };
|
||||
|
|
|
@ -34,6 +34,6 @@ private:
|
|||
virtual StringView class_name() const override { return "AudioChannel"sv; }
|
||||
|
||||
LockWeakPtr<AudioController> m_controller;
|
||||
const size_t m_channel_index;
|
||||
size_t const m_channel_index;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -85,11 +85,11 @@ public:
|
|||
|
||||
private:
|
||||
BlockDevice& m_block_device;
|
||||
const RequestType m_request_type;
|
||||
const u64 m_block_index;
|
||||
const u32 m_block_count;
|
||||
RequestType const m_request_type;
|
||||
u64 const m_block_index;
|
||||
u32 const m_block_count;
|
||||
UserOrKernelBuffer m_buffer;
|
||||
const size_t m_buffer_size;
|
||||
size_t const m_buffer_size;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -86,11 +86,11 @@ private:
|
|||
Array<OwnPtr<IntelDisplayTranscoder>, 5> m_transcoders;
|
||||
Array<OwnPtr<IntelDisplayPlane>, 3> m_planes;
|
||||
|
||||
const MMIORegion m_mmio_first_region;
|
||||
const MMIORegion m_mmio_second_region;
|
||||
MMIORegion const m_mmio_first_region;
|
||||
MMIORegion const m_mmio_second_region;
|
||||
MMIORegion const& m_assigned_mmio_registers_region;
|
||||
|
||||
const IntelGraphics::Generation m_generation;
|
||||
IntelGraphics::Generation const m_generation;
|
||||
NonnullOwnPtr<Memory::Region> m_registers_region;
|
||||
NonnullOwnPtr<GMBusConnector> m_gmbus_connector;
|
||||
};
|
||||
|
|
|
@ -21,6 +21,6 @@ public:
|
|||
virtual ErrorOr<void> enable(Badge<IntelDisplayConnectorGroup>) override;
|
||||
|
||||
private:
|
||||
explicit IntelG33DisplayPlane(Memory::TypedMapping<volatile IntelDisplayPlane::PlaneRegisters> plane_registers_mapping);
|
||||
explicit IntelG33DisplayPlane(Memory::TypedMapping<IntelDisplayPlane::PlaneRegisters volatile> plane_registers_mapping);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ ErrorOr<void> VirtIOGraphicsAdapter::ensure_backing_storage(Graphics::VirtIOGPU:
|
|||
|
||||
auto writer = create_scratchspace_writer();
|
||||
auto& request = writer.append_structure<Graphics::VirtIOGPU::Protocol::ResourceAttachBacking>();
|
||||
const size_t header_block_size = sizeof(request) + num_mem_regions * sizeof(Graphics::VirtIOGPU::Protocol::MemoryEntry);
|
||||
size_t const header_block_size = sizeof(request) + num_mem_regions * sizeof(Graphics::VirtIOGPU::Protocol::MemoryEntry);
|
||||
|
||||
populate_virtio_gpu_request_header(request.header, Graphics::VirtIOGPU::Protocol::CommandType::VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING, 0);
|
||||
request.resource_id = resource_id.value();
|
||||
|
|
|
@ -50,7 +50,7 @@ ErrorOr<size_t> ConsoleDevice::write(OpenFileDescription&, u64, Kernel::UserOrKe
|
|||
return 0;
|
||||
|
||||
return data.read_buffered<256>(size, [&](ReadonlyBytes readonly_bytes) {
|
||||
for (const auto& byte : readonly_bytes)
|
||||
for (auto const& byte : readonly_bytes)
|
||||
put_char(byte);
|
||||
return readonly_bytes.size();
|
||||
});
|
||||
|
|
|
@ -57,7 +57,7 @@ ErrorOr<size_t> SerialDevice::write(OpenFileDescription& description, u64, UserO
|
|||
return EAGAIN;
|
||||
|
||||
return buffer.read_buffered<128>(size, [&](ReadonlyBytes bytes) {
|
||||
for (const auto& byte : bytes)
|
||||
for (auto const& byte : bytes)
|
||||
put_char(byte);
|
||||
return bytes.size();
|
||||
});
|
||||
|
|
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
private:
|
||||
u32 volatile& m_bitfield;
|
||||
const u32 m_bit_mask;
|
||||
u32 const m_bit_mask;
|
||||
};
|
||||
|
||||
enum Limits : u16 {
|
||||
|
|
|
@ -39,8 +39,8 @@ protected:
|
|||
ATADevice(ATAController const&, Address, u16, u16, u64);
|
||||
|
||||
LockWeakPtr<ATAController> m_controller;
|
||||
const Address m_ata_address;
|
||||
const u16 m_capabilities;
|
||||
Address const m_ata_address;
|
||||
u16 const m_capabilities;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ protected:
|
|||
RefPtr<Memory::PhysicalPage> m_prdt_page;
|
||||
RefPtr<Memory::PhysicalPage> m_dma_buffer_page;
|
||||
|
||||
const u8 m_port_index;
|
||||
u8 const m_port_index;
|
||||
Vector<NonnullLockRefPtr<ATADevice>> m_ata_devices;
|
||||
NonnullOwnPtr<KBuffer> m_ata_identify_data_buffer;
|
||||
NonnullLockRefPtr<ATAController> m_parent_ata_controller;
|
||||
|
|
|
@ -157,7 +157,7 @@ ErrorOr<NonnullLockRefPtr<SDMemoryCard>> SDHostController::try_initialize_insert
|
|||
// 2. Send CMD8 (SEND_IF_COND) to the card
|
||||
// SD interface condition: 7:0 = check pattern, 11:8 = supply voltage
|
||||
// 0x1aa: check pattern = 10101010, supply voltage = 1 => 2.7-3.6V
|
||||
const u32 voltage_window = 0x1aa;
|
||||
u32 const voltage_window = 0x1aa;
|
||||
TRY(issue_command(SD::Commands::send_if_cond, voltage_window));
|
||||
auto interface_condition_response = wait_for_response();
|
||||
|
||||
|
@ -456,14 +456,14 @@ ErrorOr<void> SDHostController::sd_clock_supply(u32 frequency)
|
|||
VERIFY((m_registers->host_configuration_1 & sd_clock_enable) == 0);
|
||||
|
||||
// 1. Find out the divisor to determine the SD Clock Frequency
|
||||
const u32 sd_clock_frequency = TRY(retrieve_sd_clock_frequency());
|
||||
u32 const sd_clock_frequency = TRY(retrieve_sd_clock_frequency());
|
||||
u32 divisor = TRY(calculate_sd_clock_divisor(sd_clock_frequency, frequency));
|
||||
|
||||
// 2. Set Internal Clock Enable and SDCLK Frequency Select in the Clock Control register
|
||||
const u32 eight_lower_bits_of_sdclk_frequency_select = (divisor & 0xff) << 8;
|
||||
u32 const eight_lower_bits_of_sdclk_frequency_select = (divisor & 0xff) << 8;
|
||||
u32 sdclk_frequency_select = eight_lower_bits_of_sdclk_frequency_select;
|
||||
if (host_version() == SD::HostVersion::Version3) {
|
||||
const u32 two_upper_bits_of_sdclk_frequency_select = (divisor >> 8 & 0x3) << 6;
|
||||
u32 const two_upper_bits_of_sdclk_frequency_select = (divisor >> 8 & 0x3) << 6;
|
||||
sdclk_frequency_select |= two_upper_bits_of_sdclk_frequency_select;
|
||||
}
|
||||
m_registers->host_configuration_1 = (m_registers->host_configuration_1 & ~sd_clock_divisor_mask) | internal_clock_enable | sdclk_frequency_select;
|
||||
|
@ -958,7 +958,7 @@ ErrorOr<u32> SDHostController::retrieve_sd_clock_frequency()
|
|||
// If these bits are all 0, the Host System has to get information via another method
|
||||
TODO();
|
||||
}
|
||||
const i64 one_mhz = 1'000'000;
|
||||
i64 const one_mhz = 1'000'000;
|
||||
return { m_registers->capabilities.base_clock_frequency * one_mhz };
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void SlavePTY::echo(u8 ch)
|
|||
void SlavePTY::on_master_write(UserOrKernelBuffer const& buffer, size_t size)
|
||||
{
|
||||
auto result = buffer.read_buffered<128>(size, [&](ReadonlyBytes data) {
|
||||
for (const auto& byte : data)
|
||||
for (auto const& byte : data)
|
||||
emit(byte, false);
|
||||
return data.size();
|
||||
});
|
||||
|
|
|
@ -89,7 +89,7 @@ ErrorOr<size_t> TTY::write(OpenFileDescription&, u64, UserOrKernelBuffer const&
|
|||
return buffer.read_buffered<num_chars>(size, [&](ReadonlyBytes bytes) -> ErrorOr<size_t> {
|
||||
u8 modified_data[num_chars * 2];
|
||||
size_t modified_data_size = 0;
|
||||
for (const auto& byte : bytes) {
|
||||
for (auto const& byte : bytes) {
|
||||
process_output(byte, [&modified_data, &modified_data_size](u8 out_ch) {
|
||||
modified_data[modified_data_size++] = out_ch;
|
||||
});
|
||||
|
|
|
@ -285,7 +285,7 @@ ErrorOr<size_t> VirtualConsole::on_tty_write(UserOrKernelBuffer const& data, siz
|
|||
{
|
||||
SpinlockLocker global_lock(ConsoleManagement::the().tty_write_lock());
|
||||
auto result = data.read_buffered<512>(size, [&](ReadonlyBytes buffer) {
|
||||
for (const auto& byte : buffer)
|
||||
for (auto const& byte : buffer)
|
||||
m_console_impl.on_input(byte);
|
||||
return buffer.size();
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ ErrorOr<void> MountFile::ioctl(OpenFileDescription&, unsigned request, Userspace
|
|||
if ((mount_specific_data.value_type == MountSpecificFlag::ValueType::SignedInteger || mount_specific_data.value_type == MountSpecificFlag::ValueType::UnsignedInteger) && mount_specific_data.value_length != 8)
|
||||
return EDOM;
|
||||
|
||||
Syscall::StringArgument user_key_string { reinterpret_cast<const char*>(mount_specific_data.key_string_addr), static_cast<size_t>(mount_specific_data.key_string_length) };
|
||||
Syscall::StringArgument user_key_string { reinterpret_cast<char const*>(mount_specific_data.key_string_addr), static_cast<size_t>(mount_specific_data.key_string_length) };
|
||||
auto key_string = TRY(Process::get_syscall_name_string_fixed_buffer<MOUNT_SPECIFIC_FLAG_KEY_STRING_MAX_LENGTH>(user_key_string));
|
||||
|
||||
if (mount_specific_data.value_type != MountSpecificFlag::ValueType::Boolean && mount_specific_data.value_length == 0)
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
struct ReceiveCompletion final : public AtomicRefCounted<ReceiveCompletion> {
|
||||
mutable Spinlock<LockRank::None> lock {};
|
||||
bool completed { false };
|
||||
const u16 tag;
|
||||
u16 const tag;
|
||||
OwnPtr<Plan9FSMessage> message;
|
||||
ErrorOr<void> result;
|
||||
|
||||
|
|
|
@ -45,13 +45,13 @@ ErrorOr<void> SysFSDiskUsage::try_generate(KBufferBuilder& builder)
|
|||
TRY(fs_object.add("source"sv, "unknown"));
|
||||
} else {
|
||||
if (fs.is_file_backed()) {
|
||||
auto& file = static_cast<const FileBackedFileSystem&>(fs).file();
|
||||
auto& file = static_cast<FileBackedFileSystem const&>(fs).file();
|
||||
if (file.is_loop_device()) {
|
||||
auto& device = static_cast<LoopDevice const&>(file);
|
||||
auto path = TRY(device.custody().try_serialize_absolute_path());
|
||||
TRY(fs_object.add("source"sv, path->view()));
|
||||
} else {
|
||||
auto pseudo_path = TRY(static_cast<const FileBackedFileSystem&>(fs).file_description().pseudo_path());
|
||||
auto pseudo_path = TRY(static_cast<FileBackedFileSystem const&>(fs).file_description().pseudo_path());
|
||||
TRY(fs_object.add("source"sv, pseudo_path->view()));
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -114,7 +114,7 @@ ErrorOr<void> SysFSOverallProcesses::try_generate(KBufferBuilder& builder)
|
|||
TRY(process_object.add("dumpable"sv, process.is_dumpable()));
|
||||
TRY(process_object.add("kernel"sv, process.is_kernel_process()));
|
||||
auto thread_array = TRY(process_object.add_array("threads"sv));
|
||||
TRY(process.try_for_each_thread([&](const Thread& thread) -> ErrorOr<void> {
|
||||
TRY(process.try_for_each_thread([&](Thread const& thread) -> ErrorOr<void> {
|
||||
SpinlockLocker locker(thread.get_lock());
|
||||
auto thread_object = TRY(thread_array.add_object());
|
||||
#if LOCK_DEBUG
|
||||
|
|
|
@ -33,7 +33,7 @@ static constexpr size_t KMALLOC_DEFAULT_ALIGNMENT = 16;
|
|||
__attribute__((section(".heap"))) static u8 initial_kmalloc_memory[INITIAL_KMALLOC_MEMORY_SIZE];
|
||||
|
||||
namespace std {
|
||||
const nothrow_t nothrow;
|
||||
nothrow_t const nothrow;
|
||||
}
|
||||
|
||||
// FIXME: Figure out whether this can be MemoryManager.
|
||||
|
|
|
@ -38,7 +38,7 @@ struct nothrow_t {
|
|||
explicit nothrow_t() = default;
|
||||
};
|
||||
|
||||
extern const nothrow_t nothrow;
|
||||
extern nothrow_t const nothrow;
|
||||
|
||||
enum class align_val_t : size_t {};
|
||||
};
|
||||
|
|
|
@ -213,7 +213,7 @@ ErrorOr<void> memset_user(void* dest_ptr, int c, size_t n)
|
|||
// See https://bugs.llvm.org/show_bug.cgi?id=39634
|
||||
FlatPtr missing_got_workaround()
|
||||
{
|
||||
extern volatile FlatPtr _GLOBAL_OFFSET_TABLE_;
|
||||
extern FlatPtr volatile _GLOBAL_OFFSET_TABLE_;
|
||||
return _GLOBAL_OFFSET_TABLE_;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -624,7 +624,7 @@ ErrorOr<void> IPv4Socket::ioctl(OpenFileDescription&, unsigned request, Userspac
|
|||
rtentry route;
|
||||
TRY(copy_from_user(&route, user_route));
|
||||
|
||||
Userspace<const char*> user_rt_dev((FlatPtr)route.rt_dev);
|
||||
Userspace<char const*> user_rt_dev((FlatPtr)route.rt_dev);
|
||||
auto ifname = TRY(Process::get_syscall_name_string_fixed_buffer<IFNAMSIZ>(user_rt_dev));
|
||||
auto adapter = NetworkingManagement::the().lookup_by_name(ifname.representable_view());
|
||||
if (!adapter)
|
||||
|
|
|
@ -51,22 +51,22 @@ protected:
|
|||
virtual StringView class_name() const override { return "E1000NetworkAdapter"sv; }
|
||||
|
||||
struct [[gnu::packed]] e1000_rx_desc {
|
||||
volatile uint64_t addr { 0 };
|
||||
volatile uint16_t length { 0 };
|
||||
volatile uint16_t checksum { 0 };
|
||||
volatile uint8_t status { 0 };
|
||||
volatile uint8_t errors { 0 };
|
||||
volatile uint16_t special { 0 };
|
||||
uint64_t volatile addr { 0 };
|
||||
uint16_t volatile length { 0 };
|
||||
uint16_t volatile checksum { 0 };
|
||||
uint8_t volatile status { 0 };
|
||||
uint8_t volatile errors { 0 };
|
||||
uint16_t volatile special { 0 };
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] e1000_tx_desc {
|
||||
volatile uint64_t addr { 0 };
|
||||
volatile uint16_t length { 0 };
|
||||
volatile uint8_t cso { 0 };
|
||||
volatile uint8_t cmd { 0 };
|
||||
volatile uint8_t status { 0 };
|
||||
volatile uint8_t css { 0 };
|
||||
volatile uint16_t special { 0 };
|
||||
uint64_t volatile addr { 0 };
|
||||
uint16_t volatile length { 0 };
|
||||
uint8_t volatile cso { 0 };
|
||||
uint8_t volatile cmd { 0 };
|
||||
uint8_t volatile status { 0 };
|
||||
uint8_t volatile css { 0 };
|
||||
uint16_t volatile special { 0 };
|
||||
};
|
||||
|
||||
virtual void detect_eeprom();
|
||||
|
|
|
@ -340,9 +340,9 @@ void send_tcp_rst(IPv4Packet const& ipv4_packet, TCPPacket const& tcp_packet, Re
|
|||
|
||||
auto ipv4_payload_offset = routing_decision.adapter->ipv4_payload_offset();
|
||||
|
||||
const size_t options_size = 0;
|
||||
const size_t tcp_header_size = sizeof(TCPPacket) + options_size;
|
||||
const size_t buffer_size = ipv4_payload_offset + tcp_header_size;
|
||||
size_t const options_size = 0;
|
||||
size_t const tcp_header_size = sizeof(TCPPacket) + options_size;
|
||||
size_t const buffer_size = ipv4_payload_offset + tcp_header_size;
|
||||
|
||||
auto packet = routing_decision.adapter->acquire_packet_buffer(buffer_size);
|
||||
if (!packet)
|
||||
|
|
|
@ -50,12 +50,12 @@ private:
|
|||
bool determine_supported_version() const;
|
||||
|
||||
struct [[gnu::packed]] TXDescriptor {
|
||||
volatile u16 frame_length; // top 2 bits are reserved
|
||||
volatile u16 flags;
|
||||
volatile u16 vlan_tag;
|
||||
volatile u16 vlan_flags;
|
||||
volatile u32 buffer_address_low;
|
||||
volatile u32 buffer_address_high;
|
||||
u16 volatile frame_length; // top 2 bits are reserved
|
||||
u16 volatile flags;
|
||||
u16 volatile vlan_tag;
|
||||
u16 volatile vlan_flags;
|
||||
u32 volatile buffer_address_low;
|
||||
u32 volatile buffer_address_high;
|
||||
|
||||
// flags bit field
|
||||
static constexpr u16 Ownership = 0x8000u;
|
||||
|
@ -68,12 +68,12 @@ private:
|
|||
static_assert(AssertSize<TXDescriptor, 16u>());
|
||||
|
||||
struct [[gnu::packed]] RXDescriptor {
|
||||
volatile u16 buffer_size; // top 2 bits are reserved
|
||||
volatile u16 flags;
|
||||
volatile u16 vlan_tag;
|
||||
volatile u16 vlan_flags;
|
||||
volatile u32 buffer_address_low;
|
||||
volatile u32 buffer_address_high;
|
||||
u16 volatile buffer_size; // top 2 bits are reserved
|
||||
u16 volatile flags;
|
||||
u16 volatile vlan_tag;
|
||||
u16 volatile vlan_flags;
|
||||
u32 volatile buffer_address_low;
|
||||
u32 volatile buffer_address_high;
|
||||
|
||||
// flags bit field
|
||||
static constexpr u16 Ownership = 0x8000u;
|
||||
|
|
|
@ -34,10 +34,10 @@ struct Route final : public AtomicRefCounted<Route> {
|
|||
return destination == other.destination && (gateway == other.gateway || other.gateway.is_zero()) && netmask == other.netmask && flags == other.flags && adapter.ptr() == other.adapter.ptr();
|
||||
}
|
||||
|
||||
const IPv4Address destination;
|
||||
const IPv4Address gateway;
|
||||
const IPv4Address netmask;
|
||||
const u16 flags;
|
||||
IPv4Address const destination;
|
||||
IPv4Address const gateway;
|
||||
IPv4Address const netmask;
|
||||
u16 const flags;
|
||||
NonnullRefPtr<NetworkAdapter> const adapter;
|
||||
|
||||
IntrusiveListNode<Route, RefPtr<Route>> route_list_node {};
|
||||
|
|
|
@ -733,7 +733,7 @@ void TCPSocket::retransmit_packets()
|
|||
packet.tx_counter++;
|
||||
|
||||
if constexpr (TCP_SOCKET_DEBUG) {
|
||||
auto& tcp_packet = *(const TCPPacket*)(packet.buffer->buffer->data() + packet.ipv4_payload_offset);
|
||||
auto& tcp_packet = *(TCPPacket const*)(packet.buffer->buffer->data() + packet.ipv4_payload_offset);
|
||||
dbgln("Sending TCP packet from {}:{} to {}:{} with ({}{}{}{}) seq_no={}, ack_no={}, tx_counter={}",
|
||||
local_address(), local_port(),
|
||||
peer_address(), peer_port(),
|
||||
|
|
|
@ -91,7 +91,7 @@ ErrorOr<size_t> UDPSocket::protocol_send(UserOrKernelBuffer const& data, size_t
|
|||
return set_so_error(EHOSTUNREACH);
|
||||
auto ipv4_payload_offset = routing_decision.adapter->ipv4_payload_offset();
|
||||
data_length = min(data_length, routing_decision.adapter->mtu() - ipv4_payload_offset - sizeof(UDPPacket));
|
||||
const size_t udp_buffer_size = sizeof(UDPPacket) + data_length;
|
||||
size_t const udp_buffer_size = sizeof(UDPPacket) + data_length;
|
||||
auto packet = routing_decision.adapter->acquire_packet_buffer(ipv4_payload_offset + udp_buffer_size);
|
||||
if (!packet)
|
||||
return set_so_error(ENOMEM);
|
||||
|
|
|
@ -130,8 +130,8 @@ void __ubsan_handle_implicit_conversion(ImplicitConversionData const& data, Valu
|
|||
print_location(data.location);
|
||||
}
|
||||
|
||||
void __ubsan_handle_invalid_builtin(const InvalidBuiltinData) __attribute__((used));
|
||||
void __ubsan_handle_invalid_builtin(const InvalidBuiltinData data)
|
||||
void __ubsan_handle_invalid_builtin(InvalidBuiltinData const) __attribute__((used));
|
||||
void __ubsan_handle_invalid_builtin(InvalidBuiltinData const data)
|
||||
{
|
||||
print_location(data.location);
|
||||
}
|
||||
|
|
|
@ -188,8 +188,8 @@ void __ubsan_handle_implicit_conversion(ImplicitConversionData const& data, Valu
|
|||
print_location(data.location);
|
||||
}
|
||||
|
||||
void __ubsan_handle_invalid_builtin(const InvalidBuiltinData) __attribute__((used));
|
||||
void __ubsan_handle_invalid_builtin(const InvalidBuiltinData data)
|
||||
void __ubsan_handle_invalid_builtin(InvalidBuiltinData const) __attribute__((used));
|
||||
void __ubsan_handle_invalid_builtin(InvalidBuiltinData const data)
|
||||
{
|
||||
critical_dmesgln("KUBSAN: passing invalid argument");
|
||||
print_location(data.location);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct HandlerMetadata {
|
|||
};
|
||||
|
||||
#define __ENUMERATE_SYSCALL(sys_call, needs_lock) { bit_cast<Handler>(&Process::sys$##sys_call), needs_lock },
|
||||
static const HandlerMetadata s_syscall_table[] = {
|
||||
static HandlerMetadata const s_syscall_table[] = {
|
||||
ENUMERATE_SYSCALLS(__ENUMERATE_SYSCALL)
|
||||
};
|
||||
#undef __ENUMERATE_SYSCALL
|
||||
|
|
|
@ -526,7 +526,7 @@ public:
|
|||
|
||||
private:
|
||||
NonnullRefPtr<OpenFileDescription> m_blocked_description;
|
||||
const BlockFlags m_flags;
|
||||
BlockFlags const m_flags;
|
||||
BlockFlags& m_unblocked_flags;
|
||||
bool m_did_unblock { false };
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "Mesh.h"
|
||||
|
||||
const Color colors[] {
|
||||
Color const colors[] {
|
||||
Color::Red,
|
||||
Color::Green,
|
||||
Color::Blue,
|
||||
|
@ -36,17 +36,17 @@ void Mesh::draw(float uv_scale)
|
|||
for (u32 i = 0; i < m_triangle_list.size(); i++) {
|
||||
auto const& triangle = m_triangle_list[i];
|
||||
|
||||
const FloatVector3 vertex_a(
|
||||
FloatVector3 const vertex_a(
|
||||
m_vertex_list.at(triangle.a).x,
|
||||
m_vertex_list.at(triangle.a).y,
|
||||
m_vertex_list.at(triangle.a).z);
|
||||
|
||||
const FloatVector3 vertex_b(
|
||||
FloatVector3 const vertex_b(
|
||||
m_vertex_list.at(triangle.b).x,
|
||||
m_vertex_list.at(triangle.b).y,
|
||||
m_vertex_list.at(triangle.b).z);
|
||||
|
||||
const FloatVector3 vertex_c(
|
||||
FloatVector3 const vertex_c(
|
||||
m_vertex_list.at(triangle.c).x,
|
||||
m_vertex_list.at(triangle.c).y,
|
||||
m_vertex_list.at(triangle.c).z);
|
||||
|
@ -70,8 +70,8 @@ void Mesh::draw(float uv_scale)
|
|||
|
||||
} else {
|
||||
// Compute the triangle normal
|
||||
const FloatVector3 vec_ab = vertex_b - vertex_a;
|
||||
const FloatVector3 vec_ac = vertex_c - vertex_a;
|
||||
FloatVector3 const vec_ab = vertex_b - vertex_a;
|
||||
FloatVector3 const vec_ac = vertex_c - vertex_a;
|
||||
normal_a = vec_ab.cross(vec_ac).normalized();
|
||||
normal_b = normal_a;
|
||||
normal_c = normal_a;
|
||||
|
|
|
@ -299,7 +299,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> CalendarWidget::create_open_settings_action(
|
|||
void CalendarWidget::create_on_tile_doubleclick()
|
||||
{
|
||||
m_event_calendar->on_tile_doubleclick = [&] {
|
||||
for (const auto& event : m_event_calendar->event_manager().events()) {
|
||||
for (auto const& event : m_event_calendar->event_manager().events()) {
|
||||
auto start = event.start;
|
||||
auto selected_date = m_event_calendar->selected_date();
|
||||
|
||||
|
|
|
@ -248,14 +248,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
VERIFY(optional_regs.has_value());
|
||||
const PtraceRegisters& regs = optional_regs.value();
|
||||
PtraceRegisters const& regs = optional_regs.value();
|
||||
#if ARCH(X86_64)
|
||||
const FlatPtr ip = regs.rip;
|
||||
FlatPtr const ip = regs.rip;
|
||||
#elif ARCH(AARCH64)
|
||||
const FlatPtr ip = 0; // FIXME
|
||||
FlatPtr const ip = 0; // FIXME
|
||||
TODO_AARCH64();
|
||||
#elif ARCH(RISCV64)
|
||||
const FlatPtr ip = 0; // FIXME
|
||||
FlatPtr const ip = 0; // FIXME
|
||||
TODO_RISCV64();
|
||||
#else
|
||||
# error Unknown architecture
|
||||
|
|
|
@ -97,7 +97,7 @@ void KeyboardMapperWidget::create_frame()
|
|||
bottom_widget.add_spacer();
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::add_map_radio_button(const StringView map_name, String button_text)
|
||||
void KeyboardMapperWidget::add_map_radio_button(StringView const map_name, String button_text)
|
||||
{
|
||||
auto& map_radio_button = m_map_group->add<GUI::RadioButton>(button_text);
|
||||
map_radio_button.set_name(map_name);
|
||||
|
@ -106,7 +106,7 @@ void KeyboardMapperWidget::add_map_radio_button(const StringView map_name, Strin
|
|||
};
|
||||
}
|
||||
|
||||
u32* KeyboardMapperWidget::map_from_name(const StringView map_name)
|
||||
u32* KeyboardMapperWidget::map_from_name(StringView const map_name)
|
||||
{
|
||||
u32* map;
|
||||
if (map_name == "map"sv) {
|
||||
|
@ -234,7 +234,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::set_current_map(const ByteString current_map)
|
||||
void KeyboardMapperWidget::set_current_map(ByteString const current_map)
|
||||
{
|
||||
m_current_map_name = current_map;
|
||||
u32* map = map_from_name(m_current_map_name);
|
||||
|
|
|
@ -31,7 +31,7 @@ protected:
|
|||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
virtual void keyup_event(GUI::KeyEvent&) override;
|
||||
|
||||
void set_current_map(const ByteString);
|
||||
void set_current_map(ByteString const);
|
||||
void update_window_title();
|
||||
|
||||
private:
|
||||
|
@ -39,8 +39,8 @@ private:
|
|||
|
||||
Vector<KeyButton*> m_keys;
|
||||
RefPtr<GUI::Widget> m_map_group;
|
||||
void add_map_radio_button(const StringView map_name, String button_text);
|
||||
u32* map_from_name(const StringView map_name);
|
||||
void add_map_radio_button(StringView const map_name, String button_text);
|
||||
u32* map_from_name(StringView const map_name);
|
||||
void update_modifier_radio_buttons(GUI::KeyEvent&);
|
||||
|
||||
ByteString m_filename;
|
||||
|
|
|
@ -475,7 +475,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
auto& body_data = fetch_response_data.body_data();
|
||||
auto body_text_part_iterator = body_data.find_if([](Tuple<IMAP::FetchCommand::DataItem, ByteString>& data) {
|
||||
const auto data_item = data.get<0>();
|
||||
auto const data_item = data.get<0>();
|
||||
return data_item.section.has_value() && data_item.section->type == IMAP::FetchCommand::DataItem::SectionType::Parts;
|
||||
});
|
||||
VERIFY(body_text_part_iterator != body_data.end());
|
||||
|
|
|
@ -51,10 +51,10 @@ constexpr KeyColor key_pattern[] = {
|
|||
White,
|
||||
};
|
||||
|
||||
const Color note_pressed_color(64, 64, 255);
|
||||
const Color column_playing_color(128, 128, 255);
|
||||
Color const note_pressed_color(64, 64, 255);
|
||||
Color const column_playing_color(128, 128, 255);
|
||||
|
||||
const Color left_wave_colors[] = {
|
||||
Color const left_wave_colors[] = {
|
||||
// Sine
|
||||
{
|
||||
255,
|
||||
|
@ -96,7 +96,7 @@ const Color left_wave_colors[] = {
|
|||
// HACK: make the display code shut up for now
|
||||
constexpr int RecordedSample = 5;
|
||||
|
||||
const Color right_wave_colors[] = {
|
||||
Color const right_wave_colors[] = {
|
||||
// Sine
|
||||
{
|
||||
255,
|
||||
|
|
|
@ -237,8 +237,8 @@ void RollWidget::mousemove_event(GUI::MouseEvent& event)
|
|||
int const x_start = get_note_for_x(m_mousedown_event.value().x());
|
||||
int const x_end = get_note_for_x(event.x());
|
||||
|
||||
const u32 on_sample = round(roll_length * (static_cast<double>(min(x_start, x_end)) / m_num_notes));
|
||||
const u32 off_sample = round(roll_length * (static_cast<double>(max(x_start, x_end) + 1) / m_num_notes)) - 1;
|
||||
u32 const on_sample = round(roll_length * (static_cast<double>(min(x_start, x_end)) / m_num_notes));
|
||||
u32 const off_sample = round(roll_length * (static_cast<double>(max(x_start, x_end) + 1) / m_num_notes)) - 1;
|
||||
auto const note = RollNote { on_sample, off_sample, get_pitch_for_y(m_mousedown_event.value().y()), 127 };
|
||||
|
||||
m_track_manager.current_track()->set_note(note);
|
||||
|
|
|
@ -248,8 +248,8 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
|
||||
// Mouse position indicator
|
||||
const Gfx::IntPoint indicator_x({ m_mouse_position.x(), m_ruler_thickness });
|
||||
const Gfx::IntPoint indicator_y({ m_ruler_thickness, m_mouse_position.y() });
|
||||
Gfx::IntPoint const indicator_x({ m_mouse_position.x(), m_ruler_thickness });
|
||||
Gfx::IntPoint const indicator_y({ m_ruler_thickness, m_mouse_position.y() });
|
||||
painter.draw_triangle(indicator_x, indicator_x + Gfx::IntPoint(-m_mouse_indicator_triangle_size, -m_mouse_indicator_triangle_size), indicator_x + Gfx::IntPoint(m_mouse_indicator_triangle_size, -m_mouse_indicator_triangle_size), mouse_indicator_color);
|
||||
painter.draw_triangle(indicator_y, indicator_y + Gfx::IntPoint(-m_mouse_indicator_triangle_size, -m_mouse_indicator_triangle_size), indicator_y + Gfx::IntPoint(-m_mouse_indicator_triangle_size, m_mouse_indicator_triangle_size), mouse_indicator_color);
|
||||
|
||||
|
@ -276,15 +276,15 @@ int ImageEditor::calculate_ruler_step_size() const
|
|||
|
||||
Gfx::IntRect ImageEditor::mouse_indicator_rect_x() const
|
||||
{
|
||||
const Gfx::IntPoint top_left({ m_ruler_thickness, m_ruler_thickness - m_mouse_indicator_triangle_size });
|
||||
const Gfx::IntSize size({ width() + 1, m_mouse_indicator_triangle_size + 1 });
|
||||
Gfx::IntPoint const top_left({ m_ruler_thickness, m_ruler_thickness - m_mouse_indicator_triangle_size });
|
||||
Gfx::IntSize const size({ width() + 1, m_mouse_indicator_triangle_size + 1 });
|
||||
return Gfx::IntRect(top_left, size);
|
||||
}
|
||||
|
||||
Gfx::IntRect ImageEditor::mouse_indicator_rect_y() const
|
||||
{
|
||||
const Gfx::IntPoint top_left({ m_ruler_thickness - m_mouse_indicator_triangle_size, m_ruler_thickness });
|
||||
const Gfx::IntSize size({ m_mouse_indicator_triangle_size + 1, height() + 1 });
|
||||
Gfx::IntPoint const top_left({ m_ruler_thickness - m_mouse_indicator_triangle_size, m_ruler_thickness });
|
||||
Gfx::IntSize const size({ m_mouse_indicator_triangle_size + 1, height() + 1 });
|
||||
return Gfx::IntRect(top_left, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ void GradientTool::calculate_gradient_lines()
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void GradientTool::draw_gradient(GUI::Painter& painter, bool with_guidelines, const Gfx::FloatPoint drawing_offset, float scale, Optional<Gfx::IntRect const&> gradient_clip)
|
||||
void GradientTool::draw_gradient(GUI::Painter& painter, bool with_guidelines, Gfx::FloatPoint const drawing_offset, float scale, Optional<Gfx::IntRect const&> gradient_clip)
|
||||
{
|
||||
auto t_gradient_begin_line = m_gradient_begin_line.scaled(scale, scale).translated(drawing_offset);
|
||||
auto t_gradient_center_line = m_gradient_center_line.scaled(scale, scale).translated(drawing_offset);
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
|
||||
void calculate_gradient_lines();
|
||||
void calculate_transversal_points(float scale_fraction);
|
||||
void draw_gradient(GUI::Painter&, bool with_guidelines = false, const Gfx::FloatPoint drawing_offset = { 0.0f, 0.0f }, float scale = 1, Optional<Gfx::IntRect const&> gradient_clip = {});
|
||||
void draw_gradient(GUI::Painter&, bool with_guidelines = false, Gfx::FloatPoint const drawing_offset = { 0.0f, 0.0f }, float scale = 1, Optional<Gfx::IntRect const&> gradient_clip = {});
|
||||
bool has_gradient_data() { return m_gradient_center.has_value() && m_gradient_end.has_value() && m_gradient_start.has_value(); }
|
||||
void move_gradient_position(Gfx::IntPoint const movement_delta);
|
||||
void rasterize_gradient();
|
||||
|
|
|
@ -41,8 +41,8 @@ private:
|
|||
class BloomFilter {
|
||||
public:
|
||||
void reset() { m_bitmap = 0; }
|
||||
void add(const StringView key) { m_bitmap |= mask_for_key(key); }
|
||||
bool maybe_contains(const StringView key) const
|
||||
void add(StringView const key) { m_bitmap |= mask_for_key(key); }
|
||||
bool maybe_contains(StringView const key) const
|
||||
{
|
||||
auto mask = mask_for_key(key);
|
||||
return (m_bitmap & mask) == mask;
|
||||
|
|
|
@ -122,12 +122,12 @@ void TreeMapWidget::lay_out_children(TreeNode const& node, Gfx::IntRect const& r
|
|||
Gfx::IntRect canvas = rect;
|
||||
bool remaining_nodes_are_too_small = false;
|
||||
for (size_t i = 0; !remaining_nodes_are_too_small && i < node.num_children(); i++) {
|
||||
const i64 i_node_area = node.child_at(i).area();
|
||||
i64 const i_node_area = node.child_at(i).area();
|
||||
if (i_node_area == 0)
|
||||
break;
|
||||
|
||||
const size_t long_side_size = max(canvas.width(), canvas.height());
|
||||
const size_t short_side_size = min(canvas.width(), canvas.height());
|
||||
size_t const long_side_size = max(canvas.width(), canvas.height());
|
||||
size_t const short_side_size = min(canvas.width(), canvas.height());
|
||||
|
||||
size_t row_or_column_size = long_side_size * i_node_area / total_area;
|
||||
i64 node_area_sum = i_node_area;
|
||||
|
@ -163,7 +163,7 @@ void TreeMapWidget::lay_out_children(TreeNode const& node, Gfx::IntRect const& r
|
|||
|
||||
// Paint the elements from 'i' up to and including 'k-1'.
|
||||
{
|
||||
const size_t fixed_side_size = row_or_column_size;
|
||||
size_t const fixed_side_size = row_or_column_size;
|
||||
i64 placement_area = node_area_sum;
|
||||
size_t main_dim = short_side_size;
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
continue;
|
||||
}
|
||||
|
||||
const TreeNode* node = tree_map_widget.path_node(k);
|
||||
TreeNode const* node = tree_map_widget.path_node(k);
|
||||
|
||||
builder.append('/');
|
||||
builder.append(node->name());
|
||||
|
|
|
@ -145,7 +145,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
type_list.set_model(*GUI::ItemListModel<ByteString>::create(g_types));
|
||||
type_list.set_should_hide_unnecessary_scrollbars(true);
|
||||
type_list.on_selection_change = [&] {
|
||||
const auto& index = type_list.selection().first();
|
||||
auto const& index = type_list.selection().first();
|
||||
if (!index.is_valid()) {
|
||||
m_type = nullptr;
|
||||
return;
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
size_t index() const { return m_index; }
|
||||
size_t size() const { return m_xsv.headers().size(); }
|
||||
|
||||
using ConstIterator = AK::SimpleIterator<const Row, StringView const>;
|
||||
using ConstIterator = AK::SimpleIterator<Row const, StringView const>;
|
||||
using Iterator = AK::SimpleIterator<Row, StringView>;
|
||||
|
||||
constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
size_t m_index { 0 };
|
||||
};
|
||||
|
||||
const Row operator[](size_t index) const;
|
||||
Row const operator[](size_t index) const;
|
||||
Row operator[](size_t index);
|
||||
|
||||
Row at(size_t index) const;
|
||||
|
|
|
@ -455,7 +455,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
|||
auto conditional_formats = obj.get_array("conditional_formats"sv);
|
||||
auto cformats = cell->conditional_formats();
|
||||
if (conditional_formats.has_value()) {
|
||||
conditional_formats->for_each([&](const auto& fmt_val) {
|
||||
conditional_formats->for_each([&](auto const& fmt_val) {
|
||||
if (!fmt_val.is_object())
|
||||
return IterationDecision::Continue;
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR
|
|||
auto& sheet = *worksheet_ptr;
|
||||
auto& cells = sheet.selected_cells();
|
||||
VERIFY(!cells.is_empty());
|
||||
const auto& data = GUI::Clipboard::the().fetch_data_and_type();
|
||||
auto const& data = GUI::Clipboard::the().fetch_data_and_type();
|
||||
if (auto spreadsheet_data = data.metadata.get("text/x-spreadsheet-data"); spreadsheet_data.has_value()) {
|
||||
Vector<Spreadsheet::Position> source_positions, target_positions;
|
||||
auto lines = spreadsheet_data.value().split_view('\n');
|
||||
|
|
|
@ -56,7 +56,7 @@ void Gradient::timer_event(Core::TimerEvent&)
|
|||
|
||||
void Gradient::draw()
|
||||
{
|
||||
const Color colors[] {
|
||||
Color const colors[] {
|
||||
Color::Blue,
|
||||
Color::Cyan,
|
||||
Color::Green,
|
||||
|
@ -65,7 +65,7 @@ void Gradient::draw()
|
|||
Color::Yellow,
|
||||
};
|
||||
|
||||
const Orientation orientations[] {
|
||||
Orientation const orientations[] {
|
||||
Gfx::Orientation::Horizontal,
|
||||
Gfx::Orientation::Vertical
|
||||
};
|
||||
|
|
|
@ -19,11 +19,11 @@ ClassViewWidget::ClassViewWidget()
|
|||
m_class_tree = add<GUI::TreeView>();
|
||||
|
||||
m_class_tree->on_selection_change = [this] {
|
||||
const auto& index = m_class_tree->selection().first();
|
||||
auto const& index = m_class_tree->selection().first();
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
|
||||
auto* node = static_cast<const ClassViewNode*>(index.internal_data());
|
||||
auto* node = static_cast<ClassViewNode const*>(index.internal_data());
|
||||
if (!node->declaration)
|
||||
return;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ DebugInfoWidget::DebugInfoWidget()
|
|||
variables_tab_widget.add_widget(build_registers_tab());
|
||||
|
||||
m_backtrace_view->on_selection_change = [this] {
|
||||
const auto& index = m_backtrace_view->selection().first();
|
||||
auto const& index = m_backtrace_view->selection().first();
|
||||
|
||||
if (!index.is_valid()) {
|
||||
return;
|
||||
|
|
|
@ -187,7 +187,7 @@ int Debugger::debugger_loop(Debug::DebugSession::DesiredInitialDebugeeState init
|
|||
}
|
||||
remove_temporary_breakpoints();
|
||||
VERIFY(optional_regs.has_value());
|
||||
const PtraceRegisters& regs = optional_regs.value();
|
||||
PtraceRegisters const& regs = optional_regs.value();
|
||||
|
||||
auto source_position = m_debug_session->get_source_position(regs.ip());
|
||||
if (!source_position.has_value())
|
||||
|
|
|
@ -128,7 +128,7 @@ FindInFilesWidget::FindInFilesWidget()
|
|||
m_result_view = add<GUI::TableView>();
|
||||
|
||||
m_result_view->on_activation = [](auto& index) {
|
||||
auto& match = *(const Match*)index.internal_data();
|
||||
auto& match = *(Match const*)index.internal_data();
|
||||
open_file(match.filename);
|
||||
current_editor().set_selection(match.range);
|
||||
current_editor().set_focus(true);
|
||||
|
|
|
@ -43,11 +43,11 @@ GitWidget::GitWidget()
|
|||
[this](auto const& file) { stage_file(file); },
|
||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_unstaged_files->on_selection_change = [this] {
|
||||
const auto& index = m_unstaged_files->selection().first();
|
||||
auto const& index = m_unstaged_files->selection().first();
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
|
||||
const auto& selected = index.data().as_string();
|
||||
auto const& selected = index.data().as_string();
|
||||
show_diff(selected);
|
||||
};
|
||||
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void HackStudioWidget::initialize_debugger()
|
|||
m_project->root_path(),
|
||||
[this](PtraceRegisters const& regs) {
|
||||
VERIFY(Debugger::the().session());
|
||||
const auto& debug_session = *Debugger::the().session();
|
||||
auto const& debug_session = *Debugger::the().session();
|
||||
auto source_position = debug_session.get_source_position(regs.ip());
|
||||
if (!source_position.has_value()) {
|
||||
dbgln("Could not find source position for address: {:p}", regs.ip());
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
ByteString const& name() const { return m_name; }
|
||||
ByteString const& description() const { return m_description; }
|
||||
const GUI::Icon& icon() const { return m_icon; }
|
||||
const ByteString content_path() const
|
||||
ByteString const content_path() const
|
||||
{
|
||||
return LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", templates_path(), m_id));
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
|||
float hdx = h * cosf(phi);
|
||||
float hdy = h * sinf(phi);
|
||||
|
||||
const auto cos_pi_2_phi = cosf(float { M_PI_2 } - phi);
|
||||
const auto sin_pi_2_phi = sinf(float { M_PI_2 } - phi);
|
||||
auto const cos_pi_2_phi = cosf(float { M_PI_2 } - phi);
|
||||
auto const sin_pi_2_phi = sinf(float { M_PI_2 } - phi);
|
||||
|
||||
Gfx::FloatPoint A1(A.x() - (w1 / 2) * cos_pi_2_phi, A.y() - (w1 / 2) * sin_pi_2_phi);
|
||||
Gfx::FloatPoint B3(A.x() + (w1 / 2) * cos_pi_2_phi, A.y() + (w1 / 2) * sin_pi_2_phi);
|
||||
|
|
|
@ -176,8 +176,8 @@ private:
|
|||
float m_difficulty {};
|
||||
float m_restart_cooldown {};
|
||||
NonnullRefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::load_from_file("/res/graphics/flappybug/background.png"sv).release_value_but_fixme_should_propagate_errors() };
|
||||
const Gfx::IntRect m_score_rect { 10, 10, 20, 20 };
|
||||
const Gfx::IntRect m_text_rect { game_width / 2 - 80, game_height / 2 - 40, 160, 80 };
|
||||
Gfx::IntRect const m_score_rect { 10, 10, 20, 20 };
|
||||
Gfx::IntRect const m_text_rect { game_width / 2 - 80, game_height / 2 - 40, 160, 80 };
|
||||
|
||||
Game(Bug, Cloud);
|
||||
};
|
||||
|
|
|
@ -90,8 +90,8 @@ public:
|
|||
u32 target() const { return m_target; }
|
||||
|
||||
private:
|
||||
const u32 m_source;
|
||||
const u32 m_target;
|
||||
u32 const m_source;
|
||||
u32 const m_target;
|
||||
u32 m_current_ratio { 0 };
|
||||
SampleType m_last_sample_l {};
|
||||
SampleType m_last_sample_r {};
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
const in6_addr in6addr_any = IN6ADDR_ANY_INIT;
|
||||
const in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
|
||||
in6_addr const in6addr_any = IN6ADDR_ANY_INIT;
|
||||
in6_addr const in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nametoindex.html
|
||||
unsigned int if_nametoindex([[maybe_unused]] char const* ifname)
|
||||
|
|
|
@ -31,7 +31,7 @@ template<>
|
|||
inline void swap(SizedObject const& a, SizedObject const& b)
|
||||
{
|
||||
VERIFY(a.size() == b.size());
|
||||
const size_t size = a.size();
|
||||
size_t const size = a.size();
|
||||
auto const a_data = reinterpret_cast<char*>(a.data());
|
||||
auto const b_data = reinterpret_cast<char*>(b.data());
|
||||
for (auto i = 0u; i < size; ++i) {
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
, m_element_size(element_size)
|
||||
{
|
||||
}
|
||||
const SizedObject operator[](size_t index)
|
||||
SizedObject const operator[](size_t index)
|
||||
{
|
||||
return { static_cast<char*>(m_data) + index * m_element_size, m_element_size };
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ private:
|
|||
return invert ^ scan_set.contains(c);
|
||||
}
|
||||
|
||||
const StringView scan_set;
|
||||
StringView const scan_set;
|
||||
bool invert { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ private:
|
|||
return m_sign != Sign::Negative;
|
||||
}
|
||||
|
||||
const T m_base;
|
||||
T const m_base;
|
||||
T m_num;
|
||||
T m_cutoff;
|
||||
int m_max_digit_after_cutoff;
|
||||
|
@ -313,7 +313,7 @@ static T c_str_to_floating_point(char const* str, char** endptr)
|
|||
// - One of INF or INFINITY, ignoring case
|
||||
// - One of NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part
|
||||
|
||||
const Sign sign = strtosign(parse_ptr, &parse_ptr);
|
||||
Sign const sign = strtosign(parse_ptr, &parse_ptr);
|
||||
|
||||
if (is_infinity_string(parse_ptr, endptr)) {
|
||||
// Don't set errno to ERANGE here:
|
||||
|
@ -973,7 +973,7 @@ long long strtoll(char const* str, char** endptr, int base)
|
|||
// Parse spaces and sign
|
||||
char* parse_ptr = const_cast<char*>(str);
|
||||
strtons(parse_ptr, &parse_ptr);
|
||||
const Sign sign = strtosign(parse_ptr, &parse_ptr);
|
||||
Sign const sign = strtosign(parse_ptr, &parse_ptr);
|
||||
|
||||
// Parse base
|
||||
if (base == 0) {
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
bool is_disabled() const { return m_disabled; }
|
||||
Gfx::Color color() const { return (m_suit == Suit::Diamonds || m_suit == Suit::Hearts) ? Color::Red : Color::Black; }
|
||||
|
||||
void set_position(const Gfx::IntPoint p) { m_rect.set_location(p); }
|
||||
void set_position(Gfx::IntPoint const p) { m_rect.set_location(p); }
|
||||
void set_moving(bool moving) { m_moving = moving; }
|
||||
void set_upside_down(bool upside_down) { m_upside_down = upside_down; }
|
||||
void set_inverted(bool inverted) { m_inverted = inverted; }
|
||||
|
|
|
@ -116,7 +116,7 @@ ErrorOr<String> Move::to_long_algebraic() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
Move Move::from_algebraic(StringView algebraic, const Color turn, Board const& board)
|
||||
Move Move::from_algebraic(StringView algebraic, Color const turn, Board const& board)
|
||||
{
|
||||
auto move_string = algebraic;
|
||||
Move move({ 50, 50 }, { 50, 50 });
|
||||
|
@ -294,7 +294,7 @@ ErrorOr<String> Board::to_fen() const
|
|||
int empty = 0;
|
||||
for (int rank = 0; rank < 8; rank++) {
|
||||
for (int file = 0; file < 8; file++) {
|
||||
const Piece p(get_piece({ 7 - rank, file }));
|
||||
Piece const p(get_piece({ 7 - rank, file }));
|
||||
if (p.type == Type::None) {
|
||||
empty++;
|
||||
continue;
|
||||
|
|
|
@ -117,7 +117,7 @@ struct Move {
|
|||
}
|
||||
bool operator==(Move const& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; }
|
||||
|
||||
static Move from_algebraic(StringView algebraic, const Color turn, Board const& board);
|
||||
static Move from_algebraic(StringView algebraic, Color const turn, Board const& board);
|
||||
ErrorOr<String> to_long_algebraic() const;
|
||||
ErrorOr<String> to_algebraic() const;
|
||||
};
|
||||
|
|
|
@ -206,7 +206,7 @@ Vector<StringView> CppComprehensionEngine::scope_of_reference_to_symbol(ASTNode
|
|||
return scope_parts;
|
||||
}
|
||||
|
||||
Vector<CodeComprehension::AutocompleteResultEntry> CppComprehensionEngine::autocomplete_property(DocumentData const& document, MemberExpression const& parent, const ByteString partial_text) const
|
||||
Vector<CodeComprehension::AutocompleteResultEntry> CppComprehensionEngine::autocomplete_property(DocumentData const& document, MemberExpression const& parent, ByteString const partial_text) const
|
||||
{
|
||||
VERIFY(parent.object());
|
||||
auto type = type_of(document, *parent.object());
|
||||
|
|
|
@ -95,7 +95,7 @@ private:
|
|||
HashTable<ByteString> m_available_headers;
|
||||
};
|
||||
|
||||
Vector<CodeComprehension::AutocompleteResultEntry> autocomplete_property(DocumentData const&, MemberExpression const&, const ByteString partial_text) const;
|
||||
Vector<CodeComprehension::AutocompleteResultEntry> autocomplete_property(DocumentData const&, MemberExpression const&, ByteString const partial_text) const;
|
||||
Vector<AutocompleteResultEntry> autocomplete_name(DocumentData const&, ASTNode const&, ByteString const& partial_text) const;
|
||||
ByteString type_of(DocumentData const&, Expression const&) const;
|
||||
ByteString type_of_property(DocumentData const&, Identifier const&) const;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue