diff options
Diffstat (limited to 'Userland/Libraries')
697 files changed, 4340 insertions, 4342 deletions
diff --git a/Userland/Libraries/LibArchive/Tar.cpp b/Userland/Libraries/LibArchive/Tar.cpp index 65954ba64f..41b69dab59 100644 --- a/Userland/Libraries/LibArchive/Tar.cpp +++ b/Userland/Libraries/LibArchive/Tar.cpp @@ -12,8 +12,8 @@ namespace Archive { unsigned TarFileHeader::expected_checksum() const { auto checksum = 0u; - const u8* u8_this = reinterpret_cast<const u8*>(this); - const u8* u8_m_checksum = reinterpret_cast<const u8*>(&m_checksum); + u8 const* u8_this = reinterpret_cast<u8 const*>(this); + u8 const* u8_m_checksum = reinterpret_cast<u8 const*>(&m_checksum); for (auto i = 0u; i < sizeof(TarFileHeader); ++i) { if (u8_this + i >= u8_m_checksum && u8_this + i < u8_m_checksum + sizeof(m_checksum)) { checksum += ' '; diff --git a/Userland/Libraries/LibArchive/Tar.h b/Userland/Libraries/LibArchive/Tar.h index 3310a6140b..f175b3a5e0 100644 --- a/Userland/Libraries/LibArchive/Tar.h +++ b/Userland/Libraries/LibArchive/Tar.h @@ -38,7 +38,7 @@ constexpr StringView posix1_tar_magic = ""; // POSIX.1-1988 format magic constexpr StringView posix1_tar_version = ""; // POSIX.1-1988 format version template<size_t N> -static size_t get_field_as_integral(const char (&field)[N]) +static size_t get_field_as_integral(char const (&field)[N]) { size_t value = 0; for (size_t i = 0; i < N; ++i) { @@ -53,7 +53,7 @@ static size_t get_field_as_integral(const char (&field)[N]) } template<size_t N> -static StringView get_field_as_string_view(const char (&field)[N]) +static StringView get_field_as_string_view(char const (&field)[N]) { return { field, min(__builtin_strlen(field), N) }; } @@ -95,23 +95,23 @@ public: // FIXME: support ustar filename prefix StringView prefix() const { return get_field_as_string_view(m_prefix); } - void set_filename(const String& filename) { set_field(m_filename, filename); } + void set_filename(String const& filename) { set_field(m_filename, filename); } void set_mode(mode_t mode) { set_octal_field(m_mode, mode); } void set_uid(uid_t uid) { set_octal_field(m_uid, uid); } void set_gid(gid_t gid) { set_octal_field(m_gid, gid); } void set_size(size_t size) { set_octal_field(m_size, size); } void set_timestamp(time_t timestamp) { set_octal_field(m_timestamp, timestamp); } void set_type_flag(TarFileType type) { m_type_flag = to_underlying(type); } - void set_link_name(const String& link_name) { set_field(m_link_name, link_name); } + void set_link_name(String const& link_name) { set_field(m_link_name, link_name); } // magic doesn't necessarily include a null byte void set_magic(StringView magic) { set_field(m_magic, magic); } // version doesn't necessarily include a null byte void set_version(StringView version) { set_field(m_version, version); } - void set_owner_name(const String& owner_name) { set_field(m_owner_name, owner_name); } - void set_group_name(const String& group_name) { set_field(m_group_name, group_name); } + void set_owner_name(String const& owner_name) { set_field(m_owner_name, owner_name); } + void set_group_name(String const& group_name) { set_field(m_group_name, group_name); } void set_major(int major) { set_octal_field(m_major, major); } void set_minor(int minor) { set_octal_field(m_minor, minor); } - void set_prefix(const String& prefix) { set_field(m_prefix, prefix); } + void set_prefix(String const& prefix) { set_field(m_prefix, prefix); } unsigned expected_checksum() const; void calculate_checksum(); diff --git a/Userland/Libraries/LibArchive/TarStream.cpp b/Userland/Libraries/LibArchive/TarStream.cpp index 2b12eea374..80945af341 100644 --- a/Userland/Libraries/LibArchive/TarStream.cpp +++ b/Userland/Libraries/LibArchive/TarStream.cpp @@ -128,7 +128,7 @@ TarOutputStream::TarOutputStream(OutputStream& stream) { } -void TarOutputStream::add_directory(const String& path, mode_t mode) +void TarOutputStream::add_directory(String const& path, mode_t mode) { VERIFY(!m_finished); TarFileHeader header {}; @@ -144,7 +144,7 @@ void TarOutputStream::add_directory(const String& path, mode_t mode) VERIFY(m_stream.write_or_error(Bytes { &padding, block_size - sizeof(header) })); } -void TarOutputStream::add_file(const String& path, mode_t mode, ReadonlyBytes bytes) +void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes bytes) { VERIFY(!m_finished); TarFileHeader header {}; diff --git a/Userland/Libraries/LibArchive/TarStream.h b/Userland/Libraries/LibArchive/TarStream.h index 5ffa04991e..a27c30c971 100644 --- a/Userland/Libraries/LibArchive/TarStream.h +++ b/Userland/Libraries/LibArchive/TarStream.h @@ -37,7 +37,7 @@ public: void advance(); bool finished() const { return m_finished; } bool valid() const; - const TarFileHeader& header() const { return m_header; } + TarFileHeader const& header() const { return m_header; } TarFileStream file_contents(); template<VoidFunction<StringView, StringView> F> @@ -56,8 +56,8 @@ private: class TarOutputStream { public: TarOutputStream(OutputStream&); - void add_file(const String& path, mode_t, ReadonlyBytes); - void add_directory(const String& path, mode_t); + void add_file(String const& path, mode_t, ReadonlyBytes); + void add_directory(String const& path, mode_t); void finish(); private: diff --git a/Userland/Libraries/LibArchive/Zip.cpp b/Userland/Libraries/LibArchive/Zip.cpp index d5aa5d112f..71d173bab3 100644 --- a/Userland/Libraries/LibArchive/Zip.cpp +++ b/Userland/Libraries/LibArchive/Zip.cpp @@ -80,7 +80,7 @@ Optional<Zip> Zip::try_create(ReadonlyBytes buffer) }; } -bool Zip::for_each_member(Function<IterationDecision(const ZipMember&)> callback) +bool Zip::for_each_member(Function<IterationDecision(ZipMember const&)> callback) { size_t member_offset = m_members_start_offset; for (size_t i = 0; i < m_member_count; i++) { @@ -119,7 +119,7 @@ static u16 minimum_version_needed(ZipCompressionMethod method) return method == ZipCompressionMethod::Deflate ? 20 : 10; } -void ZipOutputStream::add_member(const ZipMember& member) +void ZipOutputStream::add_member(ZipMember const& member) { VERIFY(!m_finished); VERIFY(member.name.length() <= UINT16_MAX); @@ -151,7 +151,7 @@ void ZipOutputStream::finish() auto file_header_offset = 0u; auto central_directory_size = 0u; - for (const ZipMember& member : m_members) { + for (ZipMember const& member : m_members) { auto zip_version = minimum_version_needed(member.compression_method); CentralDirectoryRecord central_directory_record { .made_by_version = zip_version, diff --git a/Userland/Libraries/LibArchive/Zip.h b/Userland/Libraries/LibArchive/Zip.h index 1575743154..95913f7b5c 100644 --- a/Userland/Libraries/LibArchive/Zip.h +++ b/Userland/Libraries/LibArchive/Zip.h @@ -42,7 +42,7 @@ struct [[gnu::packed]] EndOfCentralDirectory { u32 central_directory_size; u32 central_directory_offset; u16 comment_length; - const u8* comment; + u8 const* comment; bool read(ReadonlyBytes buffer) { @@ -103,9 +103,9 @@ struct [[gnu::packed]] CentralDirectoryRecord { u16 internal_attributes; u32 external_attributes; u32 local_file_header_offset; - const u8* name; - const u8* extra_data; - const u8* comment; + u8 const* name; + u8 const* extra_data; + u8 const* comment; bool read(ReadonlyBytes buffer) { @@ -167,9 +167,9 @@ struct [[gnu::packed]] LocalFileHeader { u32 uncompressed_size; u16 name_length; u16 extra_data_length; - const u8* name; - const u8* extra_data; - const u8* compressed_data; + u8 const* name; + u8 const* extra_data; + u8 const* compressed_data; bool read(ReadonlyBytes buffer) { @@ -218,7 +218,7 @@ struct ZipMember { class Zip { public: static Optional<Zip> try_create(ReadonlyBytes buffer); - bool for_each_member(Function<IterationDecision(const ZipMember&)>); + bool for_each_member(Function<IterationDecision(ZipMember const&)>); private: static bool find_end_of_central_directory_offset(ReadonlyBytes, size_t& offset); @@ -237,7 +237,7 @@ private: class ZipOutputStream { public: ZipOutputStream(OutputStream&); - void add_member(const ZipMember&); + void add_member(ZipMember const&); void finish(); private: diff --git a/Userland/Libraries/LibAudio/Buffer.h b/Userland/Libraries/LibAudio/Buffer.h index 536d313998..cb05a06219 100644 --- a/Userland/Libraries/LibAudio/Buffer.h +++ b/Userland/Libraries/LibAudio/Buffer.h @@ -47,7 +47,7 @@ public: return MUST(adopt_nonnull_ref_or_enomem(new (nothrow) Buffer)); } - Sample const* samples() const { return (const Sample*)data(); } + Sample const* samples() const { return (Sample const*)data(); } ErrorOr<FixedArray<Sample>> to_sample_array() const { @@ -86,7 +86,7 @@ private: Core::AnonymousBuffer m_buffer; const i32 m_id { -1 }; - const int m_sample_count { 0 }; + int const m_sample_count { 0 }; }; // This only works for double resamplers, and therefore cannot be part of the class diff --git a/Userland/Libraries/LibAudio/FlacLoader.h b/Userland/Libraries/LibAudio/FlacLoader.h index fdd19a8182..23f1fba00f 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.h +++ b/Userland/Libraries/LibAudio/FlacLoader.h @@ -101,7 +101,7 @@ private: u16 m_min_block_size { 0 }; u16 m_max_block_size { 0 }; // Frames are units of encoded audio data, both of these are 24-bit - u32 m_min_frame_size { 0 }; //24 bit + u32 m_min_frame_size { 0 }; // 24 bit u32 m_max_frame_size { 0 }; // 24 bit u64 m_total_samples { 0 }; // 36 bit u8 m_md5_checksum[128 / 8]; // 128 bit (!) diff --git a/Userland/Libraries/LibAudio/Loader.h b/Userland/Libraries/LibAudio/Loader.h index 0294bba603..bca513c083 100644 --- a/Userland/Libraries/LibAudio/Loader.h +++ b/Userland/Libraries/LibAudio/Loader.h @@ -35,7 +35,7 @@ public: virtual MaybeLoaderError reset() = 0; - virtual MaybeLoaderError seek(const int sample_index) = 0; + virtual MaybeLoaderError seek(int const sample_index) = 0; // total_samples() and loaded_samples() should be independent // of the number of channels. @@ -63,7 +63,7 @@ public: LoaderSamples get_more_samples(size_t max_bytes_to_read_from_input = 128 * KiB) const { return m_plugin->get_more_samples(max_bytes_to_read_from_input); } MaybeLoaderError reset() const { return m_plugin->reset(); } - MaybeLoaderError seek(const int position) const { return m_plugin->seek(position); } + MaybeLoaderError seek(int const position) const { return m_plugin->seek(position); } int loaded_samples() const { return m_plugin->loaded_samples(); } int total_samples() const { return m_plugin->total_samples(); } diff --git a/Userland/Libraries/LibAudio/MP3HuffmanTables.h b/Userland/Libraries/LibAudio/MP3HuffmanTables.h index e07a91eabb..674d8d402b 100644 --- a/Userland/Libraries/LibAudio/MP3HuffmanTables.h +++ b/Userland/Libraries/LibAudio/MP3HuffmanTables.h @@ -112,7 +112,7 @@ HuffmanDecodeResult<T> huffman_decode(InputBitStream& bitstream, Span<HuffmanNod size_t bits_read = 0; while (!node->is_leaf() && !bitstream.has_any_error() && max_bits_to_read-- > 0) { - const bool direction = bitstream.read_bit_big_endian(); + bool const direction = bitstream.read_bit_big_endian(); ++bits_read; if (direction) { if (node->left == -1) diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index 69a556cb6d..6168cf5926 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -36,7 +36,7 @@ MaybeLoaderError WavLoaderPlugin::initialize() return {}; } -WavLoaderPlugin::WavLoaderPlugin(const Bytes& buffer) +WavLoaderPlugin::WavLoaderPlugin(Bytes const& buffer) { m_stream = make<InputMemoryStream>(buffer); if (!m_stream) { @@ -91,7 +91,7 @@ LoaderSamples WavLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_in return buffer.release_value(); } -MaybeLoaderError WavLoaderPlugin::seek(const int sample_index) +MaybeLoaderError WavLoaderPlugin::seek(int const sample_index) { dbgln_if(AWAVLOADER_DEBUG, "seek sample_index {}", sample_index); if (sample_index < 0 || sample_index >= m_total_samples) diff --git a/Userland/Libraries/LibAudio/WavLoader.h b/Userland/Libraries/LibAudio/WavLoader.h index bb6cea82df..50e97b5648 100644 --- a/Userland/Libraries/LibAudio/WavLoader.h +++ b/Userland/Libraries/LibAudio/WavLoader.h @@ -34,7 +34,7 @@ class Buffer; class WavLoaderPlugin : public LoaderPlugin { public: explicit WavLoaderPlugin(StringView path); - explicit WavLoaderPlugin(const Bytes& buffer); + explicit WavLoaderPlugin(Bytes const& buffer); virtual MaybeLoaderError initialize() override; @@ -46,7 +46,7 @@ public: // sample_index 0 is the start of the raw audio sample data // within the file/stream. - virtual MaybeLoaderError seek(const int sample_index) override; + virtual MaybeLoaderError seek(int const sample_index) override; virtual int loaded_samples() override { return m_loaded_samples; } virtual int total_samples() override { return m_total_samples; } diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp index 4428a38f9d..4ba2524797 100644 --- a/Userland/Libraries/LibAudio/WavWriter.cpp +++ b/Userland/Libraries/LibAudio/WavWriter.cpp @@ -40,7 +40,7 @@ void WavWriter::set_file(StringView path) m_finalized = false; } -void WavWriter::write_samples(const u8* samples, size_t size) +void WavWriter::write_samples(u8 const* samples, size_t size) { m_data_sz += size; m_file->write(samples, size); diff --git a/Userland/Libraries/LibAudio/WavWriter.h b/Userland/Libraries/LibAudio/WavWriter.h index d36059ab12..bfb06caf6f 100644 --- a/Userland/Libraries/LibAudio/WavWriter.h +++ b/Userland/Libraries/LibAudio/WavWriter.h @@ -22,9 +22,9 @@ public: ~WavWriter(); bool has_error() const { return !m_error_string.is_null(); } - const char* error_string() const { return m_error_string.characters(); } + char const* error_string() const { return m_error_string.characters(); } - void write_samples(const u8* samples, size_t size); + void write_samples(u8 const* samples, size_t size); void finalize(); // You can finalize manually or let the destructor do it. u32 sample_rate() const { return m_sample_rate; } diff --git a/Userland/Libraries/LibC/arpa/inet.cpp b/Userland/Libraries/LibC/arpa/inet.cpp index ca669086af..86c6f307a6 100644 --- a/Userland/Libraries/LibC/arpa/inet.cpp +++ b/Userland/Libraries/LibC/arpa/inet.cpp @@ -12,16 +12,16 @@ extern "C" { -const char* inet_ntop(int af, const void* src, char* dst, socklen_t len) +char const* inet_ntop(int af, void const* src, char* dst, socklen_t len) { if (af == AF_INET) { if (len < INET_ADDRSTRLEN) { errno = ENOSPC; return nullptr; } - auto* bytes = (const unsigned char*)src; + auto* bytes = (unsigned char const*)src; snprintf(dst, len, "%u.%u.%u.%u", bytes[0], bytes[1], bytes[2], bytes[3]); - return (const char*)dst; + return (char const*)dst; } else if (af == AF_INET6) { if (len < INET6_ADDRSTRLEN) { errno = ENOSPC; @@ -32,14 +32,14 @@ const char* inet_ntop(int af, const void* src, char* dst, socklen_t len) errno = ENOSPC; return nullptr; } - return (const char*)dst; + return (char const*)dst; } errno = EAFNOSUPPORT; return nullptr; } -int inet_pton(int af, const char* src, void* dst) +int inet_pton(int af, char const* src, void* dst) { if (af == AF_INET) { unsigned a, b, c, d; @@ -78,7 +78,7 @@ int inet_pton(int af, const char* src, void* dst) return -1; } -in_addr_t inet_addr(const char* str) +in_addr_t inet_addr(char const* str) { in_addr_t tmp {}; int rc = inet_pton(AF_INET, str, &tmp); diff --git a/Userland/Libraries/LibC/arpa/inet.h b/Userland/Libraries/LibC/arpa/inet.h index 3ba673731f..b5c4d64a0d 100644 --- a/Userland/Libraries/LibC/arpa/inet.h +++ b/Userland/Libraries/LibC/arpa/inet.h @@ -16,10 +16,10 @@ __BEGIN_DECLS #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 -const char* inet_ntop(int af, const void* src, char* dst, socklen_t); -int inet_pton(int af, const char* src, void* dst); +char const* inet_ntop(int af, void const* src, char* dst, socklen_t); +int inet_pton(int af, char const* src, void* dst); -static inline int inet_aton(const char* cp, struct in_addr* inp) +static inline int inet_aton(char const* cp, struct in_addr* inp) { return inet_pton(AF_INET, cp, inp); } diff --git a/Userland/Libraries/LibC/assert.cpp b/Userland/Libraries/LibC/assert.cpp index 20f0f2dc36..31145f26eb 100644 --- a/Userland/Libraries/LibC/assert.cpp +++ b/Userland/Libraries/LibC/assert.cpp @@ -17,7 +17,7 @@ extern "C" { extern bool __stdio_is_initialized; -void __assertion_failed(const char* msg) +void __assertion_failed(char const* msg) { if (__heap_is_stable) { dbgln("ASSERTION FAILED: {}", msg); diff --git a/Userland/Libraries/LibC/assert.h b/Userland/Libraries/LibC/assert.h index c64b51ecd0..b90b115cf6 100644 --- a/Userland/Libraries/LibC/assert.h +++ b/Userland/Libraries/LibC/assert.h @@ -22,7 +22,7 @@ __BEGIN_DECLS #ifndef NDEBUG -__attribute__((noreturn)) void __assertion_failed(const char* msg); +__attribute__((noreturn)) void __assertion_failed(char const* msg); # define assert(expr) \ (__builtin_expect(!(expr), 0) \ ? __assertion_failed(#expr "\n" __FILE__ ":" __stringify(__LINE__)) \ diff --git a/Userland/Libraries/LibC/bits/pthread_forward.h b/Userland/Libraries/LibC/bits/pthread_forward.h index 21f60072a5..3480383db2 100644 --- a/Userland/Libraries/LibC/bits/pthread_forward.h +++ b/Userland/Libraries/LibC/bits/pthread_forward.h @@ -19,7 +19,7 @@ struct PthreadFunctions { int (*pthread_once)(pthread_once_t*, void (*)(void)); int (*pthread_cond_broadcast)(pthread_cond_t*); - int (*pthread_cond_init)(pthread_cond_t*, const pthread_condattr_t*); + int (*pthread_cond_init)(pthread_cond_t*, pthread_condattr_t const*); int (*pthread_cond_signal)(pthread_cond_t*); int (*pthread_cond_wait)(pthread_cond_t*, pthread_mutex_t*); int (*pthread_cond_destroy)(pthread_cond_t*); diff --git a/Userland/Libraries/LibC/bits/pthread_integration.h b/Userland/Libraries/LibC/bits/pthread_integration.h index bbc7e820de..85147c4254 100644 --- a/Userland/Libraries/LibC/bits/pthread_integration.h +++ b/Userland/Libraries/LibC/bits/pthread_integration.h @@ -18,7 +18,7 @@ void __pthread_fork_atfork_register_prepare(void (*)(void)); void __pthread_fork_atfork_register_parent(void (*)(void)); void __pthread_fork_atfork_register_child(void (*)(void)); -int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*); +int __pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t const*); int __pthread_mutex_lock(pthread_mutex_t*); int __pthread_mutex_trylock(pthread_mutex_t*); int __pthread_mutex_lock_pessimistic_np(pthread_mutex_t*); @@ -29,7 +29,7 @@ typedef void (*KeyDestructor)(void*); int __pthread_key_create(pthread_key_t*, KeyDestructor); int __pthread_key_delete(pthread_key_t); void* __pthread_getspecific(pthread_key_t); -int __pthread_setspecific(pthread_key_t, const void*); +int __pthread_setspecific(pthread_key_t, void const*); int __pthread_self(void); diff --git a/Userland/Libraries/LibC/bits/search.h b/Userland/Libraries/LibC/bits/search.h index 9c68cd8a93..5807267ad9 100644 --- a/Userland/Libraries/LibC/bits/search.h +++ b/Userland/Libraries/LibC/bits/search.h @@ -9,10 +9,10 @@ // This is technically an implementation detail, but we require this for testing. // The key always has to be the first struct member. struct search_tree_node { - const void* key; + void const* key; struct search_tree_node* left; struct search_tree_node* right; }; -struct search_tree_node* new_tree_node(const void* key); +struct search_tree_node* new_tree_node(void const* key); void delete_node_recursive(struct search_tree_node* node); diff --git a/Userland/Libraries/LibC/bits/stdio_file_implementation.h b/Userland/Libraries/LibC/bits/stdio_file_implementation.h index 7181d7e96b..173e88f44d 100644 --- a/Userland/Libraries/LibC/bits/stdio_file_implementation.h +++ b/Userland/Libraries/LibC/bits/stdio_file_implementation.h @@ -46,7 +46,7 @@ public: void clear_err() { m_error = 0; } size_t read(u8*, size_t); - size_t write(const u8*, size_t); + size_t write(u8 const*, size_t); template<typename CharType> bool gets(CharType*, size_t); @@ -84,7 +84,7 @@ private: bool is_not_empty() const { return m_ungotten || !m_empty; } size_t buffered_size() const; - const u8* begin_dequeue(size_t& available_size) const; + u8 const* begin_dequeue(size_t& available_size) const; void did_dequeue(size_t actual_size); u8* begin_enqueue(size_t& available_size) const; @@ -114,7 +114,7 @@ private: // Read or write using the underlying fd, bypassing the buffer. ssize_t do_read(u8*, size_t); - ssize_t do_write(const u8*, size_t); + ssize_t do_write(u8 const*, size_t); // Read some data into the buffer. bool read_into_buffer(); diff --git a/Userland/Libraries/LibC/ctype.cpp b/Userland/Libraries/LibC/ctype.cpp index 9ea35ac642..81a69a8bce 100644 --- a/Userland/Libraries/LibC/ctype.cpp +++ b/Userland/Libraries/LibC/ctype.cpp @@ -8,7 +8,7 @@ extern "C" { -const char _ctype_[256] = { +char const _ctype_[256] = { _C, _C, _C, _C, _C, _C, _C, _C, _C, _C | _S, _C | _S, _C | _S, _C | _S, _C | _S, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, diff --git a/Userland/Libraries/LibC/ctype.h b/Userland/Libraries/LibC/ctype.h index 64faf788e5..b7493b8138 100644 --- a/Userland/Libraries/LibC/ctype.h +++ b/Userland/Libraries/LibC/ctype.h @@ -20,7 +20,7 @@ __BEGIN_DECLS #define _X 0100 #define _B 0200 -extern const char _ctype_[256]; +extern char const _ctype_[256]; static inline int __inline_isalnum(int c) { diff --git a/Userland/Libraries/LibC/dirent.cpp b/Userland/Libraries/LibC/dirent.cpp index 35d6ce394b..a1bd95774f 100644 --- a/Userland/Libraries/LibC/dirent.cpp +++ b/Userland/Libraries/LibC/dirent.cpp @@ -22,7 +22,7 @@ extern "C" { // https://pubs.opengroup.org/onlinepubs/9699919799/functions/opendir.html -DIR* opendir(const char* name) +DIR* opendir(char const* name) { int fd = open(name, O_RDONLY | O_DIRECTORY); if (fd == -1) @@ -229,7 +229,7 @@ int alphasort(const struct dirent** d1, const struct dirent** d2) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/scandir.html -int scandir(const char* dir_name, +int scandir(char const* dir_name, struct dirent*** namelist, int (*select)(const struct dirent*), int (*compare)(const struct dirent**, const struct dirent**)) @@ -273,10 +273,10 @@ int scandir(const char* dir_name, // Sort the entries if the user provided a comparator. if (compare) { - qsort(tmp_names.data(), tmp_names.size(), sizeof(struct dirent*), (int (*)(const void*, const void*))compare); + qsort(tmp_names.data(), tmp_names.size(), sizeof(struct dirent*), (int (*)(void const*, void const*))compare); } - const int size = tmp_names.size(); + int const size = tmp_names.size(); auto** names = static_cast<struct dirent**>(kmalloc_array(size, sizeof(struct dirent*))); if (names == nullptr) { return -1; diff --git a/Userland/Libraries/LibC/dirent.h b/Userland/Libraries/LibC/dirent.h index 7d0b1bf2d2..1d132a3db1 100644 --- a/Userland/Libraries/LibC/dirent.h +++ b/Userland/Libraries/LibC/dirent.h @@ -28,7 +28,7 @@ struct __DIR { typedef struct __DIR DIR; DIR* fdopendir(int fd); -DIR* opendir(const char* name); +DIR* opendir(char const* name); int closedir(DIR*); void rewinddir(DIR*); struct dirent* readdir(DIR*); @@ -36,7 +36,7 @@ int readdir_r(DIR*, struct dirent*, struct dirent**); int dirfd(DIR*); int alphasort(const struct dirent** d1, const struct dirent** d2); -int scandir(const char* dirp, struct dirent*** namelist, +int scandir(char const* dirp, struct dirent*** namelist, int (*filter)(const struct dirent*), int (*compar)(const struct dirent**, const struct dirent**)); diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index 01c497259e..d61dc831d2 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -145,7 +145,7 @@ typedef struct elfhdr { Elf32_Half e_shentsize; /* section header entry size */ Elf32_Half e_shnum; /* number of section header entries */ Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ + header string table" entry offset */ } Elf32_Ehdr; typedef struct { @@ -223,7 +223,7 @@ typedef struct { /* Section Header */ typedef struct { Elf32_Word sh_name; /* name - index into section header - string table section */ + string table section */ Elf32_Word sh_type; /* type */ Elf32_Word sh_flags; /* flags */ Elf32_Addr sh_addr; /* address */ diff --git a/Userland/Libraries/LibC/errno.h b/Userland/Libraries/LibC/errno.h index 75b75ddf63..ad4b251366 100644 --- a/Userland/Libraries/LibC/errno.h +++ b/Userland/Libraries/LibC/errno.h @@ -20,7 +20,7 @@ __BEGIN_DECLS -extern const char* const sys_errlist[]; +extern char const* const sys_errlist[]; extern int sys_nerr; #ifdef NO_TLS diff --git a/Userland/Libraries/LibC/fcntl.cpp b/Userland/Libraries/LibC/fcntl.cpp index 47805d0a44..5c1ed89ded 100644 --- a/Userland/Libraries/LibC/fcntl.cpp +++ b/Userland/Libraries/LibC/fcntl.cpp @@ -30,7 +30,7 @@ int create_inode_watcher(unsigned flags) __RETURN_WITH_ERRNO(rc, rc, -1); } -int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask) +int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask) { Syscall::SC_inode_watcher_add_watch_params params { { path, path_length }, fd, event_mask }; int rc = syscall(SC_inode_watcher_add_watch, ¶ms); @@ -43,12 +43,12 @@ int inode_watcher_remove_watch(int fd, int wd) __RETURN_WITH_ERRNO(rc, rc, -1); } -int creat(const char* path, mode_t mode) +int creat(char const* path, mode_t mode) { return open(path, O_CREAT | O_WRONLY | O_TRUNC, mode); } -int open(const char* path, int options, ...) +int open(char const* path, int options, ...) { if (!path) { errno = EFAULT; @@ -68,7 +68,7 @@ int open(const char* path, int options, ...) __RETURN_WITH_ERRNO(rc, rc, -1); } -int openat(int dirfd, const char* path, int options, ...) +int openat(int dirfd, char const* path, int options, ...) { if (!path) { errno = EFAULT; diff --git a/Userland/Libraries/LibC/fcntl.h b/Userland/Libraries/LibC/fcntl.h index 7056d874a9..ae1e290824 100644 --- a/Userland/Libraries/LibC/fcntl.h +++ b/Userland/Libraries/LibC/fcntl.h @@ -11,13 +11,13 @@ __BEGIN_DECLS -int creat(const char* path, mode_t); -int open(const char* path, int options, ...); -int openat(int dirfd, const char* path, int options, ...); +int creat(char const* path, mode_t); +int open(char const* path, int options, ...); +int openat(int dirfd, char const* path, int options, ...); int fcntl(int fd, int cmd, ...); int create_inode_watcher(unsigned flags); -int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask); +int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask); int inode_watcher_remove_watch(int fd, int wd); __END_DECLS diff --git a/Userland/Libraries/LibC/fenv.cpp b/Userland/Libraries/LibC/fenv.cpp index a9f057f25e..d4dc20d98a 100644 --- a/Userland/Libraries/LibC/fenv.cpp +++ b/Userland/Libraries/LibC/fenv.cpp @@ -61,7 +61,7 @@ int fegetenv(fenv_t* env) return 0; } -int fesetenv(const fenv_t* env) +int fesetenv(fenv_t const* env) { if (!env) return 1; @@ -96,7 +96,7 @@ int feholdexcept(fenv_t* env) return 0; } -int feupdateenv(const fenv_t* env) +int feupdateenv(fenv_t const* env) { auto currently_raised_exceptions = fetestexcept(FE_ALL_EXCEPT); @@ -113,7 +113,7 @@ int fegetexceptflag(fexcept_t* except, int exceptions) *except = (uint16_t)fetestexcept(exceptions); return 0; } -int fesetexceptflag(const fexcept_t* except, int exceptions) +int fesetexceptflag(fexcept_t const* except, int exceptions) { if (!except) return 1; diff --git a/Userland/Libraries/LibC/fenv.h b/Userland/Libraries/LibC/fenv.h index 415223d289..f5f1d8f7e6 100644 --- a/Userland/Libraries/LibC/fenv.h +++ b/Userland/Libraries/LibC/fenv.h @@ -32,12 +32,12 @@ typedef struct fenv_t { uint32_t __mxcsr; } fenv_t; -#define FE_DFL_ENV ((const fenv_t*)-1) +#define FE_DFL_ENV ((fenv_t const*)-1) int fegetenv(fenv_t*); -int fesetenv(const fenv_t*); +int fesetenv(fenv_t const*); int feholdexcept(fenv_t*); -int feupdateenv(const fenv_t*); +int feupdateenv(fenv_t const*); #define FE_INVALID 1u << 0 #define FE_DIVBYZERO 1u << 2 @@ -48,7 +48,7 @@ int feupdateenv(const fenv_t*); typedef uint16_t fexcept_t; int fegetexceptflag(fexcept_t*, int exceptions); -int fesetexceptflag(const fexcept_t*, int exceptions); +int fesetexceptflag(fexcept_t const*, int exceptions); int feclearexcept(int exceptions); int fetestexcept(int exceptions); diff --git a/Userland/Libraries/LibC/getopt.cpp b/Userland/Libraries/LibC/getopt.cpp index addfa3e63e..9c3e97ee84 100644 --- a/Userland/Libraries/LibC/getopt.cpp +++ b/Userland/Libraries/LibC/getopt.cpp @@ -22,7 +22,7 @@ char* optarg = nullptr; // processed". Well, this is how we do it. static size_t s_index_into_multioption_argument = 0; -[[gnu::format(printf, 1, 2)]] static inline void report_error(const char* format, ...) +[[gnu::format(printf, 1, 2)]] static inline void report_error(char const* format, ...) { if (!opterr) return; @@ -41,14 +41,14 @@ namespace { class OptionParser { public: - OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index = nullptr); + OptionParser(int argc, char* const* argv, StringView short_options, option const* long_options, int* out_long_option_index = nullptr); int getopt(); private: bool lookup_short_option(char option, int& needs_value) const; int handle_short_option(); - const option* lookup_long_option(char* raw) const; + option const* lookup_long_option(char* raw) const; int handle_long_option(); void shift_argv(); @@ -57,7 +57,7 @@ private: size_t m_argc { 0 }; char* const* m_argv { nullptr }; StringView m_short_options; - const option* m_long_options { nullptr }; + option const* m_long_options { nullptr }; int* m_out_long_option_index { nullptr }; bool m_stop_on_first_non_option { false }; @@ -65,7 +65,7 @@ private: size_t m_consumed_args { 0 }; }; -OptionParser::OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index) +OptionParser::OptionParser(int argc, char* const* argv, StringView short_options, option const* long_options, int* out_long_option_index) : m_argc(argc) , m_argv(argv) , m_short_options(short_options) @@ -204,7 +204,7 @@ int OptionParser::handle_short_option() return option; } -const option* OptionParser::lookup_long_option(char* raw) const +option const* OptionParser::lookup_long_option(char* raw) const { StringView arg = raw; @@ -336,14 +336,14 @@ bool OptionParser::find_next_option() } -int getopt(int argc, char* const* argv, const char* short_options) +int getopt(int argc, char* const* argv, char const* short_options) { option dummy { nullptr, 0, nullptr, 0 }; OptionParser parser { argc, argv, short_options, &dummy }; return parser.getopt(); } -int getopt_long(int argc, char* const* argv, const char* short_options, const struct option* long_options, int* out_long_option_index) +int getopt_long(int argc, char* const* argv, char const* short_options, const struct option* long_options, int* out_long_option_index) { OptionParser parser { argc, argv, short_options, long_options, out_long_option_index }; return parser.getopt(); diff --git a/Userland/Libraries/LibC/getopt.h b/Userland/Libraries/LibC/getopt.h index 4649322bce..f5fca0c682 100644 --- a/Userland/Libraries/LibC/getopt.h +++ b/Userland/Libraries/LibC/getopt.h @@ -15,7 +15,7 @@ __BEGIN_DECLS #define optional_argument 2 struct option { - const char* name; + char const* name; int has_arg; int* flag; int val; @@ -26,6 +26,6 @@ extern int optopt; extern int optind; extern int optreset; extern char* optarg; -int getopt_long(int argc, char* const* argv, const char* short_options, const struct option* long_options, int* out_long_option_index); +int getopt_long(int argc, char* const* argv, char const* short_options, const struct option* long_options, int* out_long_option_index); __END_DECLS diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp index 9a4d55ca05..676be6b1c3 100644 --- a/Userland/Libraries/LibC/grp.cpp +++ b/Userland/Libraries/LibC/grp.cpp @@ -24,7 +24,7 @@ static struct group s_group; static String s_name; static String s_passwd; static Vector<String> s_members; -static Vector<const char*> s_members_ptrs; +static Vector<char const*> s_members_ptrs; void setgrent() { @@ -65,7 +65,7 @@ struct group* getgrgid(gid_t gid) return nullptr; } -struct group* getgrnam(const char* name) +struct group* getgrnam(char const* name) { setgrent(); while (auto* gr = getgrent()) { @@ -75,7 +75,7 @@ struct group* getgrnam(const char* name) return nullptr; } -static bool parse_grpdb_entry(const String& line) +static bool parse_grpdb_entry(String const& line) { auto parts = line.split_view(':', true); if (parts.size() != 4) { @@ -140,7 +140,7 @@ struct group* getgrent() } } -int initgroups(const char* user, gid_t extra_gid) +int initgroups(char const* user, gid_t extra_gid) { size_t count = 0; gid_t gids[32]; @@ -169,7 +169,7 @@ int putgrent(const struct group* group, FILE* stream) return -1; } - auto is_valid_field = [](const char* str) { + auto is_valid_field = [](char const* str) { return str && !strpbrk(str, ":\n"); }; diff --git a/Userland/Libraries/LibC/grp.h b/Userland/Libraries/LibC/grp.h index 20df7747c7..8fefd99811 100644 --- a/Userland/Libraries/LibC/grp.h +++ b/Userland/Libraries/LibC/grp.h @@ -23,10 +23,10 @@ struct group { struct group* getgrent(void); void setgrent(void); void endgrent(void); -struct group* getgrnam(const char* name); +struct group* getgrnam(char const* name); struct group* getgrgid(gid_t); int putgrent(const struct group*, FILE*); -int initgroups(const char* user, gid_t); +int initgroups(char const* user, gid_t); __END_DECLS diff --git a/Userland/Libraries/LibC/iconv.h b/Userland/Libraries/LibC/iconv.h index 5f86bfa960..925e045fc5 100644 --- a/Userland/Libraries/LibC/iconv.h +++ b/Userland/Libraries/LibC/iconv.h @@ -13,7 +13,7 @@ __BEGIN_DECLS typedef void* iconv_t; -extern iconv_t iconv_open(const char* tocode, const char* fromcode); +extern iconv_t iconv_open(char const* tocode, char const* fromcode); extern size_t iconv(iconv_t, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft); extern int iconv_close(iconv_t); diff --git a/Userland/Libraries/LibC/inttypes.cpp b/Userland/Libraries/LibC/inttypes.cpp index b55e1aa964..c4160ad4da 100644 --- a/Userland/Libraries/LibC/inttypes.cpp +++ b/Userland/Libraries/LibC/inttypes.cpp @@ -25,7 +25,7 @@ imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator) return result; } -intmax_t strtoimax(const char* str, char** endptr, int base) +intmax_t strtoimax(char const* str, char** endptr, int base) { long long_value = strtoll(str, endptr, base); @@ -42,7 +42,7 @@ intmax_t strtoimax(const char* str, char** endptr, int base) return long_value; } -uintmax_t strtoumax(const char* str, char** endptr, int base) +uintmax_t strtoumax(char const* str, char** endptr, int base) { unsigned long ulong_value = strtoull(str, endptr, base); diff --git a/Userland/Libraries/LibC/inttypes.h b/Userland/Libraries/LibC/inttypes.h index d4ae75c719..8755cbd62e 100644 --- a/Userland/Libraries/LibC/inttypes.h +++ b/Userland/Libraries/LibC/inttypes.h @@ -102,7 +102,7 @@ typedef struct imaxdiv_t { } imaxdiv_t; imaxdiv_t imaxdiv(intmax_t, intmax_t); -intmax_t strtoimax(const char*, char** endptr, int base); -uintmax_t strtoumax(const char*, char** endptr, int base); +intmax_t strtoimax(char const*, char** endptr, int base); +uintmax_t strtoumax(char const*, char** endptr, int base); __END_DECLS diff --git a/Userland/Libraries/LibC/langinfo.cpp b/Userland/Libraries/LibC/langinfo.cpp index 912dce3f4c..a44f70afe1 100644 --- a/Userland/Libraries/LibC/langinfo.cpp +++ b/Userland/Libraries/LibC/langinfo.cpp @@ -8,7 +8,7 @@ #include <langinfo.h> // Values taken from glibc's en_US locale files. -static const char* __nl_langinfo(nl_item item) +static char const* __nl_langinfo(nl_item item) { switch (item) { case CODESET: diff --git a/Userland/Libraries/LibC/link.h b/Userland/Libraries/LibC/link.h index 73ad8ad07f..eaa28ec4de 100644 --- a/Userland/Libraries/LibC/link.h +++ b/Userland/Libraries/LibC/link.h @@ -18,7 +18,7 @@ __BEGIN_DECLS struct dl_phdr_info { ElfW(Addr) dlpi_addr; - const char* dlpi_name; + char const* dlpi_name; const ElfW(Phdr) * dlpi_phdr; ElfW(Half) dlpi_phnum; }; diff --git a/Userland/Libraries/LibC/locale.cpp b/Userland/Libraries/LibC/locale.cpp index 8eca939fb7..06cbcdb6ce 100644 --- a/Userland/Libraries/LibC/locale.cpp +++ b/Userland/Libraries/LibC/locale.cpp @@ -45,7 +45,7 @@ static struct lconv default_locale = { default_empty_value }; -char* setlocale(int, const char*) +char* setlocale(int, char const*) { static char locale[2]; memcpy(locale, "C", 2); diff --git a/Userland/Libraries/LibC/locale.h b/Userland/Libraries/LibC/locale.h index 7d4069ecba..0fe99ba7d8 100644 --- a/Userland/Libraries/LibC/locale.h +++ b/Userland/Libraries/LibC/locale.h @@ -55,6 +55,6 @@ struct lconv { }; struct lconv* localeconv(void); -char* setlocale(int category, const char* locale); +char* setlocale(int category, char const* locale); __END_DECLS diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp index f67dc0b4f3..5b3e7add2b 100644 --- a/Userland/Libraries/LibC/malloc.cpp +++ b/Userland/Libraries/LibC/malloc.cpp @@ -56,25 +56,25 @@ static bool s_scrub_free = true; static bool s_profiling = false; static bool s_in_userspace_emulator = false; -ALWAYS_INLINE static void ue_notify_malloc(const void* ptr, size_t size) +ALWAYS_INLINE static void ue_notify_malloc(void const* ptr, size_t size) { if (s_in_userspace_emulator) syscall(SC_emuctl, 1, size, (FlatPtr)ptr); } -ALWAYS_INLINE static void ue_notify_free(const void* ptr) +ALWAYS_INLINE static void ue_notify_free(void const* ptr) { if (s_in_userspace_emulator) syscall(SC_emuctl, 2, (FlatPtr)ptr, 0); } -ALWAYS_INLINE static void ue_notify_realloc(const void* ptr, size_t size) +ALWAYS_INLINE static void ue_notify_realloc(void const* ptr, size_t size) { if (s_in_userspace_emulator) syscall(SC_emuctl, 3, size, (FlatPtr)ptr); } -ALWAYS_INLINE static void ue_notify_chunk_size_changed(const void* block, size_t chunk_size) +ALWAYS_INLINE static void ue_notify_chunk_size_changed(void const* block, size_t chunk_size) { if (s_in_userspace_emulator) syscall(SC_emuctl, 4, chunk_size, (FlatPtr)block); @@ -176,7 +176,7 @@ static BigAllocator* big_allocator_for_size(size_t size) extern "C" { -static void* os_alloc(size_t size, const char* name) +static void* os_alloc(size_t size, char const* name) { int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_PURGEABLE; #if ARCH(X86_64) @@ -525,7 +525,7 @@ size_t malloc_size(void const* ptr) if (!ptr) return 0; void* page_base = (void*)((FlatPtr)ptr & ChunkedBlock::block_mask); - auto* header = (const CommonHeader*)page_base; + auto* header = (CommonHeader const*)page_base; auto size = header->m_size; if (header->m_magic == MAGIC_BIGALLOC_HEADER) size -= sizeof(BigAllocationBlock); diff --git a/Userland/Libraries/LibC/net.cpp b/Userland/Libraries/LibC/net.cpp index aa76ec0a6c..9a6b113529 100644 --- a/Userland/Libraries/LibC/net.cpp +++ b/Userland/Libraries/LibC/net.cpp @@ -11,7 +11,7 @@ const in6_addr in6addr_any = IN6ADDR_ANY_INIT; const in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; -unsigned int if_nametoindex([[maybe_unused]] const char* ifname) +unsigned int if_nametoindex([[maybe_unused]] char const* ifname) { errno = ENODEV; return -1; diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 6dc38f2ca4..45b13b39e1 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -37,9 +37,9 @@ static constexpr u32 lookup_server_endpoint_magic = "LookupServer"sv.hash(); // Get service entry buffers and file information for the getservent() family of functions. static FILE* services_file = nullptr; -static const char* services_path = "/etc/services"; +static char const* services_path = "/etc/services"; -static bool fill_getserv_buffers(const char* line, ssize_t read); +static bool fill_getserv_buffers(char const* line, ssize_t read); static servent __getserv_buffer; static String __getserv_name_buffer; static String __getserv_protocol_buffer; @@ -51,9 +51,9 @@ static ssize_t service_file_offset = 0; // Get protocol entry buffers and file information for the getprotent() family of functions. static FILE* protocols_file = nullptr; -static const char* protocols_path = "/etc/protocols"; +static char const* protocols_path = "/etc/protocols"; -static bool fill_getproto_buffers(const char* line, ssize_t read); +static bool fill_getproto_buffers(char const* line, ssize_t read); static protoent __getproto_buffer; static String __getproto_name_buffer; static Vector<ByteBuffer> __getproto_alias_list_buffer; @@ -75,7 +75,7 @@ static int connect_to_lookup_server() "/tmp/portal/lookup" }; - if (connect(fd, (const sockaddr*)&address, sizeof(address)) < 0) { + if (connect(fd, (sockaddr const*)&address, sizeof(address)) < 0) { perror("connect_to_lookup_server"); close(fd); return -1; @@ -85,7 +85,7 @@ static int connect_to_lookup_server() static String gethostbyname_name_buffer; -hostent* gethostbyname(const char* name) +hostent* gethostbyname(char const* name) { h_errno = 0; @@ -205,7 +205,7 @@ hostent* gethostbyname(const char* name) static String gethostbyaddr_name_buffer; -hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) +hostent* gethostbyaddr(void const* addr, socklen_t addr_size, int type) { h_errno = 0; @@ -229,7 +229,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type) close(fd); }); - const in_addr_t& in_addr = ((const struct in_addr*)addr)->s_addr; + in_addr_t const& in_addr = ((const struct in_addr*)addr)->s_addr; struct [[gnu::packed]] { u32 message_size; @@ -367,7 +367,7 @@ struct servent* getservent() return service_entry; } -struct servent* getservbyname(const char* name, const char* protocol) +struct servent* getservbyname(char const* name, char const* protocol) { if (name == nullptr) return nullptr; @@ -394,7 +394,7 @@ struct servent* getservbyname(const char* name, const char* protocol) return current_service; } -struct servent* getservbyport(int port, const char* protocol) +struct servent* getservbyport(int port, char const* protocol) { bool previous_file_open_setting = keep_service_file_open; setservent(1); @@ -444,7 +444,7 @@ void endservent() // Fill the service entry buffer with the information contained // in the currently read line, returns true if successful, // false if failure occurs. -static bool fill_getserv_buffers(const char* line, ssize_t read) +static bool fill_getserv_buffers(char const* line, ssize_t read) { // Splitting the line by tab delimiter and filling the servent buffers name, port, and protocol members. auto split_line = StringView(line, read).replace(" ", "\t", true).split('\t'); @@ -555,7 +555,7 @@ struct protoent* getprotoent() return protocol_entry; } -struct protoent* getprotobyname(const char* name) +struct protoent* getprotobyname(char const* name) { bool previous_file_open_setting = keep_protocols_file_open; setprotoent(1); @@ -623,7 +623,7 @@ void endprotoent() protocols_file = nullptr; } -static bool fill_getproto_buffers(const char* line, ssize_t read) +static bool fill_getproto_buffers(char const* line, ssize_t read) { String string_line = String(line, read); auto split_line = string_line.replace(" ", "\t", true).split('\t'); @@ -660,7 +660,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read) return true; } -int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res) +int getaddrinfo(char const* __restrict node, char const* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res) { *res = nullptr; @@ -678,7 +678,7 @@ int getaddrinfo(const char* __restrict node, const char* __restrict service, con if (!host_ent) return EAI_FAIL; - const char* proto = nullptr; + char const* proto = nullptr; if (hints && hints->ai_socktype) { switch (hints->ai_socktype) { case SOCK_STREAM: @@ -767,7 +767,7 @@ void freeaddrinfo(struct addrinfo* res) } } -const char* gai_strerror(int errcode) +char const* gai_strerror(int errcode) { switch (errcode) { case EAI_ADDRFAMILY: @@ -804,7 +804,7 @@ int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char* if (addr->sa_family != AF_INET || addrlen < sizeof(sockaddr_in)) return EAI_FAMILY; - const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(addr); + sockaddr_in const* sin = reinterpret_cast<sockaddr_in const*>(addr); if (host && hostlen > 0) { if (flags != 0) diff --git a/Userland/Libraries/LibC/netdb.h b/Userland/Libraries/LibC/netdb.h index 409be7d437..72561ebb79 100644 --- a/Userland/Libraries/LibC/netdb.h +++ b/Userland/Libraries/LibC/netdb.h @@ -20,8 +20,8 @@ struct hostent { #define h_addr h_addr_list[0] }; -struct hostent* gethostbyname(const char*); -struct hostent* gethostbyaddr(const void* addr, socklen_t len, int type); +struct hostent* gethostbyname(char const*); +struct hostent* gethostbyaddr(void const* addr, socklen_t len, int type); struct servent { char* s_name; @@ -31,8 +31,8 @@ struct servent { }; struct servent* getservent(void); -struct servent* getservbyname(const char* name, const char* protocol); -struct servent* getservbyport(int port, const char* protocol); +struct servent* getservbyname(char const* name, char const* protocol); +struct servent* getservbyport(int port, char const* protocol); void setservent(int stay_open); void endservent(void); @@ -43,7 +43,7 @@ struct protoent { }; void endprotoent(void); -struct protoent* getprotobyname(const char* name); +struct protoent* getprotobyname(char const* name); struct protoent* getprotobynumber(int proto); struct protoent* getprotoent(void); void setprotoent(int stay_open); @@ -96,9 +96,9 @@ struct addrinfo { #define NI_NOFQDN 4 #define NI_DGRAM 5 -int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res); +int getaddrinfo(char const* __restrict node, char const* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res); void freeaddrinfo(struct addrinfo* res); -const char* gai_strerror(int errcode); +char const* gai_strerror(int errcode); int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char* __restrict host, socklen_t hostlen, char* __restrict serv, socklen_t servlen, int flags); __END_DECLS diff --git a/Userland/Libraries/LibC/poll.cpp b/Userland/Libraries/LibC/poll.cpp index 8b5f5605f1..7491346d5b 100644 --- a/Userland/Libraries/LibC/poll.cpp +++ b/Userland/Libraries/LibC/poll.cpp @@ -23,7 +23,7 @@ int poll(pollfd* fds, nfds_t nfds, int timeout_ms) return ppoll(fds, nfds, timeout_ts, nullptr); } -int ppoll(pollfd* fds, nfds_t nfds, const timespec* timeout, const sigset_t* sigmask) +int ppoll(pollfd* fds, nfds_t nfds, timespec const* timeout, sigset_t const* sigmask) { Syscall::SC_poll_params params { fds, nfds, timeout, sigmask }; int rc = syscall(SC_poll, ¶ms); diff --git a/Userland/Libraries/LibC/poll.h b/Userland/Libraries/LibC/poll.h index cdc838242e..7667468442 100644 --- a/Userland/Libraries/LibC/poll.h +++ b/Userland/Libraries/LibC/poll.h @@ -12,6 +12,6 @@ __BEGIN_DECLS int poll(struct pollfd* fds, nfds_t nfds, int timeout); -int ppoll(struct pollfd* fds, nfds_t nfds, const struct timespec* timeout, const sigset_t* sigmask); +int ppoll(struct pollfd* fds, nfds_t nfds, const struct timespec* timeout, sigset_t const* sigmask); __END_DECLS diff --git a/Userland/Libraries/LibC/pthread_forward.cpp b/Userland/Libraries/LibC/pthread_forward.cpp index e610613cbb..32fcd015e7 100644 --- a/Userland/Libraries/LibC/pthread_forward.cpp +++ b/Userland/Libraries/LibC/pthread_forward.cpp @@ -56,7 +56,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond) return s_pthread_functions.pthread_cond_broadcast(cond); } -int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr) +int pthread_cond_init(pthread_cond_t* cond, pthread_condattr_t const* attr) { VERIFY(s_pthread_functions.pthread_cond_init); return s_pthread_functions.pthread_cond_init(cond, attr); diff --git a/Userland/Libraries/LibC/pthread_integration.cpp b/Userland/Libraries/LibC/pthread_integration.cpp index 64762f5d74..f802cd5247 100644 --- a/Userland/Libraries/LibC/pthread_integration.cpp +++ b/Userland/Libraries/LibC/pthread_integration.cpp @@ -97,7 +97,7 @@ static constexpr u32 MUTEX_UNLOCKED = 0; static constexpr u32 MUTEX_LOCKED_NO_NEED_TO_WAKE = 1; static constexpr u32 MUTEX_LOCKED_NEED_TO_WAKE = 2; -int __pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attributes) +int __pthread_mutex_init(pthread_mutex_t* mutex, pthread_mutexattr_t const* attributes) { mutex->lock = 0; mutex->owner = 0; @@ -106,7 +106,7 @@ int __pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr return 0; } -int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __attribute__((weak, alias("__pthread_mutex_init"))); +int pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t const*) __attribute__((weak, alias("__pthread_mutex_init"))); int __pthread_mutex_trylock(pthread_mutex_t* mutex) { diff --git a/Userland/Libraries/LibC/pthread_tls.cpp b/Userland/Libraries/LibC/pthread_tls.cpp index 6c32260dcd..abae74b75d 100644 --- a/Userland/Libraries/LibC/pthread_tls.cpp +++ b/Userland/Libraries/LibC/pthread_tls.cpp @@ -68,7 +68,7 @@ void* __pthread_getspecific(pthread_key_t key) void* pthread_getspecific(pthread_key_t) __attribute__((weak, alias("__pthread_getspecific"))); -int __pthread_setspecific(pthread_key_t key, const void* value) +int __pthread_setspecific(pthread_key_t key, void const* value) { if (key < 0) return EINVAL; @@ -79,7 +79,7 @@ int __pthread_setspecific(pthread_key_t key, const void* value) return 0; } -int pthread_setspecific(pthread_key_t, const void*) __attribute__((weak, alias("__pthread_setspecific"))); +int pthread_setspecific(pthread_key_t, void const*) __attribute__((weak, alias("__pthread_setspecific"))); void __pthread_key_destroy_for_current_thread() { diff --git a/Userland/Libraries/LibC/pwd.cpp b/Userland/Libraries/LibC/pwd.cpp index e55691d592..6b47b3d6f9 100644 --- a/Userland/Libraries/LibC/pwd.cpp +++ b/Userland/Libraries/LibC/pwd.cpp @@ -66,7 +66,7 @@ struct passwd* getpwuid(uid_t uid) return nullptr; } -struct passwd* getpwnam(const char* name) +struct passwd* getpwnam(char const* name) { setpwent(); while (auto* pw = getpwent()) { @@ -76,7 +76,7 @@ struct passwd* getpwnam(const char* name) return nullptr; } -static bool parse_pwddb_entry(const String& line) +static bool parse_pwddb_entry(String const& line) { auto parts = line.split_view(':', true); if (parts.size() != 7) { @@ -168,7 +168,7 @@ static void construct_pwd(struct passwd* pwd, char* buf, struct passwd** result) pwd->pw_shell = buf_shell; } -int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result) +int getpwnam_r(char const* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result) { // FIXME: This is a HACK! TemporaryChange name_change { s_name, {} }; @@ -191,7 +191,7 @@ int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, s return 0; } - const auto total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5; + auto const total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5; if (buflen < total_buffer_length) return ERANGE; @@ -222,7 +222,7 @@ int getpwuid_r(uid_t uid, struct passwd* pwd, char* buf, size_t buflen, struct p return 0; } - const auto total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5; + auto const total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5; if (buflen < total_buffer_length) return ERANGE; @@ -237,7 +237,7 @@ int putpwent(const struct passwd* p, FILE* stream) return -1; } - auto is_valid_field = [](const char* str) { + auto is_valid_field = [](char const* str) { return str && !strpbrk(str, ":\n"); }; diff --git a/Userland/Libraries/LibC/pwd.h b/Userland/Libraries/LibC/pwd.h index a7d8acd24c..4554888d3a 100644 --- a/Userland/Libraries/LibC/pwd.h +++ b/Userland/Libraries/LibC/pwd.h @@ -25,11 +25,11 @@ struct passwd { struct passwd* getpwent(void); void setpwent(void); void endpwent(void); -struct passwd* getpwnam(const char* name); +struct passwd* getpwnam(char const* name); struct passwd* getpwuid(uid_t); int putpwent(const struct passwd* p, FILE* stream); -int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result); +int getpwnam_r(char const* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result); int getpwuid_r(uid_t, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result); __END_DECLS diff --git a/Userland/Libraries/LibC/qsort.cpp b/Userland/Libraries/LibC/qsort.cpp index 6425f6bbcb..f628e0e189 100644 --- a/Userland/Libraries/LibC/qsort.cpp +++ b/Userland/Libraries/LibC/qsort.cpp @@ -28,12 +28,12 @@ private: namespace AK { template<> -inline void swap(const SizedObject& a, const SizedObject& b) +inline void swap(SizedObject const& a, SizedObject const& b) { VERIFY(a.size() == b.size()); const size_t size = a.size(); - const auto a_data = reinterpret_cast<char*>(a.data()); - const auto b_data = reinterpret_cast<char*>(b.data()); + 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) { swap(a_data[i], b_data[i]); } @@ -60,7 +60,7 @@ private: }; // https://pubs.opengroup.org/onlinepubs/9699919799/functions/qsort.html -void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, const void*)) +void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(void const*, void const*)) { if (nmemb <= 1) { return; @@ -68,10 +68,10 @@ void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, cons SizedObjectSlice slice { bot, size }; - AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](const SizedObject& a, const SizedObject& b) { return compar(a.data(), b.data()) < 0; }); + AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](SizedObject const& a, SizedObject const& b) { return compar(a.data(), b.data()) < 0; }); } -void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg) +void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(void const*, void const*, void*), void* arg) { if (nmemb <= 1) { return; @@ -79,5 +79,5 @@ void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, co SizedObjectSlice slice { bot, size }; - AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](const SizedObject& a, const SizedObject& b) { return compar(a.data(), b.data(), arg) < 0; }); + AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](SizedObject const& a, SizedObject const& b) { return compar(a.data(), b.data(), arg) < 0; }); } diff --git a/Userland/Libraries/LibC/regex.cpp b/Userland/Libraries/LibC/regex.cpp index dca3624113..394abb708a 100644 --- a/Userland/Libraries/LibC/regex.cpp +++ b/Userland/Libraries/LibC/regex.cpp @@ -13,9 +13,9 @@ static void* s_libregex; static pthread_mutex_t s_libregex_lock; -static int (*s_regcomp)(regex_t*, const char*, int); -static int (*s_regexec)(const regex_t*, const char*, size_t, regmatch_t[], int); -static size_t (*s_regerror)(int, const regex_t*, char*, size_t); +static int (*s_regcomp)(regex_t*, char const*, int); +static int (*s_regexec)(regex_t const*, char const*, size_t, regmatch_t[], int); +static size_t (*s_regerror)(int, regex_t const*, char*, size_t); static void (*s_regfree)(regex_t*); static void ensure_libregex() @@ -24,9 +24,9 @@ static void ensure_libregex() if (!s_libregex) { s_libregex = __dlopen("libregex.so", RTLD_NOW).value(); - s_regcomp = reinterpret_cast<int (*)(regex_t*, const char*, int)>(__dlsym(s_libregex, "regcomp").value()); - s_regexec = reinterpret_cast<int (*)(const regex_t*, const char*, size_t, regmatch_t[], int)>(__dlsym(s_libregex, "regexec").value()); - s_regerror = reinterpret_cast<size_t (*)(int, const regex_t*, char*, size_t)>(__dlsym(s_libregex, "regerror").value()); + s_regcomp = reinterpret_cast<int (*)(regex_t*, char const*, int)>(__dlsym(s_libregex, "regcomp").value()); + s_regexec = reinterpret_cast<int (*)(regex_t const*, char const*, size_t, regmatch_t[], int)>(__dlsym(s_libregex, "regexec").value()); + s_regerror = reinterpret_cast<size_t (*)(int, regex_t const*, char*, size_t)>(__dlsym(s_libregex, "regerror").value()); s_regfree = reinterpret_cast<void (*)(regex_t*)>(__dlsym(s_libregex, "regfree").value()); } pthread_mutex_unlock(&s_libregex_lock); @@ -34,19 +34,19 @@ static void ensure_libregex() extern "C" { -int __attribute__((weak)) regcomp(regex_t* reg, const char* pattern, int cflags) +int __attribute__((weak)) regcomp(regex_t* reg, char const* pattern, int cflags) { ensure_libregex(); return s_regcomp(reg, pattern, cflags); } -int __attribute__((weak)) regexec(const regex_t* reg, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags) +int __attribute__((weak)) regexec(regex_t const* reg, char const* string, size_t nmatch, regmatch_t pmatch[], int eflags) { ensure_libregex(); return s_regexec(reg, string, nmatch, pmatch, eflags); } -size_t __attribute__((weak)) regerror(int errcode, const regex_t* reg, char* errbuf, size_t errbuf_size) +size_t __attribute__((weak)) regerror(int errcode, regex_t const* reg, char* errbuf, size_t errbuf_size) { ensure_libregex(); return s_regerror(errcode, reg, errbuf, errbuf_size); diff --git a/Userland/Libraries/LibC/regex.h b/Userland/Libraries/LibC/regex.h index da11c82d96..d51c138a65 100644 --- a/Userland/Libraries/LibC/regex.h +++ b/Userland/Libraries/LibC/regex.h @@ -101,9 +101,9 @@ enum __RegexAllFlags { #define REG_SEARCH __Regex_Last << 1 -int regcomp(regex_t*, const char*, int); -int regexec(const regex_t*, const char*, size_t, regmatch_t[], int); -size_t regerror(int, const regex_t*, char*, size_t); +int regcomp(regex_t*, char const*, int); +int regexec(regex_t const*, char const*, size_t, regmatch_t[], int); +size_t regerror(int, regex_t const*, char*, size_t); void regfree(regex_t*); __END_DECLS diff --git a/Userland/Libraries/LibC/resolv.h b/Userland/Libraries/LibC/resolv.h index 5b73bd9600..ff0a7f3447 100644 --- a/Userland/Libraries/LibC/resolv.h +++ b/Userland/Libraries/LibC/resolv.h @@ -10,6 +10,6 @@ __BEGIN_DECLS -int res_query(const char* dname, int class_, int type, unsigned char* answer, int anslen); +int res_query(char const* dname, int class_, int type, unsigned char* answer, int anslen); __END_DECLS diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp index 246e54e48a..27e981427d 100644 --- a/Userland/Libraries/LibC/scanf.cpp +++ b/Userland/Libraries/LibC/scanf.cpp @@ -384,7 +384,7 @@ private: size_t count { 0 }; }; -extern "C" int vsscanf(const char* input, const char* format, va_list ap) +extern "C" int vsscanf(char const* input, char const* format, va_list ap) { GenericLexer format_lexer { format }; GenericLexer input_lexer { input }; diff --git a/Userland/Libraries/LibC/search.cpp b/Userland/Libraries/LibC/search.cpp index 7059297605..bad67a0b79 100644 --- a/Userland/Libraries/LibC/search.cpp +++ b/Userland/Libraries/LibC/search.cpp @@ -9,7 +9,7 @@ #include <bits/search.h> #include <search.h> -struct search_tree_node* new_tree_node(const void* key) +struct search_tree_node* new_tree_node(void const* key) { auto* node = static_cast<struct search_tree_node*>(malloc(sizeof(struct search_tree_node))); @@ -37,7 +37,7 @@ void delete_node_recursive(struct search_tree_node* node) extern "C" { // https://pubs.opengroup.org/onlinepubs/9699919799/functions/tsearch.html -void* tsearch(const void* key, void** rootp, int (*comparator)(const void*, const void*)) +void* tsearch(void const* key, void** rootp, int (*comparator)(void const*, void const*)) { if (!rootp) return nullptr; @@ -71,7 +71,7 @@ void* tsearch(const void* key, void** rootp, int (*comparator)(const void*, cons } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/tfind.html -void* tfind(const void* key, void* const* rootp, int (*comparator)(const void*, const void*)) +void* tfind(void const* key, void* const* rootp, int (*comparator)(void const*, void const*)) { if (!rootp) return nullptr; @@ -93,13 +93,13 @@ void* tfind(const void* key, void* const* rootp, int (*comparator)(const void*, } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/tdelete.html -void* tdelete(const void*, void**, int (*)(const void*, const void*)) +void* tdelete(void const*, void**, int (*)(void const*, void const*)) { dbgln("FIXME: Implement tdelete()"); return nullptr; } -static void twalk_internal(const struct search_tree_node* node, void (*action)(const void*, VISIT, int), int depth) +static void twalk_internal(const struct search_tree_node* node, void (*action)(void const*, VISIT, int), int depth) { if (!node) return; @@ -117,7 +117,7 @@ static void twalk_internal(const struct search_tree_node* node, void (*action)(c } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/twalk.html -void twalk(const void* rootp, void (*action)(const void*, VISIT, int)) +void twalk(void const* rootp, void (*action)(void const*, VISIT, int)) { auto node = static_cast<const struct search_tree_node*>(rootp); diff --git a/Userland/Libraries/LibC/search.h b/Userland/Libraries/LibC/search.h index cd02738a5a..1020c34487 100644 --- a/Userland/Libraries/LibC/search.h +++ b/Userland/Libraries/LibC/search.h @@ -17,9 +17,9 @@ typedef enum { leaf, } VISIT; -void* tsearch(const void*, void**, int (*)(const void*, const void*)); -void* tfind(const void*, void* const*, int (*)(const void*, const void*)); -void* tdelete(const void*, void**, int (*)(const void*, const void*)); -void twalk(const void*, void (*)(const void*, VISIT, int)); +void* tsearch(void const*, void**, int (*)(void const*, void const*)); +void* tfind(void const*, void* const*, int (*)(void const*, void const*)); +void* tdelete(void const*, void**, int (*)(void const*, void const*)); +void twalk(void const*, void (*)(void const*, VISIT, int)); __END_DECLS diff --git a/Userland/Libraries/LibC/serenity.cpp b/Userland/Libraries/LibC/serenity.cpp index e67e98e284..11c9524d4e 100644 --- a/Userland/Libraries/LibC/serenity.cpp +++ b/Userland/Libraries/LibC/serenity.cpp @@ -101,7 +101,7 @@ int anon_create(size_t size, int options) __RETURN_WITH_ERRNO(rc, rc, -1); } -int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size) +int serenity_readlink(char const* path, size_t path_length, char* buffer, size_t buffer_size) { Syscall::SC_readlink_params small_params { { path, path_length }, @@ -111,7 +111,7 @@ int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t __RETURN_WITH_ERRNO(rc, rc, -1); } -int setkeymap(const char* name, const u32* map, u32* const shift_map, const u32* alt_map, const u32* altgr_map, const u32* shift_altgr_map) +int setkeymap(char const* name, u32 const* map, u32* const shift_map, u32 const* alt_map, u32 const* altgr_map, u32 const* shift_altgr_map) { Syscall::SC_setkeymap_params params { map, shift_map, alt_map, altgr_map, shift_altgr_map, { name, strlen(name) } }; return syscall(SC_setkeymap, ¶ms); @@ -131,10 +131,10 @@ int getkeymap(char* name_buffer, size_t name_buffer_size, u32* map, u32* shift_m __RETURN_WITH_ERRNO(rc, rc, -1); } -u16 internet_checksum(const void* ptr, size_t count) +u16 internet_checksum(void const* ptr, size_t count) { u32 checksum = 0; - auto* w = (const u16*)ptr; + auto* w = (u16 const*)ptr; while (count > 1) { checksum += ntohs(*w++); if (checksum & 0x80000000) diff --git a/Userland/Libraries/LibC/serenity.h b/Userland/Libraries/LibC/serenity.h index c60625494b..6ab5538743 100644 --- a/Userland/Libraries/LibC/serenity.h +++ b/Userland/Libraries/LibC/serenity.h @@ -60,12 +60,12 @@ int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size); int anon_create(size_t size, int options); -int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size); +int serenity_readlink(char const* path, size_t path_length, char* buffer, size_t buffer_size); int getkeymap(char* name_buffer, size_t name_buffer_size, uint32_t* map, uint32_t* shift_map, uint32_t* alt_map, uint32_t* altgr_map, uint32_t* shift_altgr_map); -int setkeymap(const char* name, const uint32_t* map, uint32_t* const shift_map, const uint32_t* alt_map, const uint32_t* altgr_map, const uint32_t* shift_altgr_map); +int setkeymap(char const* name, uint32_t const* map, uint32_t* const shift_map, uint32_t const* alt_map, uint32_t const* altgr_map, uint32_t const* shift_altgr_map); -uint16_t internet_checksum(const void* ptr, size_t count); +uint16_t internet_checksum(void const* ptr, size_t count); int emuctl(uintptr_t command, uintptr_t arg0, uintptr_t arg1); diff --git a/Userland/Libraries/LibC/shadow.cpp b/Userland/Libraries/LibC/shadow.cpp index 628925ea29..a7504ec3d9 100644 --- a/Userland/Libraries/LibC/shadow.cpp +++ b/Userland/Libraries/LibC/shadow.cpp @@ -51,7 +51,7 @@ void endspent() s_pwdp = {}; } -struct spwd* getspnam(const char* name) +struct spwd* getspnam(char const* name) { setspent(); while (auto* sp = getspent()) { @@ -62,7 +62,7 @@ struct spwd* getspnam(const char* name) return nullptr; } -static bool parse_shadow_entry(const String& line) +static bool parse_shadow_entry(String const& line) { auto parts = line.split_view(':', true); if (parts.size() != 9) { @@ -192,7 +192,7 @@ static void construct_spwd(struct spwd* sp, char* buf, struct spwd** result) sp->sp_pwdp = buf_pwdp; } -int getspnam_r(const char* name, struct spwd* sp, char* buf, size_t buflen, struct spwd** result) +int getspnam_r(char const* name, struct spwd* sp, char* buf, size_t buflen, struct spwd** result) { // FIXME: This is a HACK! TemporaryChange name_change { s_name, {} }; @@ -212,7 +212,7 @@ int getspnam_r(const char* name, struct spwd* sp, char* buf, size_t buflen, stru return 0; } - const auto total_buffer_length = s_name.length() + s_pwdp.length() + 8; + auto const total_buffer_length = s_name.length() + s_pwdp.length() + 8; if (buflen < total_buffer_length) return ERANGE; @@ -227,7 +227,7 @@ int putspent(struct spwd* p, FILE* stream) return -1; } - auto is_valid_field = [](const char* str) { + auto is_valid_field = [](char const* str) { return str && !strpbrk(str, ":\n"); }; diff --git a/Userland/Libraries/LibC/shadow.h b/Userland/Libraries/LibC/shadow.h index a766451f7e..0d3e463931 100644 --- a/Userland/Libraries/LibC/shadow.h +++ b/Userland/Libraries/LibC/shadow.h @@ -27,13 +27,13 @@ struct spwd { struct spwd* getspent(void); void setspent(void); void endspent(void); -struct spwd* getspnam(const char* name); +struct spwd* getspnam(char const* name); int putspent(struct spwd* p, FILE* stream); int getspent_r(struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); -int getspnam_r(const char* name, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); +int getspnam_r(char const* name, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); int fgetspent_r(FILE* fp, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); -int sgetspent_r(const char* s, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); +int sgetspent_r(char const* s, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp); __END_DECLS diff --git a/Userland/Libraries/LibC/signal.cpp b/Userland/Libraries/LibC/signal.cpp index abbab504a4..37fba25965 100644 --- a/Userland/Libraries/LibC/signal.cpp +++ b/Userland/Libraries/LibC/signal.cpp @@ -84,7 +84,7 @@ int sigaddset(sigset_t* set, int sig) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html -int sigaltstack(const stack_t* ss, stack_t* old_ss) +int sigaltstack(stack_t const* ss, stack_t* old_ss) { int rc = syscall(SC_sigaltstack, ss, old_ss); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -102,7 +102,7 @@ int sigdelset(sigset_t* set, int sig) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigismember.html -int sigismember(const sigset_t* set, int sig) +int sigismember(sigset_t const* set, int sig) { if (sig < 1 || sig > 32) { errno = EINVAL; @@ -114,7 +114,7 @@ int sigismember(const sigset_t* set, int sig) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html -int sigprocmask(int how, const sigset_t* set, sigset_t* old_set) +int sigprocmask(int how, sigset_t const* set, sigset_t* old_set) { int rc = syscall(SC_sigprocmask, how, set, old_set); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -127,7 +127,7 @@ int sigpending(sigset_t* set) __RETURN_WITH_ERRNO(rc, rc, -1); } -const char* sys_siglist[NSIG] = { +char const* sys_siglist[NSIG] = { "Invalid signal number", "Hangup", "Interrupt", @@ -173,7 +173,7 @@ void siglongjmp(jmp_buf env, int val) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html -int sigsuspend(const sigset_t* set) +int sigsuspend(sigset_t const* set) { return pselect(0, nullptr, nullptr, nullptr, nullptr, set); } @@ -202,7 +202,7 @@ int sigtimedwait(sigset_t const* set, siginfo_t* info, struct timespec const* ti __RETURN_WITH_ERRNO(rc, rc, -1); } -const char* sys_signame[] = { +char const* sys_signame[] = { "INVAL", "HUP", "INT", @@ -237,9 +237,9 @@ const char* sys_signame[] = { "SYS", }; -static_assert(sizeof(sys_signame) == sizeof(const char*) * NSIG); +static_assert(sizeof(sys_signame) == sizeof(char const*) * NSIG); -int getsignalbyname(const char* name) +int getsignalbyname(char const* name) { VERIFY(name); StringView name_sv(name); @@ -252,7 +252,7 @@ int getsignalbyname(const char* name) return -1; } -const char* getsignalname(int signal) +char const* getsignalname(int signal) { if (signal < 0 || signal >= NSIG) { errno = EINVAL; diff --git a/Userland/Libraries/LibC/signal.h b/Userland/Libraries/LibC/signal.h index 3ed14348a0..2431e052db 100644 --- a/Userland/Libraries/LibC/signal.h +++ b/Userland/Libraries/LibC/signal.h @@ -17,25 +17,25 @@ __BEGIN_DECLS int kill(pid_t, int sig); int killpg(int pgrp, int sig); sighandler_t signal(int sig, sighandler_t); -int pthread_sigmask(int how, const sigset_t* set, sigset_t* old_set); +int pthread_sigmask(int how, sigset_t const* set, sigset_t* old_set); int sigaction(int sig, const struct sigaction* act, struct sigaction* old_act); int sigemptyset(sigset_t*); int sigfillset(sigset_t*); int sigaddset(sigset_t*, int sig); -int sigaltstack(const stack_t* ss, stack_t* old_ss); +int sigaltstack(stack_t const* ss, stack_t* old_ss); int sigdelset(sigset_t*, int sig); -int sigismember(const sigset_t*, int sig); -int sigprocmask(int how, const sigset_t* set, sigset_t* old_set); +int sigismember(sigset_t const*, int sig); +int sigprocmask(int how, sigset_t const* set, sigset_t* old_set); int sigpending(sigset_t*); -int sigsuspend(const sigset_t*); +int sigsuspend(sigset_t const*); int sigtimedwait(sigset_t const*, siginfo_t*, struct timespec const*); int sigwait(sigset_t const*, int*); int sigwaitinfo(sigset_t const*, siginfo_t*); int raise(int sig); -int getsignalbyname(const char*); -const char* getsignalname(int); +int getsignalbyname(char const*); +char const* getsignalname(int); -extern const char* sys_siglist[NSIG]; -extern const char* sys_signame[NSIG]; +extern char const* sys_siglist[NSIG]; +extern char const* sys_signame[NSIG]; __END_DECLS diff --git a/Userland/Libraries/LibC/spawn.cpp b/Userland/Libraries/LibC/spawn.cpp index c1ac4b5a7b..8cdc1fe0e1 100644 --- a/Userland/Libraries/LibC/spawn.cpp +++ b/Userland/Libraries/LibC/spawn.cpp @@ -29,7 +29,7 @@ struct posix_spawn_file_actions_state { extern "C" { -[[noreturn]] static void posix_spawn_child(const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[], int (*exec)(const char*, char* const[], char* const[])) +[[noreturn]] static void posix_spawn_child(char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[], int (*exec)(char const*, char* const[], char* const[])) { if (attr) { short flags = attr->flags; @@ -86,7 +86,7 @@ extern "C" { } if (file_actions) { - for (const auto& action : file_actions->state->actions) { + for (auto const& action : file_actions->state->actions) { if (action() < 0) { perror("posix_spawn file action"); _exit(127); @@ -100,7 +100,7 @@ extern "C" { } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html -int posix_spawn(pid_t* out_pid, const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[]) +int posix_spawn(pid_t* out_pid, char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[]) { pid_t child_pid = fork(); if (child_pid < 0) @@ -115,7 +115,7 @@ int posix_spawn(pid_t* out_pid, const char* path, const posix_spawn_file_actions } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnp.html -int posix_spawnp(pid_t* out_pid, const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[]) +int posix_spawnp(pid_t* out_pid, char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[]) { pid_t child_pid = fork(); if (child_pid < 0) @@ -130,7 +130,7 @@ int posix_spawnp(pid_t* out_pid, const char* path, const posix_spawn_file_action } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addchdir.html -int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t* actions, const char* path) +int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t* actions, char const* path) { actions->state->actions.append([path]() { return chdir(path); }); return 0; @@ -157,7 +157,7 @@ int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* actions, int ol } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addopen.html -int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* actions, int want_fd, const char* path, int flags, mode_t mode) +int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* actions, int want_fd, char const* path, int flags, mode_t mode) { actions->state->actions.append([want_fd, path, flags, mode]() { int opened_fd = open(path, flags, mode); @@ -191,42 +191,42 @@ int posix_spawnattr_destroy(posix_spawnattr_t*) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getflags.html -int posix_spawnattr_getflags(const posix_spawnattr_t* attr, short* out_flags) +int posix_spawnattr_getflags(posix_spawnattr_t const* attr, short* out_flags) { *out_flags = attr->flags; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getpgroup.html -int posix_spawnattr_getpgroup(const posix_spawnattr_t* attr, pid_t* out_pgroup) +int posix_spawnattr_getpgroup(posix_spawnattr_t const* attr, pid_t* out_pgroup) { *out_pgroup = attr->pgroup; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getschedparam.html -int posix_spawnattr_getschedparam(const posix_spawnattr_t* attr, struct sched_param* out_schedparam) +int posix_spawnattr_getschedparam(posix_spawnattr_t const* attr, struct sched_param* out_schedparam) { *out_schedparam = attr->schedparam; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getschedpolicy.html -int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* attr, int* out_schedpolicy) +int posix_spawnattr_getschedpolicy(posix_spawnattr_t const* attr, int* out_schedpolicy) { *out_schedpolicy = attr->schedpolicy; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getsigdefault.html -int posix_spawnattr_getsigdefault(const posix_spawnattr_t* attr, sigset_t* out_sigdefault) +int posix_spawnattr_getsigdefault(posix_spawnattr_t const* attr, sigset_t* out_sigdefault) { *out_sigdefault = attr->sigdefault; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getsigmask.html -int posix_spawnattr_getsigmask(const posix_spawnattr_t* attr, sigset_t* out_sigmask) +int posix_spawnattr_getsigmask(posix_spawnattr_t const* attr, sigset_t* out_sigmask) { *out_sigmask = attr->sigmask; return 0; @@ -276,14 +276,14 @@ int posix_spawnattr_setschedpolicy(posix_spawnattr_t* attr, int schedpolicy) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_setsigdefault.html -int posix_spawnattr_setsigdefault(posix_spawnattr_t* attr, const sigset_t* sigdefault) +int posix_spawnattr_setsigdefault(posix_spawnattr_t* attr, sigset_t const* sigdefault) { attr->sigdefault = *sigdefault; return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_setsigmask.html -int posix_spawnattr_setsigmask(posix_spawnattr_t* attr, const sigset_t* sigmask) +int posix_spawnattr_setsigmask(posix_spawnattr_t* attr, sigset_t const* sigmask) { attr->sigmask = *sigmask; return 0; diff --git a/Userland/Libraries/LibC/spawn.h b/Userland/Libraries/LibC/spawn.h index c5f2168b1a..8531e67044 100644 --- a/Userland/Libraries/LibC/spawn.h +++ b/Userland/Libraries/LibC/spawn.h @@ -49,30 +49,30 @@ typedef struct { sigset_t sigmask; } posix_spawnattr_t; -int posix_spawn(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const argv[], char* const envp[]); -int posix_spawnp(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const argv[], char* const envp[]); +int posix_spawn(pid_t*, char const*, posix_spawn_file_actions_t const*, posix_spawnattr_t const*, char* const argv[], char* const envp[]); +int posix_spawnp(pid_t*, char const*, posix_spawn_file_actions_t const*, posix_spawnattr_t const*, char* const argv[], char* const envp[]); -int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t*, const char*); +int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t*, char const*); int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t*, int); int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t*, int); int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int old_fd, int new_fd); -int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t*, int fd, const char*, int flags, mode_t); +int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t*, int fd, char const*, int flags, mode_t); int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t*); int posix_spawn_file_actions_init(posix_spawn_file_actions_t*); int posix_spawnattr_destroy(posix_spawnattr_t*); -int posix_spawnattr_getflags(const posix_spawnattr_t*, short*); -int posix_spawnattr_getpgroup(const posix_spawnattr_t*, pid_t*); -int posix_spawnattr_getschedparam(const posix_spawnattr_t*, struct sched_param*); -int posix_spawnattr_getschedpolicy(const posix_spawnattr_t*, int*); -int posix_spawnattr_getsigdefault(const posix_spawnattr_t*, sigset_t*); -int posix_spawnattr_getsigmask(const posix_spawnattr_t*, sigset_t*); +int posix_spawnattr_getflags(posix_spawnattr_t const*, short*); +int posix_spawnattr_getpgroup(posix_spawnattr_t const*, pid_t*); +int posix_spawnattr_getschedparam(posix_spawnattr_t const*, struct sched_param*); +int posix_spawnattr_getschedpolicy(posix_spawnattr_t const*, int*); +int posix_spawnattr_getsigdefault(posix_spawnattr_t const*, sigset_t*); +int posix_spawnattr_getsigmask(posix_spawnattr_t const*, sigset_t*); int posix_spawnattr_init(posix_spawnattr_t*); int posix_spawnattr_setflags(posix_spawnattr_t*, short); int posix_spawnattr_setpgroup(posix_spawnattr_t*, pid_t); int posix_spawnattr_setschedparam(posix_spawnattr_t*, const struct sched_param*); int posix_spawnattr_setschedpolicy(posix_spawnattr_t*, int); -int posix_spawnattr_setsigdefault(posix_spawnattr_t*, const sigset_t*); -int posix_spawnattr_setsigmask(posix_spawnattr_t*, const sigset_t*); +int posix_spawnattr_setsigdefault(posix_spawnattr_t*, sigset_t const*); +int posix_spawnattr_setsigmask(posix_spawnattr_t*, sigset_t const*); __END_DECLS diff --git a/Userland/Libraries/LibC/stat.cpp b/Userland/Libraries/LibC/stat.cpp index 3516de8df3..bcb52fd898 100644 --- a/Userland/Libraries/LibC/stat.cpp +++ b/Userland/Libraries/LibC/stat.cpp @@ -22,7 +22,7 @@ mode_t umask(mode_t mask) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html -int mkdir(const char* pathname, mode_t mode) +int mkdir(char const* pathname, mode_t mode) { if (!pathname) { errno = EFAULT; @@ -33,7 +33,7 @@ int mkdir(const char* pathname, mode_t mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html -int chmod(const char* pathname, mode_t mode) +int chmod(char const* pathname, mode_t mode) { return fchmodat(AT_FDCWD, pathname, mode, 0); } @@ -69,12 +69,12 @@ int fchmod(int fd, mode_t mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkfifo.html -int mkfifo(const char* pathname, mode_t mode) +int mkfifo(char const* pathname, mode_t mode) { return mknod(pathname, mode | S_IFIFO, 0); } -static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follow_symlinks) +static int do_stat(int dirfd, char const* path, struct stat* statbuf, bool follow_symlinks) { if (!path) { errno = EFAULT; @@ -86,13 +86,13 @@ static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follo } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html -int lstat(const char* path, struct stat* statbuf) +int lstat(char const* path, struct stat* statbuf) { return do_stat(AT_FDCWD, path, statbuf, false); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html -int stat(const char* path, struct stat* statbuf) +int stat(char const* path, struct stat* statbuf) { return do_stat(AT_FDCWD, path, statbuf, true); } @@ -105,7 +105,7 @@ int fstat(int fd, struct stat* statbuf) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html -int fstatat(int fd, const char* path, struct stat* statbuf, int flags) +int fstatat(int fd, char const* path, struct stat* statbuf, int flags) { return do_stat(fd, path, statbuf, !(flags & AT_SYMLINK_NOFOLLOW)); } diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index efcab202e5..ee23401c5c 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -124,7 +124,7 @@ ssize_t FILE::do_read(u8* data, size_t size) return nread; } -ssize_t FILE::do_write(const u8* data, size_t size) +ssize_t FILE::do_write(u8 const* data, size_t size) { int nwritten = ::write(m_fd, data, size); @@ -154,7 +154,7 @@ bool FILE::read_into_buffer() bool FILE::write_from_buffer() { size_t size; - const u8* data = m_buffer.begin_dequeue(size); + u8 const* data = m_buffer.begin_dequeue(size); // If we want to write, the buffer must have something in it! VERIFY(size); @@ -180,7 +180,7 @@ size_t FILE::read(u8* data, size_t size) if (m_buffer.may_use()) { // Let's see if the buffer has something queued for us. size_t queued_size; - const u8* queued_data = m_buffer.begin_dequeue(queued_size); + u8 const* queued_data = m_buffer.begin_dequeue(queued_size); if (queued_size == 0) { // Nothing buffered; we're going to have to read some. bool read_some_more = read_into_buffer(); @@ -209,7 +209,7 @@ size_t FILE::read(u8* data, size_t size) return total_read; } -size_t FILE::write(const u8* data, size_t size) +size_t FILE::write(u8 const* data, size_t size) { size_t total_written = 0; @@ -426,7 +426,7 @@ size_t FILE::Buffer::buffered_size() const return m_capacity - (m_begin - m_end); } -const u8* FILE::Buffer::begin_dequeue(size_t& available_size) const +u8 const* FILE::Buffer::begin_dequeue(size_t& available_size) const { if (m_ungotten != 0u) { auto available_bytes = count_trailing_zeroes(m_ungotten) + 1; @@ -743,19 +743,19 @@ int putchar(int ch) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fputs.html -int fputs(const char* s, FILE* stream) +int fputs(char const* s, FILE* stream) { VERIFY(stream); size_t len = strlen(s); ScopedFileLock lock(stream); - size_t nwritten = stream->write(reinterpret_cast<const u8*>(s), len); + size_t nwritten = stream->write(reinterpret_cast<u8 const*>(s), len); if (nwritten < len) return EOF; return 1; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/puts.html -int puts(const char* s) +int puts(char const* s) { int rc = fputs(s, stdout); if (rc == EOF) @@ -799,13 +799,13 @@ size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fwrite.html -size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) +size_t fwrite(void const* ptr, size_t size, size_t nmemb, FILE* stream) { VERIFY(stream); VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb)); ScopedFileLock lock(stream); - size_t nwritten = stream->write(reinterpret_cast<const u8*>(ptr), size * nmemb); + size_t nwritten = stream->write(reinterpret_cast<u8 const*>(ptr), size * nmemb); if (!nwritten) return 0; return nwritten / size; @@ -859,7 +859,7 @@ int fgetpos(FILE* stream, fpos_t* pos) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsetpos.html -int fsetpos(FILE* stream, const fpos_t* pos) +int fsetpos(FILE* stream, fpos_t const* pos) { VERIFY(stream); VERIFY(pos); @@ -881,13 +881,13 @@ ALWAYS_INLINE void stdout_putch(char*&, char ch) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vfprintf.html -int vfprintf(FILE* stream, const char* fmt, va_list ap) +int vfprintf(FILE* stream, char const* fmt, va_list ap) { return printf_internal([stream](auto, char ch) { fputc(ch, stream); }, nullptr, fmt, ap); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html -int fprintf(FILE* stream, const char* fmt, ...) +int fprintf(FILE* stream, char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -897,13 +897,13 @@ int fprintf(FILE* stream, const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vprintf.html -int vprintf(const char* fmt, va_list ap) +int vprintf(char const* fmt, va_list ap) { return printf_internal(stdout_putch, nullptr, fmt, ap); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html -int printf(const char* fmt, ...) +int printf(char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -913,7 +913,7 @@ int printf(const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vasprintf.html -int vasprintf(char** strp, const char* fmt, va_list ap) +int vasprintf(char** strp, char const* fmt, va_list ap) { StringBuilder builder; builder.appendvf(fmt, ap); @@ -924,7 +924,7 @@ int vasprintf(char** strp, const char* fmt, va_list ap) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/asprintf.html -int asprintf(char** strp, const char* fmt, ...) +int asprintf(char** strp, char const* fmt, ...) { StringBuilder builder; va_list ap; @@ -943,7 +943,7 @@ static void buffer_putch(char*& bufptr, char ch) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vsprintf.html -int vsprintf(char* buffer, const char* fmt, va_list ap) +int vsprintf(char* buffer, char const* fmt, va_list ap) { int ret = printf_internal(buffer_putch, buffer, fmt, ap); buffer[ret] = '\0'; @@ -951,7 +951,7 @@ int vsprintf(char* buffer, const char* fmt, va_list ap) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sprintf.html -int sprintf(char* buffer, const char* fmt, ...) +int sprintf(char* buffer, char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -961,7 +961,7 @@ int sprintf(char* buffer, const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vsnprintf.html -int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap) +int vsnprintf(char* buffer, size_t size, char const* fmt, va_list ap) { size_t space_remaining = 0; if (size) { @@ -985,7 +985,7 @@ int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/snprintf.html -int snprintf(char* buffer, size_t size, const char* fmt, ...) +int snprintf(char* buffer, size_t size, char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -995,14 +995,14 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/perror.html -void perror(const char* s) +void perror(char const* s) { int saved_errno = errno; dbgln("perror(): {}: {}", s, strerror(saved_errno)); warnln("{}: {}", s, strerror(saved_errno)); } -static int parse_mode(const char* mode) +static int parse_mode(char const* mode) { int flags = 0; @@ -1040,7 +1040,7 @@ static int parse_mode(const char* mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html -FILE* fopen(const char* pathname, const char* mode) +FILE* fopen(char const* pathname, char const* mode) { int flags = parse_mode(mode); int fd = open(pathname, flags, 0666); @@ -1050,7 +1050,7 @@ FILE* fopen(const char* pathname, const char* mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/freopen.html -FILE* freopen(const char* pathname, const char* mode, FILE* stream) +FILE* freopen(char const* pathname, char const* mode, FILE* stream) { VERIFY(stream); if (!pathname) { @@ -1068,7 +1068,7 @@ FILE* freopen(const char* pathname, const char* mode, FILE* stream) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html -FILE* fdopen(int fd, const char* mode) +FILE* fdopen(int fd, char const* mode) { int flags = parse_mode(mode); // FIXME: Verify that the mode matches how fd is already open. @@ -1078,7 +1078,7 @@ FILE* fdopen(int fd, const char* mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html -FILE* fmemopen(void*, size_t, const char*) +FILE* fmemopen(void*, size_t, char const*) { // FIXME: Implement me :^) TODO(); @@ -1113,7 +1113,7 @@ int fclose(FILE* stream) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html -int rename(const char* oldpath, const char* newpath) +int rename(char const* oldpath, char const* newpath) { if (!oldpath || !newpath) { errno = EFAULT; @@ -1124,7 +1124,7 @@ int rename(const char* oldpath, const char* newpath) __RETURN_WITH_ERRNO(rc, rc, -1); } -void dbgputstr(const char* characters, size_t length) +void dbgputstr(char const* characters, size_t length) { syscall(SC_dbgputstr, characters, length); } @@ -1137,7 +1137,7 @@ char* tmpnam(char*) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/popen.html -FILE* popen(const char* command, const char* type) +FILE* popen(char const* command, char const* type) { if (!type || (*type != 'r' && *type != 'w')) { errno = EINVAL; @@ -1208,7 +1208,7 @@ int pclose(FILE* stream) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html -int remove(const char* pathname) +int remove(char const* pathname) { if (unlink(pathname) < 0) { if (errno == EISDIR) @@ -1219,7 +1219,7 @@ int remove(const char* pathname) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html -int scanf(const char* fmt, ...) +int scanf(char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -1229,7 +1229,7 @@ int scanf(const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fscanf.html -int fscanf(FILE* stream, const char* fmt, ...) +int fscanf(FILE* stream, char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -1239,7 +1239,7 @@ int fscanf(FILE* stream, const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sscanf.html -int sscanf(const char* buffer, const char* fmt, ...) +int sscanf(char const* buffer, char const* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -1249,7 +1249,7 @@ int sscanf(const char* buffer, const char* fmt, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html -int vfscanf(FILE* stream, const char* fmt, va_list ap) +int vfscanf(FILE* stream, char const* fmt, va_list ap) { char buffer[BUFSIZ]; if (!fgets(buffer, sizeof(buffer) - 1, stream)) @@ -1258,7 +1258,7 @@ int vfscanf(FILE* stream, const char* fmt, va_list ap) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/vscanf.html -int vscanf(const char* fmt, va_list ap) +int vscanf(char const* fmt, va_list ap) { return vfscanf(stdin, fmt, ap); } diff --git a/Userland/Libraries/LibC/stdio.h b/Userland/Libraries/LibC/stdio.h index 8128beca77..96999ae422 100644 --- a/Userland/Libraries/LibC/stdio.h +++ b/Userland/Libraries/LibC/stdio.h @@ -39,7 +39,7 @@ typedef off_t fpos_t; int fseek(FILE*, long offset, int whence); int fseeko(FILE*, off_t offset, int whence); int fgetpos(FILE*, fpos_t*); -int fsetpos(FILE*, const fpos_t*); +int fsetpos(FILE*, fpos_t const*); long ftell(FILE*); off_t ftello(FILE*); char* fgets(char* buffer, int size, FILE*); @@ -53,11 +53,11 @@ int getchar(void); ssize_t getdelim(char**, size_t*, int, FILE*); ssize_t getline(char**, size_t*, FILE*); int ungetc(int c, FILE*); -int remove(const char* pathname); -FILE* fdopen(int fd, const char* mode); -FILE* fopen(const char* pathname, const char* mode); -FILE* freopen(const char* pathname, const char* mode, FILE*); -FILE* fmemopen(void* buf, size_t size, const char* mode); +int remove(char const* pathname); +FILE* fdopen(int fd, char const* mode); +FILE* fopen(char const* pathname, char const* mode); +FILE* freopen(char const* pathname, char const* mode, FILE*); +FILE* fmemopen(void* buf, size_t size, char const* mode); void flockfile(FILE* filehandle); void funlockfile(FILE* filehandle); int fclose(FILE*); @@ -68,36 +68,36 @@ int feof(FILE*); int fflush(FILE*); size_t fread(void* ptr, size_t size, size_t nmemb, FILE*); size_t fread_unlocked(void* ptr, size_t size, size_t nmemb, FILE*); -size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*); -int vprintf(const char* fmt, va_list) __attribute__((format(printf, 1, 0))); -int vfprintf(FILE*, const char* fmt, va_list) __attribute__((format(printf, 2, 0))); -int vasprintf(char** strp, const char* fmt, va_list) __attribute__((format(printf, 2, 0))); -int vsprintf(char* buffer, const char* fmt, va_list) __attribute__((format(printf, 2, 0))); -int vsnprintf(char* buffer, size_t, const char* fmt, va_list) __attribute__((format(printf, 3, 0))); -int fprintf(FILE*, const char* fmt, ...) __attribute__((format(printf, 2, 3))); -int printf(const char* fmt, ...) __attribute__((format(printf, 1, 2))); -void dbgputstr(const char*, size_t); -int sprintf(char* buffer, const char* fmt, ...) __attribute__((format(printf, 2, 3))); -int asprintf(char** strp, const char* fmt, ...) __attribute__((format(printf, 2, 3))); -int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4))); +size_t fwrite(void const* ptr, size_t size, size_t nmemb, FILE*); +int vprintf(char const* fmt, va_list) __attribute__((format(printf, 1, 0))); +int vfprintf(FILE*, char const* fmt, va_list) __attribute__((format(printf, 2, 0))); +int vasprintf(char** strp, char const* fmt, va_list) __attribute__((format(printf, 2, 0))); +int vsprintf(char* buffer, char const* fmt, va_list) __attribute__((format(printf, 2, 0))); +int vsnprintf(char* buffer, size_t, char const* fmt, va_list) __attribute__((format(printf, 3, 0))); +int fprintf(FILE*, char const* fmt, ...) __attribute__((format(printf, 2, 3))); +int printf(char const* fmt, ...) __attribute__((format(printf, 1, 2))); +void dbgputstr(char const*, size_t); +int sprintf(char* buffer, char const* fmt, ...) __attribute__((format(printf, 2, 3))); +int asprintf(char** strp, char const* fmt, ...) __attribute__((format(printf, 2, 3))); +int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4))); int putchar(int ch); int putc(int ch, FILE*); -int puts(const char*); -int fputs(const char*, FILE*); -void perror(const char*); -int scanf(const char* fmt, ...) __attribute__((format(scanf, 1, 2))); -int sscanf(const char* str, const char* fmt, ...) __attribute__((format(scanf, 2, 3))); -int fscanf(FILE*, const char* fmt, ...) __attribute__((format(scanf, 2, 3))); -int vscanf(const char*, va_list) __attribute__((format(scanf, 1, 0))); -int vfscanf(FILE*, const char*, va_list) __attribute__((format(scanf, 2, 0))); -int vsscanf(const char*, const char*, va_list) __attribute__((format(scanf, 2, 0))); +int puts(char const*); +int fputs(char const*, FILE*); +void perror(char const*); +int scanf(char const* fmt, ...) __attribute__((format(scanf, 1, 2))); +int sscanf(char const* str, char const* fmt, ...) __attribute__((format(scanf, 2, 3))); +int fscanf(FILE*, char const* fmt, ...) __attribute__((format(scanf, 2, 3))); +int vscanf(char const*, va_list) __attribute__((format(scanf, 1, 0))); +int vfscanf(FILE*, char const*, va_list) __attribute__((format(scanf, 2, 0))); +int vsscanf(char const*, char const*, va_list) __attribute__((format(scanf, 2, 0))); int setvbuf(FILE*, char* buf, int mode, size_t); void setbuf(FILE*, char* buf); void setlinebuf(FILE*); -int rename(const char* oldpath, const char* newpath); +int rename(char const* oldpath, char const* newpath); FILE* tmpfile(void); char* tmpnam(char*); -FILE* popen(const char* command, const char* type); +FILE* popen(char const* command, char const* type); int pclose(FILE*); __END_DECLS diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index d9e7d73ead..695c9c35e8 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -34,7 +34,7 @@ #include <unistd.h> #include <wchar.h> -static void strtons(const char* str, char** endptr) +static void strtons(char const* str, char** endptr) { assert(endptr); char* ptr = const_cast<char*>(str); @@ -49,7 +49,7 @@ enum Sign { Positive, }; -static Sign strtosign(const char* str, char** endptr) +static Sign strtosign(char const* str, char** endptr) { assert(endptr); if (*str == '+') { @@ -128,7 +128,7 @@ public: private: bool can_append_digit(int digit) { - const bool is_below_cutoff = positive() ? (m_num < m_cutoff) : (m_num > m_cutoff); + bool const is_below_cutoff = positive() ? (m_num < m_cutoff) : (m_num > m_cutoff); if (is_below_cutoff) { return true; @@ -232,7 +232,7 @@ void abort() static HashTable<FlatPtr> s_malloced_environment_variables; -static void free_environment_variable_if_needed(const char* var) +static void free_environment_variable_if_needed(char const* var) { if (!s_malloced_environment_variables.contains((FlatPtr)var)) return; @@ -240,11 +240,11 @@ static void free_environment_variable_if_needed(const char* var) s_malloced_environment_variables.remove((FlatPtr)var); } -char* getenv(const char* name) +char* getenv(char const* name) { size_t vl = strlen(name); for (size_t i = 0; environ[i]; ++i) { - const char* decl = environ[i]; + char const* decl = environ[i]; char* eq = strchr(decl, '='); if (!eq) continue; @@ -258,7 +258,7 @@ char* getenv(const char* name) return nullptr; } -char* secure_getenv(const char* name) +char* secure_getenv(char const* name) { if (getauxval(AT_SECURE)) return nullptr; @@ -266,7 +266,7 @@ char* secure_getenv(const char* name) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/unsetenv.html -int unsetenv(const char* name) +int unsetenv(char const* name) { auto new_var_len = strlen(name); size_t environ_size = 0; @@ -307,12 +307,12 @@ int clearenv() } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html -int setenv(const char* name, const char* value, int overwrite) +int setenv(char const* name, char const* value, int overwrite) { return serenity_setenv(name, strlen(name), value, strlen(value), overwrite); } -int serenity_setenv(const char* name, ssize_t name_length, const char* value, ssize_t value_length, int overwrite) +int serenity_setenv(char const* name, ssize_t name_length, char const* value, ssize_t value_length, int overwrite) { if (!overwrite && getenv(name)) return 0; @@ -374,14 +374,14 @@ int putenv(char* new_var) return 0; } -static const char* __progname = NULL; +static char const* __progname = NULL; -const char* getprogname() +char const* getprogname() { return __progname; } -void setprogname(const char* progname) +void setprogname(char const* progname) { for (int i = strlen(progname) - 1; i >= 0; i--) { if (progname[i] == '/') { @@ -394,7 +394,7 @@ void setprogname(const char* progname) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtod.html -double strtod(const char* str, char** endptr) +double strtod(char const* str, char** endptr) { // Parse spaces, sign, and base char* parse_ptr = const_cast<char*>(str); @@ -451,7 +451,7 @@ double strtod(const char* str, char** endptr) char exponent_upper; int base = 10; if (*parse_ptr == '0') { - const char base_ch = *(parse_ptr + 1); + char const base_ch = *(parse_ptr + 1); if (base_ch == 'x' || base_ch == 'X') { base = 16; parse_ptr += 2; @@ -676,26 +676,26 @@ double strtod(const char* str, char** endptr) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtold.html -long double strtold(const char* str, char** endptr) +long double strtold(char const* str, char** endptr) { assert(sizeof(double) == sizeof(long double)); return strtod(str, endptr); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtof.html -float strtof(const char* str, char** endptr) +float strtof(char const* str, char** endptr) { return strtod(str, endptr); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/atof.html -double atof(const char* str) +double atof(char const* str) { return strtod(str, nullptr); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoi.html -int atoi(const char* str) +int atoi(char const* str) { long value = strtol(str, nullptr, 10); if (value > INT_MAX) { @@ -705,13 +705,13 @@ int atoi(const char* str) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/atol.html -long atol(const char* str) +long atol(char const* str) { return strtol(str, nullptr, 10); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoll.html -long long atoll(const char* str) +long long atoll(char const* str) { return strtoll(str, nullptr, 10); } @@ -808,13 +808,13 @@ void srandom(unsigned seed) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html -int system(const char* command) +int system(char const* command) { if (!command) return 1; pid_t child; - const char* argv[] = { "sh", "-c", command, nullptr }; + char const* argv[] = { "sh", "-c", command, nullptr }; if ((errno = posix_spawn(&child, "/bin/sh", nullptr, nullptr, const_cast<char**>(argv), environ))) return -1; int wstatus; @@ -872,7 +872,7 @@ char* mkdtemp(char* pattern) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/bsearch.html -void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)) +void* bsearch(void const* key, void const* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*)) { char* start = static_cast<char*>(const_cast<void*>(base)); while (nmemb > 0) { @@ -956,14 +956,14 @@ int mblen(char const* s, size_t n) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbstowcs.html -size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n) +size_t mbstowcs(wchar_t* pwcs, char const* s, size_t n) { static mbstate_t state = {}; return mbsrtowcs(pwcs, &s, n, &state); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbtowc.html -int mbtowc(wchar_t* pwc, const char* s, size_t n) +int mbtowc(wchar_t* pwc, char const* s, size_t n) { static mbstate_t internal_state = {}; @@ -998,11 +998,11 @@ int wctomb(char* s, wchar_t wc) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcstombs.html -size_t wcstombs(char* dest, const wchar_t* src, size_t max) +size_t wcstombs(char* dest, wchar_t const* src, size_t max) { char* original_dest = dest; while ((size_t)(dest - original_dest) < max) { - StringView v { (const char*)src, sizeof(wchar_t) }; + StringView v { (char const*)src, sizeof(wchar_t) }; // FIXME: dependent on locale, for now utf-8 is supported. Utf8View utf8 { v }; @@ -1021,7 +1021,7 @@ size_t wcstombs(char* dest, const wchar_t* src, size_t max) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtol.html -long strtol(const char* str, char** endptr, int base) +long strtol(char const* str, char** endptr, int base) { long long value = strtoll(str, endptr, base); if (value < LONG_MIN) { @@ -1035,7 +1035,7 @@ long strtol(const char* str, char** endptr, int base) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoul.html -unsigned long strtoul(const char* str, char** endptr, int base) +unsigned long strtoul(char const* str, char** endptr, int base) { unsigned long long value = strtoull(str, endptr, base); if (value > ULONG_MAX) { @@ -1046,7 +1046,7 @@ unsigned long strtoul(const char* str, char** endptr, int base) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoll.html -long long strtoll(const char* str, char** endptr, int base) +long long strtoll(char const* str, char** endptr, int base) { // Parse spaces and sign char* parse_ptr = const_cast<char*>(str); @@ -1124,7 +1124,7 @@ long long strtoll(const char* str, char** endptr, int base) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoull.html -unsigned long long strtoull(const char* str, char** endptr, int base) +unsigned long long strtoull(char const* str, char** endptr, int base) { // Parse spaces and sign char* parse_ptr = const_cast<char*>(str); @@ -1257,7 +1257,7 @@ uint32_t arc4random_uniform(uint32_t max_bounds) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html -char* realpath(const char* pathname, char* buffer) +char* realpath(char const* pathname, char* buffer) { if (!pathname) { errno = EFAULT; diff --git a/Userland/Libraries/LibC/stdlib.h b/Userland/Libraries/LibC/stdlib.h index 21865cd398..8a76ae78fe 100644 --- a/Userland/Libraries/LibC/stdlib.h +++ b/Userland/Libraries/LibC/stdlib.h @@ -27,27 +27,27 @@ void free(void*); __attribute__((alloc_size(2))) void* realloc(void* ptr, size_t); __attribute__((malloc, alloc_size(1), alloc_align(2))) void* _aligned_malloc(size_t size, size_t alignment); void _aligned_free(void* memblock); -char* getenv(const char* name); -char* secure_getenv(const char* name); +char* getenv(char const* name); +char* secure_getenv(char const* name); int putenv(char*); -int unsetenv(const char*); +int unsetenv(char const*); int clearenv(void); -int setenv(const char* name, const char* value, int overwrite); -int serenity_setenv(const char* name, ssize_t name_length, const char* value, ssize_t value_length, int overwrite); -const char* getprogname(void); -void setprogname(const char*); -int atoi(const char*); -long atol(const char*); -long long atoll(const char*); -double strtod(const char*, char** endptr); -long double strtold(const char*, char** endptr); -float strtof(const char*, char** endptr); -long strtol(const char*, char** endptr, int base); -long long strtoll(const char*, char** endptr, int base); -unsigned long long strtoull(const char*, char** endptr, int base); -unsigned long strtoul(const char*, char** endptr, int base); -void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)); -void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg); +int setenv(char const* name, char const* value, int overwrite); +int serenity_setenv(char const* name, ssize_t name_length, char const* value, ssize_t value_length, int overwrite); +char const* getprogname(void); +void setprogname(char const*); +int atoi(char const*); +long atol(char const*); +long long atoll(char const*); +double strtod(char const*, char** endptr); +long double strtold(char const*, char** endptr); +float strtof(char const*, char** endptr); +long strtol(char const*, char** endptr, int base); +long long strtoll(char const*, char** endptr, int base); +unsigned long long strtoull(char const*, char** endptr, int base); +unsigned long strtoul(char const*, char** endptr, int base); +void qsort(void* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*)); +void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*, void*), void* arg); int atexit(void (*function)(void)); __attribute__((noreturn)) void exit(int status); __attribute__((noreturn)) void abort(void); @@ -56,18 +56,18 @@ int ptsname_r(int fd, char* buffer, size_t); int abs(int); long labs(long); long long int llabs(long long int); -double atof(const char*); -int system(const char* command); +double atof(char const*); +int system(char const* command); char* mktemp(char*); int mkstemp(char*); char* mkdtemp(char*); -void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)); +void* bsearch(void const* key, void const* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*)); int mblen(char const*, size_t); -size_t mbstowcs(wchar_t*, const char*, size_t); -int mbtowc(wchar_t*, const char*, size_t); +size_t mbstowcs(wchar_t*, char const*, size_t); +int mbtowc(wchar_t*, char const*, size_t); int wctomb(char*, wchar_t); -size_t wcstombs(char*, const wchar_t*, size_t); -char* realpath(const char* pathname, char* buffer); +size_t wcstombs(char*, wchar_t const*, size_t); +char* realpath(char const* pathname, char* buffer); __attribute__((noreturn)) void _Exit(int status); #define RAND_MAX 32767 diff --git a/Userland/Libraries/LibC/string.cpp b/Userland/Libraries/LibC/string.cpp index 093e77c871..90847bf63c 100644 --- a/Userland/Libraries/LibC/string.cpp +++ b/Userland/Libraries/LibC/string.cpp @@ -22,13 +22,13 @@ extern "C" { // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strspn.html -size_t strspn(const char* s, const char* accept) +size_t strspn(char const* s, char const* accept) { - const char* p = s; + char const* p = s; cont: char ch = *p++; char ac; - for (const char* ap = accept; (ac = *ap++) != '\0';) { + for (char const* ap = accept; (ac = *ap++) != '\0';) { if (ac == ch) goto cont; } @@ -36,7 +36,7 @@ cont: } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcspn.html -size_t strcspn(const char* s, const char* reject) +size_t strcspn(char const* s, char const* reject) { for (auto* p = s;;) { char c = *p++; @@ -50,7 +50,7 @@ size_t strcspn(const char* s, const char* reject) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strlen.html -size_t strlen(const char* str) +size_t strlen(char const* str) { size_t len = 0; while (*(str++)) @@ -59,7 +59,7 @@ size_t strlen(const char* str) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strnlen.html -size_t strnlen(const char* str, size_t maxlen) +size_t strnlen(char const* str, size_t maxlen) { size_t len = 0; for (; len < maxlen && *str; str++) @@ -68,7 +68,7 @@ size_t strnlen(const char* str, size_t maxlen) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strdup.html -char* strdup(const char* str) +char* strdup(char const* str) { size_t len = strlen(str); char* new_str = (char*)malloc(len + 1); @@ -78,7 +78,7 @@ char* strdup(const char* str) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strndup.html -char* strndup(const char* str, size_t maxlen) +char* strndup(char const* str, size_t maxlen) { size_t len = strnlen(str, maxlen); char* new_str = (char*)malloc(len + 1); @@ -88,22 +88,22 @@ char* strndup(const char* str, size_t maxlen) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcmp.html -int strcmp(const char* s1, const char* s2) +int strcmp(char const* s1, char const* s2) { while (*s1 == *s2++) if (*s1++ == 0) return 0; - return *(const unsigned char*)s1 - *(const unsigned char*)--s2; + return *(unsigned char const*)s1 - *(unsigned char const*)--s2; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncmp.html -int strncmp(const char* s1, const char* s2, size_t n) +int strncmp(char const* s1, char const* s2, size_t n) { if (!n) return 0; do { if (*s1 != *s2++) - return *(const unsigned char*)s1 - *(const unsigned char*)--s2; + return *(unsigned char const*)s1 - *(unsigned char const*)--s2; if (*s1++ == 0) break; } while (--n); @@ -111,10 +111,10 @@ int strncmp(const char* s1, const char* s2, size_t n) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/memcmp.html -int memcmp(const void* v1, const void* v2, size_t n) +int memcmp(void const* v1, void const* v2, size_t n) { - auto* s1 = (const uint8_t*)v1; - auto* s2 = (const uint8_t*)v2; + auto* s1 = (uint8_t const*)v1; + auto* s2 = (uint8_t const*)v2; while (n-- > 0) { if (*s1++ != *s2++) return s1[-1] < s2[-1] ? -1 : 1; @@ -122,13 +122,13 @@ int memcmp(const void* v1, const void* v2, size_t n) return 0; } -int timingsafe_memcmp(const void* b1, const void* b2, size_t len) +int timingsafe_memcmp(void const* b1, void const* b2, size_t len) { return AK::timing_safe_compare(b1, b2, len) ? 1 : 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/memcpy.html -void* memcpy(void* dest_ptr, const void* src_ptr, size_t n) +void* memcpy(void* dest_ptr, void const* src_ptr, size_t n) { void* original_dest = dest_ptr; asm volatile( @@ -171,25 +171,25 @@ void* memset(void* dest_ptr, int c, size_t n) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/memmove.html -void* memmove(void* dest, const void* src, size_t n) +void* memmove(void* dest, void const* src, size_t n) { if (((FlatPtr)dest - (FlatPtr)src) >= n) return memcpy(dest, src, n); u8* pd = (u8*)dest; - const u8* ps = (const u8*)src; + u8 const* ps = (u8 const*)src; for (pd += n, ps += n; n--;) *--pd = *--ps; return dest; } -const void* memmem(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length) +void const* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length) { return AK::memmem(haystack, haystack_length, needle, needle_length); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html -char* strcpy(char* dest, const char* src) +char* strcpy(char* dest, char const* src) { char* original_dest = dest; while ((*dest++ = *src++) != '\0') @@ -198,7 +198,7 @@ char* strcpy(char* dest, const char* src) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncpy.html -char* strncpy(char* dest, const char* src, size_t n) +char* strncpy(char* dest, char const* src, size_t n) { size_t i; for (i = 0; i < n && src[i] != '\0'; ++i) @@ -208,7 +208,7 @@ char* strncpy(char* dest, const char* src, size_t n) return dest; } -size_t strlcpy(char* dest, const char* src, size_t n) +size_t strlcpy(char* dest, char const* src, size_t n) { size_t i; // Would like to test i < n - 1 here, but n might be 0. @@ -222,7 +222,7 @@ size_t strlcpy(char* dest, const char* src, size_t n) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strchr.html -char* strchr(const char* str, int c) +char* strchr(char const* str, int c) { char ch = c; for (;; ++str) { @@ -234,12 +234,12 @@ char* strchr(const char* str, int c) } // https://pubs.opengroup.org/onlinepubs/9699959399/functions/index.html -char* index(const char* str, int c) +char* index(char const* str, int c) { return strchr(str, c); } -char* strchrnul(const char* str, int c) +char* strchrnul(char const* str, int c) { char ch = c; for (;; ++str) { @@ -249,10 +249,10 @@ char* strchrnul(const char* str, int c) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/memchr.html -void* memchr(const void* ptr, int c, size_t size) +void* memchr(void const* ptr, int c, size_t size) { char ch = c; - auto* cptr = (const char*)ptr; + auto* cptr = (char const*)ptr; for (size_t i = 0; i < size; ++i) { if (cptr[i] == ch) return const_cast<char*>(cptr + i); @@ -261,7 +261,7 @@ void* memchr(const void* ptr, int c, size_t size) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strrchr.html -char* strrchr(const char* str, int ch) +char* strrchr(char const* str, int ch) { char* last = nullptr; char c; @@ -273,13 +273,13 @@ char* strrchr(const char* str, int ch) } // https://pubs.opengroup.org/onlinepubs/9699959399/functions/rindex.html -char* rindex(const char* str, int ch) +char* rindex(char const* str, int ch) { return strrchr(str, ch); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcat.html -char* strcat(char* dest, const char* src) +char* strcat(char* dest, char const* src) { size_t dest_length = strlen(dest); size_t i; @@ -290,7 +290,7 @@ char* strcat(char* dest, const char* src) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncat.html -char* strncat(char* dest, const char* src, size_t n) +char* strncat(char* dest, char const* src, size_t n) { size_t dest_length = strlen(dest); size_t i; @@ -300,7 +300,7 @@ char* strncat(char* dest, const char* src, size_t n) return dest; } -const char* const sys_errlist[] = { +char const* const sys_errlist[] = { #define __ENUMERATE_ERRNO_CODE(c, s) s, ENUMERATE_ERRNO_CODES(__ENUMERATE_ERRNO_CODE) #undef __ENUMERATE_ERRNO_CODE @@ -350,7 +350,7 @@ char* strsignal(int signum) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strstr.html -char* strstr(const char* haystack, const char* needle) +char* strstr(char const* haystack, char const* needle) { char nch; char hch; @@ -369,7 +369,7 @@ char* strstr(const char* haystack, const char* needle) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strpbrk.html -char* strpbrk(const char* s, const char* accept) +char* strpbrk(char const* s, char const* accept) { while (*s) if (strchr(accept, *s++)) @@ -378,7 +378,7 @@ char* strpbrk(const char* s, const char* accept) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok_r.html -char* strtok_r(char* str, const char* delim, char** saved_str) +char* strtok_r(char* str, char const* delim, char** saved_str) { if (!str) { if (!saved_str || *saved_str == nullptr) @@ -433,20 +433,20 @@ char* strtok_r(char* str, const char* delim, char** saved_str) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html -char* strtok(char* str, const char* delim) +char* strtok(char* str, char const* delim) { static char* saved_str; return strtok_r(str, delim, &saved_str); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcoll.html -int strcoll(const char* s1, const char* s2) +int strcoll(char const* s1, char const* s2) { return strcmp(s1, s2); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strxfrm.html -size_t strxfrm(char* dest, const char* src, size_t n) +size_t strxfrm(char* dest, char const* src, size_t n) { size_t i; for (i = 0; i < n && src[i] != '\0'; ++i) diff --git a/Userland/Libraries/LibC/string.h b/Userland/Libraries/LibC/string.h index c58ee96836..c3681c89ca 100644 --- a/Userland/Libraries/LibC/string.h +++ b/Userland/Libraries/LibC/string.h @@ -17,50 +17,50 @@ __BEGIN_DECLS // do the same here to maintain compatibility #include <strings.h> -size_t strlen(const char*); -size_t strnlen(const char*, size_t maxlen); +size_t strlen(char const*); +size_t strnlen(char const*, size_t maxlen); -int strcmp(const char*, const char*); -int strncmp(const char*, const char*, size_t); +int strcmp(char const*, char const*); +int strncmp(char const*, char const*, size_t); -int memcmp(const void*, const void*, size_t); -int timingsafe_memcmp(const void*, const void*, size_t); -void* memcpy(void*, const void*, size_t); -void* memmove(void*, const void*, size_t); -void* memchr(const void*, int c, size_t); -const void* memmem(const void* haystack, size_t, const void* needle, size_t); +int memcmp(void const*, void const*, size_t); +int timingsafe_memcmp(void const*, void const*, size_t); +void* memcpy(void*, void const*, size_t); +void* memmove(void*, void const*, size_t); +void* memchr(void const*, int c, size_t); +void const* memmem(void const* haystack, size_t, void const* needle, size_t); void* memset(void*, int, size_t); void explicit_bzero(void*, size_t) __attribute__((nonnull(1))); -__attribute__((malloc)) char* strdup(const char*); -__attribute__((malloc)) char* strndup(const char*, size_t); +__attribute__((malloc)) char* strdup(char const*); +__attribute__((malloc)) char* strndup(char const*, size_t); -char* strcpy(char* dest, const char* src); -char* strncpy(char* dest, const char* src, size_t); -__attribute__((warn_unused_result)) size_t strlcpy(char* dest, const char* src, size_t); +char* strcpy(char* dest, char const* src); +char* strncpy(char* dest, char const* src, size_t); +__attribute__((warn_unused_result)) size_t strlcpy(char* dest, char const* src, size_t); -char* strchr(const char*, int c); -char* strchrnul(const char*, int c); -char* strstr(const char* haystack, const char* needle); -char* strrchr(const char*, int c); +char* strchr(char const*, int c); +char* strchrnul(char const*, int c); +char* strstr(char const* haystack, char const* needle); +char* strrchr(char const*, int c); -char* index(const char* str, int ch); -char* rindex(const char* str, int ch); +char* index(char const* str, int ch); +char* rindex(char const* str, int ch); -char* strcat(char* dest, const char* src); -char* strncat(char* dest, const char* src, size_t); +char* strcat(char* dest, char const* src); +char* strncat(char* dest, char const* src, size_t); -size_t strspn(const char*, const char* accept); -size_t strcspn(const char*, const char* reject); +size_t strspn(char const*, char const* accept); +size_t strcspn(char const*, char const* reject); int strerror_r(int, char*, size_t); char* strerror(int errnum); char* strsignal(int signum); -char* strpbrk(const char*, const char* accept); -char* strtok_r(char* str, const char* delim, char** saved_str); -char* strtok(char* str, const char* delim); -int strcoll(const char* s1, const char* s2); -size_t strxfrm(char* dest, const char* src, size_t n); +char* strpbrk(char const*, char const* accept); +char* strtok_r(char* str, char const* delim, char** saved_str); +char* strtok(char* str, char const* delim); +int strcoll(char const* s1, char const* s2); +size_t strxfrm(char* dest, char const* src, size_t n); char* strsep(char** str, char const* delim); __END_DECLS diff --git a/Userland/Libraries/LibC/strings.cpp b/Userland/Libraries/LibC/strings.cpp index 4f0d49c92a..0937cc2e1a 100644 --- a/Userland/Libraries/LibC/strings.cpp +++ b/Userland/Libraries/LibC/strings.cpp @@ -16,7 +16,7 @@ void bzero(void* dest, size_t n) memset(dest, 0, n); } -void bcopy(const void* src, void* dest, size_t n) +void bcopy(void const* src, void* dest, size_t n) { memmove(dest, src, n); } @@ -29,23 +29,23 @@ static char foldcase(char ch) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html -int strcasecmp(const char* s1, const char* s2) +int strcasecmp(char const* s1, char const* s2) { for (; foldcase(*s1) == foldcase(*s2); ++s1, ++s2) { if (*s1 == 0) return 0; } - return foldcase(*(const unsigned char*)s1) < foldcase(*(const unsigned char*)s2) ? -1 : 1; + return foldcase(*(unsigned char const*)s1) < foldcase(*(unsigned char const*)s2) ? -1 : 1; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncasecmp.html -int strncasecmp(const char* s1, const char* s2, size_t n) +int strncasecmp(char const* s1, char const* s2, size_t n) { if (!n) return 0; do { if (foldcase(*s1) != foldcase(*s2++)) - return foldcase(*(const unsigned char*)s1) - foldcase(*(const unsigned char*)--s2); + return foldcase(*(unsigned char const*)s1) - foldcase(*(unsigned char const*)--s2); if (*s1++ == 0) break; } while (--n); diff --git a/Userland/Libraries/LibC/strings.h b/Userland/Libraries/LibC/strings.h index 36e2e3621b..1805bc887c 100644 --- a/Userland/Libraries/LibC/strings.h +++ b/Userland/Libraries/LibC/strings.h @@ -11,9 +11,9 @@ __BEGIN_DECLS -int strcasecmp(const char*, const char*); -int strncasecmp(const char*, const char*, size_t); +int strcasecmp(char const*, char const*); +int strncasecmp(char const*, char const*, size_t); void bzero(void*, size_t); -void bcopy(const void*, void*, size_t); +void bcopy(void const*, void*, size_t); __END_DECLS diff --git a/Userland/Libraries/LibC/sys/mman.cpp b/Userland/Libraries/LibC/sys/mman.cpp index ff40f87e17..9dd9d4ef3a 100644 --- a/Userland/Libraries/LibC/sys/mman.cpp +++ b/Userland/Libraries/LibC/sys/mman.cpp @@ -13,7 +13,7 @@ extern "C" { -void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, const char* name) +void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, char const* name) { Syscall::SC_mmap_params params { addr, size, alignment, prot, flags, fd, offset, { name, name ? strlen(name) : 0 } }; ptrdiff_t rc = syscall(SC_mmap, ¶ms); @@ -30,7 +30,7 @@ void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, nullptr); } -void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, const char* name) +void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, char const* name) { return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, name); } @@ -60,7 +60,7 @@ int mprotect(void* addr, size_t size, int prot) __RETURN_WITH_ERRNO(rc, rc, -1); } -int set_mmap_name(void* addr, size_t size, const char* name) +int set_mmap_name(void* addr, size_t size, char const* name) { if (!name) { errno = EFAULT; @@ -83,7 +83,7 @@ int posix_madvise(void* address, size_t len, int advice) return madvise(address, len, advice); } -void* allocate_tls(const char* initial_data, size_t size) +void* allocate_tls(char const* initial_data, size_t size) { ptrdiff_t rc = syscall(SC_allocate_tls, initial_data, size); if (rc < 0 && rc > -EMAXERRNO) { @@ -94,14 +94,14 @@ void* allocate_tls(const char* initial_data, size_t size) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html -int mlock(const void*, size_t) +int mlock(void const*, size_t) { dbgln("FIXME: Implement mlock()"); return 0; } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/munlock.html -int munlock(const void*, size_t) +int munlock(void const*, size_t) { dbgln("FIXME: Implement munlock()"); return 0; diff --git a/Userland/Libraries/LibC/sys/mman.h b/Userland/Libraries/LibC/sys/mman.h index d5cd1d80ec..d5d5ed2b44 100644 --- a/Userland/Libraries/LibC/sys/mman.h +++ b/Userland/Libraries/LibC/sys/mman.h @@ -11,17 +11,17 @@ __BEGIN_DECLS void* mmap(void* addr, size_t, int prot, int flags, int fd, off_t); -void* mmap_with_name(void* addr, size_t, int prot, int flags, int fd, off_t, const char* name); -void* serenity_mmap(void* addr, size_t, int prot, int flags, int fd, off_t, size_t alignment, const char* name); +void* mmap_with_name(void* addr, size_t, int prot, int flags, int fd, off_t, char const* name); +void* serenity_mmap(void* addr, size_t, int prot, int flags, int fd, off_t, size_t alignment, char const* name); void* mremap(void* old_address, size_t old_size, size_t new_size, int flags); int munmap(void*, size_t); int mprotect(void*, size_t, int prot); -int set_mmap_name(void*, size_t, const char*); +int set_mmap_name(void*, size_t, char const*); int madvise(void*, size_t, int advice); int posix_madvise(void*, size_t, int advice); -void* allocate_tls(const char* initial_data, size_t); -int mlock(const void*, size_t); -int munlock(const void*, size_t); +void* allocate_tls(char const* initial_data, size_t); +int mlock(void const*, size_t); +int munlock(void const*, size_t); int msync(void*, size_t, int flags); __END_DECLS diff --git a/Userland/Libraries/LibC/sys/select.cpp b/Userland/Libraries/LibC/sys/select.cpp index 30f005c9c7..b3441a4910 100644 --- a/Userland/Libraries/LibC/sys/select.cpp +++ b/Userland/Libraries/LibC/sys/select.cpp @@ -28,7 +28,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timev } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html -int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const timespec* timeout, const sigset_t* sigmask) +int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timespec const* timeout, sigset_t const* sigmask) { Vector<pollfd, FD_SETSIZE> fds; diff --git a/Userland/Libraries/LibC/sys/select.h b/Userland/Libraries/LibC/sys/select.h index 57a61cc145..02e9f0d6f6 100644 --- a/Userland/Libraries/LibC/sys/select.h +++ b/Userland/Libraries/LibC/sys/select.h @@ -16,6 +16,6 @@ __BEGIN_DECLS int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout); -int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timespec* timeout, const sigset_t* sigmask); +int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timespec* timeout, sigset_t const* sigmask); __END_DECLS diff --git a/Userland/Libraries/LibC/sys/socket.cpp b/Userland/Libraries/LibC/sys/socket.cpp index 3e78ff1486..6cfedc0c0e 100644 --- a/Userland/Libraries/LibC/sys/socket.cpp +++ b/Userland/Libraries/LibC/sys/socket.cpp @@ -22,7 +22,7 @@ int socket(int domain, int type, int protocol) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html -int bind(int sockfd, const sockaddr* addr, socklen_t addrlen) +int bind(int sockfd, sockaddr const* addr, socklen_t addrlen) { int rc = syscall(SC_bind, sockfd, addr, addrlen); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -49,7 +49,7 @@ int accept4(int sockfd, sockaddr* addr, socklen_t* addrlen, int flags) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html -int connect(int sockfd, const sockaddr* addr, socklen_t addrlen) +int connect(int sockfd, sockaddr const* addr, socklen_t addrlen) { int rc = syscall(SC_connect, sockfd, addr, addrlen); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -70,7 +70,7 @@ ssize_t sendmsg(int sockfd, const struct msghdr* msg, int flags) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html -ssize_t sendto(int sockfd, const void* data, size_t data_length, int flags, const struct sockaddr* addr, socklen_t addr_length) +ssize_t sendto(int sockfd, void const* data, size_t data_length, int flags, const struct sockaddr* addr, socklen_t addr_length) { iovec iov = { const_cast<void*>(data), data_length }; msghdr msg = { const_cast<struct sockaddr*>(addr), addr_length, &iov, 1, nullptr, 0, 0 }; @@ -78,7 +78,7 @@ ssize_t sendto(int sockfd, const void* data, size_t data_length, int flags, cons } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html -ssize_t send(int sockfd, const void* data, size_t data_length, int flags) +ssize_t send(int sockfd, void const* data, size_t data_length, int flags) { return sendto(sockfd, data, data_length, flags, nullptr, 0); } @@ -124,7 +124,7 @@ int getsockopt(int sockfd, int level, int option, void* value, socklen_t* value_ } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html -int setsockopt(int sockfd, int level, int option, const void* value, socklen_t value_size) +int setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size) { Syscall::SC_setsockopt_params params { value, sockfd, level, option, value_size }; int rc = syscall(SC_setsockopt, ¶ms); diff --git a/Userland/Libraries/LibC/sys/socket.h b/Userland/Libraries/LibC/sys/socket.h index 87b4ecea8d..f37be8e7ae 100644 --- a/Userland/Libraries/LibC/sys/socket.h +++ b/Userland/Libraries/LibC/sys/socket.h @@ -18,14 +18,14 @@ int accept(int sockfd, struct sockaddr*, socklen_t*); int accept4(int sockfd, struct sockaddr*, socklen_t*, int); int connect(int sockfd, const struct sockaddr*, socklen_t); int shutdown(int sockfd, int how); -ssize_t send(int sockfd, const void*, size_t, int flags); +ssize_t send(int sockfd, void const*, size_t, int flags); ssize_t sendmsg(int sockfd, const struct msghdr*, int flags); -ssize_t sendto(int sockfd, const void*, size_t, int flags, const struct sockaddr*, socklen_t); +ssize_t sendto(int sockfd, void const*, size_t, int flags, const struct sockaddr*, socklen_t); ssize_t recv(int sockfd, void*, size_t, int flags); ssize_t recvmsg(int sockfd, struct msghdr*, int flags); ssize_t recvfrom(int sockfd, void*, size_t, int flags, struct sockaddr*, socklen_t*); int getsockopt(int sockfd, int level, int option, void*, socklen_t*); -int setsockopt(int sockfd, int level, int option, const void*, socklen_t); +int setsockopt(int sockfd, int level, int option, void const*, socklen_t); int getsockname(int sockfd, struct sockaddr*, socklen_t*); int getpeername(int sockfd, struct sockaddr*, socklen_t*); int socketpair(int domain, int type, int protocol, int sv[2]); diff --git a/Userland/Libraries/LibC/sys/stat.h b/Userland/Libraries/LibC/sys/stat.h index 9aeb90611f..4ada805708 100644 --- a/Userland/Libraries/LibC/sys/stat.h +++ b/Userland/Libraries/LibC/sys/stat.h @@ -14,14 +14,14 @@ __BEGIN_DECLS mode_t umask(mode_t); -int chmod(const char* pathname, mode_t); +int chmod(char const* pathname, mode_t); int fchmodat(int fd, char const* path, mode_t mode, int flag); int fchmod(int fd, mode_t); -int mkdir(const char* pathname, mode_t); -int mkfifo(const char* pathname, mode_t); +int mkdir(char const* pathname, mode_t); +int mkfifo(char const* pathname, mode_t); int fstat(int fd, struct stat* statbuf); -int lstat(const char* path, struct stat* statbuf); -int stat(const char* path, struct stat* statbuf); -int fstatat(int fd, const char* path, struct stat* statbuf, int flags); +int lstat(char const* path, struct stat* statbuf); +int stat(char const* path, struct stat* statbuf); +int fstatat(int fd, char const* path, struct stat* statbuf, int flags); __END_DECLS diff --git a/Userland/Libraries/LibC/sys/statvfs.cpp b/Userland/Libraries/LibC/sys/statvfs.cpp index d49e38623b..d7b238520b 100644 --- a/Userland/Libraries/LibC/sys/statvfs.cpp +++ b/Userland/Libraries/LibC/sys/statvfs.cpp @@ -11,7 +11,7 @@ extern "C" { -int statvfs(const char* path, struct statvfs* buf) +int statvfs(char const* path, struct statvfs* buf) { Syscall::SC_statvfs_params params { { path, strlen(path) }, buf }; int rc = syscall(SC_statvfs, ¶ms); diff --git a/Userland/Libraries/LibC/sys/time.h b/Userland/Libraries/LibC/sys/time.h index 452774f71c..8dc88f672a 100644 --- a/Userland/Libraries/LibC/sys/time.h +++ b/Userland/Libraries/LibC/sys/time.h @@ -19,7 +19,7 @@ struct timezone { int adjtime(const struct timeval* delta, struct timeval* old_delta); int gettimeofday(struct timeval* __restrict__, void* __restrict__); int settimeofday(struct timeval* __restrict__, void* __restrict__); -int utimes(const char* pathname, const struct timeval[2]); +int utimes(char const* pathname, const struct timeval[2]); static inline void timeradd(const struct timeval* a, const struct timeval* b, struct timeval* out) { diff --git a/Userland/Libraries/LibC/sys/xattr.cpp b/Userland/Libraries/LibC/sys/xattr.cpp index 61c6f1afaf..cc30458c90 100644 --- a/Userland/Libraries/LibC/sys/xattr.cpp +++ b/Userland/Libraries/LibC/sys/xattr.cpp @@ -7,49 +7,49 @@ #include <AK/Format.h> #include <sys/xattr.h> -ssize_t getxattr(const char*, const char*, void*, size_t) +ssize_t getxattr(char const*, char const*, void*, size_t) { dbgln("FIXME: Implement getxattr()"); return 0; } -ssize_t lgetxattr(const char*, const char*, void*, size_t) +ssize_t lgetxattr(char const*, char const*, void*, size_t) { dbgln("FIXME: Implement lgetxattr()"); return 0; } -ssize_t fgetxattr(int, const char*, void*, size_t) +ssize_t fgetxattr(int, char const*, void*, size_t) { dbgln("FIXME: Implement fgetxattr()"); return 0; } -int setxattr(const char*, const char*, const void*, size_t, int) +int setxattr(char const*, char const*, void const*, size_t, int) { dbgln("FIXME: Implement setxattr()"); return 0; } -int lsetxattr(const char*, const char*, const void*, size_t, int) +int lsetxattr(char const*, char const*, void const*, size_t, int) { dbgln("FIXME: Implement lsetxattr()"); return 0; } -int fsetxattr(int, const char*, const void*, size_t, int) +int fsetxattr(int, char const*, void const*, size_t, int) { dbgln("FIXME: Implement fsetxattr()"); return 0; } -ssize_t listxattr(const char*, char*, size_t) +ssize_t listxattr(char const*, char*, size_t) { dbgln("FIXME: Implement listxattr()"); return 0; } -ssize_t llistxattr(const char*, char*, size_t) +ssize_t llistxattr(char const*, char*, size_t) { dbgln("FIXME: Implement llistxattr()"); return 0; diff --git a/Userland/Libraries/LibC/sys/xattr.h b/Userland/Libraries/LibC/sys/xattr.h index 69c0735cab..0da4ead659 100644 --- a/Userland/Libraries/LibC/sys/xattr.h +++ b/Userland/Libraries/LibC/sys/xattr.h @@ -10,16 +10,16 @@ __BEGIN_DECLS -ssize_t getxattr(const char* path, const char* name, void* value, size_t size); -ssize_t lgetxattr(const char* path, const char* name, void* value, size_t size); -ssize_t fgetxattr(int fd, const char* name, void* value, size_t size); +ssize_t getxattr(char const* path, char const* name, void* value, size_t size); +ssize_t lgetxattr(char const* path, char const* name, void* value, size_t size); +ssize_t fgetxattr(int fd, char const* name, void* value, size_t size); -int setxattr(const char* path, const char* name, const void* value, size_t size, int flags); -int lsetxattr(const char* path, const char* name, const void* value, size_t size, int flags); -int fsetxattr(int fd, const char* name, const void* value, size_t size, int flags); +int setxattr(char const* path, char const* name, void const* value, size_t size, int flags); +int lsetxattr(char const* path, char const* name, void const* value, size_t size, int flags); +int fsetxattr(int fd, char const* name, void const* value, size_t size, int flags); -ssize_t listxattr(const char* path, char* list, size_t size); -ssize_t llistxattr(const char* path, char* list, size_t size); +ssize_t listxattr(char const* path, char* list, size_t size); +ssize_t llistxattr(char const* path, char* list, size_t size); ssize_t flistxattr(int fd, char* list, size_t size); __END_DECLS diff --git a/Userland/Libraries/LibC/syslog.cpp b/Userland/Libraries/LibC/syslog.cpp index 7e17a51498..9c563a22f7 100644 --- a/Userland/Libraries/LibC/syslog.cpp +++ b/Userland/Libraries/LibC/syslog.cpp @@ -36,7 +36,7 @@ static bool program_name_set = false; // Convenience function for initialization and checking what string to use // for the program name. -static const char* get_syslog_ident(struct syslog_data* data) +static char const* get_syslog_ident(struct syslog_data* data) { if (!program_name_set && data->ident == nullptr) program_name_set = get_process_name(program_name_buffer, sizeof(program_name_buffer)) >= 0; @@ -49,7 +49,7 @@ static const char* get_syslog_ident(struct syslog_data* data) VERIFY_NOT_REACHED(); } -void openlog_r(const char* ident, int logopt, int facility, struct syslog_data* data) +void openlog_r(char const* ident, int logopt, int facility, struct syslog_data* data) { data->ident = ident; data->logopt = logopt; @@ -59,7 +59,7 @@ void openlog_r(const char* ident, int logopt, int facility, struct syslog_data* // would be where we connect to a daemon } -void openlog(const char* ident, int logopt, int facility) +void openlog(char const* ident, int logopt, int facility) { openlog_r(ident, logopt, facility, &global_log_data); } @@ -92,7 +92,7 @@ int setlogmask(int maskpri) return setlogmask_r(maskpri, &global_log_data); } -void syslog_r(int priority, struct syslog_data* data, const char* message, ...) +void syslog_r(int priority, struct syslog_data* data, char const* message, ...) { va_list ap; va_start(ap, message); @@ -100,7 +100,7 @@ void syslog_r(int priority, struct syslog_data* data, const char* message, ...) va_end(ap); } -void syslog(int priority, const char* message, ...) +void syslog(int priority, char const* message, ...) { va_list ap; va_start(ap, message); @@ -108,7 +108,7 @@ void syslog(int priority, const char* message, ...) va_end(ap); } -void vsyslog_r(int priority, struct syslog_data* data, const char* message, va_list args) +void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_list args) { StringBuilder combined; @@ -132,7 +132,7 @@ void vsyslog_r(int priority, struct syslog_data* data, const char* message, va_l fputs(combined_string.characters(), stderr); } -void vsyslog(int priority, const char* message, va_list args) +void vsyslog(int priority, char const* message, va_list args) { vsyslog_r(priority, &global_log_data, message, args); } diff --git a/Userland/Libraries/LibC/syslog.h b/Userland/Libraries/LibC/syslog.h index f2186f42f7..92d97aae40 100644 --- a/Userland/Libraries/LibC/syslog.h +++ b/Userland/Libraries/LibC/syslog.h @@ -12,7 +12,7 @@ __BEGIN_DECLS struct syslog_data { - const char* ident; + char const* ident; int logopt; int facility; int maskpri; @@ -95,7 +95,7 @@ typedef struct _code { * Most Unices define this as char*, but in C++, we have to define it as a * const char* if we want to use string constants. */ - const char* c_name; + char const* c_name; int c_val; } CODE; @@ -146,12 +146,12 @@ CODE facilitynames[] = { #endif /* The re-entrant versions are an OpenBSD extension we also implement. */ -void syslog(int, const char*, ...); -void syslog_r(int, struct syslog_data*, const char*, ...); -void vsyslog(int, const char* message, va_list); -void vsyslog_r(int, struct syslog_data* data, const char* message, va_list); -void openlog(const char*, int, int); -void openlog_r(const char*, int, int, struct syslog_data*); +void syslog(int, char const*, ...); +void syslog_r(int, struct syslog_data*, char const*, ...); +void vsyslog(int, char const* message, va_list); +void vsyslog_r(int, struct syslog_data* data, char const* message, va_list); +void openlog(char const*, int, int); +void openlog_r(char const*, int, int, struct syslog_data*); void closelog(void); void closelog_r(struct syslog_data*); int setlogmask(int); diff --git a/Userland/Libraries/LibC/termcap.cpp b/Userland/Libraries/LibC/termcap.cpp index 24a99c6f69..a62a225be4 100644 --- a/Userland/Libraries/LibC/termcap.cpp +++ b/Userland/Libraries/LibC/termcap.cpp @@ -18,7 +18,7 @@ char PC; char* UP; char* BC; -int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] const char* name) +int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] char const* name) { warnln_if(TERMCAP_DEBUG, "tgetent: bp={:p}, name='{}'", bp, name); PC = '\0'; @@ -27,13 +27,13 @@ int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] co return 1; } -static HashMap<String, const char*>* caps = nullptr; +static HashMap<String, char const*>* caps = nullptr; static void ensure_caps() { if (caps) return; - caps = new HashMap<String, const char*>; + caps = new HashMap<String, char const*>; caps->set("DC", "\033[%p1%dP"); caps->set("IC", "\033[%p1%d@"); caps->set("ce", "\033[K"); @@ -75,14 +75,14 @@ static void ensure_caps() #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" -char* __attribute__((weak)) tgetstr(const char* id, char** area) +char* __attribute__((weak)) tgetstr(char const* id, char** area) { ensure_caps(); warnln_if(TERMCAP_DEBUG, "tgetstr: id='{}'", id); auto it = caps->find(id); if (it != caps->end()) { char* ret = *area; - const char* val = (*it).value; + char const* val = (*it).value; strcpy(*area, val); *area += strlen(val) + 1; return ret; @@ -93,7 +93,7 @@ char* __attribute__((weak)) tgetstr(const char* id, char** area) #pragma GCC diagnostic pop -int __attribute__((weak)) tgetflag([[maybe_unused]] const char* id) +int __attribute__((weak)) tgetflag([[maybe_unused]] char const* id) { warnln_if(TERMCAP_DEBUG, "tgetflag: '{}'", id); auto it = caps->find(id); @@ -102,7 +102,7 @@ int __attribute__((weak)) tgetflag([[maybe_unused]] const char* id) return 0; } -int __attribute__((weak)) tgetnum(const char* id) +int __attribute__((weak)) tgetnum(char const* id) { warnln_if(TERMCAP_DEBUG, "tgetnum: '{}'", id); auto it = caps->find(id); @@ -112,7 +112,7 @@ int __attribute__((weak)) tgetnum(const char* id) } static Vector<char> s_tgoto_buffer; -char* __attribute__((weak)) tgoto([[maybe_unused]] const char* cap, [[maybe_unused]] int col, [[maybe_unused]] int row) +char* __attribute__((weak)) tgoto([[maybe_unused]] char const* cap, [[maybe_unused]] int col, [[maybe_unused]] int row) { auto cap_str = StringView(cap).replace("%p1%d", String::number(col)).replace("%p2%d", String::number(row)); @@ -122,7 +122,7 @@ char* __attribute__((weak)) tgoto([[maybe_unused]] const char* cap, [[maybe_unus return s_tgoto_buffer.data(); } -int __attribute__((weak)) tputs(const char* str, [[maybe_unused]] int affcnt, int (*putc)(int)) +int __attribute__((weak)) tputs(char const* str, [[maybe_unused]] int affcnt, int (*putc)(int)) { size_t len = strlen(str); for (size_t i = 0; i < len; ++i) diff --git a/Userland/Libraries/LibC/termcap.h b/Userland/Libraries/LibC/termcap.h index a6a70c4b2d..451151aa75 100644 --- a/Userland/Libraries/LibC/termcap.h +++ b/Userland/Libraries/LibC/termcap.h @@ -14,11 +14,11 @@ extern char PC; extern char* UP; extern char* BC; -int tgetent(char* bp, const char* name); -int tgetflag(const char* id); -int tgetnum(const char* id); -char* tgetstr(const char* id, char** area); -char* tgoto(const char* cap, int col, int row); -int tputs(const char* str, int affcnt, int (*putc)(int)); +int tgetent(char* bp, char const* name); +int tgetflag(char const* id); +int tgetnum(char const* id); +char* tgetstr(char const* id, char** area); +char* tgoto(char const* cap, int col, int row); +int tputs(char const* str, int affcnt, int (*putc)(int)); __END_DECLS diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index 6f6dfa67b1..c28351c97a 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -68,7 +68,7 @@ int settimeofday(struct timeval* __restrict__ tv, void* __restrict__) return clock_settime(CLOCK_REALTIME, &ts); } -int utimes(const char* pathname, const struct timeval times[2]) +int utimes(char const* pathname, const struct timeval times[2]) { if (!times) { return utime(pathname, nullptr); @@ -78,18 +78,18 @@ int utimes(const char* pathname, const struct timeval times[2]) return utime(pathname, &buf); } -char* ctime(const time_t* t) +char* ctime(time_t const* t) { return asctime(localtime(t)); } -char* ctime_r(const time_t* t, char* buf) +char* ctime_r(time_t const* t, char* buf) { struct tm tm_buf; return asctime_r(localtime_r(t, &tm_buf), buf); } -static const int __seconds_per_day = 60 * 60 * 24; +static int const __seconds_per_day = 60 * 60 * 24; static void time_to_tm(struct tm* tm, time_t t) { @@ -150,7 +150,7 @@ time_t mktime(struct tm* tm) return tm_to_time(tm, daylight ? altzone : timezone); } -struct tm* localtime(const time_t* t) +struct tm* localtime(time_t const* t) { tzset(); @@ -158,7 +158,7 @@ struct tm* localtime(const time_t* t) return localtime_r(t, &tm_buf); } -struct tm* localtime_r(const time_t* t, struct tm* tm) +struct tm* localtime_r(time_t const* t, struct tm* tm) { if (!t) return nullptr; @@ -172,13 +172,13 @@ time_t timegm(struct tm* tm) return tm_to_time(tm, 0); } -struct tm* gmtime(const time_t* t) +struct tm* gmtime(time_t const* t) { static struct tm tm_buf; return gmtime_r(t, &tm_buf); } -struct tm* gmtime_r(const time_t* t, struct tm* tm) +struct tm* gmtime_r(time_t const* t, struct tm* tm) { if (!t) return nullptr; @@ -205,13 +205,13 @@ char* asctime_r(const struct tm* tm, char* buffer) } // FIXME: Some formats are not supported. -size_t strftime(char* destination, size_t max_size, const char* format, const struct tm* tm) +size_t strftime(char* destination, size_t max_size, char const* format, const struct tm* tm) { tzset(); StringBuilder builder { max_size }; - const int format_len = strlen(format); + int const format_len = strlen(format); for (int i = 0; i < format_len; ++i) { if (format[i] != '%') { builder.append(format[i]); @@ -287,20 +287,20 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st builder.appendff("{}", tm->tm_wday ? tm->tm_wday : 7); break; case 'U': { - const int wday_of_year_beginning = (tm->tm_wday + 6 * tm->tm_yday) % 7; - const int week_number = (tm->tm_yday + wday_of_year_beginning) / 7; + int const wday_of_year_beginning = (tm->tm_wday + 6 * tm->tm_yday) % 7; + int const week_number = (tm->tm_yday + wday_of_year_beginning) / 7; builder.appendff("{:02}", week_number); break; } case 'V': { - const int wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7; + int const wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7; int week_number = (tm->tm_yday + wday_of_year_beginning) / 7 + 1; if (wday_of_year_beginning > 3) { if (tm->tm_yday >= 7 - wday_of_year_beginning) --week_number; else { - const int days_of_last_year = days_in_year(tm->tm_year + 1900 - 1); - const int wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7; + int const days_of_last_year = days_in_year(tm->tm_year + 1900 - 1); + int const wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7; week_number = (days_of_last_year + wday_of_last_year_beginning) / 7 + 1; if (wday_of_last_year_beginning > 3) --week_number; @@ -313,8 +313,8 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st builder.appendff("{}", tm->tm_wday); break; case 'W': { - const int wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7; - const int week_number = (tm->tm_yday + wday_of_year_beginning) / 7; + int const wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7; + int const week_number = (tm->tm_yday + wday_of_year_beginning) / 7; builder.appendff("{:02}", week_number); break; } @@ -342,7 +342,7 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st static char __tzname_standard[TZNAME_MAX]; static char __tzname_daylight[TZNAME_MAX]; -constexpr const char* __utc = "UTC"; +constexpr char const* __utc = "UTC"; long timezone = 0; long altzone = 0; diff --git a/Userland/Libraries/LibC/time.h b/Userland/Libraries/LibC/time.h index d5316c4ee4..caf8d9d6e5 100644 --- a/Userland/Libraries/LibC/time.h +++ b/Userland/Libraries/LibC/time.h @@ -30,13 +30,13 @@ extern int daylight; typedef uint32_t clock_t; typedef int64_t time_t; -struct tm* localtime(const time_t*); -struct tm* gmtime(const time_t*); +struct tm* localtime(time_t const*); +struct tm* gmtime(time_t const*); time_t mktime(struct tm*); time_t timegm(struct tm*); time_t time(time_t*); -char* ctime(const time_t*); -char* ctime_r(const time_t* tm, char* buf); +char* ctime(time_t const*); +char* ctime_r(time_t const* tm, char* buf); void tzset(void); char* asctime(const struct tm*); char* asctime_r(const struct tm*, char* buf); @@ -48,10 +48,10 @@ int clock_settime(clockid_t, struct timespec*); int clock_nanosleep(clockid_t, int flags, const struct timespec* requested_sleep, struct timespec* remaining_sleep); int clock_getres(clockid_t, struct timespec* result); int nanosleep(const struct timespec* requested_sleep, struct timespec* remaining_sleep); -struct tm* gmtime_r(const time_t* timep, struct tm* result); -struct tm* localtime_r(const time_t* timep, struct tm* result); +struct tm* gmtime_r(time_t const* timep, struct tm* result); +struct tm* localtime_r(time_t const* timep, struct tm* result); double difftime(time_t, time_t); -size_t strftime(char* s, size_t max, const char* format, const struct tm*) __attribute__((format(strftime, 3, 0))); +size_t strftime(char* s, size_t max, char const* format, const struct tm*) __attribute__((format(strftime, 3, 0))); __END_DECLS diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index 386de58260..f613be7a19 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -44,7 +44,7 @@ static __thread int s_cached_tid = 0; static int s_cached_pid = 0; // https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html -int lchown(const char* pathname, uid_t uid, gid_t gid) +int lchown(char const* pathname, uid_t uid, gid_t gid) { if (!pathname) { errno = EFAULT; @@ -56,7 +56,7 @@ int lchown(const char* pathname, uid_t uid, gid_t gid) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html -int chown(const char* pathname, uid_t uid, gid_t gid) +int chown(char const* pathname, uid_t uid, gid_t gid) { if (!pathname) { errno = EFAULT; @@ -74,7 +74,7 @@ int fchown(int fd, uid_t uid, gid_t gid) __RETURN_WITH_ERRNO(rc, rc, -1); } -int fchownat(int fd, const char* pathname, uid_t uid, gid_t gid, int flags) +int fchownat(int fd, char const* pathname, uid_t uid, gid_t gid, int flags) { if (!pathname) { errno = EFAULT; @@ -141,13 +141,13 @@ int daemon(int nochdir, int noclose) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/execv.html -int execv(const char* path, char* const argv[]) +int execv(char const* path, char* const argv[]) { return execve(path, argv, environ); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html -int execve(const char* filename, char* const argv[], char* const envp[]) +int execve(char const* filename, char* const argv[], char* const envp[]) { size_t arg_count = 0; for (size_t i = 0; argv[i]; ++i) @@ -177,7 +177,7 @@ int execve(const char* filename, char* const argv[], char* const envp[]) __RETURN_WITH_ERRNO(rc, rc, -1); } -int execvpe(const char* filename, char* const argv[], char* const envp[]) +int execvpe(char const* filename, char* const argv[], char* const envp[]) { if (strchr(filename, '/')) return execve(filename, argv, envp); @@ -202,7 +202,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[]) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html -int execvp(const char* filename, char* const argv[]) +int execvp(char const* filename, char* const argv[]) { int rc = execvpe(filename, argv, environ); int saved_errno = errno; @@ -212,15 +212,15 @@ int execvp(const char* filename, char* const argv[]) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/execl.html -int execl(const char* filename, const char* arg0, ...) +int execl(char const* filename, char const* arg0, ...) { - Vector<const char*, 16> args; + Vector<char const*, 16> args; args.append(arg0); va_list ap; va_start(ap, arg0); for (;;) { - const char* arg = va_arg(ap, const char*); + char const* arg = va_arg(ap, char const*); if (!arg) break; args.append(arg); @@ -252,15 +252,15 @@ int execle(char const* filename, char const* arg0, ...) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/execlp.html -int execlp(const char* filename, const char* arg0, ...) +int execlp(char const* filename, char const* arg0, ...) { - Vector<const char*, 16> args; + Vector<char const*, 16> args; args.append(arg0); va_list ap; va_start(ap, arg0); for (;;) { - const char* arg = va_arg(ap, const char*); + char const* arg = va_arg(ap, char const*); if (!arg) break; args.append(arg); @@ -386,14 +386,14 @@ ssize_t pread(int fd, void* buf, size_t count, off_t offset) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html -ssize_t write(int fd, const void* buf, size_t count) +ssize_t write(int fd, void const* buf, size_t count) { int rc = syscall(SC_write, fd, buf, count); __RETURN_WITH_ERRNO(rc, rc, -1); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html -ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset) +ssize_t pwrite(int fd, void const* buf, size_t count, off_t offset) { // FIXME: This is not thread safe and should be implemented in the kernel instead. off_t old_offset = lseek(fd, 0, SEEK_CUR); @@ -404,7 +404,7 @@ ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset) } // Note: Be sure to send to directory_name parameter a directory name ended with trailing slash. -static int ttyname_r_for_directory(const char* directory_name, dev_t device_mode, ino_t inode_number, char* buffer, size_t size) +static int ttyname_r_for_directory(char const* directory_name, dev_t device_mode, ino_t inode_number, char* buffer, size_t size) { DIR* dirstream = opendir(directory_name); if (!dirstream) { @@ -489,7 +489,7 @@ int close(int fd) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html -int chdir(const char* path) +int chdir(char const* path) { if (!path) { errno = EFAULT; @@ -608,14 +608,14 @@ int gethostname(char* buffer, size_t size) __RETURN_WITH_ERRNO(rc, rc, -1); } -int sethostname(const char* hostname, ssize_t size) +int sethostname(char const* hostname, ssize_t size) { int rc = syscall(SC_sethostname, hostname, size); __RETURN_WITH_ERRNO(rc, rc, -1); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html -ssize_t readlink(const char* path, char* buffer, size_t size) +ssize_t readlink(char const* path, char* buffer, size_t size) { Syscall::SC_readlink_params params { { path, strlen(path) }, { buffer, size } }; int rc = syscall(SC_readlink, ¶ms); @@ -630,7 +630,7 @@ off_t lseek(int fd, off_t offset, int whence) __RETURN_WITH_ERRNO(rc, offset, -1); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html -int link(const char* old_path, const char* new_path) +int link(char const* old_path, char const* new_path) { if (!old_path || !new_path) { errno = EFAULT; @@ -642,14 +642,14 @@ int link(const char* old_path, const char* new_path) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html -int unlink(const char* pathname) +int unlink(char const* pathname) { int rc = syscall(SC_unlink, pathname, strlen(pathname)); __RETURN_WITH_ERRNO(rc, rc, -1); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html -int symlink(const char* target, const char* linkpath) +int symlink(char const* target, char const* linkpath) { if (!target || !linkpath) { errno = EFAULT; @@ -661,7 +661,7 @@ int symlink(const char* target, const char* linkpath) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html -int rmdir(const char* pathname) +int rmdir(char const* pathname) { if (!pathname) { errno = EFAULT; @@ -690,7 +690,7 @@ int dup2(int old_fd, int new_fd) __RETURN_WITH_ERRNO(rc, rc, -1); } -int setgroups(size_t size, const gid_t* list) +int setgroups(size_t size, gid_t const* list) { int rc = syscall(SC_setgroups, size, list); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -763,7 +763,7 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html -int access(const char* pathname, int mode) +int access(char const* pathname, int mode) { if (!pathname) { errno = EFAULT; @@ -774,7 +774,7 @@ int access(const char* pathname, int mode) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html -int mknod(const char* pathname, mode_t mode, dev_t dev) +int mknod(char const* pathname, mode_t mode, dev_t dev) { if (!pathname) { errno = EFAULT; @@ -803,7 +803,7 @@ long fpathconf([[maybe_unused]] int fd, int name) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/pathconf.html -long pathconf([[maybe_unused]] const char* path, int name) +long pathconf([[maybe_unused]] char const* path, int name) { switch (name) { case _PC_NAME_MAX: @@ -853,7 +853,7 @@ int ftruncate(int fd, off_t length) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html -int truncate(const char* path, off_t length) +int truncate(char const* path, off_t length) { int fd = open(path, O_RDWR | O_CREAT, 0666); if (fd < 0) @@ -889,7 +889,7 @@ int fsync(int fd) __RETURN_WITH_ERRNO(rc, rc, -1); } -int mount(int source_fd, const char* target, const char* fs_type, int flags) +int mount(int source_fd, char const* target, char const* fs_type, int flags) { if (!target || !fs_type) { errno = EFAULT; @@ -906,7 +906,7 @@ int mount(int source_fd, const char* target, const char* fs_type, int flags) __RETURN_WITH_ERRNO(rc, rc, -1); } -int umount(const char* mountpoint) +int umount(char const* mountpoint) { int rc = syscall(SC_umount, mountpoint, strlen(mountpoint)); __RETURN_WITH_ERRNO(rc, rc, -1); @@ -923,13 +923,13 @@ int get_process_name(char* buffer, int buffer_size) __RETURN_WITH_ERRNO(rc, rc, -1); } -int set_process_name(const char* name, size_t name_length) +int set_process_name(char const* name, size_t name_length) { int rc = syscall(SC_set_process_name, name, name_length); __RETURN_WITH_ERRNO(rc, rc, -1); } -int pledge(const char* promises, const char* execpromises) +int pledge(char const* promises, char const* execpromises) { Syscall::SC_pledge_params params { { promises, promises ? strlen(promises) : 0 }, @@ -939,7 +939,7 @@ int pledge(const char* promises, const char* execpromises) __RETURN_WITH_ERRNO(rc, rc, -1); } -int unveil(const char* path, const char* permissions) +int unveil(char const* path, char const* permissions) { Syscall::SC_unveil_params params { { path, path ? strlen(path) : 0 }, @@ -950,7 +950,7 @@ int unveil(const char* path, const char* permissions) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpass.html -char* getpass(const char* prompt) +char* getpass(char const* prompt) { dbgln("FIXME: getpass('{}')", prompt); TODO(); @@ -976,7 +976,7 @@ int pause() } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/chroot.html -int chroot(const char* path) +int chroot(char const* path) { dbgln("FIXME: chroot(\"{}\")", path); return -1; diff --git a/Userland/Libraries/LibC/unistd.h b/Userland/Libraries/LibC/unistd.h index 3300981169..8ce3ac92e4 100644 --- a/Userland/Libraries/LibC/unistd.h +++ b/Userland/Libraries/LibC/unistd.h @@ -31,7 +31,7 @@ __BEGIN_DECLS extern char** environ; int get_process_name(char* buffer, int buffer_size); -int set_process_name(const char* name, size_t name_length); +int set_process_name(char const* name, size_t name_length); void dump_backtrace(void); int fsync(int fd); int sysbeep(void); @@ -40,13 +40,13 @@ int getpagesize(void); pid_t fork(void); pid_t vfork(void); int daemon(int nochdir, int noclose); -int execv(const char* path, char* const argv[]); -int execve(const char* filename, char* const argv[], char* const envp[]); -int execvpe(const char* filename, char* const argv[], char* const envp[]); -int execvp(const char* filename, char* const argv[]); -int execl(const char* filename, const char* arg, ...); -int execle(const char* filename, const char* arg, ...); -int execlp(const char* filename, const char* arg, ...); +int execv(char const* path, char* const argv[]); +int execve(char const* filename, char* const argv[], char* const envp[]); +int execvpe(char const* filename, char* const argv[], char* const envp[]); +int execvp(char const* filename, char* const argv[]); +int execl(char const* filename, char const* arg, ...); +int execle(char const* filename, char const* arg, ...); +int execlp(char const* filename, char const* arg, ...); void sync(void); __attribute__((noreturn)) void _exit(int status); pid_t getsid(pid_t); @@ -63,7 +63,7 @@ pid_t getppid(void); int getresuid(uid_t*, uid_t*, uid_t*); int getresgid(gid_t*, gid_t*, gid_t*); int getgroups(int size, gid_t list[]); -int setgroups(size_t, const gid_t*); +int setgroups(size_t, gid_t const*); int seteuid(uid_t); int setegid(gid_t); int setuid(uid_t); @@ -75,49 +75,49 @@ pid_t tcgetpgrp(int fd); int tcsetpgrp(int fd, pid_t pgid); ssize_t read(int fd, void* buf, size_t count); ssize_t pread(int fd, void* buf, size_t count, off_t); -ssize_t write(int fd, const void* buf, size_t count); -ssize_t pwrite(int fd, const void* buf, size_t count, off_t); +ssize_t write(int fd, void const* buf, size_t count); +ssize_t pwrite(int fd, void const* buf, size_t count, off_t); int close(int fd); -int chdir(const char* path); +int chdir(char const* path); int fchdir(int fd); char* getcwd(char* buffer, size_t size); char* getwd(char* buffer); unsigned int sleep(unsigned int seconds); int usleep(useconds_t); int gethostname(char*, size_t); -int sethostname(const char*, ssize_t); -ssize_t readlink(const char* path, char* buffer, size_t); +int sethostname(char const*, ssize_t); +ssize_t readlink(char const* path, char* buffer, size_t); char* ttyname(int fd); int ttyname_r(int fd, char* buffer, size_t); off_t lseek(int fd, off_t, int whence); -int link(const char* oldpath, const char* newpath); -int unlink(const char* pathname); -int symlink(const char* target, const char* linkpath); -int rmdir(const char* pathname); +int link(char const* oldpath, char const* newpath); +int unlink(char const* pathname); +int symlink(char const* target, char const* linkpath); +int rmdir(char const* pathname); int dup(int old_fd); int dup2(int old_fd, int new_fd); int pipe(int pipefd[2]); int pipe2(int pipefd[2], int flags); unsigned int alarm(unsigned int seconds); -int access(const char* pathname, int mode); +int access(char const* pathname, int mode); int isatty(int fd); -int mknod(const char* pathname, mode_t, dev_t); +int mknod(char const* pathname, mode_t, dev_t); long fpathconf(int fd, int name); -long pathconf(const char* path, int name); +long pathconf(char const* path, int name); char* getlogin(void); -int lchown(const char* pathname, uid_t uid, gid_t gid); -int chown(const char* pathname, uid_t, gid_t); +int lchown(char const* pathname, uid_t uid, gid_t gid); +int chown(char const* pathname, uid_t, gid_t); int fchown(int fd, uid_t, gid_t); -int fchownat(int fd, const char* pathname, uid_t uid, gid_t gid, int flags); +int fchownat(int fd, char const* pathname, uid_t uid, gid_t gid, int flags); int ftruncate(int fd, off_t length); -int truncate(const char* path, off_t length); -int mount(int source_fd, const char* target, const char* fs_type, int flags); -int umount(const char* mountpoint); -int pledge(const char* promises, const char* execpromises); -int unveil(const char* path, const char* permissions); -char* getpass(const char* prompt); +int truncate(char const* path, off_t length); +int mount(int source_fd, char const* target, char const* fs_type, int flags); +int umount(char const* mountpoint); +int pledge(char const* promises, char const* execpromises); +int unveil(char const* path, char const* permissions); +char* getpass(char const* prompt); int pause(void); -int chroot(const char*); +int chroot(char const*); int getdtablesize(void); enum { @@ -155,6 +155,6 @@ extern int optreset; // value. extern char* optarg; -int getopt(int argc, char* const* argv, const char* short_options); +int getopt(int argc, char* const* argv, char const* short_options); __END_DECLS diff --git a/Userland/Libraries/LibC/utime.cpp b/Userland/Libraries/LibC/utime.cpp index 4160b28ab9..4fe8147a1a 100644 --- a/Userland/Libraries/LibC/utime.cpp +++ b/Userland/Libraries/LibC/utime.cpp @@ -11,7 +11,7 @@ extern "C" { -int utime(const char* pathname, const struct utimbuf* buf) +int utime(char const* pathname, const struct utimbuf* buf) { if (!pathname) { errno = EFAULT; diff --git a/Userland/Libraries/LibC/utime.h b/Userland/Libraries/LibC/utime.h index 6a86c8b64c..71904ba7e7 100644 --- a/Userland/Libraries/LibC/utime.h +++ b/Userland/Libraries/LibC/utime.h @@ -10,6 +10,6 @@ __BEGIN_DECLS -int utime(const char* pathname, const struct utimbuf*); +int utime(char const* pathname, const struct utimbuf*); __END_DECLS diff --git a/Userland/Libraries/LibC/wchar.h b/Userland/Libraries/LibC/wchar.h index 33d129bf6e..7f38900b95 100644 --- a/Userland/Libraries/LibC/wchar.h +++ b/Userland/Libraries/LibC/wchar.h @@ -29,47 +29,47 @@ typedef struct { struct tm; -size_t wcslen(const wchar_t*); -wchar_t* wcscpy(wchar_t*, const wchar_t*); -wchar_t* wcsdup(const wchar_t*); -wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t); -__attribute__((warn_unused_result)) size_t wcslcpy(wchar_t*, const wchar_t*, size_t); -int wcscmp(const wchar_t*, const wchar_t*); -int wcsncmp(const wchar_t*, const wchar_t*, size_t); -wchar_t* wcschr(const wchar_t*, int); -wchar_t* wcsrchr(const wchar_t*, wchar_t); -wchar_t* wcscat(wchar_t*, const wchar_t*); -wchar_t* wcsncat(wchar_t*, const wchar_t*, size_t); -wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**); -long wcstol(const wchar_t*, wchar_t**, int); -long long wcstoll(const wchar_t*, wchar_t**, int); +size_t wcslen(wchar_t const*); +wchar_t* wcscpy(wchar_t*, wchar_t const*); +wchar_t* wcsdup(wchar_t const*); +wchar_t* wcsncpy(wchar_t*, wchar_t const*, size_t); +__attribute__((warn_unused_result)) size_t wcslcpy(wchar_t*, wchar_t const*, size_t); +int wcscmp(wchar_t const*, wchar_t const*); +int wcsncmp(wchar_t const*, wchar_t const*, size_t); +wchar_t* wcschr(wchar_t const*, int); +wchar_t* wcsrchr(wchar_t const*, wchar_t); +wchar_t* wcscat(wchar_t*, wchar_t const*); +wchar_t* wcsncat(wchar_t*, wchar_t const*, size_t); +wchar_t* wcstok(wchar_t*, wchar_t const*, wchar_t**); +long wcstol(wchar_t const*, wchar_t**, int); +long long wcstoll(wchar_t const*, wchar_t**, int); wint_t btowc(int c); -size_t mbrtowc(wchar_t*, const char*, size_t, mbstate_t*); -size_t mbrlen(const char*, size_t, mbstate_t*); +size_t mbrtowc(wchar_t*, char const*, size_t, mbstate_t*); +size_t mbrlen(char const*, size_t, mbstate_t*); size_t wcrtomb(char*, wchar_t, mbstate_t*); -int wcscoll(const wchar_t*, const wchar_t*); -size_t wcsxfrm(wchar_t*, const wchar_t*, size_t); +int wcscoll(wchar_t const*, wchar_t const*); +size_t wcsxfrm(wchar_t*, wchar_t const*, size_t); int wctob(wint_t); -int mbsinit(const mbstate_t*); -wchar_t* wcspbrk(const wchar_t*, const wchar_t*); -wchar_t* wcsstr(const wchar_t*, const wchar_t*); -wchar_t* wmemchr(const wchar_t*, wchar_t, size_t); -wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t); +int mbsinit(mbstate_t const*); +wchar_t* wcspbrk(wchar_t const*, wchar_t const*); +wchar_t* wcsstr(wchar_t const*, wchar_t const*); +wchar_t* wmemchr(wchar_t const*, wchar_t, size_t); +wchar_t* wmemcpy(wchar_t*, wchar_t const*, size_t); wchar_t* wmemset(wchar_t*, wchar_t, size_t); -wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t); -unsigned long wcstoul(const wchar_t*, wchar_t**, int); -unsigned long long wcstoull(const wchar_t*, wchar_t**, int); -float wcstof(const wchar_t*, wchar_t**); -double wcstod(const wchar_t*, wchar_t**); -long double wcstold(const wchar_t*, wchar_t**); +wchar_t* wmemmove(wchar_t*, wchar_t const*, size_t); +unsigned long wcstoul(wchar_t const*, wchar_t**, int); +unsigned long long wcstoull(wchar_t const*, wchar_t**, int); +float wcstof(wchar_t const*, wchar_t**); +double wcstod(wchar_t const*, wchar_t**); +long double wcstold(wchar_t const*, wchar_t**); int wcwidth(wchar_t); -size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*); -size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*); -int wmemcmp(const wchar_t*, const wchar_t*, size_t); -size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*); -size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*); -size_t wcscspn(const wchar_t* wcs, const wchar_t* reject); -size_t wcsspn(const wchar_t* wcs, const wchar_t* accept); +size_t wcsrtombs(char*, wchar_t const**, size_t, mbstate_t*); +size_t mbsrtowcs(wchar_t*, char const**, size_t, mbstate_t*); +int wmemcmp(wchar_t const*, wchar_t const*, size_t); +size_t wcsnrtombs(char*, wchar_t const**, size_t, size_t, mbstate_t*); +size_t mbsnrtowcs(wchar_t*, char const**, size_t, size_t, mbstate_t*); +size_t wcscspn(wchar_t const* wcs, wchar_t const* reject); +size_t wcsspn(wchar_t const* wcs, wchar_t const* accept); wint_t fgetwc(FILE* stream); wint_t getwc(FILE* stream); @@ -78,24 +78,24 @@ wint_t fputwc(wchar_t wc, FILE* stream); wint_t putwc(wchar_t wc, FILE* stream); wint_t putwchar(wchar_t wc); wchar_t* fgetws(wchar_t* __restrict ws, int n, FILE* __restrict stream); -int fputws(const wchar_t* __restrict ws, FILE* __restrict stream); +int fputws(wchar_t const* __restrict ws, FILE* __restrict stream); wint_t ungetwc(wint_t wc, FILE* stream); int fwide(FILE* stream, int mode); -int wprintf(const wchar_t* __restrict format, ...); -int fwprintf(FILE* __restrict stream, const wchar_t* __restrict format, ...); -int swprintf(wchar_t* __restrict wcs, size_t maxlen, const wchar_t* __restrict format, ...); -int vwprintf(const wchar_t* __restrict format, va_list args); -int vfwprintf(FILE* __restrict stream, const wchar_t* __restrict format, va_list args); -int vswprintf(wchar_t* __restrict wcs, size_t maxlen, const wchar_t* __restrict format, va_list args); +int wprintf(wchar_t const* __restrict format, ...); +int fwprintf(FILE* __restrict stream, wchar_t const* __restrict format, ...); +int swprintf(wchar_t* __restrict wcs, size_t maxlen, wchar_t const* __restrict format, ...); +int vwprintf(wchar_t const* __restrict format, va_list args); +int vfwprintf(FILE* __restrict stream, wchar_t const* __restrict format, va_list args); +int vswprintf(wchar_t* __restrict wcs, size_t maxlen, wchar_t const* __restrict format, va_list args); -int fwscanf(FILE* __restrict stream, const wchar_t* __restrict format, ...); -int swscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, ...); -int wscanf(const wchar_t* __restrict format, ...); -int vfwscanf(FILE* __restrict stream, const wchar_t* __restrict format, va_list arg); -int vswscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, va_list arg); -int vwscanf(const wchar_t* __restrict format, va_list arg); +int fwscanf(FILE* __restrict stream, wchar_t const* __restrict format, ...); +int swscanf(wchar_t const* __restrict ws, wchar_t const* __restrict format, ...); +int wscanf(wchar_t const* __restrict format, ...); +int vfwscanf(FILE* __restrict stream, wchar_t const* __restrict format, va_list arg); +int vswscanf(wchar_t const* __restrict ws, wchar_t const* __restrict format, va_list arg); +int vwscanf(wchar_t const* __restrict format, va_list arg); -size_t wcsftime(wchar_t* __restrict wcs, size_t maxsize, const wchar_t* __restrict format, const struct tm* __restrict timeptr); +size_t wcsftime(wchar_t* __restrict wcs, size_t maxsize, wchar_t const* __restrict format, const struct tm* __restrict timeptr); __END_DECLS diff --git a/Userland/Libraries/LibC/wctype.cpp b/Userland/Libraries/LibC/wctype.cpp index c5dfdcda7a..92f2ca77e9 100644 --- a/Userland/Libraries/LibC/wctype.cpp +++ b/Userland/Libraries/LibC/wctype.cpp @@ -136,7 +136,7 @@ int iswctype(wint_t wc, wctype_t charclass) } } -wctype_t wctype(const char* property) +wctype_t wctype(char const* property) { if (strcmp(property, "alnum") == 0) return WCTYPE_ALNUM; @@ -201,7 +201,7 @@ wint_t towctrans(wint_t wc, wctrans_t desc) } } -wctrans_t wctrans(const char* charclass) +wctrans_t wctrans(char const* charclass) { if (strcmp(charclass, "tolower") == 0) return WCTRANS_TOLOWER; diff --git a/Userland/Libraries/LibC/wctype.h b/Userland/Libraries/LibC/wctype.h index 3bf6afa65c..6f08a0b04b 100644 --- a/Userland/Libraries/LibC/wctype.h +++ b/Userland/Libraries/LibC/wctype.h @@ -27,10 +27,10 @@ int iswlower(wint_t wc); int iswupper(wint_t wc); int iswblank(wint_t wc); int iswctype(wint_t, wctype_t); -wctype_t wctype(const char*); +wctype_t wctype(char const*); wint_t towlower(wint_t wc); wint_t towupper(wint_t wc); wint_t towctrans(wint_t, wctrans_t); -wctrans_t wctrans(const char*); +wctrans_t wctrans(char const*); __END_DECLS diff --git a/Userland/Libraries/LibCards/Card.cpp b/Userland/Libraries/LibCards/Card.cpp index c38641f7fb..a29d5f77ef 100644 --- a/Userland/Libraries/LibCards/Card.cpp +++ b/Userland/Libraries/LibCards/Card.cpp @@ -148,7 +148,7 @@ void Card::draw(GUI::Painter& painter) const painter.blit(position(), m_upside_down ? *s_background : *m_front, m_front->rect()); } -void Card::clear(GUI::Painter& painter, const Color& background_color) const +void Card::clear(GUI::Painter& painter, Color const& background_color) const { painter.fill_rect({ old_position(), { width, height } }, background_color); } @@ -159,7 +159,7 @@ void Card::save_old_position() m_old_position_valid = true; } -void Card::clear_and_draw(GUI::Painter& painter, const Color& background_color) +void Card::clear_and_draw(GUI::Painter& painter, Color const& background_color) { if (is_old_position_valid()) clear(painter, background_color); diff --git a/Userland/Libraries/LibCards/Card.h b/Userland/Libraries/LibCards/Card.h index 31028bf27f..257751f057 100644 --- a/Userland/Libraries/LibCards/Card.h +++ b/Userland/Libraries/LibCards/Card.h @@ -41,7 +41,7 @@ public: Gfx::IntRect& rect() { return m_rect; } Gfx::IntPoint position() const { return m_rect.location(); } - const Gfx::IntPoint& old_position() const { return m_old_position; } + Gfx::IntPoint const& old_position() const { return m_old_position; } uint8_t value() const { return m_value; }; Suit suit() const { return m_suit; } @@ -59,8 +59,8 @@ public: void save_old_position(); void draw(GUI::Painter&) const; - void clear(GUI::Painter&, const Color& background_color) const; - void clear_and_draw(GUI::Painter&, const Color& background_color); + void clear(GUI::Painter&, Color const& background_color) const; + void clear_and_draw(GUI::Painter&, Color const& background_color); private: Card(Suit suit, uint8_t value); diff --git a/Userland/Libraries/LibCards/CardStack.cpp b/Userland/Libraries/LibCards/CardStack.cpp index 2d65d124ea..7826a3938c 100644 --- a/Userland/Libraries/LibCards/CardStack.cpp +++ b/Userland/Libraries/LibCards/CardStack.cpp @@ -15,7 +15,7 @@ CardStack::CardStack() { } -CardStack::CardStack(const Gfx::IntPoint& position, Type type) +CardStack::CardStack(Gfx::IntPoint const& position, Type type) : m_position(position) , m_type(type) , m_rules(rules_for_type(type)) @@ -25,7 +25,7 @@ CardStack::CardStack(const Gfx::IntPoint& position, Type type) calculate_bounding_box(); } -CardStack::CardStack(const Gfx::IntPoint& position, Type type, NonnullRefPtr<CardStack> associated_stack) +CardStack::CardStack(Gfx::IntPoint const& position, Type type, NonnullRefPtr<CardStack> associated_stack) : m_associated_stack(move(associated_stack)) , m_position(position) , m_type(type) @@ -42,7 +42,7 @@ void CardStack::clear() m_stack_positions.clear(); } -void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color) +void CardStack::draw(GUI::Painter& painter, Gfx::Color const& background_color) { auto draw_background_if_empty = [&]() { size_t number_of_moving_cards = 0; @@ -108,7 +108,7 @@ void CardStack::rebound_cards() card.set_position(m_stack_positions.at(card_index++)); } -void CardStack::add_all_grabbed_cards(const Gfx::IntPoint& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule) +void CardStack::add_all_grabbed_cards(Gfx::IntPoint const& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule) { VERIFY(grabbed.is_empty()); @@ -187,7 +187,7 @@ void CardStack::add_all_grabbed_cards(const Gfx::IntPoint& click_location, Nonnu } } -bool CardStack::is_allowed_to_push(const Card& card, size_t stack_size, MovementRule movement_rule) const +bool CardStack::is_allowed_to_push(Card const& card, size_t stack_size, MovementRule movement_rule) const { if (m_type == Type::Stock || m_type == Type::Waste || m_type == Type::Play) return false; diff --git a/Userland/Libraries/LibCards/CardStack.h b/Userland/Libraries/LibCards/CardStack.h index 82e39f7bf3..7c763daae3 100644 --- a/Userland/Libraries/LibCards/CardStack.h +++ b/Userland/Libraries/LibCards/CardStack.h @@ -31,17 +31,17 @@ public: }; CardStack(); - CardStack(const Gfx::IntPoint& position, Type type); - CardStack(const Gfx::IntPoint& position, Type type, NonnullRefPtr<CardStack> associated_stack); + CardStack(Gfx::IntPoint const& position, Type type); + CardStack(Gfx::IntPoint const& position, Type type, NonnullRefPtr<CardStack> associated_stack); bool is_empty() const { return m_stack.is_empty(); } bool is_focused() const { return m_focused; } Type type() const { return m_type; } - const NonnullRefPtrVector<Card>& stack() const { return m_stack; } + NonnullRefPtrVector<Card> const& stack() const { return m_stack; } size_t count() const { return m_stack.size(); } - const Card& peek() const { return m_stack.last(); } + Card const& peek() const { return m_stack.last(); } Card& peek() { return m_stack.last(); } - const Gfx::IntRect& bounding_box() const { return m_bounding_box; } + Gfx::IntRect const& bounding_box() const { return m_bounding_box; } void set_focused(bool focused) { m_focused = focused; } @@ -50,9 +50,9 @@ public: void move_to_stack(CardStack&); void rebound_cards(); - bool is_allowed_to_push(const Card&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const; - void add_all_grabbed_cards(const Gfx::IntPoint& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating); - void draw(GUI::Painter&, const Gfx::Color& background_color); + bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const; + void add_all_grabbed_cards(Gfx::IntPoint const& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating); + void draw(GUI::Painter&, Gfx::Color const& background_color); void clear(); private: @@ -125,7 +125,7 @@ struct AK::Formatter<Cards::CardStack> : Formatter<FormatString> { StringBuilder cards; bool first_card = true; - for (const auto& card : stack.stack()) { + for (auto const& card : stack.stack()) { cards.appendff("{}{}", (first_card ? "" : " "), card); first_card = false; } diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index 6d56ecd1f0..60c1ff4d88 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -101,7 +101,7 @@ String Move::to_long_algebraic() const return builder.build(); } -Move Move::from_algebraic(StringView algebraic, const Color turn, const Board& board) +Move Move::from_algebraic(StringView algebraic, const Color turn, Board const& board) { String move_string = algebraic; Move move({ 50, 50 }, { 50, 50 }); @@ -143,7 +143,7 @@ Move Move::from_algebraic(StringView algebraic, const Color turn, const Board& b move_string = move_string.substring(1, move_string.length() - 1); } - Square::for_each([&](const Square& square) { + Square::for_each([&](Square const& square) { if (!move_string.is_empty()) { if (board.get_piece(square).type == move.piece.type && board.is_legal(Move(square, move.to), turn)) { if (move_string.length() >= 2) { @@ -326,19 +326,19 @@ String Board::to_fen() const return builder.to_string(); } -Piece Board::get_piece(const Square& square) const +Piece Board::get_piece(Square const& square) const { VERIFY(square.in_bounds()); return m_board[square.rank][square.file]; } -Piece Board::set_piece(const Square& square, const Piece& piece) +Piece Board::set_piece(Square const& square, Piece const& piece) { VERIFY(square.in_bounds()); return m_board[square.rank][square.file] = piece; } -bool Board::is_legal_promotion(const Move& move, Color color) const +bool Board::is_legal_promotion(Move const& move, Color color) const { auto piece = get_piece(move.from); @@ -367,7 +367,7 @@ bool Board::is_legal_promotion(const Move& move, Color color) const return true; } -bool Board::is_legal(const Move& move, Color color) const +bool Board::is_legal(Move const& move, Color color) const { if (color == Color::None) color = turn(); @@ -409,7 +409,7 @@ bool Board::is_legal(const Move& move, Color color) const return true; } -bool Board::is_legal_no_check(const Move& move, Color color) const +bool Board::is_legal_no_check(Move const& move, Color color) const { auto piece = get_piece(move.from); @@ -536,7 +536,7 @@ bool Board::is_legal_no_check(const Move& move, Color color) const bool Board::in_check(Color color) const { Square king_square = { 50, 50 }; - Square::for_each([&](const Square& square) { + Square::for_each([&](Square const& square) { if (get_piece(square) == Piece(color, Type::King)) { king_square = square; return IterationDecision::Break; @@ -545,7 +545,7 @@ bool Board::in_check(Color color) const }); bool check = false; - Square::for_each([&](const Square& square) { + Square::for_each([&](Square const& square) { if (is_legal_no_check({ square, king_square }, opposing_color(color))) { check = true; return IterationDecision::Break; @@ -556,7 +556,7 @@ bool Board::in_check(Color color) const return check; } -bool Board::apply_move(const Move& move, Color color) +bool Board::apply_move(Move const& move, Color color) { if (color == Color::None) color = turn(); @@ -569,7 +569,7 @@ bool Board::apply_move(const Move& move, Color color) return apply_illegal_move(move, color); } -bool Board::apply_illegal_move(const Move& move, Color color) +bool Board::apply_illegal_move(Move const& move, Color color) { auto state = Traits<Board>::hash(*this); auto state_count = 0; @@ -826,7 +826,7 @@ int Board::material_imbalance() const return imbalance; } -bool Board::is_promotion_move(const Move& move, Color color) const +bool Board::is_promotion_move(Move const& move, Color color) const { if (color == Color::None) color = turn(); @@ -846,7 +846,7 @@ bool Board::is_promotion_move(const Move& move, Color color) const return true; } -bool Board::operator==(const Board& other) const +bool Board::operator==(Board const& other) const { bool equal_squares = true; Square::for_each([&](Square sq) { diff --git a/Userland/Libraries/LibChess/Chess.h b/Userland/Libraries/LibChess/Chess.h index e20a683cec..c73bdc5cce 100644 --- a/Userland/Libraries/LibChess/Chess.h +++ b/Userland/Libraries/LibChess/Chess.h @@ -49,7 +49,7 @@ struct Piece { } Color color : 4; Type type : 4; - bool operator==(const Piece& other) const { return color == other.color && type == other.type; } + bool operator==(Piece const& other) const { return color == other.color && type == other.type; } }; constexpr Piece EmptyPiece = { Color::None, Type::None }; @@ -58,12 +58,12 @@ struct Square { i8 rank; // zero indexed; i8 file; Square(StringView name); - Square(const int& rank, const int& file) + Square(int const& rank, int const& file) : rank(rank) , file(file) { } - bool operator==(const Square& other) const { return rank == other.rank && file == other.file; } + bool operator==(Square const& other) const { return rank == other.rank && file == other.file; } template<typename Callback> static void for_each(Callback callback) @@ -94,15 +94,15 @@ struct Move { bool is_ambiguous : 1 = false; Square ambiguous { 50, 50 }; Move(StringView long_algebraic); - Move(const Square& from, const Square& to, const Type& promote_to = Type::None) + Move(Square const& from, Square const& to, Type const& promote_to = Type::None) : from(from) , to(to) , promote_to(promote_to) { } - bool operator==(const Move& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; } + 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, const Board& board); + static Move from_algebraic(StringView algebraic, const Color turn, Board const& board); String to_long_algebraic() const; String to_algebraic() const; }; @@ -111,16 +111,16 @@ class Board { public: Board(); - Piece get_piece(const Square&) const; - Piece set_piece(const Square&, const Piece&); + Piece get_piece(Square const&) const; + Piece set_piece(Square const&, Piece const&); - bool is_legal(const Move&, Color color = Color::None) const; + bool is_legal(Move const&, Color color = Color::None) const; bool in_check(Color color) const; - bool is_promotion_move(const Move&, Color color = Color::None) const; + bool is_promotion_move(Move const&, Color color = Color::None) const; - bool apply_move(const Move&, Color color = Color::None); - const Optional<Move>& last_move() const { return m_last_move; } + bool apply_move(Move const&, Color color = Color::None); + Optional<Move> const& last_move() const { return m_last_move; } String to_fen() const; @@ -151,14 +151,14 @@ public: int material_imbalance() const; Color turn() const { return m_turn; } - const Vector<Move>& moves() const { return m_moves; } + Vector<Move> const& moves() const { return m_moves; } - bool operator==(const Board& other) const; + bool operator==(Board const& other) const; private: - bool is_legal_no_check(const Move&, Color color) const; - bool is_legal_promotion(const Move&, Color color) const; - bool apply_illegal_move(const Move&, Color color); + bool is_legal_no_check(Move const&, Color color) const; + bool is_legal_promotion(Move const&, Color color) const; + bool apply_illegal_move(Move const&, Color color); Piece m_board[8][8]; Optional<Move> m_last_move; diff --git a/Userland/Libraries/LibChess/UCICommand.h b/Userland/Libraries/LibChess/UCICommand.h index 33415ae8c5..0b5ae607cb 100644 --- a/Userland/Libraries/LibChess/UCICommand.h +++ b/Userland/Libraries/LibChess/UCICommand.h @@ -109,8 +109,8 @@ public: virtual String to_string() const override; - const String& name() const { return m_name; } - const Optional<String>& value() const { return m_value; } + String const& name() const { return m_name; } + Optional<String> const& value() const { return m_value; } private: String m_name; @@ -119,7 +119,7 @@ private: class PositionCommand : public Command { public: - explicit PositionCommand(const Optional<String>& fen, const Vector<Chess::Move>& moves) + explicit PositionCommand(Optional<String> const& fen, Vector<Chess::Move> const& moves) : Command(Command::Type::Position) , m_fen(fen) , m_moves(moves) @@ -130,8 +130,8 @@ public: virtual String to_string() const override; - const Optional<String>& fen() const { return m_fen; } - const Vector<Chess::Move>& moves() const { return m_moves; } + Optional<String> const& fen() const { return m_fen; } + Vector<Chess::Move> const& moves() const { return m_moves; } private: Optional<String> m_fen; @@ -194,7 +194,7 @@ public: virtual String to_string() const override; Type field_type() const { return m_field_type; } - const String& value() const { return m_value; } + String const& value() const { return m_value; } private: Type m_field_type; @@ -227,7 +227,7 @@ public: class BestMoveCommand : public Command { public: - explicit BestMoveCommand(const Chess::Move& move) + explicit BestMoveCommand(Chess::Move const& move) : Command(Command::Type::BestMove) , m_move(move) { diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index e1ab9d234b..0c8723b9db 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -21,7 +21,7 @@ Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevic set_in_notifier(); } -void Endpoint::send_command(const Command& command) +void Endpoint::send_command(Command const& command) { dbgln_if(UCI_DEBUG, "{} Sent UCI Command: {}", class_name(), String(command.to_string().characters(), Chomp)); m_out->write(command.to_string()); @@ -33,27 +33,27 @@ void Endpoint::event(Core::Event& event) case Command::Type::UCI: return handle_uci(); case Command::Type::Debug: - return handle_debug(static_cast<const DebugCommand&>(event)); + return handle_debug(static_cast<DebugCommand const&>(event)); case Command::Type::IsReady: return handle_uci(); case Command::Type::SetOption: - return handle_setoption(static_cast<const SetOptionCommand&>(event)); + return handle_setoption(static_cast<SetOptionCommand const&>(event)); case Command::Type::Position: - return handle_position(static_cast<const PositionCommand&>(event)); + return handle_position(static_cast<PositionCommand const&>(event)); case Command::Type::Go: - return handle_go(static_cast<const GoCommand&>(event)); + return handle_go(static_cast<GoCommand const&>(event)); case Command::Type::Stop: return handle_stop(); case Command::Type::Id: - return handle_id(static_cast<const IdCommand&>(event)); + return handle_id(static_cast<IdCommand const&>(event)); case Command::Type::UCIOk: return handle_uciok(); case Command::Type::ReadyOk: return handle_readyok(); case Command::Type::BestMove: - return handle_bestmove(static_cast<const BestMoveCommand&>(event)); + return handle_bestmove(static_cast<BestMoveCommand const&>(event)); case Command::Type::Info: - return handle_info(static_cast<const InfoCommand&>(event)); + return handle_info(static_cast<InfoCommand const&>(event)); default: break; } diff --git a/Userland/Libraries/LibChess/UCIEndpoint.h b/Userland/Libraries/LibChess/UCIEndpoint.h index f9843ae8cf..8e99ab979d 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.h +++ b/Userland/Libraries/LibChess/UCIEndpoint.h @@ -19,19 +19,19 @@ public: virtual ~Endpoint() override = default; virtual void handle_uci() { } - virtual void handle_debug(const DebugCommand&) { } + virtual void handle_debug(DebugCommand const&) { } virtual void handle_isready() { } - virtual void handle_setoption(const SetOptionCommand&) { } - virtual void handle_position(const PositionCommand&) { } - virtual void handle_go(const GoCommand&) { } + virtual void handle_setoption(SetOptionCommand const&) { } + virtual void handle_position(PositionCommand const&) { } + virtual void handle_go(GoCommand const&) { } virtual void handle_stop() { } - virtual void handle_id(const IdCommand&) { } + virtual void handle_id(IdCommand const&) { } virtual void handle_uciok() { } virtual void handle_readyok() { } - virtual void handle_bestmove(const BestMoveCommand&) { } - virtual void handle_info(const InfoCommand&) { } + virtual void handle_bestmove(BestMoveCommand const&) { } + virtual void handle_info(InfoCommand const&) { } - void send_command(const Command&); + void send_command(Command const&); virtual void event(Core::Event&) override; diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp index a4e0bcedbe..31a2271572 100644 --- a/Userland/Libraries/LibCompress/Deflate.cpp +++ b/Userland/Libraries/LibCompress/Deflate.cpp @@ -16,7 +16,7 @@ namespace Compress { -const CanonicalCode& CanonicalCode::fixed_literal_codes() +CanonicalCode const& CanonicalCode::fixed_literal_codes() { static CanonicalCode code; static bool initialized = false; @@ -30,7 +30,7 @@ const CanonicalCode& CanonicalCode::fixed_literal_codes() return code; } -const CanonicalCode& CanonicalCode::fixed_distance_codes() +CanonicalCode const& CanonicalCode::fixed_distance_codes() { static CanonicalCode code; static bool initialized = false; @@ -128,7 +128,7 @@ bool DeflateDecompressor::CompressedBlock::try_read_more() if (m_eof == true) return false; - const auto symbol = m_literal_codes.read_symbol(m_decompressor.m_input_stream); + auto const symbol = m_literal_codes.read_symbol(m_decompressor.m_input_stream); if (symbol >= 286) { // invalid deflate literal/length symbol m_decompressor.set_fatal_error(); @@ -147,13 +147,13 @@ bool DeflateDecompressor::CompressedBlock::try_read_more() return false; } - const auto length = m_decompressor.decode_length(symbol); - const auto distance_symbol = m_distance_codes.value().read_symbol(m_decompressor.m_input_stream); + auto const length = m_decompressor.decode_length(symbol); + auto const distance_symbol = m_distance_codes.value().read_symbol(m_decompressor.m_input_stream); if (distance_symbol >= 30) { // invalid deflate distance symbol m_decompressor.set_fatal_error(); return false; } - const auto distance = m_decompressor.decode_distance(distance_symbol); + auto const distance = m_decompressor.decode_distance(distance_symbol); for (size_t idx = 0; idx < length; ++idx) { u8 byte = 0; @@ -180,7 +180,7 @@ bool DeflateDecompressor::UncompressedBlock::try_read_more() if (m_bytes_remaining == 0) return false; - const auto nread = min(m_bytes_remaining, m_decompressor.m_output_stream.remaining_contiguous_space()); + auto const nread = min(m_bytes_remaining, m_decompressor.m_output_stream.remaining_contiguous_space()); m_bytes_remaining -= nread; m_decompressor.m_input_stream >> m_decompressor.m_output_stream.reserve_contiguous_space(nread); @@ -215,7 +215,7 @@ size_t DeflateDecompressor::read(Bytes bytes) break; m_read_final_bock = m_input_stream.read_bit(); - const auto block_type = m_input_stream.read_bits(2); + auto const block_type = m_input_stream.read_bits(2); if (m_input_stream.has_any_error()) { set_fatal_error(); @@ -363,7 +363,7 @@ Optional<ByteBuffer> DeflateDecompressor::decompress_all(ReadonlyBytes bytes) u8 buffer[4096]; while (!deflate_stream.has_any_error() && !deflate_stream.unreliable_eof()) { - const auto nread = deflate_stream.read({ buffer, sizeof(buffer) }); + auto const nread = deflate_stream.read({ buffer, sizeof(buffer) }); output_stream.write_or_error({ buffer, nread }); } @@ -428,7 +428,7 @@ void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional<Can set_fatal_error(); return; } - const auto code_length_code = code_length_code_result.value(); + auto const code_length_code = code_length_code_result.value(); // Next we extract the code lengths of the code that was used to encode the block. @@ -544,7 +544,7 @@ bool DeflateCompressor::write_or_error(ReadonlyBytes bytes) } // Knuth's multiplicative hash on 4 bytes -u16 DeflateCompressor::hash_sequence(const u8* bytes) +u16 DeflateCompressor::hash_sequence(u8 const* bytes) { constexpr const u32 knuth_constant = 2654435761; // shares no common factors with 2^32 return ((bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24) * knuth_constant) >> (32 - hash_bits); @@ -617,7 +617,7 @@ ALWAYS_INLINE u8 DeflateCompressor::distance_to_base(u16 distance) } template<size_t Size> -void DeflateCompressor::generate_huffman_lengths(Array<u8, Size>& lengths, const Array<u16, Size>& frequencies, size_t max_bit_length, u16 frequency_cap) +void DeflateCompressor::generate_huffman_lengths(Array<u8, Size>& lengths, Array<u16, Size> const& frequencies, size_t max_bit_length, u16 frequency_cap) { VERIFY((1u << max_bit_length) >= Size); u16 heap_keys[Size]; // Used for O(n) heap construction @@ -773,7 +773,7 @@ void DeflateCompressor::lz77_compress_block() } } -size_t DeflateCompressor::huffman_block_length(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths) +size_t DeflateCompressor::huffman_block_length(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths) { size_t length = 0; @@ -807,7 +807,7 @@ size_t DeflateCompressor::fixed_block_length() return 3 + huffman_block_length(fixed_literal_bit_lengths, fixed_distance_bit_lengths); } -size_t DeflateCompressor::dynamic_block_length(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths, const Array<u8, 19>& code_lengths_bit_lengths, const Array<u16, 19>& code_lengths_frequencies, size_t code_lengths_count) +size_t DeflateCompressor::dynamic_block_length(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths, Array<u8, 19> const& code_lengths_bit_lengths, Array<u16, 19> const& code_lengths_frequencies, size_t code_lengths_count) { // block header + literal code count + distance code count + code length count auto length = 3 + 5 + 5 + 4; @@ -831,7 +831,7 @@ size_t DeflateCompressor::dynamic_block_length(const Array<u8, max_huffman_liter return length + huffman_block_length(literal_bit_lengths, distance_bit_lengths); } -void DeflateCompressor::write_huffman(const CanonicalCode& literal_code, const Optional<CanonicalCode>& distance_code) +void DeflateCompressor::write_huffman(CanonicalCode const& literal_code, Optional<CanonicalCode> const& distance_code) { auto has_distances = distance_code.has_value(); for (size_t i = 0; i < m_pending_symbol_size; i++) { @@ -852,7 +852,7 @@ void DeflateCompressor::write_huffman(const CanonicalCode& literal_code, const O } } -size_t DeflateCompressor::encode_huffman_lengths(const Array<u8, max_huffman_literals + max_huffman_distances>& lengths, size_t lengths_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths) +size_t DeflateCompressor::encode_huffman_lengths(Array<u8, max_huffman_literals + max_huffman_distances> const& lengths, size_t lengths_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths) { size_t encoded_count = 0; size_t i = 0; @@ -895,7 +895,7 @@ size_t DeflateCompressor::encode_huffman_lengths(const Array<u8, max_huffman_lit return encoded_count; } -size_t DeflateCompressor::encode_block_lengths(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t& literal_code_count, size_t& distance_code_count) +size_t DeflateCompressor::encode_block_lengths(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t& literal_code_count, size_t& distance_code_count) { literal_code_count = max_huffman_literals; distance_code_count = max_huffman_distances; @@ -920,7 +920,7 @@ size_t DeflateCompressor::encode_block_lengths(const Array<u8, max_huffman_liter return encode_huffman_lengths(all_lengths, lengths_count, encoded_lengths); } -void DeflateCompressor::write_dynamic_huffman(const CanonicalCode& literal_code, size_t literal_code_count, const Optional<CanonicalCode>& distance_code, size_t distance_code_count, const Array<u8, 19>& code_lengths_bit_lengths, size_t code_length_count, const Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t encoded_lengths_count) +void DeflateCompressor::write_dynamic_huffman(CanonicalCode const& literal_code, size_t literal_code_count, Optional<CanonicalCode> const& distance_code, size_t distance_code_count, Array<u8, 19> const& code_lengths_bit_lengths, size_t code_length_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances> const& encoded_lengths, size_t encoded_lengths_count) { m_output_stream.write_bits(literal_code_count - 257, 5); m_output_stream.write_bits(distance_code_count - 1, 5); diff --git a/Userland/Libraries/LibCompress/Deflate.h b/Userland/Libraries/LibCompress/Deflate.h index 9d9b51de8b..85e5a811dd 100644 --- a/Userland/Libraries/LibCompress/Deflate.h +++ b/Userland/Libraries/LibCompress/Deflate.h @@ -22,8 +22,8 @@ public: u32 read_symbol(InputBitStream&) const; void write_symbol(OutputBitStream&, u32) const; - static const CanonicalCode& fixed_literal_codes(); - static const CanonicalCode& fixed_distance_codes(); + static CanonicalCode const& fixed_literal_codes(); + static CanonicalCode const& fixed_distance_codes(); static Optional<CanonicalCode> from_bytes(ReadonlyBytes); @@ -157,7 +157,7 @@ private: Bytes pending_block() { return { m_rolling_window + block_size, block_size }; } // LZ77 Compression - static u16 hash_sequence(const u8* bytes); + static u16 hash_sequence(u8 const* bytes); size_t compare_match_candidate(size_t start, size_t candidate, size_t prev_match_length, size_t max_match_length); size_t find_back_match(size_t start, u16 hash, size_t previous_match_length, size_t max_match_length, size_t& match_position); void lz77_compress_block(); @@ -169,16 +169,16 @@ private: }; static u8 distance_to_base(u16 distance); template<size_t Size> - static void generate_huffman_lengths(Array<u8, Size>& lengths, const Array<u16, Size>& frequencies, size_t max_bit_length, u16 frequency_cap = UINT16_MAX); - size_t huffman_block_length(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths); - void write_huffman(const CanonicalCode& literal_code, const Optional<CanonicalCode>& distance_code); - static size_t encode_huffman_lengths(const Array<u8, max_huffman_literals + max_huffman_distances>& lengths, size_t lengths_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths); - size_t encode_block_lengths(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t& literal_code_count, size_t& distance_code_count); - void write_dynamic_huffman(const CanonicalCode& literal_code, size_t literal_code_count, const Optional<CanonicalCode>& distance_code, size_t distance_code_count, const Array<u8, 19>& code_lengths_bit_lengths, size_t code_length_count, const Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t encoded_lengths_count); + static void generate_huffman_lengths(Array<u8, Size>& lengths, Array<u16, Size> const& frequencies, size_t max_bit_length, u16 frequency_cap = UINT16_MAX); + size_t huffman_block_length(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths); + void write_huffman(CanonicalCode const& literal_code, Optional<CanonicalCode> const& distance_code); + static size_t encode_huffman_lengths(Array<u8, max_huffman_literals + max_huffman_distances> const& lengths, size_t lengths_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths); + size_t encode_block_lengths(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths, Array<code_length_symbol, max_huffman_literals + max_huffman_distances>& encoded_lengths, size_t& literal_code_count, size_t& distance_code_count); + void write_dynamic_huffman(CanonicalCode const& literal_code, size_t literal_code_count, Optional<CanonicalCode> const& distance_code, size_t distance_code_count, Array<u8, 19> const& code_lengths_bit_lengths, size_t code_length_count, Array<code_length_symbol, max_huffman_literals + max_huffman_distances> const& encoded_lengths, size_t encoded_lengths_count); size_t uncompressed_block_length(); size_t fixed_block_length(); - size_t dynamic_block_length(const Array<u8, max_huffman_literals>& literal_bit_lengths, const Array<u8, max_huffman_distances>& distance_bit_lengths, const Array<u8, 19>& code_lengths_bit_lengths, const Array<u16, 19>& code_lengths_frequencies, size_t code_lengths_count); + size_t dynamic_block_length(Array<u8, max_huffman_literals> const& literal_bit_lengths, Array<u8, max_huffman_distances> const& distance_bit_lengths, Array<u8, 19> const& code_lengths_bit_lengths, Array<u16, 19> const& code_lengths_frequencies, size_t code_lengths_count); void flush(); bool m_finished { false }; diff --git a/Userland/Libraries/LibCompress/Gzip.cpp b/Userland/Libraries/LibCompress/Gzip.cpp index f93554d272..924bb7bc9b 100644 --- a/Userland/Libraries/LibCompress/Gzip.cpp +++ b/Userland/Libraries/LibCompress/Gzip.cpp @@ -159,11 +159,11 @@ Optional<String> GzipDecompressor::describe_header(ReadonlyBytes bytes) if (bytes.size() < sizeof(BlockHeader)) return {}; - auto& header = *(reinterpret_cast<const BlockHeader*>(bytes.data())); + auto& header = *(reinterpret_cast<BlockHeader const*>(bytes.data())); if (!header.valid_magic_number() || !header.supported_by_implementation()) return {}; - LittleEndian<u32> original_size = *reinterpret_cast<const u32*>(bytes.offset(bytes.size() - sizeof(u32))); + LittleEndian<u32> original_size = *reinterpret_cast<u32 const*>(bytes.offset(bytes.size() - sizeof(u32))); return String::formatted("last modified: {}, original size {}", Core::DateTime::from_timestamp(header.modification_time).to_string(), (u32)original_size); } @@ -202,7 +202,7 @@ Optional<ByteBuffer> GzipDecompressor::decompress_all(ReadonlyBytes bytes) u8 buffer[4096]; while (!gzip_stream.has_any_error() && !gzip_stream.unreliable_eof()) { - const auto nread = gzip_stream.read({ buffer, sizeof(buffer) }); + auto const nread = gzip_stream.read({ buffer, sizeof(buffer) }); output_stream.write_or_error({ buffer, nread }); } diff --git a/Userland/Libraries/LibCompress/Gzip.h b/Userland/Libraries/LibCompress/Gzip.h index e25b6b0813..c043bcadc4 100644 --- a/Userland/Libraries/LibCompress/Gzip.h +++ b/Userland/Libraries/LibCompress/Gzip.h @@ -68,7 +68,7 @@ private: size_t m_nread { 0 }; }; - const Member& current_member() const { return m_current_member.value(); } + Member const& current_member() const { return m_current_member.value(); } Member& current_member() { return m_current_member.value(); } InputStream& m_input_stream; diff --git a/Userland/Libraries/LibConfig/Client.cpp b/Userland/Libraries/LibConfig/Client.cpp index 7b821523dc..2ad0afcc1d 100644 --- a/Userland/Libraries/LibConfig/Client.cpp +++ b/Userland/Libraries/LibConfig/Client.cpp @@ -96,7 +96,7 @@ void Client::notify_changed_bool_value(String const& domain, String const& group }); } -void Client::notify_removed_key(const String& domain, const String& group, const String& key) +void Client::notify_removed_key(String const& domain, String const& group, String const& key) { Listener::for_each([&](auto& listener) { listener.config_key_was_removed(domain, group, key); diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index 5d935c7b3a..12e22d3b82 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -38,7 +38,7 @@ static String get_salt() return builder.build(); } -static Vector<gid_t> get_extra_gids(const passwd& pwd) +static Vector<gid_t> get_extra_gids(passwd const& pwd) { StringView username { pwd.pw_name }; Vector<gid_t> extra_gids; @@ -57,7 +57,7 @@ static Vector<gid_t> get_extra_gids(const passwd& pwd) return extra_gids; } -ErrorOr<Account> Account::from_passwd(const passwd& pwd, const spwd& spwd) +ErrorOr<Account> Account::from_passwd(passwd const& pwd, spwd const& spwd) { Account account(pwd, spwd, get_extra_gids(pwd)); endpwent(); @@ -88,7 +88,7 @@ ErrorOr<Account> Account::self([[maybe_unused]] Read options) return Account(*pwd, spwd, extra_gids); } -ErrorOr<Account> Account::from_name(const char* username, [[maybe_unused]] Read options) +ErrorOr<Account> Account::from_name(char const* username, [[maybe_unused]] Read options) { auto pwd = TRY(Core::System::getpwnam(username)); if (!pwd.has_value()) @@ -175,7 +175,7 @@ void Account::delete_password() m_password_hash = ""; } -Account::Account(const passwd& pwd, const spwd& spwd, Vector<gid_t> extra_gids) +Account::Account(passwd const& pwd, spwd const& spwd, Vector<gid_t> extra_gids) : m_username(pwd.pw_name) , m_password_hash(spwd.sp_pwdp) , m_uid(pwd.pw_uid) diff --git a/Userland/Libraries/LibCore/Account.h b/Userland/Libraries/LibCore/Account.h index decf46ede0..5cbd7253ec 100644 --- a/Userland/Libraries/LibCore/Account.h +++ b/Userland/Libraries/LibCore/Account.h @@ -46,11 +46,11 @@ public: // You must call sync to apply changes. void set_password(SecretString const& password); void set_password_enabled(bool enabled); - void set_home_directory(const char* home_directory) { m_home_directory = home_directory; } + void set_home_directory(char const* home_directory) { m_home_directory = home_directory; } void set_uid(uid_t uid) { m_uid = uid; } void set_gid(gid_t gid) { m_gid = gid; } - void set_shell(const char* shell) { m_shell = shell; } - void set_gecos(const char* gecos) { m_gecos = gecos; } + void set_shell(char const* shell) { m_shell = shell; } + void set_gecos(char const* gecos) { m_gecos = gecos; } void delete_password(); // A null password means that this account was missing from /etc/shadow. @@ -59,17 +59,17 @@ public: uid_t uid() const { return m_uid; } gid_t gid() const { return m_gid; } - const String& gecos() const { return m_gecos; } - const String& home_directory() const { return m_home_directory; } - const String& shell() const { return m_shell; } - const Vector<gid_t>& extra_gids() const { return m_extra_gids; } + String const& gecos() const { return m_gecos; } + String const& home_directory() const { return m_home_directory; } + String const& shell() const { return m_shell; } + Vector<gid_t> const& extra_gids() const { return m_extra_gids; } ErrorOr<void> sync(); private: static ErrorOr<Account> from_passwd(passwd const&, spwd const&); - Account(const passwd& pwd, const spwd& spwd, Vector<gid_t> extra_gids); + Account(passwd const& pwd, spwd const& spwd, Vector<gid_t> extra_gids); ErrorOr<String> generate_passwd_file() const; #ifndef AK_OS_BSD_GENERIC diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.h b/Userland/Libraries/LibCore/AnonymousBuffer.h index 895bfec464..a0fd5bc76d 100644 --- a/Userland/Libraries/LibCore/AnonymousBuffer.h +++ b/Userland/Libraries/LibCore/AnonymousBuffer.h @@ -24,7 +24,7 @@ public: int fd() const { return m_fd; } size_t size() const { return m_size; } void* data() { return m_data; } - const void* data() const { return m_data; } + void const* data() const { return m_data; } private: AnonymousBufferImpl(int fd, size_t, void*); @@ -74,7 +74,7 @@ private: namespace IPC { -bool encode(Encoder&, const Core::AnonymousBuffer&); +bool encode(Encoder&, Core::AnonymousBuffer const&); ErrorOr<void> decode(Decoder&, Core::AnonymousBuffer&); } diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index a339b8a0bd..ced9d32548 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -16,7 +16,7 @@ #include <stdio.h> #include <string.h> -static Optional<double> convert_to_double(const char* s) +static Optional<double> convert_to_double(char const* s) { char* p; double v = strtod(s, &p); @@ -103,7 +103,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha } VERIFY(found_option); - const char* arg = found_option->requires_argument ? optarg : nullptr; + char const* arg = found_option->requires_argument ? optarg : nullptr; if (!found_option->accept_value(arg)) { warnln("\033[31mInvalid value for option \033[1m{}\033[22m\033[0m", found_option->name_for_display()); fail(); @@ -171,7 +171,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha for (size_t i = 0; i < m_positional_args.size(); i++) { auto& arg = m_positional_args[i]; for (int j = 0; j < num_values_for_arg[i]; j++) { - const char* value = argv[optind++]; + char const* value = argv[optind++]; if (!arg.accept_value(value)) { warnln("Invalid value for argument {}", arg.name); fail(); @@ -183,7 +183,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha return true; } -void ArgsParser::print_usage(FILE* file, const char* argv0) +void ArgsParser::print_usage(FILE* file, char const* argv0) { char const* env_preference = getenv("ARGSPARSER_EMIT_MARKDOWN"); if (env_preference != nullptr && env_preference[0] == '1' && env_preference[1] == 0) { @@ -193,7 +193,7 @@ void ArgsParser::print_usage(FILE* file, const char* argv0) } } -void ArgsParser::print_usage_terminal(FILE* file, const char* argv0) +void ArgsParser::print_usage_terminal(FILE* file, char const* argv0) { out(file, "Usage:\n\t\033[1m{}\033[0m", argv0); @@ -264,7 +264,7 @@ void ArgsParser::print_usage_terminal(FILE* file, const char* argv0) } } -void ArgsParser::print_usage_markdown(FILE* file, const char* argv0) +void ArgsParser::print_usage_markdown(FILE* file, char const* argv0) { outln(file, "## Name\n\n{}", argv0); @@ -347,7 +347,7 @@ void ArgsParser::add_option(Option&& option) m_options.append(move(option)); } -void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden) +void ArgsParser::add_ignored(char const* long_name, char short_name, bool hidden) { Option option { false, @@ -355,7 +355,7 @@ void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden long_name, short_name, nullptr, - [](const char*) { + [](char const*) { return true; }, hidden, @@ -363,7 +363,7 @@ void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden add_option(move(option)); } -void ArgsParser::add_option(bool& value, const char* help_string, const char* long_name, char short_name, bool hidden) +void ArgsParser::add_option(bool& value, char const* help_string, char const* long_name, char short_name, bool hidden) { Option option { false, @@ -371,7 +371,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo long_name, short_name, nullptr, - [&value](const char* s) { + [&value](char const* s) { VERIFY(s == nullptr); value = true; return true; @@ -381,7 +381,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo add_option(move(option)); } -void ArgsParser::add_option(const char*& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(char const*& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -389,7 +389,7 @@ void ArgsParser::add_option(const char*& value, const char* help_string, const c long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; }, @@ -398,7 +398,7 @@ void ArgsParser::add_option(const char*& value, const char* help_string, const c add_option(move(option)); } -void ArgsParser::add_option(String& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -406,7 +406,7 @@ void ArgsParser::add_option(String& value, const char* help_string, const char* long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; }, @@ -423,7 +423,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; }, @@ -432,7 +432,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con add_option(move(option)); } -void ArgsParser::add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(int& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -440,7 +440,7 @@ void ArgsParser::add_option(int& value, const char* help_string, const char* lon long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { auto opt = StringView(s).to_int(); value = opt.value_or(0); return opt.has_value(); @@ -450,7 +450,7 @@ void ArgsParser::add_option(int& value, const char* help_string, const char* lon add_option(move(option)); } -void ArgsParser::add_option(unsigned& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(unsigned& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -458,7 +458,7 @@ void ArgsParser::add_option(unsigned& value, const char* help_string, const char long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { auto opt = StringView(s).to_uint(); value = opt.value_or(0); return opt.has_value(); @@ -468,7 +468,7 @@ void ArgsParser::add_option(unsigned& value, const char* help_string, const char add_option(move(option)); } -void ArgsParser::add_option(double& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(double& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -476,7 +476,7 @@ void ArgsParser::add_option(double& value, const char* help_string, const char* long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { auto opt = convert_to_double(s); value = opt.value_or(0.0); return opt.has_value(); @@ -486,7 +486,7 @@ void ArgsParser::add_option(double& value, const char* help_string, const char* add_option(move(option)); } -void ArgsParser::add_option(Optional<double>& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(Optional<double>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -494,7 +494,7 @@ void ArgsParser::add_option(Optional<double>& value, const char* help_string, co long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { value = convert_to_double(s); return value.has_value(); }, @@ -503,7 +503,7 @@ void ArgsParser::add_option(Optional<double>& value, const char* help_string, co add_option(move(option)); } -void ArgsParser::add_option(Optional<size_t>& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden) +void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden) { Option option { true, @@ -511,7 +511,7 @@ void ArgsParser::add_option(Optional<size_t>& value, const char* help_string, co long_name, short_name, value_name, - [&value](const char* s) { + [&value](char const* s) { value = AK::StringUtils::convert_to_uint<size_t>(s); return value.has_value(); }, @@ -551,14 +551,14 @@ void ArgsParser::add_positional_argument(Arg&& arg) m_positional_args.append(move(arg)); } -void ArgsParser::add_positional_argument(const char*& value, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(char const*& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; } @@ -566,14 +566,14 @@ void ArgsParser::add_positional_argument(const char*& value, const char* help_st add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(String& value, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(String& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; } @@ -588,7 +588,7 @@ void ArgsParser::add_positional_argument(StringView& value, char const* help_str name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { value = s; return true; } @@ -596,14 +596,14 @@ void ArgsParser::add_positional_argument(StringView& value, char const* help_str add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(int& value, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(int& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { auto opt = StringView(s).to_int(); value = opt.value_or(0); return opt.has_value(); @@ -612,14 +612,14 @@ void ArgsParser::add_positional_argument(int& value, const char* help_string, co add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(unsigned& value, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(unsigned& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { auto opt = StringView(s).to_uint(); value = opt.value_or(0); return opt.has_value(); @@ -628,14 +628,14 @@ void ArgsParser::add_positional_argument(unsigned& value, const char* help_strin add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(double& value, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(double& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, 1, - [&value](const char* s) { + [&value](char const* s) { auto opt = convert_to_double(s); value = opt.value_or(0.0); return opt.has_value(); @@ -644,14 +644,14 @@ void ArgsParser::add_positional_argument(double& value, const char* help_string, add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(Vector<const char*>& values, const char* help_string, const char* name, Required required) +void ArgsParser::add_positional_argument(Vector<char const*>& values, char const* help_string, char const* name, Required required) { Arg arg { help_string, name, required == Required::Yes ? 1 : 0, INT_MAX, - [&values](const char* s) { + [&values](char const* s) { values.append(s); return true; } diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index 25e48425a6..ab6ea80bef 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -46,13 +46,13 @@ ErrorOr<CommandResult> command(String const& program, Vector<String> const& argu close(stderr_pipe[0]); }); - Vector<const char*> parts = { program.characters() }; - for (const auto& part : arguments) { + Vector<char const*> parts = { program.characters() }; + for (auto const& part : arguments) { parts.append(part.characters()); } parts.append(nullptr); - const char** argv = parts.data(); + char const** argv = parts.data(); posix_spawn_file_actions_t action; posix_spawn_file_actions_init(&action); diff --git a/Userland/Libraries/LibCore/DateTime.cpp b/Userland/Libraries/LibCore/DateTime.cpp index 50d4153c11..41c1b7f78c 100644 --- a/Userland/Libraries/LibCore/DateTime.cpp +++ b/Userland/Libraries/LibCore/DateTime.cpp @@ -89,7 +89,7 @@ String DateTime::to_string(StringView format) const struct tm tm; localtime_r(&m_timestamp, &tm); StringBuilder builder; - const int format_len = format.length(); + int const format_len = format.length(); auto format_time_zone_offset = [&](bool with_separator) { #if defined(__serenity__) @@ -190,20 +190,20 @@ String DateTime::to_string(StringView format) const builder.appendff("{}", tm.tm_wday ? tm.tm_wday : 7); break; case 'U': { - const int wday_of_year_beginning = (tm.tm_wday + 6 * tm.tm_yday) % 7; - const int week_number = (tm.tm_yday + wday_of_year_beginning) / 7; + int const wday_of_year_beginning = (tm.tm_wday + 6 * tm.tm_yday) % 7; + int const week_number = (tm.tm_yday + wday_of_year_beginning) / 7; builder.appendff("{:02}", week_number); break; } case 'V': { - const int wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7; + int const wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7; int week_number = (tm.tm_yday + wday_of_year_beginning) / 7 + 1; if (wday_of_year_beginning > 3) { if (tm.tm_yday >= 7 - wday_of_year_beginning) --week_number; else { - const int days_of_last_year = days_in_year(tm.tm_year + 1900 - 1); - const int wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7; + int const days_of_last_year = days_in_year(tm.tm_year + 1900 - 1); + int const wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7; week_number = (days_of_last_year + wday_of_last_year_beginning) / 7 + 1; if (wday_of_last_year_beginning > 3) --week_number; @@ -216,8 +216,8 @@ String DateTime::to_string(StringView format) const builder.appendff("{}", tm.tm_wday); break; case 'W': { - const int wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7; - const int week_number = (tm.tm_yday + wday_of_year_beginning) / 7; + int const wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7; + int const week_number = (tm.tm_yday + wday_of_year_beginning) / 7; builder.appendff("{:02}", week_number); break; } @@ -253,7 +253,7 @@ String DateTime::to_string(StringView format) const return builder.build(); } -Optional<DateTime> DateTime::parse(StringView format, const String& string) +Optional<DateTime> DateTime::parse(StringView format, String const& string) { unsigned format_pos = 0; unsigned string_pos = 0; diff --git a/Userland/Libraries/LibCore/DateTime.h b/Userland/Libraries/LibCore/DateTime.h index 41d8a1ad72..f8c35f133d 100644 --- a/Userland/Libraries/LibCore/DateTime.h +++ b/Userland/Libraries/LibCore/DateTime.h @@ -36,9 +36,9 @@ public: static DateTime create(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0); static DateTime now(); static DateTime from_timestamp(time_t); - static Optional<DateTime> parse(StringView format, const String& string); + static Optional<DateTime> parse(StringView format, String const& string); - bool operator<(const DateTime& other) const { return m_timestamp < other.m_timestamp; } + bool operator<(DateTime const& other) const { return m_timestamp < other.m_timestamp; } private: time_t m_timestamp { 0 }; @@ -54,7 +54,7 @@ private: namespace IPC { -bool encode(IPC::Encoder&, const Core::DateTime&); +bool encode(IPC::Encoder&, Core::DateTime const&); ErrorOr<void> decode(IPC::Decoder&, Core::DateTime&); } diff --git a/Userland/Libraries/LibCore/DirIterator.h b/Userland/Libraries/LibCore/DirIterator.h index 6fca1ae502..3fdd3d613c 100644 --- a/Userland/Libraries/LibCore/DirIterator.h +++ b/Userland/Libraries/LibCore/DirIterator.h @@ -28,7 +28,7 @@ public: bool has_error() const { return m_error != 0; } int error() const { return m_error; } - const char* error_string() const { return strerror(m_error); } + char const* error_string() const { return strerror(m_error); } bool has_next(); String next_path(); String next_full_path(); diff --git a/Userland/Libraries/LibCore/Event.cpp b/Userland/Libraries/LibCore/Event.cpp index 37cc05d95c..6faee840f1 100644 --- a/Userland/Libraries/LibCore/Event.cpp +++ b/Userland/Libraries/LibCore/Event.cpp @@ -25,7 +25,7 @@ Object* ChildEvent::child() return nullptr; } -const Object* ChildEvent::child() const +Object const* ChildEvent::child() const { if (auto ref = m_child.strong_ref()) return ref.ptr(); @@ -39,7 +39,7 @@ Object* ChildEvent::insertion_before_child() return nullptr; } -const Object* ChildEvent::insertion_before_child() const +Object const* ChildEvent::insertion_before_child() const { if (auto ref = m_insertion_before_child.strong_ref()) return ref.ptr(); diff --git a/Userland/Libraries/LibCore/Event.h b/Userland/Libraries/LibCore/Event.h index 164580b0c7..fab8095cd9 100644 --- a/Userland/Libraries/LibCore/Event.h +++ b/Userland/Libraries/LibCore/Event.h @@ -115,10 +115,10 @@ public: ~ChildEvent() = default; Object* child(); - const Object* child() const; + Object const* child() const; Object* insertion_before_child(); - const Object* insertion_before_child() const; + Object const* insertion_before_child() const; private: WeakPtr<Object> m_child; diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index 76ad358f7c..c72784da63 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -53,8 +53,8 @@ struct EventLoopTimer { TimerShouldFireWhenNotVisible fire_when_not_visible { TimerShouldFireWhenNotVisible::No }; WeakPtr<Object> owner; - void reload(const Time& now); - bool has_expired(const Time& now) const; + void reload(Time const& now); + bool has_expired(Time const& now) const; }; struct EventLoop::Private { @@ -208,16 +208,16 @@ private: } public: - void send_response(const JsonObject& response) + void send_response(JsonObject const& response) { auto serialized = response.to_string(); u32 length = serialized.length(); // FIXME: Propagate errors - MUST(m_socket->write({ (const u8*)&length, sizeof(length) })); + MUST(m_socket->write({ (u8 const*)&length, sizeof(length) })); MUST(m_socket->write(serialized.bytes())); } - void handle_request(const JsonObject& request) + void handle_request(JsonObject const& request) { auto type = request.get("type").as_string_or({}); @@ -792,12 +792,12 @@ try_select_again: } } -bool EventLoopTimer::has_expired(const Time& now) const +bool EventLoopTimer::has_expired(Time const& now) const { return now > fire_time; } -void EventLoopTimer::reload(const Time& now) +void EventLoopTimer::reload(Time const& now) { fire_time = now + interval; } diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index 811a50dd44..8fcef0e41c 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -152,7 +152,7 @@ bool File::looks_like_shared_library() const return File::looks_like_shared_library(m_filename); } -bool File::looks_like_shared_library(const String& filename) +bool File::looks_like_shared_library(String const& filename) { return filename.ends_with(".so"sv) || filename.contains(".so."sv); } diff --git a/Userland/Libraries/LibCore/FileStream.h b/Userland/Libraries/LibCore/FileStream.h index f8462397d7..13f8a1ffbd 100644 --- a/Userland/Libraries/LibCore/FileStream.h +++ b/Userland/Libraries/LibCore/FileStream.h @@ -40,7 +40,7 @@ public: if (has_any_error()) return 0; - const auto buffer = m_file->read(bytes.size()); + auto const buffer = m_file->read(bytes.size()); return buffer.bytes().copy_to(bytes); } diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp index a0d792e85e..809a6aab58 100644 --- a/Userland/Libraries/LibCore/IODevice.cpp +++ b/Userland/Libraries/LibCore/IODevice.cpp @@ -22,7 +22,7 @@ IODevice::IODevice(Object* parent) { } -const char* IODevice::error_string() const +char const* IODevice::error_string() const { return strerror(m_error); } @@ -142,7 +142,7 @@ ByteBuffer IODevice::read_all() set_eof(true); break; } - data.append((const u8*)read_buffer, nread); + data.append((u8 const*)read_buffer, nread); } auto result = ByteBuffer::copy(data); @@ -166,7 +166,7 @@ String IODevice::read_line(size_t max_size) dbgln("IODevice::read_line: At EOF but there's more than max_size({}) buffered", max_size); return {}; } - auto line = String((const char*)m_buffered_data.data(), m_buffered_data.size(), Chomp); + auto line = String((char const*)m_buffered_data.data(), m_buffered_data.size(), Chomp); m_buffered_data.clear(); return line; } @@ -272,7 +272,7 @@ bool IODevice::truncate(off_t size) return true; } -bool IODevice::write(const u8* data, int size) +bool IODevice::write(u8 const* data, int size) { int rc = ::write(m_fd, data, size); if (rc < 0) { @@ -294,7 +294,7 @@ void IODevice::set_fd(int fd) bool IODevice::write(StringView v) { - return write((const u8*)v.characters_without_null_termination(), v.length()); + return write((u8 const*)v.characters_without_null_termination(), v.length()); } LineIterator::LineIterator(IODevice& device, bool is_end) diff --git a/Userland/Libraries/LibCore/IODevice.h b/Userland/Libraries/LibCore/IODevice.h index 6fb3255155..d98f4ecc42 100644 --- a/Userland/Libraries/LibCore/IODevice.h +++ b/Userland/Libraries/LibCore/IODevice.h @@ -23,7 +23,7 @@ class LineIterator { public: explicit LineIterator(IODevice&, bool is_end = false); - bool operator==(const LineIterator& other) const { return &other == this || (at_end() && other.is_end()) || (other.at_end() && is_end()); } + bool operator==(LineIterator const& other) const { return &other == this || (at_end() && other.is_end()) || (other.at_end() && is_end()); } bool is_end() const { return m_is_end; } bool at_end() const; @@ -81,7 +81,7 @@ public: bool eof() const { return m_eof; } int error() const { return m_error; } - const char* error_string() const; + char const* error_string() const; bool has_error() const { return m_error != 0; } @@ -91,7 +91,7 @@ public: ByteBuffer read_all(); String read_line(size_t max_size = 16384); - bool write(const u8*, int size); + bool write(u8 const*, int size); bool write(StringView); bool truncate(off_t); diff --git a/Userland/Libraries/LibCore/InputBitStream.h b/Userland/Libraries/LibCore/InputBitStream.h index 573f460dbf..be0c8f9cc7 100644 --- a/Userland/Libraries/LibCore/InputBitStream.h +++ b/Userland/Libraries/LibCore/InputBitStream.h @@ -78,7 +78,7 @@ public: nread += 8; m_current_byte.clear(); } else { - const auto bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1; + auto const bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1; result <<= 1; result |= bit; ++nread; @@ -87,7 +87,7 @@ public: } } else { // Always take this branch for booleans or u8: there's no purpose in reading more than a single bit - const auto bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1; + auto const bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1; if constexpr (IsSame<bool, T>) result = bit; else { diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index e1f4ab1a51..9bbd878a83 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -61,7 +61,7 @@ void LocalServer::setup_notifier() }; } -bool LocalServer::listen(const String& address) +bool LocalServer::listen(String const& address) { if (m_listening) return false; @@ -92,7 +92,7 @@ bool LocalServer::listen(const String& address) return false; } auto un = un_optional.value(); - rc = ::bind(m_fd, (const sockaddr*)&un, sizeof(un)); + rc = ::bind(m_fd, (sockaddr const*)&un, sizeof(un)); if (rc < 0) { perror("bind"); return false; diff --git a/Userland/Libraries/LibCore/LocalServer.h b/Userland/Libraries/LibCore/LocalServer.h index 209fb0547b..8554ec5937 100644 --- a/Userland/Libraries/LibCore/LocalServer.h +++ b/Userland/Libraries/LibCore/LocalServer.h @@ -19,7 +19,7 @@ public: ErrorOr<void> take_over_from_system_server(String const& path = String()); bool is_listening() const { return m_listening; } - bool listen(const String& address); + bool listen(String const& address); ErrorOr<NonnullOwnPtr<Stream::LocalSocket>> accept(); diff --git a/Userland/Libraries/LibCore/MappedFile.h b/Userland/Libraries/LibCore/MappedFile.h index 7048caf995..d0fbbbd59c 100644 --- a/Userland/Libraries/LibCore/MappedFile.h +++ b/Userland/Libraries/LibCore/MappedFile.h @@ -24,7 +24,7 @@ public: ~MappedFile(); void* data() { return m_data; } - const void* data() const { return m_data; } + void const* data() const { return m_data; } size_t size() const { return m_size; } diff --git a/Userland/Libraries/LibCore/MemoryStream.h b/Userland/Libraries/LibCore/MemoryStream.h index 5eeb066acf..465da44f9f 100644 --- a/Userland/Libraries/LibCore/MemoryStream.h +++ b/Userland/Libraries/LibCore/MemoryStream.h @@ -68,7 +68,7 @@ public: virtual ErrorOr<size_t> write(ReadonlyBytes bytes) override { // FIXME: Can this not error? - 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; } diff --git a/Userland/Libraries/LibCore/MimeData.cpp b/Userland/Libraries/LibCore/MimeData.cpp index 6e57cee162..ae94d041f9 100644 --- a/Userland/Libraries/LibCore/MimeData.cpp +++ b/Userland/Libraries/LibCore/MimeData.cpp @@ -31,7 +31,7 @@ Vector<URL> MimeData::urls() const return urls; } -void MimeData::set_urls(const Vector<URL>& urls) +void MimeData::set_urls(Vector<URL> const& urls) { StringBuilder builder; for (auto& url : urls) { @@ -46,7 +46,7 @@ String MimeData::text() const return String::copy(m_data.get("text/plain").value_or({})); } -void MimeData::set_text(const String& text) +void MimeData::set_text(String const& text) { set_data("text/plain", text.to_byte_buffer()); } diff --git a/Userland/Libraries/LibCore/MimeData.h b/Userland/Libraries/LibCore/MimeData.h index d3f6b05df8..f94d6b61c9 100644 --- a/Userland/Libraries/LibCore/MimeData.h +++ b/Userland/Libraries/LibCore/MimeData.h @@ -20,27 +20,27 @@ class MimeData : public Object { public: virtual ~MimeData() = default; - ByteBuffer data(const String& mime_type) const { return m_data.get(mime_type).value_or({}); } - void set_data(const String& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); } + ByteBuffer data(String const& mime_type) const { return m_data.get(mime_type).value_or({}); } + void set_data(String const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); } - bool has_format(const String& mime_type) const { return m_data.contains(mime_type); } + bool has_format(String const& mime_type) const { return m_data.contains(mime_type); } Vector<String> formats() const; // Convenience helpers for "text/plain" bool has_text() const { return has_format("text/plain"); } String text() const; - void set_text(const String&); + void set_text(String const&); // Convenience helpers for "text/uri-list" bool has_urls() const { return has_format("text/uri-list"); } Vector<URL> urls() const; - void set_urls(const Vector<URL>&); + void set_urls(Vector<URL> const&); - const HashMap<String, ByteBuffer>& all_data() const { return m_data; } + HashMap<String, ByteBuffer> const& all_data() const { return m_data; } private: MimeData() = default; - explicit MimeData(const HashMap<String, ByteBuffer>& data) + explicit MimeData(HashMap<String, ByteBuffer> const& data) : m_data(data) { } diff --git a/Userland/Libraries/LibCore/NetworkJob.cpp b/Userland/Libraries/LibCore/NetworkJob.cpp index 9c031f4f39..8a18f85002 100644 --- a/Userland/Libraries/LibCore/NetworkJob.cpp +++ b/Userland/Libraries/LibCore/NetworkJob.cpp @@ -69,7 +69,7 @@ void NetworkJob::did_progress(Optional<u32> total_size, u32 downloaded) on_progress(total_size, downloaded); } -const char* to_string(NetworkJob::Error error) +char const* to_string(NetworkJob::Error error) { switch (error) { case NetworkJob::Error::ProtocolFailed: diff --git a/Userland/Libraries/LibCore/NetworkJob.h b/Userland/Libraries/LibCore/NetworkJob.h index 84bdc2dbc4..878dc33db8 100644 --- a/Userland/Libraries/LibCore/NetworkJob.h +++ b/Userland/Libraries/LibCore/NetworkJob.h @@ -28,7 +28,7 @@ public: virtual ~NetworkJob() override = default; // Could fire twice, after Headers and after Trailers! - Function<void(const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code)> on_headers_received; + Function<void(HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code)> on_headers_received; Function<void(bool success)> on_finish; Function<void(Optional<u32>, u32)> on_progress; @@ -36,7 +36,7 @@ public: bool has_error() const { return m_error != Error::None; } Error error() const { return m_error; } NetworkResponse* response() { return m_response.ptr(); } - const NetworkResponse* response() const { return m_response.ptr(); } + NetworkResponse const* response() const { return m_response.ptr(); } enum class ShutdownMode { DetachFromSocket, @@ -66,7 +66,7 @@ private: Error m_error { Error::None }; }; -const char* to_string(NetworkJob::Error); +char const* to_string(NetworkJob::Error); } diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index 62f9d54939..f0c5dcf1be 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -198,7 +198,7 @@ bool Object::set_property(String const& name, JsonValue const& value) return it->value->set(value); } -bool Object::is_ancestor_of(const Object& other) const +bool Object::is_ancestor_of(Object const& other) const { if (&other == this) return false; @@ -247,7 +247,7 @@ void Object::decrement_inspector_count(Badge<InspectorServerConnection>) did_end_inspection(); } -void Object::register_property(const String& name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter) +void Object::register_property(String const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter) { m_properties.set(name, make<Property>(name, move(getter), move(setter))); } @@ -271,7 +271,7 @@ ObjectClassRegistration::ObjectClassRegistration(StringView class_name, Function object_classes().set(class_name, this); } -bool ObjectClassRegistration::is_derived_from(const ObjectClassRegistration& base_class) const +bool ObjectClassRegistration::is_derived_from(ObjectClassRegistration const& base_class) const { if (&base_class == this) return true; @@ -280,14 +280,14 @@ bool ObjectClassRegistration::is_derived_from(const ObjectClassRegistration& bas return m_parent_class->is_derived_from(base_class); } -void ObjectClassRegistration::for_each(Function<void(const ObjectClassRegistration&)> callback) +void ObjectClassRegistration::for_each(Function<void(ObjectClassRegistration const&)> callback) { for (auto& it : object_classes()) { callback(*it.value); } } -const ObjectClassRegistration* ObjectClassRegistration::find(StringView class_name) +ObjectClassRegistration const* ObjectClassRegistration::find(StringView class_name) { return object_classes().get(class_name).value_or(nullptr); } diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index c5511b3b8e..bad2ae50de 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -45,12 +45,12 @@ public: ~ObjectClassRegistration() = default; StringView class_name() const { return m_class_name; } - const ObjectClassRegistration* parent_class() const { return m_parent_class; } + ObjectClassRegistration const* parent_class() const { return m_parent_class; } RefPtr<Object> construct() const { return m_factory(); } - bool is_derived_from(const ObjectClassRegistration& base_class) const; + bool is_derived_from(ObjectClassRegistration const& base_class) const; - static void for_each(Function<void(const ObjectClassRegistration&)>); - static const ObjectClassRegistration* find(StringView class_name); + static void for_each(Function<void(ObjectClassRegistration const&)>); + static ObjectClassRegistration const* find(StringView class_name); private: StringView m_class_name; @@ -98,11 +98,11 @@ public: virtual StringView class_name() const = 0; - const String& name() const { return m_name; } + String const& name() const { return m_name; } void set_name(String name) { m_name = move(name); } NonnullRefPtrVector<Object>& children() { return m_children; } - const NonnullRefPtrVector<Object>& children() const { return m_children; } + NonnullRefPtrVector<Object> const& children() const { return m_children; } template<typename Callback> void for_each_child(Callback callback) @@ -117,15 +117,15 @@ public: void for_each_child_of_type(Callback callback) requires IsBaseOf<Object, T>; template<typename T> - T* find_child_of_type_named(const String&) requires IsBaseOf<Object, T>; + T* find_child_of_type_named(String const&) requires IsBaseOf<Object, T>; template<typename T> - T* find_descendant_of_type_named(const String&) requires IsBaseOf<Object, T>; + T* find_descendant_of_type_named(String const&) requires IsBaseOf<Object, T>; - bool is_ancestor_of(const Object&) const; + bool is_ancestor_of(Object const&) const; Object* parent() { return m_parent; } - const Object* parent() const { return m_parent; } + Object const* parent() const { return m_parent; } void start_timer(int ms, TimerShouldFireWhenNotVisible = TimerShouldFireWhenNotVisible::No); void stop_timer(); @@ -146,9 +146,9 @@ public: void save_to(JsonObject&); - bool set_property(String const& name, const JsonValue& value); + bool set_property(String const& name, JsonValue const& value); JsonValue property(String const& name) const; - const HashMap<String, NonnullOwnPtr<Property>>& properties() const { return m_properties; } + HashMap<String, NonnullOwnPtr<Property>> const& properties() const { return m_properties; } static IntrusiveList<&Object::m_all_objects_list_node>& all_objects(); @@ -186,7 +186,7 @@ public: protected: explicit Object(Object* parent = nullptr); - void register_property(const String& name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter = nullptr); + void register_property(String const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr); virtual void event(Core::Event&); @@ -213,7 +213,7 @@ private: template<> struct AK::Formatter<Core::Object> : AK::Formatter<FormatString> { - ErrorOr<void> format(FormatBuilder& builder, const Core::Object& value) + ErrorOr<void> format(FormatBuilder& builder, Core::Object const& value) { return AK::Formatter<FormatString>::format(builder, "{}({})", value.class_name(), &value); } @@ -231,7 +231,7 @@ inline void Object::for_each_child_of_type(Callback callback) requires IsBaseOf< } template<typename T> -T* Object::find_child_of_type_named(const String& name) requires IsBaseOf<Object, T> +T* Object::find_child_of_type_named(String const& name) requires IsBaseOf<Object, T> { T* found_child = nullptr; for_each_child_of_type<T>([&](auto& child) { diff --git a/Userland/Libraries/LibCore/Property.cpp b/Userland/Libraries/LibCore/Property.cpp index 16443a0171..0d9f66dbab 100644 --- a/Userland/Libraries/LibCore/Property.cpp +++ b/Userland/Libraries/LibCore/Property.cpp @@ -9,7 +9,7 @@ namespace Core { -Property::Property(String name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter) +Property::Property(String name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter) : m_name(move(name)) , m_getter(move(getter)) , m_setter(move(setter)) diff --git a/Userland/Libraries/LibCore/Property.h b/Userland/Libraries/LibCore/Property.h index 8370bdf5a4..1588379b2c 100644 --- a/Userland/Libraries/LibCore/Property.h +++ b/Userland/Libraries/LibCore/Property.h @@ -16,10 +16,10 @@ class Property { AK_MAKE_NONCOPYABLE(Property); public: - Property(String name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter = nullptr); + Property(String name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr); ~Property() = default; - bool set(const JsonValue& value) + bool set(JsonValue const& value) { if (!m_setter) return false; @@ -28,13 +28,13 @@ public: JsonValue get() const { return m_getter(); } - const String& name() const { return m_name; } + String const& name() const { return m_name; } bool is_readonly() const { return !m_setter; } private: String m_name; Function<JsonValue()> m_getter; - Function<bool(const JsonValue&)> m_setter; + Function<bool(JsonValue const&)> m_setter; }; } diff --git a/Userland/Libraries/LibCore/SecretString.h b/Userland/Libraries/LibCore/SecretString.h index 865542ff7c..f6440eb285 100644 --- a/Userland/Libraries/LibCore/SecretString.h +++ b/Userland/Libraries/LibCore/SecretString.h @@ -21,7 +21,7 @@ public: [[nodiscard]] bool is_empty() const { return m_secure_buffer.is_empty(); } [[nodiscard]] size_t length() const { return m_secure_buffer.size(); } - [[nodiscard]] char const* characters() const { return reinterpret_cast<const char*>(m_secure_buffer.data()); } + [[nodiscard]] char const* characters() const { return reinterpret_cast<char const*>(m_secure_buffer.data()); } [[nodiscard]] StringView view() const { return { characters(), length() }; } SecretString() = default; diff --git a/Userland/Libraries/LibCore/SocketAddress.h b/Userland/Libraries/LibCore/SocketAddress.h index b575ff339d..faf17c36f0 100644 --- a/Userland/Libraries/LibCore/SocketAddress.h +++ b/Userland/Libraries/LibCore/SocketAddress.h @@ -25,20 +25,20 @@ public: }; SocketAddress() = default; - SocketAddress(const IPv4Address& address) + SocketAddress(IPv4Address const& address) : m_type(Type::IPv4) , m_ipv4_address(address) { } - SocketAddress(const IPv4Address& address, u16 port) + SocketAddress(IPv4Address const& address, u16 port) : m_type(Type::IPv4) , m_ipv4_address(address) , m_port(port) { } - static SocketAddress local(const String& address) + static SocketAddress local(String const& address) { SocketAddress addr; addr.m_type = Type::Local; diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 00fdfb7f6e..b5e6290c30 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -30,7 +30,7 @@ # include <linux/memfd.h> # include <sys/syscall.h> -static int memfd_create(const char* name, unsigned int flags) +static int memfd_create(char const* name, unsigned int flags) { return syscall(SYS_memfd_create, name, flags); } diff --git a/Userland/Libraries/LibCore/SystemServerTakeover.cpp b/Userland/Libraries/LibCore/SystemServerTakeover.cpp index 3f134663ca..a1dfe9e401 100644 --- a/Userland/Libraries/LibCore/SystemServerTakeover.cpp +++ b/Userland/Libraries/LibCore/SystemServerTakeover.cpp @@ -17,7 +17,7 @@ static void parse_sockets_from_system_server() VERIFY(!s_overtaken_sockets_parsed); constexpr auto socket_takeover = "SOCKET_TAKEOVER"; - const char* sockets = getenv(socket_takeover); + char const* sockets = getenv(socket_takeover); if (!sockets) { s_overtaken_sockets_parsed = true; return; diff --git a/Userland/Libraries/LibCore/UDPServer.cpp b/Userland/Libraries/LibCore/UDPServer.cpp index 47a07fdf07..729b640de6 100644 --- a/Userland/Libraries/LibCore/UDPServer.cpp +++ b/Userland/Libraries/LibCore/UDPServer.cpp @@ -38,7 +38,7 @@ UDPServer::~UDPServer() ::close(m_fd); } -bool UDPServer::bind(const IPv4Address& address, u16 port) +bool UDPServer::bind(IPv4Address const& address, u16 port) { if (m_bound) return false; @@ -46,7 +46,7 @@ bool UDPServer::bind(const IPv4Address& address, u16 port) auto saddr = SocketAddress(address, port); auto in = saddr.to_sockaddr_in(); - if (::bind(m_fd, (const sockaddr*)&in, sizeof(in)) != 0) { + if (::bind(m_fd, (sockaddr const*)&in, sizeof(in)) != 0) { perror("UDPServer::bind"); return false; } diff --git a/Userland/Libraries/LibCore/UDPServer.h b/Userland/Libraries/LibCore/UDPServer.h index 453cf43056..50ac61ee31 100644 --- a/Userland/Libraries/LibCore/UDPServer.h +++ b/Userland/Libraries/LibCore/UDPServer.h @@ -22,7 +22,7 @@ public: bool is_bound() const { return m_bound; } - bool bind(const IPv4Address& address, u16 port); + bool bind(IPv4Address const& address, u16 port); ByteBuffer receive(size_t size, sockaddr_in& from); ByteBuffer receive(size_t size) { diff --git a/Userland/Libraries/LibCoredump/Backtrace.cpp b/Userland/Libraries/LibCoredump/Backtrace.cpp index fa4515f8f7..f063e30c80 100644 --- a/Userland/Libraries/LibCoredump/Backtrace.cpp +++ b/Userland/Libraries/LibCoredump/Backtrace.cpp @@ -41,7 +41,7 @@ ELFObjectInfo const* Backtrace::object_info_for_region(Reader const& coredump, M return info_ptr; } -Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread_info, Function<void(size_t, size_t)> on_progress) +Backtrace::Backtrace(Reader const& coredump, const ELF::Core::ThreadInfo& thread_info, Function<void(size_t, size_t)> on_progress) : m_thread_info(move(thread_info)) { #if ARCH(I386) @@ -92,7 +92,7 @@ Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread } } -void Backtrace::add_entry(const Reader& coredump, FlatPtr ip) +void Backtrace::add_entry(Reader const& coredump, FlatPtr ip) { auto ip_region = coredump.region_containing(ip); if (!ip_region.has_value()) { diff --git a/Userland/Libraries/LibCoredump/Backtrace.h b/Userland/Libraries/LibCoredump/Backtrace.h index d06bad1167..d112f110c5 100644 --- a/Userland/Libraries/LibCoredump/Backtrace.h +++ b/Userland/Libraries/LibCoredump/Backtrace.h @@ -38,14 +38,14 @@ public: String to_string(bool color = false) const; }; - Backtrace(const Reader&, const ELF::Core::ThreadInfo&, Function<void(size_t, size_t)> on_progress = {}); + Backtrace(Reader const&, const ELF::Core::ThreadInfo&, Function<void(size_t, size_t)> on_progress = {}); ~Backtrace() = default; ELF::Core::ThreadInfo const& thread_info() const { return m_thread_info; } Vector<Entry> const& entries() const { return m_entries; } private: - void add_entry(const Reader&, FlatPtr ip); + void add_entry(Reader const&, FlatPtr ip); ELFObjectInfo const* object_info_for_region(Reader const&, MemoryRegionInfo const&); bool m_skip_loader_so { false }; diff --git a/Userland/Libraries/LibCoredump/Reader.cpp b/Userland/Libraries/LibCoredump/Reader.cpp index 445acd353c..e010abab58 100644 --- a/Userland/Libraries/LibCoredump/Reader.cpp +++ b/Userland/Libraries/LibCoredump/Reader.cpp @@ -77,7 +77,7 @@ Optional<ByteBuffer> Reader::decompress_coredump(ReadonlyBytes raw_coredump) return bytebuffer.release_value(); } -Reader::NotesEntryIterator::NotesEntryIterator(const u8* notes_data) +Reader::NotesEntryIterator::NotesEntryIterator(u8 const* notes_data) : m_current(bit_cast<const ELF::Core::NotesEntry*>(notes_data)) , start(notes_data) { @@ -103,22 +103,22 @@ void Reader::NotesEntryIterator::next() VERIFY(!at_end()); switch (type()) { case ELF::Core::NotesEntryHeader::Type::ProcessInfo: { - const auto* current = bit_cast<const ELF::Core::ProcessInfo*>(m_current); + auto const* current = bit_cast<const ELF::Core::ProcessInfo*>(m_current); m_current = bit_cast<const ELF::Core::NotesEntry*>(current->json_data + strlen(current->json_data) + 1); break; } case ELF::Core::NotesEntryHeader::Type::ThreadInfo: { - const auto* current = bit_cast<const ELF::Core::ThreadInfo*>(m_current); + auto const* current = bit_cast<const ELF::Core::ThreadInfo*>(m_current); m_current = bit_cast<const ELF::Core::NotesEntry*>(current + 1); break; } case ELF::Core::NotesEntryHeader::Type::MemoryRegionInfo: { - const auto* current = bit_cast<const ELF::Core::MemoryRegionInfo*>(m_current); + auto const* current = bit_cast<const ELF::Core::MemoryRegionInfo*>(m_current); m_current = bit_cast<const ELF::Core::NotesEntry*>(current->region_name + strlen(current->region_name) + 1); break; } case ELF::Core::NotesEntryHeader::Type::Metadata: { - const auto* current = bit_cast<const ELF::Core::Metadata*>(m_current); + auto const* current = bit_cast<const ELF::Core::Metadata*>(m_current); m_current = bit_cast<const ELF::Core::NotesEntry*>(current->json_data + strlen(current->json_data) + 1); break; } @@ -139,7 +139,7 @@ Optional<FlatPtr> Reader::peek_memory(FlatPtr address) const return {}; FlatPtr offset_in_region = address - region->region_start; - auto* region_data = bit_cast<const u8*>(image().program_header(region->program_header_index).raw_data()); + auto* region_data = bit_cast<u8 const*>(image().program_header(region->program_header_index).raw_data()); FlatPtr value { 0 }; ByteReader::load(region_data + offset_in_region, value); return value; @@ -148,7 +148,7 @@ Optional<FlatPtr> Reader::peek_memory(FlatPtr address) const const JsonObject Reader::process_info() const { const ELF::Core::ProcessInfo* process_info_notes_entry = nullptr; - NotesEntryIterator it(bit_cast<const u8*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); + NotesEntryIterator it(bit_cast<u8 const*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); for (; !it.at_end(); it.next()) { if (it.type() != ELF::Core::NotesEntryHeader::Type::ProcessInfo) continue; @@ -182,7 +182,7 @@ Optional<MemoryRegionInfo> Reader::first_region_for_object(StringView object_nam Optional<MemoryRegionInfo> Reader::region_containing(FlatPtr address) const { Optional<MemoryRegionInfo> ret; - for_each_memory_region_info([&ret, address](const auto& region_info) { + for_each_memory_region_info([&ret, address](auto const& region_info) { if (region_info.region_start <= address && region_info.region_end >= address) { ret = region_info; return IterationDecision::Break; @@ -247,7 +247,7 @@ Vector<String> Reader::process_environment() const HashMap<String, String> Reader::metadata() const { const ELF::Core::Metadata* metadata_notes_entry = nullptr; - NotesEntryIterator it(bit_cast<const u8*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); + NotesEntryIterator it(bit_cast<u8 const*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); for (; !it.at_end(); it.next()) { if (it.type() != ELF::Core::NotesEntryHeader::Type::Metadata) continue; @@ -268,7 +268,7 @@ HashMap<String, String> Reader::metadata() const return metadata; } -const Reader::LibraryData* Reader::library_containing(FlatPtr address) const +Reader::LibraryData const* Reader::library_containing(FlatPtr address) const { static HashMap<String, OwnPtr<LibraryData>> cached_libs; auto region = region_containing(address); diff --git a/Userland/Libraries/LibCoredump/Reader.h b/Userland/Libraries/LibCoredump/Reader.h index 536ecfb009..8f13f74f70 100644 --- a/Userland/Libraries/LibCoredump/Reader.h +++ b/Userland/Libraries/LibCoredump/Reader.h @@ -69,7 +69,7 @@ public: NonnullRefPtr<Core::MappedFile> file; ELF::Image lib_elf; }; - const LibraryData* library_containing(FlatPtr address) const; + LibraryData const* library_containing(FlatPtr address) const; String resolve_object_path(StringView object_name) const; @@ -89,7 +89,7 @@ private: class NotesEntryIterator { public: - NotesEntryIterator(const u8* notes_data); + NotesEntryIterator(u8 const* notes_data); ELF::Core::NotesEntryHeader::Type type() const; const ELF::Core::NotesEntry* current() const; @@ -99,7 +99,7 @@ private: private: const ELF::Core::NotesEntry* m_current { nullptr }; - const u8* start { nullptr }; + u8 const* start { nullptr }; }; // Private as we don't need anyone poking around in this JsonObject @@ -122,7 +122,7 @@ private: template<typename Func> void Reader::for_each_memory_region_info(Func func) const { - NotesEntryIterator it(bit_cast<const u8*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); + NotesEntryIterator it(bit_cast<u8 const*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); for (; !it.at_end(); it.next()) { if (it.type() != ELF::Core::NotesEntryHeader::Type::MemoryRegionInfo) continue; @@ -138,7 +138,7 @@ void Reader::for_each_memory_region_info(Func func) const raw_memory_region_info.region_start, raw_memory_region_info.region_end, raw_memory_region_info.program_header_index, - { bit_cast<const char*>(raw_data.offset_pointer(raw_data.size())) }, + { bit_cast<char const*>(raw_data.offset_pointer(raw_data.size())) }, }; IterationDecision decision = func(memory_region_info); if (decision == IterationDecision::Break) @@ -149,12 +149,12 @@ void Reader::for_each_memory_region_info(Func func) const template<typename Func> void Reader::for_each_thread_info(Func func) const { - NotesEntryIterator it(bit_cast<const u8*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); + NotesEntryIterator it(bit_cast<u8 const*>(m_coredump_image.program_header(m_notes_segment_index).raw_data())); for (; !it.at_end(); it.next()) { if (it.type() != ELF::Core::NotesEntryHeader::Type::ThreadInfo) continue; ELF::Core::ThreadInfo thread_info; - ByteReader::load(bit_cast<const u8*>(it.current()), thread_info); + ByteReader::load(bit_cast<u8 const*>(it.current()), thread_info); IterationDecision decision = func(thread_info); if (decision == IterationDecision::Break) diff --git a/Userland/Libraries/LibCpp/AST.cpp b/Userland/Libraries/LibCpp/AST.cpp index f07e09d252..53ff3cfe2d 100644 --- a/Userland/Libraries/LibCpp/AST.cpp +++ b/Userland/Libraries/LibCpp/AST.cpp @@ -23,7 +23,7 @@ void ASTNode::dump(FILE* output, size_t indent) const void TranslationUnit::dump(FILE* output, size_t indent) const { ASTNode::dump(output, indent); - for (const auto& child : m_declarations) { + for (auto const& child : m_declarations) { child.dump(output, indent + 1); } } @@ -45,7 +45,7 @@ void FunctionDeclaration::dump(FILE* output, size_t indent) const } print_indent(output, indent + 1); outln(output, "("); - for (const auto& arg : m_parameters) { + for (auto const& arg : m_parameters) { arg.dump(output, indent + 1); } print_indent(output, indent + 1); @@ -155,7 +155,7 @@ void FunctionDefinition::dump(FILE* output, size_t indent) const ASTNode::dump(output, indent); print_indent(output, indent); outln(output, "{{"); - for (const auto& statement : m_statements) { + for (auto const& statement : m_statements) { statement.dump(output, indent + 1); } print_indent(output, indent); @@ -200,7 +200,7 @@ void BinaryExpression::dump(FILE* output, size_t indent) const { ASTNode::dump(output, indent); - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case BinaryOp::Addition: op_string = "+"; @@ -272,7 +272,7 @@ void AssignmentExpression::dump(FILE* output, size_t indent) const { ASTNode::dump(output, indent); - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case AssignmentOp::Assignment: op_string = "="; @@ -296,7 +296,7 @@ void FunctionCall::dump(FILE* output, size_t indent) const { ASTNode::dump(output, indent); m_callee->dump(output, indent + 1); - for (const auto& arg : m_arguments) { + for (auto const& arg : m_arguments) { arg.dump(output, indent + 1); } } @@ -349,7 +349,7 @@ void UnaryExpression::dump(FILE* output, size_t indent) const { ASTNode::dump(output, indent); - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case UnaryOp::BitwiseNot: op_string = "~"; @@ -449,7 +449,7 @@ NonnullRefPtrVector<Declaration> Statement::declarations() const { if (is_declaration()) { NonnullRefPtrVector<Declaration> vec; - const auto& decl = static_cast<const Declaration&>(*this); + auto const& decl = static_cast<Declaration const&>(*this); vec.empend(const_cast<Declaration&>(decl)); return vec; } @@ -607,7 +607,7 @@ void Constructor::dump(FILE* output, size_t indent) const outln(output, "C'tor"); print_indent(output, indent + 1); outln(output, "("); - for (const auto& arg : parameters()) { + for (auto const& arg : parameters()) { arg.dump(output, indent + 1); } print_indent(output, indent + 1); @@ -623,7 +623,7 @@ void Destructor::dump(FILE* output, size_t indent) const outln(output, "D'tor"); print_indent(output, indent + 1); outln(output, "("); - for (const auto& arg : parameters()) { + for (auto const& arg : parameters()) { arg.dump(output, indent + 1); } print_indent(output, indent + 1); diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h index 259ef63e4e..c2c772aa33 100644 --- a/Userland/Libraries/LibCpp/AST.h +++ b/Userland/Libraries/LibCpp/AST.h @@ -47,11 +47,11 @@ public: VERIFY(m_end.has_value()); return m_end.value(); } - const FlyString& filename() const + FlyString const& filename() const { return m_filename; } - void set_end(const Position& end) { m_end = end; } + void set_end(Position const& end) { m_end = end; } void set_parent(ASTNode& parent) { m_parent = &parent; } virtual NonnullRefPtrVector<Declaration> declarations() const { return {}; } @@ -66,7 +66,7 @@ public: virtual bool is_dummy_node() const { return false; } protected: - ASTNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + ASTNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : m_parent(parent) , m_start(start) , m_end(end) @@ -89,7 +89,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual NonnullRefPtrVector<Declaration> declarations() const override { return m_declarations; } - TranslationUnit(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + TranslationUnit(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : ASTNode(parent, start, end, filename) { } @@ -108,7 +108,7 @@ public: virtual NonnullRefPtrVector<Declaration> declarations() const override; protected: - Statement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Statement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : ASTNode(parent, start, end, filename) { } @@ -127,12 +127,12 @@ public: virtual bool is_namespace() const { return false; } virtual bool is_enum() const { return false; } bool is_member() const { return parent() != nullptr && parent()->is_declaration() && verify_cast<Declaration>(parent())->is_struct_or_class(); } - const Name* name() const { return m_name; } + Name const* name() const { return m_name; } StringView full_name() const; void set_name(RefPtr<Name> name) { m_name = move(name); } protected: - Declaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Declaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -146,7 +146,7 @@ class InvalidDeclaration : public Declaration { public: virtual ~InvalidDeclaration() override = default; virtual StringView class_name() const override { return "InvalidDeclaration"sv; } - InvalidDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + InvalidDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Declaration(parent, start, end, filename) { } @@ -162,19 +162,19 @@ public: virtual bool is_destructor() const { return false; } RefPtr<FunctionDefinition> definition() { return m_definition; } - FunctionDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + FunctionDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Declaration(parent, start, end, filename) { } virtual NonnullRefPtrVector<Declaration> declarations() const override; - const Vector<StringView>& qualifiers() const { return m_qualifiers; } - void set_qualifiers(const Vector<StringView>& qualifiers) { m_qualifiers = qualifiers; } - const Type* return_type() const { return m_return_type.ptr(); } - void set_return_type(const RefPtr<Type>& return_type) { m_return_type = return_type; } - const NonnullRefPtrVector<Parameter>& parameters() const { return m_parameters; } - void set_parameters(const NonnullRefPtrVector<Parameter>& parameters) { m_parameters = parameters; } - const FunctionDefinition* definition() const { return m_definition.ptr(); } + Vector<StringView> const& qualifiers() const { return m_qualifiers; } + void set_qualifiers(Vector<StringView> const& qualifiers) { m_qualifiers = qualifiers; } + Type const* return_type() const { return m_return_type.ptr(); } + void set_return_type(RefPtr<Type> const& return_type) { m_return_type = return_type; } + NonnullRefPtrVector<Parameter> const& parameters() const { return m_parameters; } + void set_parameters(NonnullRefPtrVector<Parameter> const& parameters) { m_parameters = parameters; } + FunctionDefinition const* definition() const { return m_definition.ptr(); } void set_definition(RefPtr<FunctionDefinition>&& definition) { m_definition = move(definition); } private: @@ -190,10 +190,10 @@ public: virtual bool is_variable_or_parameter_declaration() const override { return true; } void set_type(RefPtr<Type>&& type) { m_type = move(type); } - const Type* type() const { return m_type.ptr(); } + Type const* type() const { return m_type.ptr(); } protected: - VariableOrParameterDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + VariableOrParameterDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Declaration(parent, start, end, filename) { } @@ -208,7 +208,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_parameter() const override { return true; } - Parameter(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, RefPtr<Name> name) + Parameter(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, RefPtr<Name> name) : VariableOrParameterDeclaration(parent, start, end, filename) { m_name = name; @@ -237,7 +237,7 @@ public: void set_qualifiers(Vector<StringView>&& qualifiers) { m_qualifiers = move(qualifiers); } protected: - Type(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Type(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : ASTNode(parent, start, end, filename) { } @@ -254,12 +254,12 @@ public: virtual String to_string() const override; virtual bool is_named_type() const override { return true; } - NamedType(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + NamedType(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Type(parent, start, end, filename) { } - const Name* name() const { return m_name.ptr(); } + Name const* name() const { return m_name.ptr(); } void set_name(RefPtr<Name>&& name) { m_name = move(name); } private: @@ -273,12 +273,12 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual String to_string() const override; - Pointer(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Pointer(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Type(parent, start, end, filename) { } - const Type* pointee() const { return m_pointee.ptr(); } + Type const* pointee() const { return m_pointee.ptr(); } void set_pointee(RefPtr<Type>&& pointee) { m_pointee = move(pointee); } private: @@ -297,13 +297,13 @@ public: Rvalue, }; - Reference(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, Kind kind) + Reference(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, Kind kind) : Type(parent, start, end, filename) , m_kind(kind) { } - const Type* referenced_type() const { return m_referenced_type.ptr(); } + Type const* referenced_type() const { return m_referenced_type.ptr(); } void set_referenced_type(RefPtr<Type>&& pointee) { m_referenced_type = move(pointee); } Kind kind() const { return m_kind; } @@ -319,7 +319,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual String to_string() const override; - FunctionType(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + FunctionType(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Type(parent, start, end, filename) { } @@ -338,7 +338,7 @@ public: virtual StringView class_name() const override { return "FunctionDefinition"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - FunctionDefinition(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + FunctionDefinition(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : ASTNode(parent, start, end, filename) { } @@ -355,7 +355,7 @@ class InvalidStatement : public Statement { public: virtual ~InvalidStatement() override = default; virtual StringView class_name() const override { return "InvalidStatement"sv; } - InvalidStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + InvalidStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -367,7 +367,7 @@ public: virtual StringView class_name() const override { return "Expression"sv; } protected: - Expression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Expression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -377,7 +377,7 @@ class InvalidExpression : public Expression { public: virtual ~InvalidExpression() override = default; virtual StringView class_name() const override { return "InvalidExpression"sv; } - InvalidExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + InvalidExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -389,14 +389,14 @@ public: virtual StringView class_name() const override { return "VariableDeclaration"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - VariableDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + VariableDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : VariableOrParameterDeclaration(parent, start, end, filename) { } virtual bool is_variable_declaration() const override { return true; } - const Expression* initial_value() const { return m_initial_value; } + Expression const* initial_value() const { return m_initial_value; } void set_initial_value(RefPtr<Expression>&& initial_value) { m_initial_value = move(initial_value); } private: @@ -409,12 +409,12 @@ public: virtual StringView class_name() const override { return "Identifier"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - Identifier(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, StringView name) + Identifier(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, StringView name) : Expression(parent, start, end, filename) , m_name(name) { } - Identifier(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Identifier(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Identifier(parent, start, end, filename, {}) { } @@ -436,13 +436,13 @@ public: virtual bool is_name() const override { return true; } virtual bool is_templatized() const { return false; } - Name(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Name(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } virtual StringView full_name() const; - const Identifier* name() const { return m_name.ptr(); } + Identifier const* name() const { return m_name.ptr(); } void set_name(RefPtr<Identifier>&& name) { m_name = move(name); } NonnullRefPtrVector<Identifier> const& scope() const { return m_scope; } void set_scope(NonnullRefPtrVector<Identifier> scope) { m_scope = move(scope); } @@ -461,7 +461,7 @@ public: virtual bool is_templatized() const override { return true; } virtual StringView full_name() const override; - TemplatizedName(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + TemplatizedName(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Name(parent, start, end, filename) { } @@ -479,7 +479,7 @@ public: virtual StringView class_name() const override { return "NumericLiteral"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - NumericLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, StringView value) + NumericLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, StringView value) : Expression(parent, start, end, filename) , m_value(value) { @@ -495,7 +495,7 @@ public: virtual StringView class_name() const override { return "NullPointerLiteral"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - NullPointerLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + NullPointerLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -507,7 +507,7 @@ public: virtual StringView class_name() const override { return "BooleanLiteral"sv; } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - BooleanLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, bool value) + BooleanLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, bool value) : Expression(parent, start, end, filename) , m_value(value) { @@ -541,7 +541,7 @@ enum class BinaryOp { class BinaryExpression : public Expression { public: - BinaryExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + BinaryExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -571,7 +571,7 @@ enum class AssignmentOp { class AssignmentExpression : public Expression { public: - AssignmentExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + AssignmentExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -582,9 +582,9 @@ public: AssignmentOp op() const { return m_op; } void set_op(AssignmentOp op) { m_op = op; } - const Expression* lhs() const { return m_lhs; } + Expression const* lhs() const { return m_lhs; } void set_lhs(RefPtr<Expression>&& e) { m_lhs = move(e); } - const Expression* rhs() const { return m_rhs; } + Expression const* rhs() const { return m_rhs; } void set_rhs(RefPtr<Expression>&& e) { m_rhs = move(e); } private: @@ -595,7 +595,7 @@ private: class FunctionCall : public Expression { public: - FunctionCall(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + FunctionCall(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -605,7 +605,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_function_call() const override { return true; } - const Expression* callee() const { return m_callee.ptr(); } + Expression const* callee() const { return m_callee.ptr(); } void set_callee(RefPtr<Expression>&& callee) { m_callee = move(callee); } void add_argument(NonnullRefPtr<Expression>&& arg) { m_arguments.append(move(arg)); } @@ -618,7 +618,7 @@ private: class StringLiteral final : public Expression { public: - StringLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + StringLiteral(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -639,13 +639,13 @@ public: virtual ~ReturnStatement() override = default; virtual StringView class_name() const override { return "ReturnStatement"sv; } - ReturnStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + ReturnStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } virtual void dump(FILE* = stdout, size_t indent = 0) const override; - const Expression* value() const { return m_value.ptr(); } + Expression const* value() const { return m_value.ptr(); } void set_value(RefPtr<Expression>&& value) { m_value = move(value); } private: @@ -659,7 +659,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_enum() const override { return true; } - EnumDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + EnumDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Declaration(parent, start, end, filename) { } @@ -696,7 +696,7 @@ public: Class }; - StructOrClassDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, StructOrClassDeclaration::Type type) + StructOrClassDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename, StructOrClassDeclaration::Type type) : Declaration(parent, start, end, filename) , m_type(type) { @@ -722,7 +722,7 @@ enum class UnaryOp { class UnaryExpression : public Expression { public: - UnaryExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + UnaryExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -741,7 +741,7 @@ private: class MemberExpression : public Expression { public: - MemberExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + MemberExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -751,9 +751,9 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_member_expression() const override { return true; } - const Expression* object() const { return m_object.ptr(); } + Expression const* object() const { return m_object.ptr(); } void set_object(RefPtr<Expression>&& object) { m_object = move(object); } - const Expression* property() const { return m_property.ptr(); } + Expression const* property() const { return m_property.ptr(); } void set_property(RefPtr<Expression>&& property) { m_property = move(property); } private: @@ -763,7 +763,7 @@ private: class ForStatement : public Statement { public: - ForStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + ForStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -778,7 +778,7 @@ public: void set_test(RefPtr<Expression>&& test) { m_test = move(test); } void set_update(RefPtr<Expression>&& update) { m_update = move(update); } void set_body(RefPtr<Statement>&& body) { m_body = move(body); } - const Statement* body() const { return m_body.ptr(); } + Statement const* body() const { return m_body.ptr(); } private: RefPtr<VariableDeclaration> m_init; @@ -789,7 +789,7 @@ private: class BlockStatement final : public Statement { public: - BlockStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + BlockStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -808,7 +808,7 @@ private: class Comment final : public Statement { public: - Comment(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Comment(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -819,7 +819,7 @@ public: class IfStatement : public Statement { public: - IfStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + IfStatement(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Statement(parent, start, end, filename) { } @@ -833,8 +833,8 @@ public: void set_then_statement(RefPtr<Statement>&& then) { m_then = move(then); } void set_else_statement(RefPtr<Statement>&& _else) { m_else = move(_else); } - const Statement* then_statement() const { return m_then.ptr(); } - const Statement* else_statement() const { return m_else.ptr(); } + Statement const* then_statement() const { return m_then.ptr(); } + Statement const* else_statement() const { return m_else.ptr(); } private: RefPtr<Expression> m_predicate; @@ -849,7 +849,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_namespace() const override { return true; } - NamespaceDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + NamespaceDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Declaration(parent, start, end, filename) { } @@ -863,7 +863,7 @@ private: class CppCastExpression : public Expression { public: - CppCastExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + CppCastExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -884,7 +884,7 @@ private: class CStyleCastExpression : public Expression { public: - CStyleCastExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + CStyleCastExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -903,7 +903,7 @@ private: class SizeofExpression : public Expression { public: - SizeofExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + SizeofExpression(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -920,7 +920,7 @@ private: class BracedInitList : public Expression { public: - BracedInitList(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + BracedInitList(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : Expression(parent, start, end, filename) { } @@ -937,7 +937,7 @@ private: class DummyAstNode : public ASTNode { public: - DummyAstNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + DummyAstNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : ASTNode(parent, start, end, filename) { } @@ -953,7 +953,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_constructor() const override { return true; } - Constructor(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Constructor(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : FunctionDeclaration(parent, start, end, filename) { } @@ -966,7 +966,7 @@ public: virtual void dump(FILE* = stdout, size_t indent = 0) const override; virtual bool is_destructor() const override { return true; } - Destructor(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) + Destructor(ASTNode* parent, Optional<Position> start, Optional<Position> end, String const& filename) : FunctionDeclaration(parent, start, end, filename) { } diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index 0a0e9bb7e0..9cb3e65de5 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -864,12 +864,12 @@ void Parser::load_state() m_state = m_saved_states.take_last(); } -StringView Parser::text_of_token(const Cpp::Token& token) const +StringView Parser::text_of_token(Cpp::Token const& token) const { return token.text(); } -String Parser::text_of_node(const ASTNode& node) const +String Parser::text_of_node(ASTNode const& node) const { return text_in_range(node.start(), node.end()); } @@ -969,7 +969,7 @@ Optional<size_t> Parser::index_of_node_at(Position pos) const VERIFY(m_saved_states.is_empty()); Optional<size_t> match_node_index; - auto node_span = [](const ASTNode& node) { + auto node_span = [](ASTNode const& node) { VERIFY(node.end().line >= node.start().line); VERIFY((node.end().line > node.start().line) || (node.end().column >= node.start().column)); return Position { node.end().line - node.start().line, node.start().line != node.end().line ? 0 : node.end().column - node.start().column }; @@ -1106,7 +1106,7 @@ NonnullRefPtr<EnumDeclaration> Parser::parse_enum_declaration(ASTNode& parent) return enum_decl; } -Token Parser::consume_keyword(const String& keyword) +Token Parser::consume_keyword(String const& keyword) { auto token = consume(); if (token.type() != Token::Type::Keyword) { @@ -1120,7 +1120,7 @@ Token Parser::consume_keyword(const String& keyword) return token; } -bool Parser::match_keyword(const String& keyword) +bool Parser::match_keyword(String const& keyword) { auto token = peek(); if (token.type() != Token::Type::Keyword) { diff --git a/Userland/Libraries/LibCpp/Parser.h b/Userland/Libraries/LibCpp/Parser.h index 5ef0f36d08..e9054a376c 100644 --- a/Userland/Libraries/LibCpp/Parser.h +++ b/Userland/Libraries/LibCpp/Parser.h @@ -29,11 +29,11 @@ public: Optional<Token> token_at(Position) const; Optional<size_t> index_of_token_at(Position) const; RefPtr<const TranslationUnit> root_node() const { return m_root_node; } - String text_of_node(const ASTNode&) const; - StringView text_of_token(const Cpp::Token& token) const; + String text_of_node(ASTNode const&) const; + StringView text_of_token(Cpp::Token const& token) const; void print_tokens() const; Vector<Token> const& tokens() const { return m_tokens; } - const Vector<String>& errors() const { return m_errors; } + Vector<String> const& errors() const { return m_errors; } struct TodoEntry { String content; @@ -71,7 +71,7 @@ private: bool match_literal(); bool match_unary_expression(); bool match_boolean_literal(); - bool match_keyword(const String&); + bool match_keyword(String const&); bool match_block_statement(); bool match_namespace_declaration(); bool match_template_arguments(); @@ -130,7 +130,7 @@ private: bool match(Token::Type); Token consume(Token::Type); Token consume(); - Token consume_keyword(const String&); + Token consume_keyword(String const&); Token peek(size_t offset = 0) const; Optional<Token> peek(Token::Type) const; Position position() const; @@ -149,7 +149,7 @@ private: template<class T, class... Args> NonnullRefPtr<T> - create_ast_node(ASTNode& parent, const Position& start, Optional<Position> end, Args&&... args) + create_ast_node(ASTNode& parent, Position const& start, Optional<Position> end, Args&&... args) { auto node = adopt_ref(*new T(&parent, start, end, m_filename, forward<Args>(args)...)); @@ -163,7 +163,7 @@ private: } NonnullRefPtr<TranslationUnit> - create_root_ast_node(const Position& start, Position end) + create_root_ast_node(Position const& start, Position end) { auto node = adopt_ref(*new TranslationUnit(nullptr, start, end, m_filename)); m_nodes.append(node); diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp index 330bef1e14..0f956f5c96 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.cpp +++ b/Userland/Libraries/LibCpp/Preprocessor.cpp @@ -12,7 +12,7 @@ #include <ctype.h> namespace Cpp { -Preprocessor::Preprocessor(const String& filename, StringView program) +Preprocessor::Preprocessor(String const& filename, StringView program) : m_filename(filename) , m_program(program) { diff --git a/Userland/Libraries/LibCpp/Preprocessor.h b/Userland/Libraries/LibCpp/Preprocessor.h index 92e5ce5dc4..0452ea3581 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.h +++ b/Userland/Libraries/LibCpp/Preprocessor.h @@ -20,7 +20,7 @@ namespace Cpp { class Preprocessor { public: - explicit Preprocessor(const String& filename, StringView program); + explicit Preprocessor(String const& filename, StringView program); Vector<Token> process_and_lex(); Vector<StringView> included_paths() const { return m_included_paths; } diff --git a/Userland/Libraries/LibCpp/Token.cpp b/Userland/Libraries/LibCpp/Token.cpp index 481ca0e42e..71f7bc768b 100644 --- a/Userland/Libraries/LibCpp/Token.cpp +++ b/Userland/Libraries/LibCpp/Token.cpp @@ -9,19 +9,19 @@ namespace Cpp { -bool Position::operator<(const Position& other) const +bool Position::operator<(Position const& other) const { return line < other.line || (line == other.line && column < other.column); } -bool Position::operator>(const Position& other) const +bool Position::operator>(Position const& other) const { return !(*this < other) && !(*this == other); } -bool Position::operator==(const Position& other) const +bool Position::operator==(Position const& other) const { return line == other.line && column == other.column; } -bool Position::operator<=(const Position& other) const +bool Position::operator<=(Position const& other) const { return !(*this > other); } diff --git a/Userland/Libraries/LibCpp/Token.h b/Userland/Libraries/LibCpp/Token.h index f4de7fbfcf..c592a924cb 100644 --- a/Userland/Libraries/LibCpp/Token.h +++ b/Userland/Libraries/LibCpp/Token.h @@ -83,10 +83,10 @@ struct Position { size_t line { 0 }; size_t column { 0 }; - bool operator<(const Position&) const; - bool operator<=(const Position&) const; - bool operator>(const Position&) const; - bool operator==(const Position&) const; + bool operator<(Position const&) const; + bool operator<=(Position const&) const; + bool operator>(Position const&) const; + bool operator==(Position const&) const; }; struct Token { @@ -96,7 +96,7 @@ struct Token { #undef __TOKEN }; - Token(Type type, const Position& start, const Position& end, StringView text) + Token(Type type, Position const& start, Position const& end, StringView text) : m_type(type) , m_start(start) , m_end(end) @@ -104,7 +104,7 @@ struct Token { { } - static const char* type_to_string(Type t) + static char const* type_to_string(Type t) { switch (t) { #define __TOKEN(x) \ @@ -119,11 +119,11 @@ struct Token { String to_string() const; String type_as_string() const; - const Position& start() const { return m_start; } - const Position& end() const { return m_end; } + Position const& start() const { return m_start; } + Position const& end() const { return m_end; } - void set_start(const Position& other) { m_start = other; } - void set_end(const Position& other) { m_end = other; } + void set_start(Position const& other) { m_start = other; } + void set_end(Position const& other) { m_end = other; } Type type() const { return m_type; } StringView text() const { return m_text; } diff --git a/Userland/Libraries/LibCrypt/crypt.cpp b/Userland/Libraries/LibCrypt/crypt.cpp index c952a74d07..9823ef980e 100644 --- a/Userland/Libraries/LibCrypt/crypt.cpp +++ b/Userland/Libraries/LibCrypt/crypt.cpp @@ -15,7 +15,7 @@ extern "C" { static struct crypt_data crypt_data; -char* crypt(const char* key, const char* salt) +char* crypt(char const* key, char const* salt) { crypt_data.initialized = true; return crypt_r(key, salt, &crypt_data); @@ -24,7 +24,7 @@ char* crypt(const char* key, const char* salt) static constexpr size_t crypt_salt_max = 16; static constexpr size_t sha_string_length = 44; -char* crypt_r(const char* key, const char* salt, struct crypt_data* data) +char* crypt_r(char const* key, char const* salt, struct crypt_data* data) { if (!data->initialized) { errno = EINVAL; @@ -33,7 +33,7 @@ char* crypt_r(const char* key, const char* salt, struct crypt_data* data) if (salt[0] == '$') { if (salt[1] == '5') { - const char* salt_value = salt + 3; + char const* salt_value = salt + 3; size_t salt_len = min(strcspn(salt_value, "$"), crypt_salt_max); size_t header_len = salt_len + 3; @@ -46,7 +46,7 @@ char* crypt_r(const char* key, const char* salt, struct crypt_data* data) Crypto::Hash::SHA256 sha; sha.update(key); - sha.update((const u8*)salt_value, salt_len); + sha.update((u8 const*)salt_value, salt_len); auto digest = sha.digest(); auto string = encode_base64(ReadonlyBytes(digest.immutable_data(), digest.data_length())); diff --git a/Userland/Libraries/LibCrypt/crypt.h b/Userland/Libraries/LibCrypt/crypt.h index c51744a666..0a304ac047 100644 --- a/Userland/Libraries/LibCrypt/crypt.h +++ b/Userland/Libraries/LibCrypt/crypt.h @@ -22,7 +22,7 @@ struct crypt_data { char result[65]; }; -char* crypt(const char* key, const char* salt); -char* crypt_r(const char* key, const char* salt, struct crypt_data* data); +char* crypt(char const* key, char const* salt); +char* crypt_r(char const* key, char const* salt, struct crypt_data* data); __END_DECLS diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp index de06e63087..396da9b53f 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp @@ -12,12 +12,12 @@ namespace { -static u32 to_u32(const u8* b) +static u32 to_u32(u8 const* b) { return AK::convert_between_host_and_big_endian(ByteReader::load32(b)); } -static void to_u8s(u8* b, const u32* w) +static void to_u8s(u8* b, u32 const* w) { for (auto i = 0; i < 4; ++i) { ByteReader::store(b + i * 4, AK::convert_between_host_and_big_endian(w[i])); diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.h b/Userland/Libraries/LibCrypto/Authentication/GHash.h index 0bfc8274cd..21b6039d5d 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.h +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.h @@ -24,7 +24,7 @@ struct GHashDigest { constexpr static size_t Size = 16; u8 data[Size]; - const u8* immutable_data() const { return data; } + u8 const* immutable_data() const { return data; } size_t data_length() { return Size; } }; @@ -33,7 +33,7 @@ public: using TagType = GHashDigest; template<size_t N> - explicit GHash(const char (&key)[N]) + explicit GHash(char const (&key)[N]) : GHash({ key, N }) { } diff --git a/Userland/Libraries/LibCrypto/Authentication/HMAC.h b/Userland/Libraries/LibCrypto/Authentication/HMAC.h index 8c80602dbe..29c9ce1300 100644 --- a/Userland/Libraries/LibCrypto/Authentication/HMAC.h +++ b/Userland/Libraries/LibCrypto/Authentication/HMAC.h @@ -39,23 +39,23 @@ public: reset(); } - TagType process(const u8* message, size_t length) + TagType process(u8 const* message, size_t length) { reset(); update(message, length); return digest(); } - void update(const u8* message, size_t length) + void update(u8 const* message, size_t length) { m_inner_hasher.update(message, length); } TagType process(ReadonlyBytes span) { return process(span.data(), span.size()); } - TagType process(StringView string) { return process((const u8*)string.characters_without_null_termination(), string.length()); } + TagType process(StringView string) { return process((u8 const*)string.characters_without_null_termination(), string.length()); } void update(ReadonlyBytes span) { return update(span.data(), span.size()); } - void update(StringView string) { return update((const u8*)string.characters_without_null_termination(), string.length()); } + void update(StringView string) { return update((u8 const*)string.characters_without_null_termination(), string.length()); } TagType digest() { @@ -84,7 +84,7 @@ public: #endif private: - void derive_key(const u8* key, size_t length) + void derive_key(u8 const* key, size_t length) { auto block_size = m_inner_hasher.block_size(); // Note: The block size of all the current hash functions is 512 bits. diff --git a/Userland/Libraries/LibCrypto/BigInt/Algorithms/BitwiseOperations.cpp b/Userland/Libraries/LibCrypto/BigInt/Algorithms/BitwiseOperations.cpp index 55bcbb44e8..2003e4896c 100644 --- a/Userland/Libraries/LibCrypto/BigInt/Algorithms/BitwiseOperations.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/Algorithms/BitwiseOperations.cpp @@ -32,7 +32,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_or_without_allocation( return; } - const UnsignedBigInteger *shorter, *longer; + UnsignedBigInteger const *shorter, *longer; if (left.length() < right.length()) { shorter = &left; longer = &right; @@ -71,7 +71,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_and_without_allocation( return; } - const UnsignedBigInteger *shorter, *longer; + UnsignedBigInteger const *shorter, *longer; if (left.length() < right.length()) { shorter = &left; longer = &right; @@ -110,7 +110,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_xor_without_allocation( return; } - const UnsignedBigInteger *shorter, *longer; + UnsignedBigInteger const *shorter, *longer; if (left.length() < right.length()) { shorter = &left; longer = &right; diff --git a/Userland/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp b/Userland/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp index bf8e784180..78ac298c61 100644 --- a/Userland/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp @@ -17,8 +17,8 @@ void UnsignedBigIntegerAlgorithms::add_without_allocation( UnsignedBigInteger const& right, UnsignedBigInteger& output) { - const UnsignedBigInteger* const longer = (left.length() > right.length()) ? &left : &right; - const UnsignedBigInteger* const shorter = (longer == &right) ? &left : &right; + UnsignedBigInteger const* const longer = (left.length() > right.length()) ? &left : &right; + UnsignedBigInteger const* const shorter = (longer == &right) ? &left : &right; output.set_to(*longer); add_into_accumulator_without_allocation(output, *shorter); diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp index e95102cb84..da24f95b31 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp @@ -9,7 +9,7 @@ namespace Crypto { -SignedBigInteger SignedBigInteger::import_data(const u8* ptr, size_t length) +SignedBigInteger SignedBigInteger::import_data(u8 const* ptr, size_t length) { bool sign = *ptr; auto unsigned_data = UnsignedBigInteger::import_data(ptr + 1, length - 1); @@ -71,7 +71,7 @@ double SignedBigInteger::to_double() const return -unsigned_value; } -FLATTEN SignedBigInteger SignedBigInteger::plus(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::plus(SignedBigInteger const& other) const { // If both are of the same sign, just add the unsigned data and return. if (m_sign == other.m_sign) @@ -81,7 +81,7 @@ FLATTEN SignedBigInteger SignedBigInteger::plus(const SignedBigInteger& other) c return m_sign ? other.minus(this->m_unsigned_data) : minus(other.m_unsigned_data); } -FLATTEN SignedBigInteger SignedBigInteger::minus(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::minus(SignedBigInteger const& other) const { // If the signs are different, convert the op to an addition. if (m_sign != other.m_sign) { @@ -120,7 +120,7 @@ FLATTEN SignedBigInteger SignedBigInteger::minus(const SignedBigInteger& other) return SignedBigInteger { 0 }; } -FLATTEN SignedBigInteger SignedBigInteger::plus(const UnsignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::plus(UnsignedBigInteger const& other) const { if (m_sign) { if (other < m_unsigned_data) @@ -132,7 +132,7 @@ FLATTEN SignedBigInteger SignedBigInteger::plus(const UnsignedBigInteger& other) return { m_unsigned_data.plus(other), false }; } -FLATTEN SignedBigInteger SignedBigInteger::minus(const UnsignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::minus(UnsignedBigInteger const& other) const { if (m_sign) return { m_unsigned_data.plus(m_unsigned_data), true }; @@ -167,7 +167,7 @@ FLATTEN SignedDivisionResult SignedBigInteger::divided_by(UnsignedBigInteger con }; } -FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(SignedBigInteger const& other) const { // See bitwise_and() for derivations. if (!is_negative() && !other.is_negative()) @@ -191,7 +191,7 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(const SignedBigInteger& ot return { unsigned_value().minus(1).bitwise_and(other.unsigned_value().minus(1)).plus(1), true }; } -FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(SignedBigInteger const& other) const { if (!is_negative() && !other.is_negative()) return { unsigned_value().bitwise_and(other.unsigned_value()), false }; @@ -229,33 +229,33 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(const SignedBigInteger& o return { unsigned_value().minus(1).bitwise_or(other.unsigned_value().minus(1)).plus(1), true }; } -FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(SignedBigInteger const& other) const { return bitwise_or(other).minus(bitwise_and(other)); } -bool SignedBigInteger::operator==(const UnsignedBigInteger& other) const +bool SignedBigInteger::operator==(UnsignedBigInteger const& other) const { if (m_sign) return false; return m_unsigned_data == other; } -bool SignedBigInteger::operator!=(const UnsignedBigInteger& other) const +bool SignedBigInteger::operator!=(UnsignedBigInteger const& other) const { if (m_sign) return true; return m_unsigned_data != other; } -bool SignedBigInteger::operator<(const UnsignedBigInteger& other) const +bool SignedBigInteger::operator<(UnsignedBigInteger const& other) const { if (m_sign) return true; return m_unsigned_data < other; } -bool SignedBigInteger::operator>(const UnsignedBigInteger& other) const +bool SignedBigInteger::operator>(UnsignedBigInteger const& other) const { return *this != other && !(*this < other); } @@ -265,13 +265,13 @@ FLATTEN SignedBigInteger SignedBigInteger::shift_left(size_t num_bits) const return SignedBigInteger { m_unsigned_data.shift_left(num_bits), m_sign }; } -FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(const SignedBigInteger& other) const +FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(SignedBigInteger const& other) const { bool result_sign = m_sign ^ other.m_sign; return { m_unsigned_data.multiplied_by(other.m_unsigned_data), result_sign }; } -FLATTEN SignedDivisionResult SignedBigInteger::divided_by(const SignedBigInteger& divisor) const +FLATTEN SignedDivisionResult SignedBigInteger::divided_by(SignedBigInteger const& divisor) const { // Aa / Bb -> (A^B)q, Ar bool result_sign = m_sign ^ divisor.m_sign; @@ -292,7 +292,7 @@ void SignedBigInteger::set_bit_inplace(size_t bit_index) m_unsigned_data.set_bit_inplace(bit_index); } -bool SignedBigInteger::operator==(const SignedBigInteger& other) const +bool SignedBigInteger::operator==(SignedBigInteger const& other) const { if (is_invalid() != other.is_invalid()) return false; @@ -303,12 +303,12 @@ bool SignedBigInteger::operator==(const SignedBigInteger& other) const return m_sign == other.m_sign && m_unsigned_data == other.m_unsigned_data; } -bool SignedBigInteger::operator!=(const SignedBigInteger& other) const +bool SignedBigInteger::operator!=(SignedBigInteger const& other) const { return !(*this == other); } -bool SignedBigInteger::operator<(const SignedBigInteger& other) const +bool SignedBigInteger::operator<(SignedBigInteger const& other) const { if (m_sign ^ other.m_sign) return m_sign; @@ -319,24 +319,24 @@ bool SignedBigInteger::operator<(const SignedBigInteger& other) const return m_unsigned_data < other.m_unsigned_data; } -bool SignedBigInteger::operator<=(const SignedBigInteger& other) const +bool SignedBigInteger::operator<=(SignedBigInteger const& other) const { return *this < other || *this == other; } -bool SignedBigInteger::operator>(const SignedBigInteger& other) const +bool SignedBigInteger::operator>(SignedBigInteger const& other) const { return *this != other && !(*this < other); } -bool SignedBigInteger::operator>=(const SignedBigInteger& other) const +bool SignedBigInteger::operator>=(SignedBigInteger const& other) const { return !(*this < other); } } -ErrorOr<void> AK::Formatter<Crypto::SignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::SignedBigInteger& value) +ErrorOr<void> AK::Formatter<Crypto::SignedBigInteger>::format(FormatBuilder& fmtbuilder, Crypto::SignedBigInteger const& value) { if (value.is_negative()) TRY(fmtbuilder.put_string("-")); diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h index 5b5468a728..e39e37b038 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h @@ -45,8 +45,8 @@ public: return { UnsignedBigInteger::create_invalid(), false }; } - static SignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } - static SignedBigInteger import_data(const u8* ptr, size_t length); + static SignedBigInteger import_data(StringView data) { return import_data((u8 const*)data.characters_without_null_termination(), data.length()); } + static SignedBigInteger import_data(u8 const* ptr, size_t length); static SignedBigInteger create_from(i64 value) { @@ -69,8 +69,8 @@ public: u64 to_u64() const; double to_double() const; - const UnsignedBigInteger& unsigned_value() const { return m_unsigned_data; } - const Vector<u32, STARTING_WORD_SIZE> words() const { return m_unsigned_data.words(); } + UnsignedBigInteger const& unsigned_value() const { return m_unsigned_data; } + Vector<u32, STARTING_WORD_SIZE> const words() const { return m_unsigned_data.words(); } bool is_negative() const { return m_sign; } void negate() @@ -90,7 +90,7 @@ public: m_unsigned_data.set_to((u32)other); m_sign = other < 0; } - void set_to(const SignedBigInteger& other) + void set_to(SignedBigInteger const& other) { m_unsigned_data.set_to(other.m_unsigned_data); m_sign = other.m_sign; @@ -107,36 +107,36 @@ public: size_t length() const { return m_unsigned_data.length() + 1; } size_t trimmed_length() const { return m_unsigned_data.trimmed_length() + 1; }; - SignedBigInteger plus(const SignedBigInteger& other) const; - SignedBigInteger minus(const SignedBigInteger& other) const; - SignedBigInteger bitwise_or(const SignedBigInteger& other) const; - SignedBigInteger bitwise_and(const SignedBigInteger& other) const; - SignedBigInteger bitwise_xor(const SignedBigInteger& other) const; + SignedBigInteger plus(SignedBigInteger const& other) const; + SignedBigInteger minus(SignedBigInteger const& other) const; + SignedBigInteger bitwise_or(SignedBigInteger const& other) const; + SignedBigInteger bitwise_and(SignedBigInteger const& other) const; + SignedBigInteger bitwise_xor(SignedBigInteger const& other) const; SignedBigInteger bitwise_not() const; SignedBigInteger shift_left(size_t num_bits) const; - SignedBigInteger multiplied_by(const SignedBigInteger& other) const; - SignedDivisionResult divided_by(const SignedBigInteger& divisor) const; + SignedBigInteger multiplied_by(SignedBigInteger const& other) const; + SignedDivisionResult divided_by(SignedBigInteger const& divisor) const; - SignedBigInteger plus(const UnsignedBigInteger& other) const; - SignedBigInteger minus(const UnsignedBigInteger& other) const; - SignedBigInteger multiplied_by(const UnsignedBigInteger& other) const; - SignedDivisionResult divided_by(const UnsignedBigInteger& divisor) const; + SignedBigInteger plus(UnsignedBigInteger const& other) const; + SignedBigInteger minus(UnsignedBigInteger const& other) const; + SignedBigInteger multiplied_by(UnsignedBigInteger const& other) const; + SignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const; u32 hash() const; void set_bit_inplace(size_t bit_index); - bool operator==(const SignedBigInteger& other) const; - bool operator!=(const SignedBigInteger& other) const; - bool operator<(const SignedBigInteger& other) const; - bool operator<=(const SignedBigInteger& other) const; - bool operator>(const SignedBigInteger& other) const; - bool operator>=(const SignedBigInteger& other) const; + bool operator==(SignedBigInteger const& other) const; + bool operator!=(SignedBigInteger const& other) const; + bool operator<(SignedBigInteger const& other) const; + bool operator<=(SignedBigInteger const& other) const; + bool operator>(SignedBigInteger const& other) const; + bool operator>=(SignedBigInteger const& other) const; - bool operator==(const UnsignedBigInteger& other) const; - bool operator!=(const UnsignedBigInteger& other) const; - bool operator<(const UnsignedBigInteger& other) const; - bool operator>(const UnsignedBigInteger& other) const; + bool operator==(UnsignedBigInteger const& other) const; + bool operator!=(UnsignedBigInteger const& other) const; + bool operator<(UnsignedBigInteger const& other) const; + bool operator>(UnsignedBigInteger const& other) const; private: void ensure_sign_is_valid() @@ -162,7 +162,7 @@ struct AK::Formatter<Crypto::SignedBigInteger> : AK::Formatter<Crypto::UnsignedB }; inline Crypto::SignedBigInteger -operator""_sbigint(const char* string, size_t length) +operator""_sbigint(char const* string, size_t length) { return Crypto::SignedBigInteger::from_base(10, { string, length }); } diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index a8082721d1..b47b0f05ec 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -13,7 +13,7 @@ namespace Crypto { -UnsignedBigInteger::UnsignedBigInteger(const u8* ptr, size_t length) +UnsignedBigInteger::UnsignedBigInteger(u8 const* ptr, size_t length) { m_words.resize_and_keep_capacity((length + sizeof(u32) - 1) / sizeof(u32)); size_t in = length, out = 0; @@ -136,7 +136,7 @@ void UnsignedBigInteger::set_to(UnsignedBigInteger::Word other) m_cached_hash = 0; } -void UnsignedBigInteger::set_to(const UnsignedBigInteger& other) +void UnsignedBigInteger::set_to(UnsignedBigInteger const& other) { m_is_invalid = other.m_is_invalid; m_words.resize_and_keep_capacity(other.m_words.size()); @@ -195,7 +195,7 @@ size_t UnsignedBigInteger::one_based_index_of_highest_set_bit() const return index; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(UnsignedBigInteger const& other) const { UnsignedBigInteger result; @@ -204,7 +204,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(const UnsignedBigInteger& ot return result; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(UnsignedBigInteger const& other) const { UnsignedBigInteger result; @@ -213,7 +213,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(const UnsignedBigInteger& o return result; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(UnsignedBigInteger const& other) const { UnsignedBigInteger result; @@ -222,7 +222,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(const UnsignedBigInteg return result; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(UnsignedBigInteger const& other) const { UnsignedBigInteger result; @@ -231,7 +231,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(const UnsignedBigInte return result; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_xor(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_xor(UnsignedBigInteger const& other) const { UnsignedBigInteger result; @@ -260,7 +260,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::shift_left(size_t num_bits) const return output; } -FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(const UnsignedBigInteger& other) const +FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(UnsignedBigInteger const& other) const { UnsignedBigInteger result; UnsignedBigInteger temp_shift_result; @@ -272,7 +272,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(const UnsignedBigIn return result; } -FLATTEN UnsignedDivisionResult UnsignedBigInteger::divided_by(const UnsignedBigInteger& divisor) const +FLATTEN UnsignedDivisionResult UnsignedBigInteger::divided_by(UnsignedBigInteger const& divisor) const { UnsignedBigInteger quotient; UnsignedBigInteger remainder; @@ -299,7 +299,7 @@ u32 UnsignedBigInteger::hash() const if (m_cached_hash != 0) return m_cached_hash; - return m_cached_hash = string_hash((const char*)m_words.data(), sizeof(Word) * m_words.size()); + return m_cached_hash = string_hash((char const*)m_words.data(), sizeof(Word) * m_words.size()); } void UnsignedBigInteger::set_bit_inplace(size_t bit_index) @@ -318,7 +318,7 @@ void UnsignedBigInteger::set_bit_inplace(size_t bit_index) m_cached_hash = 0; } -bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const +bool UnsignedBigInteger::operator==(UnsignedBigInteger const& other) const { if (is_invalid() != other.is_invalid()) return false; @@ -331,12 +331,12 @@ bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const return !__builtin_memcmp(m_words.data(), other.words().data(), length * (BITS_IN_WORD / 8)); } -bool UnsignedBigInteger::operator!=(const UnsignedBigInteger& other) const +bool UnsignedBigInteger::operator!=(UnsignedBigInteger const& other) const { return !(*this == other); } -bool UnsignedBigInteger::operator<(const UnsignedBigInteger& other) const +bool UnsignedBigInteger::operator<(UnsignedBigInteger const& other) const { auto length = trimmed_length(); auto other_length = other.trimmed_length(); @@ -360,7 +360,7 @@ bool UnsignedBigInteger::operator<(const UnsignedBigInteger& other) const return false; } -bool UnsignedBigInteger::operator>(const UnsignedBigInteger& other) const +bool UnsignedBigInteger::operator>(UnsignedBigInteger const& other) const { return *this != other && !(*this < other); } @@ -372,7 +372,7 @@ bool UnsignedBigInteger::operator>=(UnsignedBigInteger const& other) const } -ErrorOr<void> AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::UnsignedBigInteger& value) +ErrorOr<void> AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, Crypto::UnsignedBigInteger const& value) { if (value.is_invalid()) return Formatter<StringView>::format(fmtbuilder, "invalid"); diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index 36cb4c1707..4a2c4878d5 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -30,14 +30,14 @@ public: { } - explicit UnsignedBigInteger(const u8* ptr, size_t length); + explicit UnsignedBigInteger(u8 const* ptr, size_t length); UnsignedBigInteger() = default; static UnsignedBigInteger create_invalid(); - static UnsignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } - static UnsignedBigInteger import_data(const u8* ptr, size_t length) + static UnsignedBigInteger import_data(StringView data) { return import_data((u8 const*)data.characters_without_null_termination(), data.length()); } + static UnsignedBigInteger import_data(u8 const* ptr, size_t length) { return UnsignedBigInteger(ptr, length); } @@ -60,11 +60,11 @@ public: u64 to_u64() const; double to_double() const; - const Vector<Word, STARTING_WORD_SIZE>& words() const { return m_words; } + Vector<Word, STARTING_WORD_SIZE> const& words() const { return m_words; } void set_to_0(); void set_to(Word other); - void set_to(const UnsignedBigInteger& other); + void set_to(UnsignedBigInteger const& other); void invalidate() { @@ -86,24 +86,24 @@ public: size_t one_based_index_of_highest_set_bit() const; - UnsignedBigInteger plus(const UnsignedBigInteger& other) const; - UnsignedBigInteger minus(const UnsignedBigInteger& other) const; - UnsignedBigInteger bitwise_or(const UnsignedBigInteger& other) const; - UnsignedBigInteger bitwise_and(const UnsignedBigInteger& other) const; - UnsignedBigInteger bitwise_xor(const UnsignedBigInteger& other) const; + UnsignedBigInteger plus(UnsignedBigInteger const& other) const; + UnsignedBigInteger minus(UnsignedBigInteger const& other) const; + UnsignedBigInteger bitwise_or(UnsignedBigInteger const& other) const; + UnsignedBigInteger bitwise_and(UnsignedBigInteger const& other) const; + UnsignedBigInteger bitwise_xor(UnsignedBigInteger const& other) const; UnsignedBigInteger bitwise_not_fill_to_one_based_index(size_t) const; UnsignedBigInteger shift_left(size_t num_bits) const; - UnsignedBigInteger multiplied_by(const UnsignedBigInteger& other) const; - UnsignedDivisionResult divided_by(const UnsignedBigInteger& divisor) const; + UnsignedBigInteger multiplied_by(UnsignedBigInteger const& other) const; + UnsignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const; u32 hash() const; void set_bit_inplace(size_t bit_index); - bool operator==(const UnsignedBigInteger& other) const; - bool operator!=(const UnsignedBigInteger& other) const; - bool operator<(const UnsignedBigInteger& other) const; - bool operator>(const UnsignedBigInteger& other) const; + bool operator==(UnsignedBigInteger const& other) const; + bool operator!=(UnsignedBigInteger const& other) const; + bool operator<(UnsignedBigInteger const& other) const; + bool operator>(UnsignedBigInteger const& other) const; bool operator>=(UnsignedBigInteger const& other) const; private: @@ -133,7 +133,7 @@ struct AK::Formatter<Crypto::UnsignedBigInteger> : Formatter<StringView> { }; inline Crypto::UnsignedBigInteger -operator""_bigint(const char* string, size_t length) +operator""_bigint(char const* string, size_t length) { return Crypto::UnsignedBigInteger::from_base(10, { string, length }); } diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index 989134d456..b853599f88 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -197,13 +197,13 @@ void AESCipherKey::expand_decrypt_key(ReadonlyBytes user_key, size_t bits) } } -void AESCipher::encrypt_block(const AESCipherBlock& in, AESCipherBlock& out) +void AESCipher::encrypt_block(AESCipherBlock const& in, AESCipherBlock& out) { u32 s0, s1, s2, s3, t0, t1, t2, t3; size_t r { 0 }; - const auto& dec_key = key(); - const auto* round_keys = dec_key.round_keys(); + auto const& dec_key = key(); + auto const* round_keys = dec_key.round_keys(); s0 = get_key(in.bytes().offset_pointer(0)) ^ round_keys[0]; s1 = get_key(in.bytes().offset_pointer(4)) ^ round_keys[1]; @@ -289,13 +289,13 @@ void AESCipher::encrypt_block(const AESCipherBlock& in, AESCipherBlock& out) // clang-format on } -void AESCipher::decrypt_block(const AESCipherBlock& in, AESCipherBlock& out) +void AESCipher::decrypt_block(AESCipherBlock const& in, AESCipherBlock& out) { u32 s0, s1, s2, s3, t0, t1, t2, t3; size_t r { 0 }; - const auto& dec_key = key(); - const auto* round_keys = dec_key.round_keys(); + auto const& dec_key = key(); + auto const* round_keys = dec_key.round_keys(); s0 = get_key(in.bytes().offset_pointer(0)) ^ round_keys[0]; s1 = get_key(in.bytes().offset_pointer(4)) ^ round_keys[1]; diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.h b/Userland/Libraries/LibCrypto/Cipher/AES.h index dd92484d59..4aa94bf6dd 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.h +++ b/Userland/Libraries/LibCrypto/Cipher/AES.h @@ -28,7 +28,7 @@ public: : CipherBlock(mode) { } - AESCipherBlock(const u8* data, size_t length, PaddingMode mode = PaddingMode::CMS) + AESCipherBlock(u8 const* data, size_t length, PaddingMode mode = PaddingMode::CMS) : AESCipherBlock(mode) { CipherBlock::overwrite(data, length); @@ -40,7 +40,7 @@ public: virtual Bytes bytes() override { return Bytes { m_data, sizeof(m_data) }; } virtual void overwrite(ReadonlyBytes) override; - virtual void overwrite(const u8* data, size_t size) override { overwrite({ data, size }); } + virtual void overwrite(u8 const* data, size_t size) override { overwrite({ data, size }); } virtual void apply_initialization_vector(ReadonlyBytes ivec) override { @@ -68,9 +68,9 @@ struct AESCipherKey : public CipherKey { String to_string() const; #endif - const u32* round_keys() const + u32 const* round_keys() const { - return (const u32*)m_rd_keys; + return (u32 const*)m_rd_keys; } AESCipherKey(ReadonlyBytes user_key, size_t key_bits, Intent intent) @@ -114,11 +114,11 @@ public: { } - virtual const AESCipherKey& key() const override { return m_key; }; + virtual AESCipherKey const& key() const override { return m_key; }; virtual AESCipherKey& key() override { return m_key; }; - virtual void encrypt_block(const BlockType& in, BlockType& out) override; - virtual void decrypt_block(const BlockType& in, BlockType& out) override; + virtual void encrypt_block(BlockType const& in, BlockType& out) override; + virtual void decrypt_block(BlockType const& in, BlockType& out) override; #ifndef KERNEL virtual String class_name() const override diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index 88178a1f38..644dd1353a 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -43,7 +43,7 @@ public: virtual ReadonlyBytes bytes() const = 0; virtual void overwrite(ReadonlyBytes) = 0; - virtual void overwrite(const u8* data, size_t size) { overwrite({ data, size }); } + virtual void overwrite(u8 const* data, size_t size) { overwrite({ data, size }); } virtual void apply_initialization_vector(ReadonlyBytes ivec) = 0; @@ -102,15 +102,15 @@ public: { } - virtual const KeyType& key() const = 0; + virtual KeyType const& key() const = 0; virtual KeyType& key() = 0; constexpr static size_t block_size() { return BlockType::block_size(); } PaddingMode padding_mode() const { return m_padding_mode; } - virtual void encrypt_block(const BlockType& in, BlockType& out) = 0; - virtual void decrypt_block(const BlockType& in, BlockType& out) = 0; + virtual void encrypt_block(BlockType const& in, BlockType& out) = 0; + virtual void decrypt_block(BlockType const& in, BlockType& out) = 0; #ifndef KERNEL virtual String class_name() const = 0; diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h index 979ca281ed..3639282bf8 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h @@ -99,7 +99,7 @@ public: // FIXME: Add back the default intent parameter once clang-11 is the default in GitHub Actions. // Once added back, remove the parameter where it's constructed in get_random_bytes in Kernel/Random.h. template<typename KeyType, typename... Args> - explicit constexpr CTR(const KeyType& user_key, size_t key_bits, Intent, Args... args) + explicit constexpr CTR(KeyType const& user_key, size_t key_bits, Intent, Args... args) : Mode<T>(user_key, key_bits, Intent::Encryption, args...) { } @@ -126,7 +126,7 @@ public: this->encrypt_or_stream(&in, out, ivec, ivec_out); } - void key_stream(Bytes& out, const Bytes& ivec = {}, Bytes* ivec_out = nullptr) + void key_stream(Bytes& out, Bytes const& ivec = {}, Bytes* ivec_out = nullptr) { this->encrypt_or_stream(nullptr, out, ivec, ivec_out); } @@ -144,7 +144,7 @@ private: protected: constexpr static IncrementFunctionType increment {}; - void encrypt_or_stream(const ReadonlyBytes* in, Bytes& out, ReadonlyBytes ivec, Bytes* ivec_out = nullptr) + void encrypt_or_stream(ReadonlyBytes const* in, Bytes& out, ReadonlyBytes ivec, Bytes* ivec_out = nullptr) { size_t length; if (in) { diff --git a/Userland/Libraries/LibCrypto/Hash/HashFunction.h b/Userland/Libraries/LibCrypto/Hash/HashFunction.h index ff73aa6e61..3d875ff5db 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashFunction.h +++ b/Userland/Libraries/LibCrypto/Hash/HashFunction.h @@ -19,7 +19,7 @@ struct Digest { constexpr static size_t Size = DigestS / 8; u8 data[Size]; - [[nodiscard]] ALWAYS_INLINE const u8* immutable_data() const { return data; } + [[nodiscard]] ALWAYS_INLINE u8 const* immutable_data() const { return data; } [[nodiscard]] ALWAYS_INLINE size_t data_length() const { return Size; } [[nodiscard]] ALWAYS_INLINE ReadonlyBytes bytes() const { return { immutable_data(), data_length() }; } @@ -39,12 +39,12 @@ public: constexpr static size_t block_size() { return BlockSize; } constexpr static size_t digest_size() { return DigestSize; } - virtual void update(const u8*, size_t) = 0; + virtual void update(u8 const*, size_t) = 0; void update(Bytes buffer) { update(buffer.data(), buffer.size()); } void update(ReadonlyBytes buffer) { update(buffer.data(), buffer.size()); } - void update(const ByteBuffer& buffer) { update(buffer.data(), buffer.size()); } - void update(StringView string) { update((const u8*)string.characters_without_null_termination(), string.length()); } + void update(ByteBuffer const& buffer) { update(buffer.data(), buffer.size()); } + void update(StringView string) { update((u8 const*)string.characters_without_null_termination(), string.length()); } virtual DigestType peek() = 0; virtual DigestType digest() = 0; diff --git a/Userland/Libraries/LibCrypto/Hash/HashManager.h b/Userland/Libraries/LibCrypto/Hash/HashManager.h index 10628bc52c..834823bf5f 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashManager.h +++ b/Userland/Libraries/LibCrypto/Hash/HashManager.h @@ -59,25 +59,25 @@ struct MultiHashDigestVariant { { } - [[nodiscard]] const u8* immutable_data() const + [[nodiscard]] u8 const* immutable_data() const { return m_digest.visit( - [&](const Empty&) -> const u8* { VERIFY_NOT_REACHED(); }, - [&](const auto& value) { return value.immutable_data(); }); + [&](Empty const&) -> u8 const* { VERIFY_NOT_REACHED(); }, + [&](auto const& value) { return value.immutable_data(); }); } [[nodiscard]] size_t data_length() const { return m_digest.visit( - [&](const Empty&) -> size_t { VERIFY_NOT_REACHED(); }, - [&](const auto& value) { return value.data_length(); }); + [&](Empty const&) -> size_t { VERIFY_NOT_REACHED(); }, + [&](auto const& value) { return value.data_length(); }); } [[nodiscard]] ReadonlyBytes bytes() const { return m_digest.visit( - [&](const Empty&) -> ReadonlyBytes { VERIFY_NOT_REACHED(); }, - [&](const auto& value) { return value.bytes(); }); + [&](Empty const&) -> ReadonlyBytes { VERIFY_NOT_REACHED(); }, + [&](auto const& value) { return value.bytes(); }); } using DigestVariant = Variant<Empty, MD5::DigestType, SHA1::DigestType, SHA256::DigestType, SHA384::DigestType, SHA512::DigestType>; @@ -93,7 +93,7 @@ public: m_pre_init_buffer = ByteBuffer(); } - Manager(const Manager& other) // NOT a copy constructor! + Manager(Manager const& other) // NOT a copy constructor! { m_pre_init_buffer = ByteBuffer(); // will not be used initialize(other.m_kind); @@ -113,15 +113,15 @@ public: inline size_t digest_size() const { return m_algorithm.visit( - [&](const Empty&) -> size_t { return 0; }, - [&](const auto& hash) { return hash.digest_size(); }); + [&](Empty const&) -> size_t { return 0; }, + [&](auto const& hash) { return hash.digest_size(); }); } inline size_t block_size() const { return m_algorithm.visit( - [&](const Empty&) -> size_t { return 0; }, - [&](const auto& hash) { return hash.block_size(); }); + [&](Empty const&) -> size_t { return 0; }, + [&](auto const& hash) { return hash.block_size(); }); } inline void initialize(HashKind kind) @@ -154,7 +154,7 @@ public: } } - virtual void update(const u8* data, size_t length) override + virtual void update(u8 const* data, size_t length) override { auto size = m_pre_init_buffer.size(); if (size) { @@ -195,8 +195,8 @@ public: virtual String class_name() const override { return m_algorithm.visit( - [&](const Empty&) -> String { return "UninitializedHashManager"; }, - [&](const auto& hash) { return hash.class_name(); }); + [&](Empty const&) -> String { return "UninitializedHashManager"; }, + [&](auto const& hash) { return hash.class_name(); }); } #endif diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.cpp b/Userland/Libraries/LibCrypto/Hash/MD5.cpp index e698021cff..72cb516d0c 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.cpp +++ b/Userland/Libraries/LibCrypto/Hash/MD5.cpp @@ -48,7 +48,7 @@ static constexpr void round_4(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac) namespace Crypto { namespace Hash { -void MD5::update(const u8* input, size_t length) +void MD5::update(u8 const* input, size_t length) { auto index = (u32)(m_count[0] >> 3) & 0x3f; size_t offset { 0 }; @@ -101,7 +101,7 @@ MD5::DigestType MD5::peek() return digest; } -void MD5::encode(const u32* from, u8* to, size_t length) +void MD5::encode(u32 const* from, u8* to, size_t length) { for (size_t i = 0, j = 0; j < length; ++i, j += 4) { to[j] = (u8)(from[i] & 0xff); @@ -111,13 +111,13 @@ void MD5::encode(const u32* from, u8* to, size_t length) } } -void MD5::decode(const u8* from, u32* to, size_t length) +void MD5::decode(u8 const* from, u32* to, size_t length) { for (size_t i = 0, j = 0; j < length; ++i, j += 4) to[i] = (((u32)from[j]) | (((u32)from[j + 1]) << 8) | (((u32)from[j + 2]) << 16) | (((u32)from[j + 3]) << 24)); } -void MD5::transform(const u8* block) +void MD5::transform(u8 const* block) { auto a = m_A; auto b = m_B; diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.h b/Userland/Libraries/LibCrypto/Hash/MD5.h index 9c55b38b86..087ae022bd 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.h +++ b/Userland/Libraries/LibCrypto/Hash/MD5.h @@ -52,7 +52,7 @@ class MD5 final : public HashFunction<512, 128> { public: using HashFunction::update; - virtual void update(const u8*, size_t) override; + virtual void update(u8 const*, size_t) override; virtual DigestType digest() override; virtual DigestType peek() override; @@ -63,15 +63,15 @@ public: } #endif - inline static DigestType hash(const u8* data, size_t length) + inline static DigestType hash(u8 const* data, size_t length) { MD5 md5; md5.update(data, length); return md5.digest(); } - inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(ByteBuffer const& buffer) { return hash(buffer.data(), buffer.size()); } + inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); } inline virtual void reset() override { m_A = MD5Constants::init_A; @@ -86,10 +86,10 @@ public: } private: - inline void transform(const u8*); + inline void transform(u8 const*); - static void encode(const u32* from, u8* to, size_t length); - static void decode(const u8* from, u32* to, size_t length); + static void encode(u32 const* from, u8* to, size_t length); + static void decode(u8 const* from, u32* to, size_t length); u32 m_A { MD5Constants::init_A }, m_B { MD5Constants::init_B }, m_C { MD5Constants::init_C }, m_D { MD5Constants::init_D }; u32 m_count[2] { 0, 0 }; diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp index edb699d708..6202225a8b 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp @@ -17,11 +17,11 @@ static constexpr auto ROTATE_LEFT(u32 value, size_t bits) return (value << bits) | (value >> (32 - bits)); } -inline void SHA1::transform(const u8* data) +inline void SHA1::transform(u8 const* data) { u32 blocks[80]; for (size_t i = 0; i < 16; ++i) - blocks[i] = AK::convert_between_host_and_network_endian(((const u32*)data)[i]); + blocks[i] = AK::convert_between_host_and_network_endian(((u32 const*)data)[i]); // w[i] = (w[i-3] xor w[i-8] xor w[i-14] xor w[i-16]) leftrotate 1 for (size_t i = 16; i < Rounds; ++i) @@ -67,7 +67,7 @@ inline void SHA1::transform(const u8* data) secure_zero(blocks, 16 * sizeof(u32)); } -void SHA1::update(const u8* message, size_t length) +void SHA1::update(u8 const* message, size_t length) { for (size_t i = 0; i < length; ++i) { if (m_data_length == BlockSize) { diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.h b/Userland/Libraries/LibCrypto/Hash/SHA1.h index 8fcbfc7f56..200cc1f509 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.h @@ -37,20 +37,20 @@ public: reset(); } - virtual void update(const u8*, size_t) override; + virtual void update(u8 const*, size_t) override; virtual DigestType digest() override; virtual DigestType peek() override; - inline static DigestType hash(const u8* data, size_t length) + inline static DigestType hash(u8 const* data, size_t length) { SHA1 sha; sha.update(data, length); return sha.digest(); } - inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(ByteBuffer const& buffer) { return hash(buffer.data(), buffer.size()); } + inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); } #ifndef KERNEL virtual String class_name() const override @@ -68,7 +68,7 @@ public: } private: - inline void transform(const u8*); + inline void transform(u8 const*); u8 m_data_buffer[BlockSize] {}; size_t m_data_length { 0 }; diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp index 85a4a0dd87..6876e1e2b5 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp @@ -25,7 +25,7 @@ constexpr static auto EP1(u64 x) { return ROTRIGHT(x, 14) ^ ROTRIGHT(x, 18) ^ RO constexpr static auto SIGN0(u64 x) { return ROTRIGHT(x, 1) ^ ROTRIGHT(x, 8) ^ (x >> 7); } constexpr static auto SIGN1(u64 x) { return ROTRIGHT(x, 19) ^ ROTRIGHT(x, 61) ^ (x >> 6); } -inline void SHA256::transform(const u8* data) +inline void SHA256::transform(u8 const* data) { u32 m[64]; @@ -66,7 +66,7 @@ inline void SHA256::transform(const u8* data) m_state[7] += h; } -void SHA256::update(const u8* message, size_t length) +void SHA256::update(u8 const* message, size_t length) { for (size_t i = 0; i < length; ++i) { if (m_data_length == BlockSize) { @@ -142,7 +142,7 @@ SHA256::DigestType SHA256::peek() return digest; } -inline void SHA384::transform(const u8* data) +inline void SHA384::transform(u8 const* data) { u64 m[80]; @@ -184,7 +184,7 @@ inline void SHA384::transform(const u8* data) m_state[7] += h; } -void SHA384::update(const u8* message, size_t length) +void SHA384::update(u8 const* message, size_t length) { for (size_t i = 0; i < length; ++i) { if (m_data_length == BlockSize) { @@ -267,7 +267,7 @@ SHA384::DigestType SHA384::peek() return digest; } -inline void SHA512::transform(const u8* data) +inline void SHA512::transform(u8 const* data) { u64 m[80]; @@ -308,7 +308,7 @@ inline void SHA512::transform(const u8* data) m_state[7] += h; } -void SHA512::update(const u8* message, size_t length) +void SHA512::update(u8 const* message, size_t length) { for (size_t i = 0; i < length; ++i) { if (m_data_length == BlockSize) { diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.h b/Userland/Libraries/LibCrypto/Hash/SHA2.h index b9cb3315dd..9cc4433140 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.h @@ -85,20 +85,20 @@ public: reset(); } - virtual void update(const u8*, size_t) override; + virtual void update(u8 const*, size_t) override; virtual DigestType digest() override; virtual DigestType peek() override; - inline static DigestType hash(const u8* data, size_t length) + inline static DigestType hash(u8 const* data, size_t length) { SHA256 sha; sha.update(data, length); return sha.digest(); } - inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(ByteBuffer const& buffer) { return hash(buffer.data(), buffer.size()); } + inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); } #ifndef KERNEL virtual String class_name() const override @@ -116,7 +116,7 @@ public: } private: - inline void transform(const u8*); + inline void transform(u8 const*); u8 m_data_buffer[BlockSize] {}; size_t m_data_length { 0 }; @@ -137,20 +137,20 @@ public: reset(); } - virtual void update(const u8*, size_t) override; + virtual void update(u8 const*, size_t) override; virtual DigestType digest() override; virtual DigestType peek() override; - inline static DigestType hash(const u8* data, size_t length) + inline static DigestType hash(u8 const* data, size_t length) { SHA384 sha; sha.update(data, length); return sha.digest(); } - inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(ByteBuffer const& buffer) { return hash(buffer.data(), buffer.size()); } + inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); } #ifndef KERNEL virtual String class_name() const override @@ -168,7 +168,7 @@ public: } private: - inline void transform(const u8*); + inline void transform(u8 const*); u8 m_data_buffer[BlockSize] {}; size_t m_data_length { 0 }; @@ -189,20 +189,20 @@ public: reset(); } - virtual void update(const u8*, size_t) override; + virtual void update(u8 const*, size_t) override; virtual DigestType digest() override; virtual DigestType peek() override; - inline static DigestType hash(const u8* data, size_t length) + inline static DigestType hash(u8 const* data, size_t length) { SHA512 sha; sha.update(data, length); return sha.digest(); } - inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(ByteBuffer const& buffer) { return hash(buffer.data(), buffer.size()); } + inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); } #ifndef KERNEL virtual String class_name() const override @@ -220,7 +220,7 @@ public: } private: - inline void transform(const u8*); + inline void transform(u8 const*); u8 m_data_buffer[BlockSize] {}; size_t m_data_length { 0 }; diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp index 4aa33b015d..b44e6cac0c 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp @@ -11,7 +11,7 @@ namespace Crypto { namespace NumberTheory { -UnsignedBigInteger ModularInverse(const UnsignedBigInteger& a_, const UnsignedBigInteger& b) +UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b) { if (b == 1) return { 1 }; @@ -32,7 +32,7 @@ UnsignedBigInteger ModularInverse(const UnsignedBigInteger& a_, const UnsignedBi return result; } -UnsignedBigInteger ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& e, const UnsignedBigInteger& m) +UnsignedBigInteger ModularPower(UnsignedBigInteger const& b, UnsignedBigInteger const& e, UnsignedBigInteger const& m) { if (m == 1) return 0; @@ -68,7 +68,7 @@ UnsignedBigInteger ModularPower(const UnsignedBigInteger& b, const UnsignedBigIn return result; } -UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInteger& b) +UnsignedBigInteger GCD(UnsignedBigInteger const& a, UnsignedBigInteger const& b) { UnsignedBigInteger temp_a { a }; UnsignedBigInteger temp_b { b }; @@ -85,7 +85,7 @@ UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInteger& b) return output; } -UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) +UnsignedBigInteger LCM(UnsignedBigInteger const& a, UnsignedBigInteger const& b) { UnsignedBigInteger temp_a { a }; UnsignedBigInteger temp_b { b }; @@ -113,7 +113,7 @@ UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) return output; } -static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInteger, 256>& tests) +static bool MR_primality_test(UnsignedBigInteger n, Vector<UnsignedBigInteger, 256> const& tests) { // Written using Wikipedia: // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test @@ -158,7 +158,7 @@ static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInte return true; // "probably prime" } -UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBigInteger& max_excluded) +UnsignedBigInteger random_number(UnsignedBigInteger const& min, UnsignedBigInteger const& max_excluded) { VERIFY(min < max_excluded); auto range = max_excluded.minus(min); @@ -181,7 +181,7 @@ UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBi return divmod.remainder.plus(min); } -bool is_probably_prime(const UnsignedBigInteger& p) +bool is_probably_prime(UnsignedBigInteger const& p) { // Is it a small number? if (p < 49) { diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h index 3f6f04f0a0..b77d2c0db4 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h @@ -12,14 +12,14 @@ namespace Crypto { namespace NumberTheory { -UnsignedBigInteger ModularInverse(const UnsignedBigInteger& a_, const UnsignedBigInteger& b); -UnsignedBigInteger ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& e, const UnsignedBigInteger& m); +UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b); +UnsignedBigInteger ModularPower(UnsignedBigInteger const& b, UnsignedBigInteger const& e, UnsignedBigInteger const& m); // Note: This function _will_ generate extremely huge numbers, and in doing so, // it will allocate and free a lot of memory! // Please use |ModularPower| if your use-case is modexp. template<typename IntegerType> -static IntegerType Power(const IntegerType& b, const IntegerType& e) +static IntegerType Power(IntegerType const& b, IntegerType const& e) { IntegerType ep { e }; IntegerType base { b }; @@ -39,11 +39,11 @@ static IntegerType Power(const IntegerType& b, const IntegerType& e) return exp; } -UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInteger& b); -UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b); +UnsignedBigInteger GCD(UnsignedBigInteger const& a, UnsignedBigInteger const& b); +UnsignedBigInteger LCM(UnsignedBigInteger const& a, UnsignedBigInteger const& b); -UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBigInteger& max_excluded); -bool is_probably_prime(const UnsignedBigInteger& p); +UnsignedBigInteger random_number(UnsignedBigInteger const& min, UnsignedBigInteger const& max_excluded); +bool is_probably_prime(UnsignedBigInteger const& p); UnsignedBigInteger random_big_prime(size_t bits); } diff --git a/Userland/Libraries/LibCrypto/PK/Code/Code.h b/Userland/Libraries/LibCrypto/PK/Code/Code.h index 3300129ac7..6835c4d7b5 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/Code.h +++ b/Userland/Libraries/LibCrypto/PK/Code/Code.h @@ -24,7 +24,7 @@ public: virtual void encode(ReadonlyBytes in, ByteBuffer& out, size_t em_bits) = 0; virtual VerificationConsistency verify(ReadonlyBytes msg, ReadonlyBytes emsg, size_t em_bits) = 0; - const HashFunction& hasher() const { return m_hasher; } + HashFunction const& hasher() const { return m_hasher; } HashFunction& hasher() { return m_hasher; } protected: diff --git a/Userland/Libraries/LibCrypto/PK/RSA.cpp b/Userland/Libraries/LibCrypto/PK/RSA.cpp index 15f257fc29..bc532d5ffa 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.cpp +++ b/Userland/Libraries/LibCrypto/PK/RSA.cpp @@ -56,7 +56,7 @@ RSA::KeyPairType RSA::parse_rsa_key(ReadonlyBytes der) bool has_read_error = false; - const auto check_if_pkcs8_rsa_key = [&] { + auto const check_if_pkcs8_rsa_key = [&] { // see if it's a sequence: auto tag_result = decoder.peek(); if (tag_result.is_error()) { diff --git a/Userland/Libraries/LibCrypto/PK/RSA.h b/Userland/Libraries/LibCrypto/PK/RSA.h index 0134728093..9884ae0610 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.h +++ b/Userland/Libraries/LibCrypto/PK/RSA.h @@ -31,8 +31,8 @@ public: { } - const Integer& modulus() const { return m_modulus; } - const Integer& public_exponent() const { return m_public_exponent; } + Integer const& modulus() const { return m_modulus; } + Integer const& public_exponent() const { return m_public_exponent; } size_t length() const { return m_length; } void set_length(size_t length) { m_length = length; } @@ -62,9 +62,9 @@ public: RSAPrivateKey() = default; - const Integer& modulus() const { return m_modulus; } - const Integer& private_exponent() const { return m_private_exponent; } - const Integer& public_exponent() const { return m_public_exponent; } + Integer const& modulus() const { return m_modulus; } + Integer const& private_exponent() const { return m_private_exponent; } + Integer const& public_exponent() const { return m_public_exponent; } size_t length() const { return m_length; } void set_length(size_t length) { m_length = length; } @@ -135,7 +135,7 @@ public: { } - RSA(const ByteBuffer& publicKeyPEM, const ByteBuffer& privateKeyPEM) + RSA(ByteBuffer const& publicKeyPEM, ByteBuffer const& privateKeyPEM) { import_public_key(publicKeyPEM); import_private_key(privateKeyPEM); @@ -176,8 +176,8 @@ public: void import_public_key(ReadonlyBytes, bool pem = true); void import_private_key(ReadonlyBytes, bool pem = true); - const PrivateKeyType& private_key() const { return m_private_key; } - const PublicKeyType& public_key() const { return m_public_key; } + PrivateKeyType const& private_key() const { return m_private_key; } + PublicKeyType const& public_key() const { return m_public_key; } }; template<typename HashFunction> diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp index c0dc9b1905..6cf6a90cf1 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -142,7 +142,7 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source } Optional<SourcePositionAndAddress> result; - for (const auto& line_entry : m_sorted_lines) { + for (auto const& line_entry : m_sorted_lines) { if (!line_entry.file.ends_with(file_path)) continue; @@ -159,12 +159,12 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source return result; } -NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current_scope(const PtraceRegisters& regs) const +NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const { NonnullOwnPtrVector<DebugInfo::VariableInfo> variables; // TODO: We can store the scopes in a better data structure - for (const auto& scope : m_scopes) { + for (auto const& scope : m_scopes) { FlatPtr ip; #if ARCH(I386) ip = regs.eip; @@ -174,7 +174,7 @@ NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current if (ip - m_base_address < scope.address_low || ip - m_base_address >= scope.address_high) continue; - for (const auto& die_entry : scope.dies_of_variables) { + for (auto const& die_entry : scope.dies_of_variables) { auto variable_info = create_variable_info(die_entry, regs); if (!variable_info) continue; @@ -357,7 +357,7 @@ String DebugInfo::name_of_containing_function(FlatPtr address) const Optional<DebugInfo::VariablesScope> DebugInfo::get_containing_function(FlatPtr address) const { - for (const auto& scope : m_scopes) { + for (auto const& scope : m_scopes) { if (!scope.is_function || address < scope.address_low || address >= scope.address_high) continue; return scope; @@ -368,7 +368,7 @@ Optional<DebugInfo::VariablesScope> DebugInfo::get_containing_function(FlatPtr a Vector<DebugInfo::SourcePosition> DebugInfo::source_lines_in_scope(VariablesScope const& scope) const { Vector<DebugInfo::SourcePosition> source_lines; - for (const auto& line : m_sorted_lines) { + for (auto const& line : m_sorted_lines) { if (line.address < scope.address_low) continue; diff --git a/Userland/Libraries/LibDebug/DebugInfo.h b/Userland/Libraries/LibDebug/DebugInfo.h index 6a8d12b20d..43493c3313 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.h +++ b/Userland/Libraries/LibDebug/DebugInfo.h @@ -71,7 +71,7 @@ public: union { u32 as_u32; u32 as_i32; - const char* as_string; + char const* as_string; } constant_data { 0 }; Dwarf::EntryTag type_tag; @@ -107,22 +107,22 @@ public: FlatPtr address; }; - Optional<SourcePositionAndAddress> get_address_from_source_position(const String& file, size_t line) const; + Optional<SourcePositionAndAddress> get_address_from_source_position(String const& file, size_t line) const; String name_of_containing_function(FlatPtr address) const; - Vector<SourcePosition> source_lines_in_scope(const VariablesScope&) const; + Vector<SourcePosition> source_lines_in_scope(VariablesScope const&) const; Optional<VariablesScope> get_containing_function(FlatPtr address) const; private: void prepare_variable_scopes(); void prepare_lines(); - void parse_scopes_impl(const Dwarf::DIE& die); - OwnPtr<VariableInfo> create_variable_info(const Dwarf::DIE& variable_die, const PtraceRegisters&, u32 address_offset = 0) const; - static bool is_variable_tag_supported(const Dwarf::EntryTag& tag); - void add_type_info_to_variable(const Dwarf::DIE& type_die, const PtraceRegisters& regs, DebugInfo::VariableInfo* parent_variable) const; + void parse_scopes_impl(Dwarf::DIE const& die); + OwnPtr<VariableInfo> create_variable_info(Dwarf::DIE const& variable_die, PtraceRegisters const&, u32 address_offset = 0) const; + static bool is_variable_tag_supported(Dwarf::EntryTag const& tag); + void add_type_info_to_variable(Dwarf::DIE const& type_die, PtraceRegisters const& regs, DebugInfo::VariableInfo* parent_variable) const; - Optional<Dwarf::LineProgram::DirectoryAndFile> get_source_path_of_inline(const Dwarf::DIE&) const; - Optional<uint32_t> get_line_of_inline(const Dwarf::DIE&) const; + Optional<Dwarf::LineProgram::DirectoryAndFile> get_source_path_of_inline(Dwarf::DIE const&) const; + Optional<uint32_t> get_line_of_inline(Dwarf::DIE const&) const; ELF::Image const& m_elf; String m_source_root; diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp index f9d5515ed4..de990e6220 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -29,12 +29,12 @@ DebugSession::~DebugSession() if (m_is_debuggee_dead) return; - for (const auto& bp : m_breakpoints) { + for (auto const& bp : m_breakpoints) { disable_breakpoint(bp.key); } m_breakpoints.clear(); - for (const auto& wp : m_watchpoints) { + for (auto const& wp : m_watchpoints) { disable_watchpoint(wp.key); } m_watchpoints.clear(); @@ -46,8 +46,8 @@ DebugSession::~DebugSession() void DebugSession::for_each_loaded_library(Function<IterationDecision(LoadedLibrary const&)> func) const { - for (const auto& lib_name : m_loaded_libraries.keys()) { - const auto& lib = *m_loaded_libraries.get(lib_name).value(); + for (auto const& lib_name : m_loaded_libraries.keys()) { + auto const& lib = *m_loaded_libraries.get(lib_name).value(); if (func(lib) == IterationDecision::Break) break; } @@ -80,11 +80,11 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(String const& command, auto parts = command.split(' '); VERIFY(!parts.is_empty()); - const char** args = bit_cast<const char**>(calloc(parts.size() + 1, sizeof(const char*))); + char const** args = bit_cast<char const**>(calloc(parts.size() + 1, sizeof(char const*))); for (size_t i = 0; i < parts.size(); i++) { args[i] = parts[i].characters(); } - const char** envp = bit_cast<const char**>(calloc(2, sizeof(const char*))); + char const** envp = bit_cast<char const**>(calloc(2, sizeof(char const*))); // This causes loader to stop on a breakpoint before jumping to the entry point of the program. envp[0] = "_LOADER_BREAKPOINT=1"; int rc = execvpe(args[0], const_cast<char**>(args), const_cast<char**>(envp)); diff --git a/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h index 9343328abf..c46979c877 100644 --- a/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h +++ b/Userland/Libraries/LibDebug/Dwarf/AttributeValue.h @@ -36,7 +36,7 @@ public: FlatPtr as_addr() const; u64 as_unsigned() const { return m_data.as_unsigned; } i64 as_signed() const { return m_data.as_signed; } - const char* as_string() const; + char const* as_string() const; bool as_bool() const { return m_data.as_bool; } ReadonlyBytes as_raw_bytes() const { return m_data.as_raw_bytes; } @@ -46,7 +46,7 @@ private: FlatPtr as_addr; u64 as_unsigned; i64 as_signed; - const char* as_string; // points to bytes in the memory mapped elf image + char const* as_string; // points to bytes in the memory mapped elf image bool as_bool; ReadonlyBytes as_raw_bytes; } m_data {}; diff --git a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp index 4c1c271c5b..1577d98fd7 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp @@ -54,7 +54,7 @@ Optional<AttributeValue> DIE::get_attribute(Attribute const& attribute) const auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); VERIFY(abbreviation_info); - for (const auto& attribute_spec : abbreviation_info->attribute_specifications) { + for (auto const& attribute_spec : abbreviation_info->attribute_specifications) { auto value = m_compilation_unit.dwarf_info().get_attribute_value(attribute_spec.form, attribute_spec.value, stream, &m_compilation_unit); if (attribute_spec.attribute == attribute) { return value; diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 57b3991c10..23f7596019 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -77,7 +77,7 @@ void DwarfInfo::populate_compilation_units() } AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t implicit_const_value, - InputMemoryStream& debug_info_stream, const CompilationUnit* unit) const + InputMemoryStream& debug_info_stream, CompilationUnit const* unit) const { AttributeValue value; value.m_form = form; @@ -98,7 +98,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im value.m_type = AttributeValue::Type::String; auto strings_data = debug_strings_data(); - value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset)); + value.m_data.as_string = bit_cast<char const*>(strings_data.offset_pointer(offset)); break; } case AttributeDataForm::Data1: { @@ -199,7 +199,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im debug_info_stream >> str; VERIFY(!debug_info_stream.has_any_error()); value.m_type = AttributeValue::Type::String; - value.m_data.as_string = bit_cast<const char*>(debug_info_data().offset_pointer(str_offset)); + value.m_data.as_string = bit_cast<char const*>(debug_info_data().offset_pointer(str_offset)); break; } case AttributeDataForm::Block1: { @@ -241,7 +241,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im value.m_type = AttributeValue::Type::String; auto strings_data = debug_line_strings_data(); - value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset)); + value.m_data.as_string = bit_cast<char const*>(strings_data.offset_pointer(offset)); break; } case AttributeDataForm::ImplicitConst: { diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h index 3e9375801b..ac2ec7e2e5 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h @@ -39,7 +39,7 @@ public: void for_each_compilation_unit(Callback) const; AttributeValue get_attribute_value(AttributeDataForm form, ssize_t implicit_const_value, - InputMemoryStream& debug_info_stream, const CompilationUnit* unit = nullptr) const; + InputMemoryStream& debug_info_stream, CompilationUnit const* unit = nullptr) const; Optional<DIE> get_die_at_address(FlatPtr) const; @@ -89,7 +89,7 @@ private: template<typename Callback> void DwarfInfo::for_each_compilation_unit(Callback callback) const { - for (const auto& unit : m_compilation_units) { + for (auto const& unit : m_compilation_units) { callback(unit); } } diff --git a/Userland/Libraries/LibDebug/ProcessInspector.cpp b/Userland/Libraries/LibDebug/ProcessInspector.cpp index c006b2094f..bf07ff3dab 100644 --- a/Userland/Libraries/LibDebug/ProcessInspector.cpp +++ b/Userland/Libraries/LibDebug/ProcessInspector.cpp @@ -9,10 +9,10 @@ namespace Debug { -const LoadedLibrary* ProcessInspector::library_at(FlatPtr address) const +LoadedLibrary const* ProcessInspector::library_at(FlatPtr address) const { - const LoadedLibrary* result = nullptr; - for_each_loaded_library([&result, address](const auto& lib) { + LoadedLibrary const* result = nullptr; + for_each_loaded_library([&result, address](auto const& lib) { if (address >= lib.base_address && address < lib.base_address + lib.debug_info->elf().size()) { result = &lib; return IterationDecision::Break; diff --git a/Userland/Libraries/LibDebug/ProcessInspector.h b/Userland/Libraries/LibDebug/ProcessInspector.h index 315d3e520f..00672ae111 100644 --- a/Userland/Libraries/LibDebug/ProcessInspector.h +++ b/Userland/Libraries/LibDebug/ProcessInspector.h @@ -22,7 +22,7 @@ public: virtual void set_registers(PtraceRegisters const&) = 0; virtual void for_each_loaded_library(Function<IterationDecision(LoadedLibrary const&)>) const = 0; - const LoadedLibrary* library_at(FlatPtr address) const; + LoadedLibrary const* library_at(FlatPtr address) const; struct SymbolicationResult { String library_name; String symbol; diff --git a/Userland/Libraries/LibDesktop/AppFile.h b/Userland/Libraries/LibDesktop/AppFile.h index 98f3af6cf0..a9f10da6fa 100644 --- a/Userland/Libraries/LibDesktop/AppFile.h +++ b/Userland/Libraries/LibDesktop/AppFile.h @@ -15,7 +15,7 @@ namespace Desktop { class AppFile : public RefCounted<AppFile> { public: - static constexpr const char* APP_FILES_DIRECTORY = "/res/apps"; + static constexpr char const* APP_FILES_DIRECTORY = "/res/apps"; static NonnullRefPtr<AppFile> get_for_app(StringView app_name); static NonnullRefPtr<AppFile> open(StringView path); static void for_each(Function<void(NonnullRefPtr<AppFile>)>, StringView directory = APP_FILES_DIRECTORY); diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 62da78b5ac..fc32bb1951 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -14,7 +14,7 @@ namespace Desktop { -auto Launcher::Details::from_details_str(const String& details_str) -> NonnullRefPtr<Details> +auto Launcher::Details::from_details_str(String const& details_str) -> NonnullRefPtr<Details> { auto details = adopt_ref(*new Details); auto json = JsonValue::from_string(details_str).release_value_but_fixme_should_propagate_errors(); @@ -87,12 +87,12 @@ ErrorOr<void> Launcher::seal_allowlist() return {}; } -bool Launcher::open(const URL& url, const String& handler_name) +bool Launcher::open(const URL& url, String const& handler_name) { return connection().open_url(url, handler_name); } -bool Launcher::open(const URL& url, const Details& details) +bool Launcher::open(const URL& url, Details const& details) { VERIFY(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications return open(url, details.executable); diff --git a/Userland/Libraries/LibDesktop/Launcher.h b/Userland/Libraries/LibDesktop/Launcher.h index c62764a011..1a9229e0b1 100644 --- a/Userland/Libraries/LibDesktop/Launcher.h +++ b/Userland/Libraries/LibDesktop/Launcher.h @@ -28,7 +28,7 @@ public: String executable; LauncherType launcher_type { LauncherType::Default }; - static NonnullRefPtr<Details> from_details_str(const String&); + static NonnullRefPtr<Details> from_details_str(String const&); }; static void ensure_connection(); @@ -36,8 +36,8 @@ public: static ErrorOr<void> add_allowed_handler_with_any_url(String const& handler); static ErrorOr<void> add_allowed_handler_with_only_specific_urls(String const& handler, Vector<URL> const&); static ErrorOr<void> seal_allowlist(); - static bool open(const URL&, const String& handler_name = {}); - static bool open(const URL&, const Details& details); + static bool open(const URL&, String const& handler_name = {}); + static bool open(const URL&, Details const& details); static Vector<String> get_handlers_for_url(const URL&); static NonnullRefPtrVector<Details> get_handlers_with_details_for_url(const URL&); }; diff --git a/Userland/Libraries/LibDiff/Format.cpp b/Userland/Libraries/LibDiff/Format.cpp index ee28282183..1e1718ada0 100644 --- a/Userland/Libraries/LibDiff/Format.cpp +++ b/Userland/Libraries/LibDiff/Format.cpp @@ -10,12 +10,12 @@ #include <AK/Vector.h> namespace Diff { -String generate_only_additions(const String& text) +String generate_only_additions(String const& text) { auto lines = text.split('\n', true); // Keep empty StringBuilder builder; builder.appendff("@@ -0,0 +1,{} @@\n", lines.size()); - for (const auto& line : lines) { + for (auto const& line : lines) { builder.appendff("+{}\n", line); } return builder.to_string(); diff --git a/Userland/Libraries/LibDiff/Format.h b/Userland/Libraries/LibDiff/Format.h index e0570392ff..888b19555e 100644 --- a/Userland/Libraries/LibDiff/Format.h +++ b/Userland/Libraries/LibDiff/Format.h @@ -9,5 +9,5 @@ #include <AK/String.h> namespace Diff { -String generate_only_additions(const String&); +String generate_only_additions(String const&); }; diff --git a/Userland/Libraries/LibDiff/Hunks.cpp b/Userland/Libraries/LibDiff/Hunks.cpp index fe526045aa..babe53628c 100644 --- a/Userland/Libraries/LibDiff/Hunks.cpp +++ b/Userland/Libraries/LibDiff/Hunks.cpp @@ -8,7 +8,7 @@ #include <AK/Debug.h> namespace Diff { -Vector<Hunk> parse_hunks(const String& diff) +Vector<Hunk> parse_hunks(String const& diff) { Vector<String> diff_lines = diff.split('\n'); if (diff_lines.is_empty()) @@ -58,15 +58,15 @@ Vector<Hunk> parse_hunks(const String& diff) } if constexpr (HUNKS_DEBUG) { - for (const auto& hunk : hunks) { + for (auto const& hunk : hunks) { dbgln("Hunk location:"); dbgln(" orig: {}", hunk.original_start_line); dbgln(" target: {}", hunk.target_start_line); dbgln(" removed:"); - for (const auto& line : hunk.removed_lines) + for (auto const& line : hunk.removed_lines) dbgln("- {}", line); dbgln(" added:"); - for (const auto& line : hunk.added_lines) + for (auto const& line : hunk.added_lines) dbgln("+ {}", line); } } @@ -74,14 +74,14 @@ Vector<Hunk> parse_hunks(const String& diff) return hunks; } -HunkLocation parse_hunk_location(const String& location_line) +HunkLocation parse_hunk_location(String const& location_line) { size_t char_index = 0; struct StartAndLength { size_t start { 0 }; size_t length { 0 }; }; - auto parse_start_and_length_pair = [](const String& raw) { + auto parse_start_and_length_pair = [](String const& raw) { auto index_of_separator = raw.find(',').value(); auto start = raw.substring(0, index_of_separator).to_uint().value(); auto length = raw.substring(index_of_separator + 1, raw.length() - index_of_separator - 1).to_uint().value(); diff --git a/Userland/Libraries/LibDiff/Hunks.h b/Userland/Libraries/LibDiff/Hunks.h index dafd61bc1e..63050c12f0 100644 --- a/Userland/Libraries/LibDiff/Hunks.h +++ b/Userland/Libraries/LibDiff/Hunks.h @@ -32,6 +32,6 @@ struct Hunk { Vector<String> added_lines; }; -Vector<Hunk> parse_hunks(const String& diff); -HunkLocation parse_hunk_location(const String& location_line); +Vector<Hunk> parse_hunks(String const& diff); +HunkLocation parse_hunk_location(String const& location_line); }; diff --git a/Userland/Libraries/LibDl/dlfcn.cpp b/Userland/Libraries/LibDl/dlfcn.cpp index 077f62a101..ae1e18fe00 100644 --- a/Userland/Libraries/LibDl/dlfcn.cpp +++ b/Userland/Libraries/LibDl/dlfcn.cpp @@ -14,7 +14,7 @@ __thread char* s_dlerror_text = NULL; __thread bool s_dlerror_retrieved = false; -static void store_error(const String& error) +static void store_error(String const& error) { free(s_dlerror_text); s_dlerror_text = strdup(error.characters()); @@ -41,7 +41,7 @@ char* dlerror() return const_cast<char*>(s_dlerror_text); } -void* dlopen(const char* filename, int flags) +void* dlopen(char const* filename, int flags) { auto result = __dlopen(filename, flags); if (result.is_error()) { @@ -51,7 +51,7 @@ void* dlopen(const char* filename, int flags) return result.value(); } -void* dlsym(void* handle, const char* symbol_name) +void* dlsym(void* handle, char const* symbol_name) { auto result = __dlsym(handle, symbol_name); if (result.is_error()) { diff --git a/Userland/Libraries/LibDl/dlfcn.h b/Userland/Libraries/LibDl/dlfcn.h index b8ab808793..99f2c68e67 100644 --- a/Userland/Libraries/LibDl/dlfcn.h +++ b/Userland/Libraries/LibDl/dlfcn.h @@ -17,16 +17,16 @@ __BEGIN_DECLS #define RTLD_LOCAL 16 typedef struct __Dl_info { - const char* dli_fname; + char const* dli_fname; void* dli_fbase; - const char* dli_sname; + char const* dli_sname; void* dli_saddr; } Dl_info; int dlclose(void*); char* dlerror(void); -void* dlopen(const char*, int); -void* dlsym(void*, const char*); +void* dlopen(char const*, int); +void* dlsym(void*, char const*); int dladdr(void*, Dl_info*); __END_DECLS diff --git a/Userland/Libraries/LibDl/dlfcn_integration.h b/Userland/Libraries/LibDl/dlfcn_integration.h index aa4642d4f3..bf5a20ae60 100644 --- a/Userland/Libraries/LibDl/dlfcn_integration.h +++ b/Userland/Libraries/LibDl/dlfcn_integration.h @@ -28,8 +28,8 @@ struct __Dl_info; typedef struct __Dl_info Dl_info; typedef Result<void, DlErrorMessage> (*DlCloseFunction)(void*); -typedef Result<void*, DlErrorMessage> (*DlOpenFunction)(const char*, int); -typedef Result<void*, DlErrorMessage> (*DlSymFunction)(void*, const char*); +typedef Result<void*, DlErrorMessage> (*DlOpenFunction)(char const*, int); +typedef Result<void*, DlErrorMessage> (*DlSymFunction)(void*, char const*); typedef Result<void, DlErrorMessage> (*DlAddrFunction)(void*, Dl_info*); extern "C" { diff --git a/Userland/Libraries/LibEDID/EDID.cpp b/Userland/Libraries/LibEDID/EDID.cpp index 599df45a45..1c5a9ca772 100644 --- a/Userland/Libraries/LibEDID/EDID.cpp +++ b/Userland/Libraries/LibEDID/EDID.cpp @@ -319,7 +319,7 @@ T Parser::read_host(T const* field) const template<typename T> requires(IsIntegral<T> && sizeof(T) > 1) T Parser::read_le(T const* field) - const +const { static_assert(sizeof(T) > 1); return AK::convert_between_host_and_little_endian(read_host(field)); @@ -327,7 +327,7 @@ requires(IsIntegral<T> && sizeof(T) > 1) T Parser::read_le(T const* field) template<typename T> requires(IsIntegral<T> && sizeof(T) > 1) T Parser::read_be(T const* field) - const +const { static_assert(sizeof(T) > 1); return AK::convert_between_host_and_big_endian(read_host(field)); diff --git a/Userland/Libraries/LibEDID/EDID.h b/Userland/Libraries/LibEDID/EDID.h index 18ac90336f..b70b4b9b9b 100644 --- a/Userland/Libraries/LibEDID/EDID.h +++ b/Userland/Libraries/LibEDID/EDID.h @@ -438,11 +438,11 @@ private: template<typename T> requires(IsIntegral<T> && sizeof(T) > 1) T read_le(T const*) - const; + const; template<typename T> requires(IsIntegral<T> && sizeof(T) > 1) T read_be(T const*) - const; + const; Definitions::EDID const& raw_edid() const; ErrorOr<IterationDecision> for_each_display_descriptor(Function<IterationDecision(u8, Definitions::DisplayDescriptor const&)>) const; diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 66ce35adf3..b4d5033997 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -56,8 +56,8 @@ static bool s_do_breakpoint_trap_before_entry { false }; static StringView s_ld_library_path; static Result<void, DlErrorMessage> __dlclose(void* handle); -static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags); -static Result<void*, DlErrorMessage> __dlsym(void* handle, const char* symbol_name); +static Result<void*, DlErrorMessage> __dlopen(char const* filename, int flags); +static Result<void*, DlErrorMessage> __dlsym(void* handle, char const* symbol_name); static Result<void, DlErrorMessage> __dladdr(void* addr, Dl_info* info); Optional<DynamicObject::SymbolLookupResult> DynamicLinker::lookup_global_symbol(StringView name) @@ -84,7 +84,7 @@ static String get_library_name(String path) return LexicalPath::basename(move(path)); } -static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(const String& filename, int fd) +static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(String const& filename, int fd) { auto result = ELF::DynamicLoader::try_create(fd, filename); if (result.is_error()) { @@ -139,7 +139,7 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(String c return DlErrorMessage { String::formatted("Could not find required shared library: {}", name) }; } -static Vector<String> get_dependencies(const String& name) +static Vector<String> get_dependencies(String const& name) { auto lib = s_loaders.get(name).value(); Vector<String> dependencies; @@ -152,13 +152,13 @@ static Vector<String> get_dependencies(const String& name) return dependencies; } -static Result<void, DlErrorMessage> map_dependencies(const String& name) +static Result<void, DlErrorMessage> map_dependencies(String const& name) { dbgln_if(DYNAMIC_LOAD_DEBUG, "mapping dependencies for: {}", name); auto const& parent_object = (*s_loaders.get(name))->dynamic_object(); - for (const auto& needed_name : get_dependencies(name)) { + for (auto const& needed_name : get_dependencies(name)) { dbgln_if(DYNAMIC_LOAD_DEBUG, "needed library: {}", needed_name.characters()); String library_name = get_library_name(needed_name); @@ -180,7 +180,7 @@ static Result<void, DlErrorMessage> map_dependencies(const String& name) static void allocate_tls() { s_total_tls_size = 0; - for (const auto& data : s_loaders) { + for (auto const& data : s_loaders) { dbgln_if(DYNAMIC_LOAD_DEBUG, "{}: TLS Size: {}", data.key, data.value->tls_size_of_current_object()); s_total_tls_size += data.value->tls_size_of_current_object(); } @@ -198,7 +198,7 @@ static void allocate_tls() auto& initial_tls_data = initial_tls_data_result.value(); // Initialize TLS data - for (const auto& entry : s_loaders) { + for (auto const& entry : s_loaders) { entry.value->copy_initial_tls_data_into(initial_tls_data); } @@ -277,7 +277,7 @@ static void initialize_libc(DynamicObject& libc) } template<typename Callback> -static void for_each_unfinished_dependency_of(const String& name, HashTable<String>& seen_names, bool first, bool skip_global_objects, Callback callback) +static void for_each_unfinished_dependency_of(String const& name, HashTable<String>& seen_names, bool first, bool skip_global_objects, Callback callback) { if (!s_loaders.contains(name)) return; @@ -289,13 +289,13 @@ static void for_each_unfinished_dependency_of(const String& name, HashTable<Stri return; seen_names.set(name); - for (const auto& needed_name : get_dependencies(name)) + for (auto const& needed_name : get_dependencies(name)) for_each_unfinished_dependency_of(get_library_name(needed_name), seen_names, false, skip_global_objects, callback); callback(*s_loaders.get(name).value()); } -static NonnullRefPtrVector<DynamicLoader> collect_loaders_for_library(const String& name, bool skip_global_objects) +static NonnullRefPtrVector<DynamicLoader> collect_loaders_for_library(String const& name, bool skip_global_objects) { HashTable<String> seen_names; NonnullRefPtrVector<DynamicLoader> loaders; @@ -305,7 +305,7 @@ static NonnullRefPtrVector<DynamicLoader> collect_loaders_for_library(const Stri return loaders; } -static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(const String& name, int flags, bool skip_global_objects) +static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(String const& name, int flags, bool skip_global_objects) { auto main_library_loader = *s_loaders.get(name); auto main_library_object = main_library_loader->map(); @@ -333,7 +333,7 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(co if (loader.filename() == "libsystem.so"sv) { VERIFY(!loader.text_segments().is_empty()); - for (const auto& segment : loader.text_segments()) { + for (auto const& segment : loader.text_segments()) { if (syscall(SC_msyscall, segment.address().get())) { VERIFY_NOT_REACHED(); } @@ -367,7 +367,7 @@ static Result<void, DlErrorMessage> __dlclose(void* handle) return {}; } -static Optional<DlErrorMessage> verify_tls_for_dlopen(const DynamicLoader& loader) +static Optional<DlErrorMessage> verify_tls_for_dlopen(DynamicLoader const& loader) { if (loader.tls_size_of_current_object() == 0) return {}; @@ -396,7 +396,7 @@ static Optional<DlErrorMessage> verify_tls_for_dlopen(const DynamicLoader& loade return DlErrorMessage("Using dlopen() with libraries that have non-zeroed TLS is currently not supported"); } -static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags) +static Result<void*, DlErrorMessage> __dlopen(char const* filename, int flags) { // FIXME: RTLD_NOW and RTLD_LOCAL are not supported flags &= ~RTLD_NOW; @@ -451,7 +451,7 @@ static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags) return *object; } -static Result<void*, DlErrorMessage> __dlsym(void* handle, const char* symbol_name) +static Result<void*, DlErrorMessage> __dlsym(void* handle, char const* symbol_name) { dbgln_if(DYNAMIC_LOAD_DEBUG, "__dlsym: {}, {}", handle, symbol_name); diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index 2ea5e16df6..63bad18311 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -26,7 +26,7 @@ #include <unistd.h> #ifndef __serenity__ -static void* mmap_with_name(void* addr, size_t length, int prot, int flags, int fd, off_t offset, const char*) +static void* mmap_with_name(void* addr, size_t length, int prot, int flags, int fd, off_t offset, char const*) { return mmap(addr, length, prot, flags, fd, offset); } @@ -86,7 +86,7 @@ DynamicLoader::~DynamicLoader() } } -const DynamicObject& DynamicLoader::dynamic_object() const +DynamicObject const& DynamicLoader::dynamic_object() const { if (!m_cached_dynamic_object) { VirtualAddress dynamic_section_address; @@ -238,7 +238,7 @@ void DynamicLoader::load_stage_4() void DynamicLoader::do_lazy_relocations() { - for (const auto& relocation : m_unresolved_relocations) { + for (auto const& relocation : m_unresolved_relocations) { if (auto res = do_relocation(relocation, ShouldInitializeWeak::Yes); res != RelocationResult::Success) { dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name()); VERIFY_NOT_REACHED(); @@ -256,7 +256,7 @@ void DynamicLoader::load_program_headers() VirtualAddress dynamic_region_desired_vaddr; - m_elf_image.for_each_program_header([&](const Image::ProgramHeader& program_header) { + m_elf_image.for_each_program_header([&](Image::ProgramHeader const& program_header) { ProgramHeaderRegion region {}; region.set_program_header(program_header.raw_header()); if (region.is_tls_template()) { @@ -555,7 +555,7 @@ ssize_t DynamicLoader::negative_offset_from_tls_block_end(ssize_t tls_offset, si void DynamicLoader::copy_initial_tls_data_into(ByteBuffer& buffer) const { - const u8* tls_data = nullptr; + u8 const* tls_data = nullptr; size_t tls_size_in_image = 0; m_elf_image.for_each_program_header([this, &tls_data, &tls_size_in_image](ELF::Image::ProgramHeader program_header) { diff --git a/Userland/Libraries/LibELF/DynamicLoader.h b/Userland/Libraries/LibELF/DynamicLoader.h index 23ef8ff5c9..db3ab6cfba 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.h +++ b/Userland/Libraries/LibELF/DynamicLoader.h @@ -45,7 +45,7 @@ public: static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> try_create(int fd, String filename); ~DynamicLoader(); - const String& filename() const { return m_filename; } + String const& filename() const { return m_filename; } bool is_valid() const { return m_valid; } @@ -74,7 +74,7 @@ public: void for_each_needed_library(F) const; VirtualAddress base_address() const { return m_base_address; } - const Vector<LoadedSegment> text_segments() const { return m_text_segments; } + Vector<LoadedSegment> const text_segments() const { return m_text_segments; } bool is_dynamic() const { return m_elf_image.is_dynamic(); } static Optional<DynamicObject::SymbolLookupResult> lookup_symbol(const ELF::DynamicObject::Symbol&); @@ -129,7 +129,7 @@ private: Success = 1, ResolveLater = 2, }; - RelocationResult do_relocation(const DynamicObject::Relocation&, ShouldInitializeWeak should_initialize_weak); + RelocationResult do_relocation(DynamicObject::Relocation const&, ShouldInitializeWeak should_initialize_weak); void do_relr_relocations(); size_t calculate_tls_size() const; ssize_t negative_offset_from_tls_block_end(ssize_t tls_offset, size_t value_of_symbol) const; diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index 22ec378e7d..ad1e5b1c4f 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -16,7 +16,7 @@ namespace ELF { -DynamicObject::DynamicObject(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address) +DynamicObject::DynamicObject(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address) : m_filename(filename) , m_base_address(base_address) , m_dynamic_address(dynamic_section_address) @@ -44,7 +44,7 @@ void DynamicObject::dump() const builder.append("\nd_tag tag_name value\n"); size_t num_dynamic_sections = 0; - for_each_dynamic_entry([&](const DynamicObject::DynamicEntry& entry) { + for_each_dynamic_entry([&](DynamicObject::DynamicEntry const& entry) { String name_field = String::formatted("({})", name_for_dtag(entry.tag())); builder.appendff("{:#08x} {:17} {:#08x}\n", entry.tag(), name_field, entry.val()); num_dynamic_sections++; @@ -64,7 +64,7 @@ void DynamicObject::dump() const void DynamicObject::parse() { - for_each_dynamic_entry([&](const DynamicEntry& entry) { + for_each_dynamic_entry([&](DynamicEntry const& entry) { switch (entry.tag()) { case DT_INIT: m_init_offset = entry.ptr() - m_elf_base_address.get(); @@ -294,7 +294,7 @@ auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_val using BloomWord = FlatPtr; constexpr size_t bloom_word_size = sizeof(BloomWord) * 8; - const u32* hash_table_begin = (u32*)address().as_ptr(); + u32 const* hash_table_begin = (u32*)address().as_ptr(); const size_t num_buckets = hash_table_begin[0]; const size_t num_omitted_symbols = hash_table_begin[1]; @@ -303,9 +303,9 @@ auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_val const u32 num_maskwords_bitmask = num_maskwords - 1; const u32 shift2 = hash_table_begin[3]; - const BloomWord* bloom_words = (BloomWord const*)&hash_table_begin[4]; - const u32* const buckets = (u32 const*)&bloom_words[num_maskwords]; - const u32* const chains = &buckets[num_buckets]; + BloomWord const* bloom_words = (BloomWord const*)&hash_table_begin[4]; + u32 const* const buckets = (u32 const*)&bloom_words[num_maskwords]; + u32 const* const chains = &buckets[num_buckets]; BloomWord hash1 = hash_value; BloomWord hash2 = hash1 >> shift2; @@ -317,7 +317,7 @@ auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_val size_t current_sym = buckets[hash1 % num_buckets]; if (current_sym == 0) return {}; - const u32* current_chain = &chains[current_sym - num_omitted_symbols]; + u32 const* current_chain = &chains[current_sym - num_omitted_symbols]; for (hash1 &= ~1;; ++current_sym) { hash2 = *(current_chain++); @@ -336,12 +336,12 @@ auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_val StringView DynamicObject::symbol_string_table_string(ElfW(Word) index) const { - return StringView { (const char*)base_address().offset(m_string_table_offset + index).as_ptr() }; + return StringView { (char const*)base_address().offset(m_string_table_offset + index).as_ptr() }; } -const char* DynamicObject::raw_symbol_string_table_string(ElfW(Word) index) const +char const* DynamicObject::raw_symbol_string_table_string(ElfW(Word) index) const { - return (const char*)base_address().offset(m_string_table_offset + index).as_ptr(); + return (char const*)base_address().offset(m_string_table_offset + index).as_ptr(); } DynamicObject::InitializationFunction DynamicObject::init_section_function() const @@ -350,7 +350,7 @@ DynamicObject::InitializationFunction DynamicObject::init_section_function() con return (InitializationFunction)init_section().address().as_ptr(); } -const char* DynamicObject::name_for_dtag(ElfW(Sword) d_tag) +char const* DynamicObject::name_for_dtag(ElfW(Sword) d_tag) { switch (d_tag) { case DT_NULL: @@ -463,7 +463,7 @@ auto DynamicObject::lookup_symbol(StringView name) const -> Optional<SymbolLooku return lookup_symbol(HashSymbol { name }); } -auto DynamicObject::lookup_symbol(const HashSymbol& symbol) const -> Optional<SymbolLookupResult> +auto DynamicObject::lookup_symbol(HashSymbol const& symbol) const -> Optional<SymbolLookupResult> { auto result = hash_section().lookup_symbol(symbol); if (!result.has_value()) @@ -474,7 +474,7 @@ auto DynamicObject::lookup_symbol(const HashSymbol& symbol) const -> Optional<Sy return SymbolLookupResult { symbol_result.value(), symbol_result.size(), symbol_result.address(), symbol_result.bind(), this }; } -NonnullRefPtr<DynamicObject> DynamicObject::create(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address) +NonnullRefPtr<DynamicObject> DynamicObject::create(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address) { return adopt_ref(*new DynamicObject(filename, base_address, dynamic_section_address)); } diff --git a/Userland/Libraries/LibELF/DynamicObject.h b/Userland/Libraries/LibELF/DynamicObject.h index 19c277977c..6161a6c568 100644 --- a/Userland/Libraries/LibELF/DynamicObject.h +++ b/Userland/Libraries/LibELF/DynamicObject.h @@ -20,8 +20,8 @@ namespace ELF { class DynamicObject : public RefCounted<DynamicObject> { public: - static NonnullRefPtr<DynamicObject> create(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address); - static const char* name_for_dtag(ElfW(Sword) d_tag); + static NonnullRefPtr<DynamicObject> create(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address); + static char const* name_for_dtag(ElfW(Sword) d_tag); ~DynamicObject(); void dump() const; @@ -52,7 +52,7 @@ public: class Symbol { public: - Symbol(const DynamicObject& dynamic, unsigned index, const ElfW(Sym) & sym) + Symbol(DynamicObject const& dynamic, unsigned index, const ElfW(Sym) & sym) : m_dynamic(dynamic) , m_sym(sym) , m_index(index) @@ -60,7 +60,7 @@ public: } StringView name() const { return m_dynamic.symbol_string_table_string(m_sym.st_name); } - const char* raw_name() const { return m_dynamic.raw_symbol_string_table_string(m_sym.st_name); } + char const* raw_name() const { return m_dynamic.raw_symbol_string_table_string(m_sym.st_name); } unsigned section_index() const { return m_sym.st_shndx; } FlatPtr value() const { return m_sym.st_value; } size_t size() const { return m_sym.st_size; } @@ -90,17 +90,17 @@ public: return m_dynamic.base_address().offset(value()); return VirtualAddress { value() }; } - const DynamicObject& object() const { return m_dynamic; } + DynamicObject const& object() const { return m_dynamic; } private: - const DynamicObject& m_dynamic; + DynamicObject const& m_dynamic; const ElfW(Sym) & m_sym; - const unsigned m_index; + unsigned const m_index; }; class Section { public: - Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name) + Section(DynamicObject const& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name) : m_dynamic(dynamic) , m_section_offset(section_offset) , m_section_size_bytes(section_size_bytes) @@ -126,7 +126,7 @@ public: protected: friend class RelocationSection; friend class HashSection; - const DynamicObject& m_dynamic; + DynamicObject const& m_dynamic; unsigned m_section_offset; unsigned m_section_size_bytes; unsigned m_entry_size; @@ -135,7 +135,7 @@ public: class RelocationSection : public Section { public: - explicit RelocationSection(const Section& section, bool addend_used) + explicit RelocationSection(Section const& section, bool addend_used) : Section(section.m_dynamic, section.m_section_offset, section.m_section_size_bytes, section.m_entry_size, section.m_name) , m_addend_used(addend_used) { @@ -150,12 +150,12 @@ public: void for_each_relocation(F func) const; private: - const bool m_addend_used; + bool const m_addend_used; }; class Relocation { public: - Relocation(const DynamicObject& dynamic, const ElfW(Rela) & rel, unsigned offset_in_section, bool addend_used) + Relocation(DynamicObject const& dynamic, const ElfW(Rela) & rel, unsigned offset_in_section, bool addend_used) : m_dynamic(dynamic) , m_rel(rel) , m_offset_in_section(offset_in_section) @@ -200,10 +200,10 @@ public: [[nodiscard]] DynamicObject const& dynamic_object() const { return m_dynamic; } private: - const DynamicObject& m_dynamic; + DynamicObject const& m_dynamic; const ElfW(Rela) & m_rel; - const unsigned m_offset_in_section; - const bool m_addend_used; + unsigned const m_offset_in_section; + bool const m_addend_used; }; enum class HashType { @@ -230,13 +230,13 @@ public: class HashSection : public Section { public: - HashSection(const Section& section, HashType hash_type) + HashSection(Section const& section, HashType hash_type) : Section(section.m_dynamic, section.m_section_offset, section.m_section_size_bytes, section.m_entry_size, section.m_name) , m_hash_type(hash_type) { } - Optional<Symbol> lookup_symbol(const HashSymbol& symbol) const + Optional<Symbol> lookup_symbol(HashSymbol const& symbol) const { if (m_hash_type == HashType::SYSV) return lookup_sysv_symbol(symbol.name(), symbol.sysv_hash()); @@ -286,7 +286,7 @@ public: VirtualAddress plt_got_base_address() const { return m_base_address.offset(m_procedure_linkage_table_offset.value()); } VirtualAddress base_address() const { return m_base_address; } - const String& filename() const { return m_filename; } + String const& filename() const { return m_filename; } StringView rpath() const { return m_has_rpath ? symbol_string_table_string(m_rpath_index) : StringView {}; } StringView runpath() const { return m_has_runpath ? symbol_string_table_string(m_runpath_index) : StringView {}; } @@ -326,7 +326,7 @@ public: }; Optional<SymbolLookupResult> lookup_symbol(StringView name) const; - Optional<SymbolLookupResult> lookup_symbol(const HashSymbol& symbol) const; + Optional<SymbolLookupResult> lookup_symbol(HashSymbol const& symbol) const; // Will be called from _fixup_plt_entry, as part of the PLT trampoline VirtualAddress patch_plt_entry(u32 relocation_offset); @@ -336,10 +336,10 @@ public: void* symbol_for_name(StringView name); private: - explicit DynamicObject(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address); + explicit DynamicObject(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address); StringView symbol_string_table_string(ElfW(Word)) const; - const char* raw_symbol_string_table_string(ElfW(Word)) const; + char const* raw_symbol_string_table_string(ElfW(Word)) const; void parse(); String m_filename; @@ -403,7 +403,7 @@ template<IteratorFunction<DynamicObject::Relocation&> F> inline void DynamicObject::RelocationSection::for_each_relocation(F func) const { for (unsigned i = 0; i < relocation_count(); ++i) { - const auto reloc = relocation(i); + auto const reloc = relocation(i); if (reloc.type() == 0) continue; if (func(reloc) == IterationDecision::Break) diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp index e8e9a6f568..694a7721f3 100644 --- a/Userland/Libraries/LibELF/Image.cpp +++ b/Userland/Libraries/LibELF/Image.cpp @@ -26,7 +26,7 @@ Image::Image(ReadonlyBytes bytes, bool verbose_logging) parse(); } -Image::Image(const u8* buffer, size_t size, bool verbose_logging) +Image::Image(u8 const* buffer, size_t size, bool verbose_logging) : Image(ReadonlyBytes { buffer, size }, verbose_logging) { } @@ -69,7 +69,7 @@ void Image::dump() const dbgln(" phnum: {}", header().e_phnum); dbgln(" shstrndx: {}", header().e_shstrndx); - for_each_program_header([&](const ProgramHeader& program_header) { + for_each_program_header([&](ProgramHeader const& program_header) { dbgln(" Program Header {}: {{", program_header.index()); dbgln(" type: {:x}", program_header.type()); dbgln(" offset: {:x}", program_header.offset()); @@ -78,7 +78,7 @@ void Image::dump() const }); for (unsigned i = 0; i < header().e_shnum; ++i) { - const auto& section = this->section(i); + auto const& section = this->section(i); dbgln(" Section {}: {{", i); dbgln(" name: {}", section.name()); dbgln(" type: {:x}", section.type()); @@ -90,7 +90,7 @@ void Image::dump() const dbgln("Symbol count: {} (table is {})", symbol_count(), m_symbol_table_section_index); for (unsigned i = 1; i < symbol_count(); ++i) { - const auto& sym = symbol(i); + auto const& sym = symbol(i); dbgln("Symbol @{}:", i); dbgln(" Name: {}", sym.name()); dbgln(" In section: {}", section_index_to_string(sym.section_index())); @@ -187,10 +187,10 @@ StringView Image::table_string(unsigned offset) const return table_string(m_string_table_section_index, offset); } -const char* Image::raw_data(unsigned offset) const +char const* Image::raw_data(unsigned offset) const { VERIFY(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds. - return reinterpret_cast<const char*>(m_buffer) + offset; + return reinterpret_cast<char const*>(m_buffer) + offset; } const ElfW(Ehdr) & Image::header() const @@ -361,7 +361,7 @@ StringView Image::Symbol::raw_data() const Optional<Image::Symbol> Image::find_demangled_function(StringView name) const { Optional<Image::Symbol> found; - for_each_symbol([&](const Image::Symbol& symbol) { + for_each_symbol([&](Image::Symbol const& symbol) { if (symbol.type() != STT_FUNC) return IterationDecision::Continue; if (symbol.is_undefined()) @@ -416,7 +416,7 @@ Optional<Image::Symbol> Image::find_symbol(FlatPtr address, u32* out_offset) con NEVER_INLINE void Image::sort_symbols() const { m_sorted_symbols.ensure_capacity(symbol_count()); - for_each_symbol([this](const auto& symbol) { + for_each_symbol([this](auto const& symbol) { m_sorted_symbols.append({ symbol.value(), symbol.name(), {}, symbol }); }); quick_sort(m_sorted_symbols, [](auto& a, auto& b) { diff --git a/Userland/Libraries/LibELF/Image.h b/Userland/Libraries/LibELF/Image.h index 7811463cc5..7af308a810 100644 --- a/Userland/Libraries/LibELF/Image.h +++ b/Userland/Libraries/LibELF/Image.h @@ -21,18 +21,18 @@ namespace ELF { class Image { public: explicit Image(ReadonlyBytes, bool verbose_logging = true); - explicit Image(const u8*, size_t, bool verbose_logging = true); + explicit Image(u8 const*, size_t, bool verbose_logging = true); ~Image() = default; void dump() const; bool is_valid() const { return m_valid; } bool parse(); - bool is_within_image(const void* address, size_t size) const + bool is_within_image(void const* address, size_t size) const { if (address < m_buffer) return false; - if (((const u8*)address + size) > m_buffer + m_size) + if (((u8 const*)address + size) > m_buffer + m_size) return false; return true; } @@ -44,7 +44,7 @@ public: class Symbol { public: - Symbol(const Image& image, unsigned index, const ElfW(Sym) & sym) + Symbol(Image const& image, unsigned index, const ElfW(Sym) & sym) : m_image(image) , m_sym(sym) , m_index(index) @@ -79,14 +79,14 @@ public: StringView raw_data() const; private: - const Image& m_image; + Image const& m_image; const ElfW(Sym) & m_sym; - const unsigned m_index; + unsigned const m_index; }; class ProgramHeader { public: - ProgramHeader(const Image& image, unsigned program_header_index) + ProgramHeader(Image const& image, unsigned program_header_index) : m_image(image) , m_program_header(image.program_header_internal(program_header_index)) , m_program_header_index(program_header_index) @@ -105,18 +105,18 @@ public: bool is_readable() const { return flags() & PF_R; } bool is_writable() const { return flags() & PF_W; } bool is_executable() const { return flags() & PF_X; } - const char* raw_data() const { return m_image.raw_data(m_program_header.p_offset); } + char const* raw_data() const { return m_image.raw_data(m_program_header.p_offset); } ElfW(Phdr) raw_header() const { return m_program_header; } private: - const Image& m_image; + Image const& m_image; const ElfW(Phdr) & m_program_header; unsigned m_program_header_index { 0 }; }; class Section { public: - Section(const Image& image, unsigned sectionIndex) + Section(Image const& image, unsigned sectionIndex) : m_image(image) , m_section_header(image.section_header(sectionIndex)) , m_section_index(sectionIndex) @@ -131,7 +131,7 @@ public: size_t entry_size() const { return m_section_header.sh_entsize; } size_t entry_count() const { return !entry_size() ? 0 : size() / entry_size(); } FlatPtr address() const { return m_section_header.sh_addr; } - const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); } + char const* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); } ReadonlyBytes bytes() const { return { raw_data(), size() }; } Optional<RelocationSection> relocations() const; auto flags() const { return m_section_header.sh_flags; } @@ -140,14 +140,14 @@ public: protected: friend class RelocationSection; - const Image& m_image; + Image const& m_image; const ElfW(Shdr) & m_section_header; unsigned m_section_index; }; class RelocationSection : public Section { public: - explicit RelocationSection(const Section& section) + explicit RelocationSection(Section const& section) : Section(section.m_image, section.m_section_index) { } @@ -160,7 +160,7 @@ public: class Relocation { public: - Relocation(const Image& image, const ElfW(Rel) & rel) + Relocation(Image const& image, const ElfW(Rel) & rel) : m_image(image) , m_rel(rel) { @@ -188,7 +188,7 @@ public: } private: - const Image& m_image; + Image const& m_image; const ElfW(Rel) & m_rel; }; @@ -243,7 +243,7 @@ public: Optional<Image::Symbol> find_symbol(FlatPtr address, u32* offset = nullptr) const; private: - const char* raw_data(unsigned offset) const; + char const* raw_data(unsigned offset) const; const ElfW(Ehdr) & header() const; const ElfW(Shdr) & section_header(unsigned) const; const ElfW(Phdr) & program_header_internal(unsigned) const; @@ -252,7 +252,7 @@ private: StringView section_index_to_string(unsigned index) const; StringView table_string(unsigned table_index, unsigned offset) const; - const u8* m_buffer { nullptr }; + u8 const* m_buffer { nullptr }; size_t m_size { 0 }; bool m_verbose_logging { true }; bool m_valid { false }; diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index ce37953258..696ae07cce 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -484,26 +484,26 @@ GLAPI void glClearStencil(GLint s); GLAPI void glColor3d(GLdouble r, GLdouble g, GLdouble b); GLAPI void glColor3dv(GLdouble const* v); GLAPI void glColor3f(GLfloat r, GLfloat g, GLfloat b); -GLAPI void glColor3fv(const GLfloat* v); +GLAPI void glColor3fv(GLfloat const* v); GLAPI void glColor3ub(GLubyte r, GLubyte g, GLubyte b); GLAPI void glColor3ubv(GLubyte const* v); GLAPI void glColor4b(GLbyte r, GLbyte g, GLbyte b, GLbyte a); GLAPI void glColor4dv(GLdouble const* v); GLAPI void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); -GLAPI void glColor4fv(const GLfloat* v); +GLAPI void glColor4fv(GLfloat const* v); GLAPI void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a); -GLAPI void glColor4ubv(const GLubyte* v); +GLAPI void glColor4ubv(GLubyte const* v); GLAPI void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); GLAPI void glColorMaterial(GLenum face, GLenum mode); -GLAPI void glDeleteTextures(GLsizei n, const GLuint* textures); +GLAPI void glDeleteTextures(GLsizei n, GLuint const* textures); GLAPI void glEnd(); GLAPI void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal); GLAPI void glGenTextures(GLsizei n, GLuint* textures); GLAPI GLenum glGetError(); GLAPI GLubyte* glGetString(GLenum name); GLAPI void glLoadIdentity(); -GLAPI void glLoadMatrixd(const GLdouble* matrix); -GLAPI void glLoadMatrixf(const GLfloat* matrix); +GLAPI void glLoadMatrixd(GLdouble const* matrix); +GLAPI void glLoadMatrixf(GLfloat const* matrix); GLAPI void glMatrixMode(GLenum mode); GLAPI void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal); GLAPI void glPushMatrix(); @@ -517,29 +517,29 @@ GLAPI void glScalef(GLfloat x, GLfloat y, GLfloat z); GLAPI void glTranslated(GLdouble x, GLdouble y, GLdouble z); GLAPI void glTranslatef(GLfloat x, GLfloat y, GLfloat z); GLAPI void glVertex2d(GLdouble x, GLdouble y); -GLAPI void glVertex2dv(const GLdouble* v); +GLAPI void glVertex2dv(GLdouble const* v); GLAPI void glVertex2f(GLfloat x, GLfloat y); -GLAPI void glVertex2fv(const GLfloat* v); +GLAPI void glVertex2fv(GLfloat const* v); GLAPI void glVertex2i(GLint x, GLint y); -GLAPI void glVertex2iv(const GLint* v); +GLAPI void glVertex2iv(GLint const* v); GLAPI void glVertex2s(GLshort x, GLshort y); -GLAPI void glVertex2sv(const GLshort* v); +GLAPI void glVertex2sv(GLshort const* v); GLAPI void glVertex3d(GLdouble x, GLdouble y, GLdouble z); -GLAPI void glVertex3dv(const GLdouble* v); +GLAPI void glVertex3dv(GLdouble const* v); GLAPI void glVertex3f(GLfloat x, GLfloat y, GLfloat z); -GLAPI void glVertex3fv(const GLfloat* v); +GLAPI void glVertex3fv(GLfloat const* v); GLAPI void glVertex3i(GLint x, GLint y, GLint z); -GLAPI void glVertex3iv(const GLint* v); +GLAPI void glVertex3iv(GLint const* v); GLAPI void glVertex3s(GLshort x, GLshort y, GLshort z); -GLAPI void glVertex3sv(const GLshort* v); +GLAPI void glVertex3sv(GLshort const* v); GLAPI void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void glVertex4dv(const GLdouble* v); +GLAPI void glVertex4dv(GLdouble const* v); GLAPI void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void glVertex4fv(const GLfloat* v); +GLAPI void glVertex4fv(GLfloat const* v); GLAPI void glVertex4i(GLint x, GLint y, GLint z, GLint w); -GLAPI void glVertex4iv(const GLint* v); +GLAPI void glVertex4iv(GLint const* v); GLAPI void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void glVertex4sv(const GLshort* v); +GLAPI void glVertex4sv(GLshort const* v); GLAPI void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void glEnable(GLenum cap); GLAPI void glDisable(GLenum cap); @@ -566,7 +566,7 @@ GLAPI void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum GLAPI void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data); GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data); GLAPI void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data); -GLAPI void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data); +GLAPI void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data); GLAPI void glTexCoord1f(GLfloat s); GLAPI void glTexCoord1fv(GLfloat const* v); GLAPI void glTexCoord2d(GLdouble s, GLdouble t); @@ -577,7 +577,7 @@ GLAPI void glTexCoord2i(GLint s, GLint t); GLAPI void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r); GLAPI void glTexCoord3fv(GLfloat const* v); GLAPI void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void glTexCoord4fv(const GLfloat* v); +GLAPI void glTexCoord4fv(GLfloat const* v); GLAPI void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); GLAPI void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t); GLAPI void glTexParameteri(GLenum target, GLenum pname, GLint param); @@ -602,12 +602,12 @@ GLAPI void glDisableClientState(GLenum cap); GLAPI void glClientActiveTextureARB(GLenum target); GLAPI void glClientActiveTexture(GLenum target); -GLAPI void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); -GLAPI void glColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); -GLAPI void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); +GLAPI void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer); +GLAPI void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer); +GLAPI void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer); GLAPI void glDrawArrays(GLenum mode, GLint first, GLsizei count); -GLAPI void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices); -GLAPI void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void* data); +GLAPI void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices); +GLAPI void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data); GLAPI void glDepthRange(GLdouble nearVal, GLdouble farVal); GLAPI void glDepthFunc(GLenum func); GLAPI void glPolygonMode(GLenum face, GLenum mode); diff --git a/Userland/Libraries/LibGL/GLColor.cpp b/Userland/Libraries/LibGL/GLColor.cpp index a3b50c3fc1..4eb277c919 100644 --- a/Userland/Libraries/LibGL/GLColor.cpp +++ b/Userland/Libraries/LibGL/GLColor.cpp @@ -26,7 +26,7 @@ void glColor3f(GLfloat r, GLfloat g, GLfloat b) g_gl_context->gl_color(r, g, b, 1.0); } -void glColor3fv(const GLfloat* v) +void glColor3fv(GLfloat const* v) { g_gl_context->gl_color(v[0], v[1], v[2], 1.0); } @@ -60,7 +60,7 @@ void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) g_gl_context->gl_color(r, g, b, a); } -void glColor4fv(const GLfloat* v) +void glColor4fv(GLfloat const* v) { g_gl_context->gl_color(v[0], v[1], v[2], v[3]); } @@ -70,7 +70,7 @@ void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) g_gl_context->gl_color(r / 255.0, g / 255.0, b / 255.0, a / 255.0); } -void glColor4ubv(const GLubyte* v) +void glColor4ubv(GLubyte const* v) { g_gl_context->gl_color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0); } diff --git a/Userland/Libraries/LibGL/GLContext.cpp b/Userland/Libraries/LibGL/GLContext.cpp index 0c0246f25d..f57c6f99b5 100644 --- a/Userland/Libraries/LibGL/GLContext.cpp +++ b/Userland/Libraries/LibGL/GLContext.cpp @@ -471,7 +471,7 @@ void GLContext::gl_load_identity() *m_current_matrix = FloatMatrix4x4::identity(); } -void GLContext::gl_load_matrix(const FloatMatrix4x4& matrix) +void GLContext::gl_load_matrix(FloatMatrix4x4 const& matrix) { APPEND_TO_CALL_LIST_WITH_ARG_AND_RETURN_IF_NEEDED(gl_load_matrix, matrix); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); @@ -859,7 +859,7 @@ void GLContext::gl_gen_textures(GLsizei n, GLuint* textures) } } -void GLContext::gl_delete_textures(GLsizei n, const GLuint* textures) +void GLContext::gl_delete_textures(GLsizei n, GLuint const* textures) { RETURN_WITH_ERROR_IF(n < 0, GL_INVALID_VALUE); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); @@ -1070,8 +1070,7 @@ void GLContext::invoke_list(size_t list_index) for (auto& entry : listing.entries) { entry.function.visit([&](auto& function) { entry.arguments.visit([&](auto& arguments) { - auto apply = [&]<typename... Args>(Args && ... args) - { + auto apply = [&]<typename... Args>(Args&&... args) { if constexpr (requires { (this->*function)(forward<Args>(args)...); }) (this->*function)(forward<Args>(args)...); }; @@ -1987,7 +1986,7 @@ void GLContext::gl_client_active_texture(GLenum target) m_client_active_texture = target - GL_TEXTURE0; } -void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); RETURN_WITH_ERROR_IF(!(size == 2 || size == 3 || size == 4), GL_INVALID_VALUE); @@ -1997,7 +1996,7 @@ void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, const m_client_vertex_pointer = { .size = size, .type = type, .stride = stride, .pointer = pointer }; } -void GLContext::gl_color_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void GLContext::gl_color_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); RETURN_WITH_ERROR_IF(!(size == 3 || size == 4), GL_INVALID_VALUE); @@ -2015,7 +2014,7 @@ void GLContext::gl_color_pointer(GLint size, GLenum type, GLsizei stride, const m_client_color_pointer = { .size = size, .type = type, .stride = stride, .pointer = pointer }; } -void GLContext::gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void GLContext::gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); RETURN_WITH_ERROR_IF(!(size == 1 || size == 2 || size == 3 || size == 4), GL_INVALID_VALUE); @@ -2117,7 +2116,7 @@ void GLContext::gl_draw_arrays(GLenum mode, GLint first, GLsizei count) gl_end(); } -void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, const void* indices) +void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, void const* indices) { APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_draw_elements, mode, count, type, indices); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); @@ -2147,13 +2146,13 @@ void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, const int i = 0; switch (type) { case GL_UNSIGNED_BYTE: - i = reinterpret_cast<const GLubyte*>(indices)[index]; + i = reinterpret_cast<GLubyte const*>(indices)[index]; break; case GL_UNSIGNED_SHORT: - i = reinterpret_cast<const GLushort*>(indices)[index]; + i = reinterpret_cast<GLushort const*>(indices)[index]; break; case GL_UNSIGNED_INT: - i = reinterpret_cast<const GLuint*>(indices)[index]; + i = reinterpret_cast<GLuint const*>(indices)[index]; break; } @@ -2184,7 +2183,7 @@ void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, const gl_end(); } -void GLContext::gl_draw_pixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void* data) +void GLContext::gl_draw_pixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data) { APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_draw_pixels, width, height, format, type, data); @@ -2335,7 +2334,7 @@ void GLContext::gl_depth_func(GLenum func) // General helper function to read arbitrary vertex attribute data into a float array void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& attrib, int index, float* elements) { - auto byte_ptr = reinterpret_cast<const char*>(attrib.pointer); + auto byte_ptr = reinterpret_cast<char const*>(attrib.pointer); auto normalize = attrib.normalize; size_t stride = attrib.stride; @@ -2345,7 +2344,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLbyte) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLbyte*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLbyte const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0x80; } @@ -2356,7 +2355,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLubyte) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLubyte*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLubyte const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0xff; } @@ -2367,7 +2366,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLshort) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLshort*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLshort const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0x8000; } @@ -2378,7 +2377,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLushort) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLushort*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLushort const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0xffff; } @@ -2389,7 +2388,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLint) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLint*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLint const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0x80000000; } @@ -2400,7 +2399,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLuint) * attrib.size; for (int i = 0; i < attrib.size; i++) { - elements[i] = *(reinterpret_cast<const GLuint*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLuint const*>(byte_ptr + stride * index) + i); if (normalize) elements[i] /= 0xffffffff; } @@ -2411,7 +2410,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLfloat) * attrib.size; for (int i = 0; i < attrib.size; i++) - elements[i] = *(reinterpret_cast<const GLfloat*>(byte_ptr + stride * index) + i); + elements[i] = *(reinterpret_cast<GLfloat const*>(byte_ptr + stride * index) + i); break; } case GL_DOUBLE: { @@ -2419,7 +2418,7 @@ void GLContext::read_from_vertex_attribute_pointer(VertexAttribPointer const& at stride = sizeof(GLdouble) * attrib.size; for (int i = 0; i < attrib.size; i++) - elements[i] = static_cast<float>(*(reinterpret_cast<const GLdouble*>(byte_ptr + stride * index) + i)); + elements[i] = static_cast<float>(*(reinterpret_cast<GLdouble const*>(byte_ptr + stride * index) + i)); break; } } diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index c4704973fb..394ee8216e 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -57,14 +57,14 @@ public: void gl_clear_depth(GLdouble depth); void gl_clear_stencil(GLint s); void gl_color(GLdouble r, GLdouble g, GLdouble b, GLdouble a); - void gl_delete_textures(GLsizei n, const GLuint* textures); + void gl_delete_textures(GLsizei n, GLuint const* textures); void gl_end(); void gl_frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val); void gl_gen_textures(GLsizei n, GLuint* textures); GLenum gl_get_error(); GLubyte* gl_get_string(GLenum name); void gl_load_identity(); - void gl_load_matrix(const FloatMatrix4x4& matrix); + void gl_load_matrix(FloatMatrix4x4 const& matrix); void gl_matrix_mode(GLenum mode); void gl_ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val); void gl_push_matrix(); @@ -110,12 +110,12 @@ public: void gl_enable_client_state(GLenum cap); void gl_disable_client_state(GLenum cap); void gl_client_active_texture(GLenum target); - void gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer); - void gl_color_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer); - void gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer); + void gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer); + void gl_color_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer); + void gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, void const* pointer); void gl_draw_arrays(GLenum mode, GLint first, GLsizei count); - void gl_draw_elements(GLenum mode, GLsizei count, GLenum type, const void* indices); - void gl_draw_pixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void* data); + void gl_draw_elements(GLenum mode, GLsizei count, GLenum type, void const* indices); + void gl_draw_pixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data); void gl_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void gl_get_booleanv(GLenum pname, GLboolean* data); void gl_get_doublev(GLenum pname, GLdouble* params); @@ -419,7 +419,7 @@ private: GLenum type { GL_FLOAT }; bool normalize { true }; GLsizei stride { 0 }; - const void* pointer { 0 }; + void const* pointer { 0 }; }; static void read_from_vertex_attribute_pointer(VertexAttribPointer const&, int index, float* elements); diff --git a/Userland/Libraries/LibGL/GLDraw.cpp b/Userland/Libraries/LibGL/GLDraw.cpp index f484dc49d2..9d16e42f44 100644 --- a/Userland/Libraries/LibGL/GLDraw.cpp +++ b/Userland/Libraries/LibGL/GLDraw.cpp @@ -15,7 +15,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLflo g_gl_context->gl_bitmap(width, height, xorig, yorig, xmove, ymove, bitmap); } -void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void* data) +void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data) { g_gl_context->gl_draw_pixels(width, height, format, type, data); } diff --git a/Userland/Libraries/LibGL/GLTexture.cpp b/Userland/Libraries/LibGL/GLTexture.cpp index 73c8d1af46..adf43b416f 100644 --- a/Userland/Libraries/LibGL/GLTexture.cpp +++ b/Userland/Libraries/LibGL/GLTexture.cpp @@ -15,29 +15,29 @@ void glGenTextures(GLsizei n, GLuint* textures) g_gl_context->gl_gen_textures(n, textures); } -void glDeleteTextures(GLsizei n, const GLuint* textures) +void glDeleteTextures(GLsizei n, GLuint const* textures) { g_gl_context->gl_delete_textures(n, textures); } -void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid* data) +void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data) { dbgln("glTexImage1D({:#x}, {}, {:#x}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, border, format, type, data); TODO(); } -void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) +void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data) { g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data); } -void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data) +void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data) { dbgln("glTexImage3D({:#x}, {}, {:#x}, {}, {}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, height, depth, border, format, type, data); TODO(); } -void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data) +void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data) { g_gl_context->gl_tex_sub_image_2d(target, level, xoffset, yoffset, width, height, format, type, data); } diff --git a/Userland/Libraries/LibGL/GLVert.cpp b/Userland/Libraries/LibGL/GLVert.cpp index a0a40e9082..1005a7f875 100644 --- a/Userland/Libraries/LibGL/GLVert.cpp +++ b/Userland/Libraries/LibGL/GLVert.cpp @@ -25,7 +25,7 @@ void glVertex2d(GLdouble x, GLdouble y) g_gl_context->gl_vertex(x, y, 0.0, 1.0); } -void glVertex2dv(const GLdouble* v) +void glVertex2dv(GLdouble const* v) { g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0); } @@ -35,7 +35,7 @@ void glVertex2f(GLfloat x, GLfloat y) g_gl_context->gl_vertex(x, y, 0.0, 1.0); } -void glVertex2fv(const GLfloat* v) +void glVertex2fv(GLfloat const* v) { g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0); } @@ -45,7 +45,7 @@ void glVertex2i(GLint x, GLint y) g_gl_context->gl_vertex(x, y, 0.0, 1.0); } -void glVertex2iv(const GLint* v) +void glVertex2iv(GLint const* v) { g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0); } @@ -55,7 +55,7 @@ void glVertex2s(GLshort x, GLshort y) g_gl_context->gl_vertex(x, y, 0.0, 1.0); } -void glVertex2sv(const GLshort* v) +void glVertex2sv(GLshort const* v) { g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0); } @@ -65,7 +65,7 @@ void glVertex3d(GLdouble x, GLdouble y, GLdouble z) g_gl_context->gl_vertex(x, y, z, 1.0); } -void glVertex3dv(const GLdouble* v) +void glVertex3dv(GLdouble const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0); } @@ -75,7 +75,7 @@ void glVertex3f(GLfloat x, GLfloat y, GLfloat z) g_gl_context->gl_vertex(x, y, z, 1.0); } -void glVertex3fv(const GLfloat* v) +void glVertex3fv(GLfloat const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0); } @@ -85,7 +85,7 @@ void glVertex3i(GLint x, GLint y, GLint z) g_gl_context->gl_vertex(x, y, z, 1.0); } -void glVertex3iv(const GLint* v) +void glVertex3iv(GLint const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0); } @@ -95,7 +95,7 @@ void glVertex3s(GLshort x, GLshort y, GLshort z) g_gl_context->gl_vertex(x, y, z, 1.0); } -void glVertex3sv(const GLshort* v) +void glVertex3sv(GLshort const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0); } @@ -105,7 +105,7 @@ void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) g_gl_context->gl_vertex(x, y, z, w); } -void glVertex4dv(const GLdouble* v) +void glVertex4dv(GLdouble const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]); } @@ -115,7 +115,7 @@ void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) g_gl_context->gl_vertex(x, y, z, w); } -void glVertex4fv(const GLfloat* v) +void glVertex4fv(GLfloat const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]); } @@ -125,7 +125,7 @@ void glVertex4i(GLint x, GLint y, GLint z, GLint w) g_gl_context->gl_vertex(x, y, z, w); } -void glVertex4iv(const GLint* v) +void glVertex4iv(GLint const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]); } @@ -135,7 +135,7 @@ void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w) g_gl_context->gl_vertex(x, y, z, w); } -void glVertex4sv(const GLshort* v) +void glVertex4sv(GLshort const* v) { g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]); } @@ -190,7 +190,7 @@ void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) g_gl_context->gl_tex_coord(s, t, r, q); } -void glTexCoord4fv(const GLfloat* v) +void glTexCoord4fv(GLfloat const* v) { g_gl_context->gl_tex_coord(v[0], v[1], v[2], v[3]); } diff --git a/Userland/Libraries/LibGL/GLVertexArrays.cpp b/Userland/Libraries/LibGL/GLVertexArrays.cpp index 46a3a8d2a9..3dea1ade54 100644 --- a/Userland/Libraries/LibGL/GLVertexArrays.cpp +++ b/Userland/Libraries/LibGL/GLVertexArrays.cpp @@ -9,17 +9,17 @@ extern GL::GLContext* g_gl_context; -void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { g_gl_context->gl_vertex_pointer(size, type, stride, pointer); } -void glColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { g_gl_context->gl_color_pointer(size, type, stride, pointer); } -void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) { g_gl_context->gl_tex_coord_pointer(size, type, stride, pointer); } @@ -29,7 +29,7 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) g_gl_context->gl_draw_arrays(mode, first, count); } -void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) +void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices) { g_gl_context->gl_draw_elements(mode, count, type, indices); } diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index c0ae44b967..a2d1fdb23a 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -17,7 +17,7 @@ namespace GUI { -AboutDialog::AboutDialog(StringView name, const Gfx::Bitmap* icon, Window* parent_window, StringView version) +AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* parent_window, StringView version) : Dialog(parent_window) , m_name(name) , m_icon(icon) diff --git a/Userland/Libraries/LibGUI/AboutDialog.h b/Userland/Libraries/LibGUI/AboutDialog.h index 4fb3ac3ee4..a6b5a724e0 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.h +++ b/Userland/Libraries/LibGUI/AboutDialog.h @@ -17,7 +17,7 @@ class AboutDialog final : public Dialog { public: virtual ~AboutDialog() override = default; - static void show(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, const Gfx::Bitmap* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION) + static void show(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION) { auto dialog = AboutDialog::construct(name, icon, parent_window, version); if (window_icon) @@ -26,7 +26,7 @@ public: } private: - AboutDialog(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION); + AboutDialog(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION); String m_name; RefPtr<Gfx::Bitmap> m_icon; diff --git a/Userland/Libraries/LibGUI/AbstractButton.cpp b/Userland/Libraries/LibGUI/AbstractButton.cpp index 4697c490b0..be77913634 100644 --- a/Userland/Libraries/LibGUI/AbstractButton.cpp +++ b/Userland/Libraries/LibGUI/AbstractButton.cpp @@ -218,7 +218,7 @@ void AbstractButton::keyup_event(KeyEvent& event) Widget::keyup_event(event); } -void AbstractButton::paint_text(Painter& painter, const Gfx::IntRect& rect, const Gfx::Font& font, Gfx::TextAlignment text_alignment, Gfx::TextWrapping text_wrapping) +void AbstractButton::paint_text(Painter& painter, Gfx::IntRect const& rect, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::TextWrapping text_wrapping) { auto clipped_rect = rect.intersected(this->rect()); diff --git a/Userland/Libraries/LibGUI/AbstractButton.h b/Userland/Libraries/LibGUI/AbstractButton.h index 40c3b71d56..0a29c8b9fc 100644 --- a/Userland/Libraries/LibGUI/AbstractButton.h +++ b/Userland/Libraries/LibGUI/AbstractButton.h @@ -21,7 +21,7 @@ public: Function<void(bool)> on_checked; void set_text(String); - const String& text() const { return m_text; } + String const& text() const { return m_text; } bool is_exclusive() const { return m_exclusive; } void set_exclusive(bool b) { m_exclusive = b; } @@ -54,7 +54,7 @@ protected: virtual void focusout_event(GUI::FocusEvent&) override; virtual void change_event(Event&) override; - void paint_text(Painter&, const Gfx::IntRect&, const Gfx::Font&, Gfx::TextAlignment, Gfx::TextWrapping = Gfx::TextWrapping::DontWrap); + void paint_text(Painter&, Gfx::IntRect const&, Gfx::Font const&, Gfx::TextAlignment, Gfx::TextWrapping = Gfx::TextWrapping::DontWrap); private: String m_text; diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp index b1a022f1a9..30e55ca91b 100644 --- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp +++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp @@ -146,7 +146,7 @@ void AbstractScrollableWidget::update_scrollbar_ranges() m_vertical_scrollbar->set_page_step(visible_content_rect().height() - m_vertical_scrollbar->step()); } -void AbstractScrollableWidget::set_content_size(const Gfx::IntSize& size) +void AbstractScrollableWidget::set_content_size(Gfx::IntSize const& size) { if (m_content_size == size) return; @@ -154,7 +154,7 @@ void AbstractScrollableWidget::set_content_size(const Gfx::IntSize& size) update_scrollbar_ranges(); } -void AbstractScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& size) +void AbstractScrollableWidget::set_size_occupied_by_fixed_elements(Gfx::IntSize const& size) { if (m_size_occupied_by_fixed_elements == size) return; @@ -191,14 +191,14 @@ Gfx::IntRect AbstractScrollableWidget::visible_content_rect() const return rect; } -void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, Orientation orientation) +void AbstractScrollableWidget::scroll_into_view(Gfx::IntRect const& rect, Orientation orientation) { if (orientation == Orientation::Vertical) return scroll_into_view(rect, false, true); return scroll_into_view(rect, true, false); } -void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_horizontally, bool scroll_vertically) +void AbstractScrollableWidget::scroll_into_view(Gfx::IntRect const& rect, bool scroll_horizontally, bool scroll_vertically) { auto visible_content_rect = this->visible_content_rect(); if (visible_content_rect.contains(rect)) @@ -255,7 +255,7 @@ void AbstractScrollableWidget::set_automatic_scrolling_timer(bool active) } } -Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const +Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const { Gfx::IntPoint delta { 0, 0 }; @@ -280,7 +280,7 @@ Gfx::IntRect AbstractScrollableWidget::widget_inner_rect() const return rect; } -Gfx::IntPoint AbstractScrollableWidget::to_content_position(const Gfx::IntPoint& widget_position) const +Gfx::IntPoint AbstractScrollableWidget::to_content_position(Gfx::IntPoint const& widget_position) const { auto content_position = widget_position; content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value()); @@ -288,7 +288,7 @@ Gfx::IntPoint AbstractScrollableWidget::to_content_position(const Gfx::IntPoint& return content_position; } -Gfx::IntPoint AbstractScrollableWidget::to_widget_position(const Gfx::IntPoint& content_position) const +Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint const& content_position) const { auto widget_position = content_position; widget_position.translate_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h index fdc3ff5d12..54a79b7db7 100644 --- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h +++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h @@ -33,8 +33,8 @@ public: return viewport_rect; } - void scroll_into_view(const Gfx::IntRect&, Orientation); - void scroll_into_view(const Gfx::IntRect&, bool scroll_horizontally, bool scroll_vertically); + void scroll_into_view(Gfx::IntRect const&, Orientation); + void scroll_into_view(Gfx::IntRect const&, bool scroll_horizontally, bool scroll_vertically); void set_scrollbars_enabled(bool); bool is_scrollbars_enabled() const { return m_scrollbars_enabled; } @@ -43,17 +43,17 @@ public: Gfx::IntSize excess_size() const; Scrollbar& vertical_scrollbar() { return *m_vertical_scrollbar; } - const Scrollbar& vertical_scrollbar() const { return *m_vertical_scrollbar; } + Scrollbar const& vertical_scrollbar() const { return *m_vertical_scrollbar; } Scrollbar& horizontal_scrollbar() { return *m_horizontal_scrollbar; } - const Scrollbar& horizontal_scrollbar() const { return *m_horizontal_scrollbar; } + Scrollbar const& horizontal_scrollbar() const { return *m_horizontal_scrollbar; } Widget& corner_widget() { return *m_corner_widget; } - const Widget& corner_widget() const { return *m_corner_widget; } + Widget const& corner_widget() const { return *m_corner_widget; } void scroll_to_top(); void scroll_to_bottom(); void set_automatic_scrolling_timer(bool active); - virtual Gfx::IntPoint automatic_scroll_delta_from_position(const Gfx::IntPoint&) const; + virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const&) const; int width_occupied_by_vertical_scrollbar() const; int height_occupied_by_horizontal_scrollbar() const; @@ -63,11 +63,11 @@ public: void set_should_hide_unnecessary_scrollbars(bool b) { m_should_hide_unnecessary_scrollbars = b; } bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; } - Gfx::IntPoint to_content_position(const Gfx::IntPoint& widget_position) const; - Gfx::IntPoint to_widget_position(const Gfx::IntPoint& content_position) const; + Gfx::IntPoint to_content_position(Gfx::IntPoint const& widget_position) const; + Gfx::IntPoint to_widget_position(Gfx::IntPoint const& content_position) const; - Gfx::IntRect to_content_rect(const Gfx::IntRect& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; } - Gfx::IntRect to_widget_rect(const Gfx::IntRect& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; } + Gfx::IntRect to_content_rect(Gfx::IntRect const& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; } + Gfx::IntRect to_widget_rect(Gfx::IntRect const& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; } protected: AbstractScrollableWidget(); @@ -75,8 +75,8 @@ protected: virtual void resize_event(ResizeEvent&) override; virtual void mousewheel_event(MouseEvent&) override; virtual void did_scroll() { } - void set_content_size(const Gfx::IntSize&); - void set_size_occupied_by_fixed_elements(const Gfx::IntSize&); + void set_content_size(Gfx::IntSize const&); + void set_size_occupied_by_fixed_elements(Gfx::IntSize const&); virtual void on_automatic_scrolling_timer_fired() {}; int autoscroll_threshold() const { return m_autoscroll_threshold; } diff --git a/Userland/Libraries/LibGUI/AbstractTableView.cpp b/Userland/Libraries/LibGUI/AbstractTableView.cpp index 68db013f4c..bc29dadf82 100644 --- a/Userland/Libraries/LibGUI/AbstractTableView.cpp +++ b/Userland/Libraries/LibGUI/AbstractTableView.cpp @@ -219,7 +219,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event) AbstractView::mousedown_event(event); } -ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position, bool& is_toggle) const +ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position, bool& is_toggle) const { is_toggle = false; if (!model()) @@ -239,7 +239,7 @@ ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& posit return {}; } -ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position) const +ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position) const { bool is_toggle; auto index = index_at_event_position(position, is_toggle); @@ -269,7 +269,7 @@ void AbstractTableView::move_cursor_relative(int vertical_steps, int horizontal_ } } -void AbstractTableView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) +void AbstractTableView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) { Gfx::IntRect rect; switch (selection_behavior()) { @@ -321,12 +321,12 @@ Gfx::IntRect AbstractTableView::content_rect(int row, int column) const return { row_rect.x() + x, row_rect.y(), column_width(column) + horizontal_padding() * 2, row_height() }; } -Gfx::IntRect AbstractTableView::content_rect(const ModelIndex& index) const +Gfx::IntRect AbstractTableView::content_rect(ModelIndex const& index) const { return content_rect(index.row(), index.column()); } -Gfx::IntRect AbstractTableView::content_rect_minus_scrollbars(const ModelIndex& index) const +Gfx::IntRect AbstractTableView::content_rect_minus_scrollbars(ModelIndex const& index) const { auto naive_content_rect = content_rect(index.row(), index.column()); return { naive_content_rect.x() - horizontal_scrollbar().value(), naive_content_rect.y() - vertical_scrollbar().value(), naive_content_rect.width(), naive_content_rect.height() }; @@ -340,7 +340,7 @@ Gfx::IntRect AbstractTableView::row_rect(int item_index) const row_height() }; } -Gfx::IntPoint AbstractTableView::adjusted_position(const Gfx::IntPoint& position) const +Gfx::IntPoint AbstractTableView::adjusted_position(Gfx::IntPoint const& position) const { return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness()); } @@ -469,7 +469,7 @@ bool AbstractTableView::is_navigation(GUI::KeyEvent& event) } } -Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const +Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const { if (pos.y() > column_header().height() + autoscroll_threshold()) return AbstractScrollableWidget::automatic_scroll_delta_from_position(pos); diff --git a/Userland/Libraries/LibGUI/AbstractTableView.h b/Userland/Libraries/LibGUI/AbstractTableView.h index 74de744560..30afb19a82 100644 --- a/Userland/Libraries/LibGUI/AbstractTableView.h +++ b/Userland/Libraries/LibGUI/AbstractTableView.h @@ -19,7 +19,7 @@ public: virtual ~TableCellPaintingDelegate() = default; virtual bool should_paint(ModelIndex const&) { return true; } - virtual void paint(Painter&, const Gfx::IntRect&, const Gfx::Palette&, const ModelIndex&) = 0; + virtual void paint(Painter&, Gfx::IntRect const&, Gfx::Palette const&, ModelIndex const&) = 0; }; class AbstractTableView : public AbstractView { @@ -52,23 +52,23 @@ public: void set_column_painting_delegate(int column, OwnPtr<TableCellPaintingDelegate>); - Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) const; + Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const; - virtual Gfx::IntRect content_rect(const ModelIndex&) const override; - Gfx::IntRect content_rect_minus_scrollbars(const ModelIndex&) const; + virtual Gfx::IntRect content_rect(ModelIndex const&) const override; + Gfx::IntRect content_rect_minus_scrollbars(ModelIndex const&) const; Gfx::IntRect content_rect(int row, int column) const; Gfx::IntRect row_rect(int item_index) const; virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const& index) const override; - virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override; - void scroll_into_view(const ModelIndex& index, Orientation orientation) + virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally = true, bool scroll_vertically = true) override; + void scroll_into_view(ModelIndex const& index, Orientation orientation) { scroll_into_view(index, orientation == Gfx::Orientation::Horizontal, orientation == Gfx::Orientation::Vertical); } - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const; - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override; virtual void select_all() override; @@ -78,10 +78,10 @@ public: virtual void did_scroll() override; HeaderView& column_header() { return *m_column_header; } - const HeaderView& column_header() const { return *m_column_header; } + HeaderView const& column_header() const { return *m_column_header; } HeaderView& row_header() { return *m_row_header; } - const HeaderView& row_header() const { return *m_row_header; } + HeaderView const& row_header() const { return *m_row_header; } virtual void model_did_update(unsigned flags) override; @@ -94,7 +94,7 @@ protected: virtual void keydown_event(KeyEvent&) override; virtual void resize_event(ResizeEvent&) override; - virtual void toggle_index(const ModelIndex&) { } + virtual void toggle_index(ModelIndex const&) { } void update_content_size(); virtual void auto_resize_column(int column); @@ -106,7 +106,7 @@ protected: void move_cursor_relative(int vertical_steps, int horizontal_steps, SelectionUpdate); - virtual Gfx::IntPoint automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const override; + virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const override; private: void layout_headers(); diff --git a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp index 03247bd670..0957ad587d 100644 --- a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp +++ b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp @@ -185,7 +185,7 @@ void AbstractZoomPanWidget::set_scale_bounds(float min_scale, float max_scale) void AbstractZoomPanWidget::fit_content_to_rect(Gfx::IntRect const& viewport_rect, FitType type) { - const float border_ratio = 0.95f; + float const border_ratio = 0.95f; auto image_size = m_original_rect.size(); auto height_ratio = floorf(border_ratio * viewport_rect.height()) / image_size.height(); auto width_ratio = floorf(border_ratio * viewport_rect.width()) / image_size.width(); diff --git a/Userland/Libraries/LibGUI/Action.cpp b/Userland/Libraries/LibGUI/Action.cpp index 8191798993..4eceaa6fbd 100644 --- a/Userland/Libraries/LibGUI/Action.cpp +++ b/Userland/Libraries/LibGUI/Action.cpp @@ -23,22 +23,22 @@ NonnullRefPtr<Action> Action::create(String text, RefPtr<Gfx::Bitmap> icon, Func return adopt_ref(*new Action(move(text), move(icon), move(callback), parent)); } -NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, move(callback), parent)); } -NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(callback), parent)); } -NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent)); } -NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(icon), move(callback), parent)); } @@ -53,12 +53,12 @@ NonnullRefPtr<Action> Action::create_checkable(String text, RefPtr<Gfx::Bitmap> return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true)); } -NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create_checkable(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true)); } -NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) +NonnullRefPtr<Action> Action::create_checkable(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent) { return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent, true)); } @@ -73,17 +73,17 @@ Action::Action(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on { } -Action::Action(String text, const Shortcut& shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(String text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) : Action(move(text), shortcut, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable) { } -Action::Action(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) : Action(move(text), shortcut, alternate_shortcut, nullptr, move(on_activation_callback), parent, checkable) { } -Action::Action(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable) : Core::Object(parent) , on_activation(move(on_activation_callback)) , m_text(move(text)) @@ -217,7 +217,7 @@ void Action::set_group(Badge<ActionGroup>, ActionGroup* group) m_action_group = AK::make_weak_ptr_if_nonnull(group); } -void Action::set_icon(const Gfx::Bitmap* icon) +void Action::set_icon(Gfx::Bitmap const* icon) { m_icon = icon; } diff --git a/Userland/Libraries/LibGUI/Action.h b/Userland/Libraries/LibGUI/Action.h index b1eca83b7a..bf2b5376d4 100644 --- a/Userland/Libraries/LibGUI/Action.h +++ b/Userland/Libraries/LibGUI/Action.h @@ -23,7 +23,7 @@ namespace GUI { namespace CommonActions { -NonnullRefPtr<Action> make_about_action(const String& app_name, const Icon& app_icon, Window* parent = nullptr); +NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_icon, Window* parent = nullptr); NonnullRefPtr<Action> make_open_action(Function<void(Action&)>, Core::Object* parent = nullptr); NonnullRefPtr<Action> make_save_action(Function<void(Action&)>, Core::Object* parent = nullptr); NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)>, Core::Object* parent = nullptr); @@ -65,14 +65,14 @@ public: }; static NonnullRefPtr<Action> create(String text, Function<void(Action&)> callback, Core::Object* parent = nullptr); static NonnullRefPtr<Action> create(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); static NonnullRefPtr<Action> create_checkable(String text, Function<void(Action&)> callback, Core::Object* parent = nullptr); static NonnullRefPtr<Action> create_checkable(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create_checkable(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); - static NonnullRefPtr<Action> create_checkable(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create_checkable(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr); + static NonnullRefPtr<Action> create_checkable(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr); virtual ~Action() override; @@ -84,10 +84,10 @@ public: Shortcut const& shortcut() const { return m_shortcut; } Shortcut const& alternate_shortcut() const { return m_alternate_shortcut; } - const Gfx::Bitmap* icon() const { return m_icon.ptr(); } - void set_icon(const Gfx::Bitmap*); + Gfx::Bitmap const* icon() const { return m_icon.ptr(); } + void set_icon(Gfx::Bitmap const*); - const Core::Object* activator() const { return m_activator.ptr(); } + Core::Object const* activator() const { return m_activator.ptr(); } Core::Object* activator() { return m_activator.ptr(); } Function<void(Action&)> on_activation; @@ -116,16 +116,16 @@ public: void register_menu_item(Badge<MenuItem>, MenuItem&); void unregister_menu_item(Badge<MenuItem>, MenuItem&); - const ActionGroup* group() const { return m_action_group.ptr(); } + ActionGroup const* group() const { return m_action_group.ptr(); } void set_group(Badge<ActionGroup>, ActionGroup*); HashTable<MenuItem*> menu_items() const { return m_menu_items; } private: Action(String, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(String, const Shortcut&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(String, const Shortcut&, const Shortcut&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(String, const Shortcut&, const Shortcut&, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); + Action(String, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); + Action(String, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); + Action(String, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); Action(String, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false); template<typename Callback> diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 1ab1ad8bec..96427ecc0b 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -24,7 +24,7 @@ class Application::TooltipWindow final : public Window { C_OBJECT(TooltipWindow); public: - void set_tooltip(const String& tooltip) + void set_tooltip(String const& tooltip) { m_label->set_text(Gfx::parse_ampersand_string(tooltip)); int tooltip_width = m_label->min_width() + 10; @@ -136,7 +136,7 @@ void Application::unregister_global_shortcut_action(Badge<Action>, Action& actio m_global_shortcut_actions.remove(action.alternate_shortcut()); } -Action* Application::action_for_key_event(const KeyEvent& event) +Action* Application::action_for_key_event(KeyEvent const& event) { auto it = m_global_shortcut_actions.find(Shortcut(event.modifiers(), (KeyCode)event.key())); if (it == m_global_shortcut_actions.end()) @@ -144,7 +144,7 @@ Action* Application::action_for_key_event(const KeyEvent& event) return (*it).value; } -void Application::show_tooltip(String tooltip, const Widget* tooltip_source_widget) +void Application::show_tooltip(String tooltip, Widget const* tooltip_source_widget) { m_tooltip_source_widget = tooltip_source_widget; if (!m_tooltip_window) { @@ -163,7 +163,7 @@ void Application::show_tooltip(String tooltip, const Widget* tooltip_source_widg } } -void Application::show_tooltip_immediately(String tooltip, const Widget* tooltip_source_widget) +void Application::show_tooltip_immediately(String tooltip, Widget const* tooltip_source_widget) { m_tooltip_source_widget = tooltip_source_widget; if (!m_tooltip_window) { @@ -206,7 +206,7 @@ void Application::set_system_palette(Core::AnonymousBuffer& buffer) m_palette = m_system_palette; } -void Application::set_palette(const Palette& palette) +void Application::set_palette(Palette const& palette) { m_palette = palette.impl(); } @@ -221,7 +221,7 @@ void Application::request_tooltip_show() VERIFY(m_tooltip_window); Gfx::IntRect desktop_rect = Desktop::the().rect(); - const int margin = 30; + int const margin = 30; Gfx::IntPoint adjusted_pos = ConnectionToWindowServer::the().get_global_cursor_position(); adjusted_pos.translate_by(0, 18); @@ -271,7 +271,7 @@ void Application::set_pending_drop_widget(Widget* widget) m_pending_drop_widget->update(); } -void Application::set_drag_hovered_widget_impl(Widget* widget, const Gfx::IntPoint& position, Vector<String> mime_types) +void Application::set_drag_hovered_widget_impl(Widget* widget, Gfx::IntPoint const& position, Vector<String> mime_types) { if (widget == m_drag_hovered_widget) return; diff --git a/Userland/Libraries/LibGUI/Application.h b/Userland/Libraries/LibGUI/Application.h index f4f594d6fd..68466bb39a 100644 --- a/Userland/Libraries/LibGUI/Application.h +++ b/Userland/Libraries/LibGUI/Application.h @@ -33,13 +33,13 @@ public: int exec(); void quit(int = 0); - Action* action_for_key_event(const KeyEvent&); + Action* action_for_key_event(KeyEvent const&); void register_global_shortcut_action(Badge<Action>, Action&); void unregister_global_shortcut_action(Badge<Action>, Action&); - void show_tooltip(String, const Widget* tooltip_source_widget); - void show_tooltip_immediately(String, const Widget* tooltip_source_widget); + void show_tooltip(String, Widget const* tooltip_source_widget); + void show_tooltip_immediately(String, Widget const* tooltip_source_widget); void hide_tooltip(); Widget* tooltip_source_widget() { return m_tooltip_source_widget; }; @@ -49,11 +49,11 @@ public: void did_create_window(Badge<Window>); void did_delete_last_window(Badge<Window>); - const String& invoked_as() const { return m_invoked_as; } - const Vector<String>& args() const { return m_args; } + String const& invoked_as() const { return m_invoked_as; } + Vector<String> const& args() const { return m_args; } Gfx::Palette palette() const; - void set_palette(const Gfx::Palette&); + void set_palette(Gfx::Palette const&); void set_system_palette(Core::AnonymousBuffer&); @@ -64,18 +64,18 @@ public: Core::EventLoop& event_loop() { return *m_event_loop; } Window* active_window() { return m_active_window; } - const Window* active_window() const { return m_active_window; } + Window const* active_window() const { return m_active_window; } void window_did_become_active(Badge<Window>, Window&); void window_did_become_inactive(Badge<Window>, Window&); Widget* drag_hovered_widget() { return m_drag_hovered_widget.ptr(); } - const Widget* drag_hovered_widget() const { return m_drag_hovered_widget.ptr(); } + Widget const* drag_hovered_widget() const { return m_drag_hovered_widget.ptr(); } Widget* pending_drop_widget() { return m_pending_drop_widget.ptr(); } - const Widget* pending_drop_widget() const { return m_pending_drop_widget.ptr(); } + Widget const* pending_drop_widget() const { return m_pending_drop_widget.ptr(); } - void set_drag_hovered_widget(Badge<Window>, Widget* widget, const Gfx::IntPoint& position = {}, Vector<String> mime_types = {}) + void set_drag_hovered_widget(Badge<Window>, Widget* widget, Gfx::IntPoint const& position = {}, Vector<String> mime_types = {}) { set_drag_hovered_widget_impl(widget, position, move(mime_types)); } @@ -98,7 +98,7 @@ private: void request_tooltip_show(); void tooltip_hide_timer_did_fire(); - void set_drag_hovered_widget_impl(Widget*, const Gfx::IntPoint& = {}, Vector<String> = {}); + void set_drag_hovered_widget_impl(Widget*, Gfx::IntPoint const& = {}, Vector<String> = {}); void set_pending_drop_widget(Widget*); OwnPtr<Core::EventLoop> m_event_loop; diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index 82a46800f2..400aff8471 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -219,12 +219,12 @@ AutocompleteProvider::Entry::HideAutocompleteAfterApplying AutocompleteBox::appl return hide_when_done; } -bool AutocompleteProvider::Declaration::operator==(const AutocompleteProvider::Declaration& other) const +bool AutocompleteProvider::Declaration::operator==(AutocompleteProvider::Declaration const& other) const { return name == other.name && position == other.position && type == other.type && scope == other.scope; } -bool AutocompleteProvider::ProjectLocation::operator==(const ProjectLocation& other) const +bool AutocompleteProvider::ProjectLocation::operator==(ProjectLocation const& other) const { return file == other.file && line == other.line && column == other.column; } diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h index a6acd00ccd..0475436046 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h @@ -45,7 +45,7 @@ public: size_t line { 0 }; size_t column { 0 }; - bool operator==(const ProjectLocation&) const; + bool operator==(ProjectLocation const&) const; }; enum class DeclarationType { @@ -64,7 +64,7 @@ public: DeclarationType type; String scope; - bool operator==(const Declaration&) const; + bool operator==(Declaration const&) const; }; virtual void provide_completions(Function<void(Vector<Entry>)>) = 0; @@ -102,7 +102,7 @@ public: size_t end_line { 0 }; size_t end_column { 0 }; - static constexpr const char* type_to_string(SemanticType t) + static constexpr char const* type_to_string(SemanticType t) { switch (t) { #define __SEMANTIC(x) \ diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index 3cf593c470..c274935c32 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -101,7 +101,7 @@ void Breadcrumbbar::append_segment(String text, Gfx::Bitmap const* icon, String auto icon_width = icon ? icon->width() : 0; auto icon_padding = icon ? 4 : 0; - const int max_button_width = 100; + int const max_button_width = 100; auto button_width = min(button_text_width + icon_width + icon_padding + 16, max_button_width); auto shrunken_width = icon_width + icon_padding + (icon ? 4 : 16); diff --git a/Userland/Libraries/LibGUI/Button.h b/Userland/Libraries/LibGUI/Button.h index 73c4102a81..5e1cb76a84 100644 --- a/Userland/Libraries/LibGUI/Button.h +++ b/Userland/Libraries/LibGUI/Button.h @@ -23,7 +23,7 @@ public: void set_icon(RefPtr<Gfx::Bitmap>); void set_icon_from_path(String const&); - const Gfx::Bitmap* icon() const { return m_icon.ptr(); } + Gfx::Bitmap const* icon() const { return m_icon.ptr(); } Gfx::Bitmap* icon() { return m_icon.ptr(); } void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; } diff --git a/Userland/Libraries/LibGUI/Calendar.cpp b/Userland/Libraries/LibGUI/Calendar.cpp index cd3cbbca3b..922e030255 100644 --- a/Userland/Libraries/LibGUI/Calendar.cpp +++ b/Userland/Libraries/LibGUI/Calendar.cpp @@ -17,10 +17,10 @@ REGISTER_WIDGET(GUI, Calendar); namespace GUI { -static const auto extra_large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular36.font"); -static const auto large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font"); -static const auto medium_font = Gfx::BitmapFont::load_from_file("/res/fonts/PebbletonRegular14.font"); -static const auto small_font = Gfx::BitmapFont::load_from_file("/res/fonts/KaticaRegular10.font"); +static auto const extra_large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular36.font"); +static auto const large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font"); +static auto const medium_font = Gfx::BitmapFont::load_from_file("/res/fonts/PebbletonRegular14.font"); +static auto const small_font = Gfx::BitmapFont::load_from_file("/res/fonts/KaticaRegular10.font"); Calendar::Calendar(Core::DateTime date_time, Mode mode) : m_selected_date(date_time) @@ -75,7 +75,7 @@ void Calendar::resize_event(GUI::ResizeEvent& event) set_show_year(false); - const int GRID_LINES = 6; + int const GRID_LINES = 6; int tile_width = (m_event_size.width() - GRID_LINES) / 7; int width_remainder = (m_event_size.width() - GRID_LINES) % 7; int y_offset = is_showing_days_of_the_week() ? 16 : 0; @@ -124,10 +124,10 @@ void Calendar::resize_event(GUI::ResizeEvent& event) set_show_month_and_year(false); - const int VERT_GRID_LINES = 27; - const int HORI_GRID_LINES = 15; - const int THREADING = 3; - const int MONTH_TITLE = 19; + int const VERT_GRID_LINES = 27; + int const HORI_GRID_LINES = 15; + int const THREADING = 3; + int const MONTH_TITLE = 19; int tile_width = (m_event_size.width() - VERT_GRID_LINES) / 28; int width_remainder = (m_event_size.width() - VERT_GRID_LINES) % 28; int y_offset = is_showing_year() ? 22 : 0; diff --git a/Userland/Libraries/LibGUI/ColumnsView.cpp b/Userland/Libraries/LibGUI/ColumnsView.cpp index 67ba0bce1b..ce1cbef995 100644 --- a/Userland/Libraries/LibGUI/ColumnsView.cpp +++ b/Userland/Libraries/LibGUI/ColumnsView.cpp @@ -156,7 +156,7 @@ void ColumnsView::paint_event(PaintEvent& event) } } -void ColumnsView::push_column(const ModelIndex& parent_index) +void ColumnsView::push_column(ModelIndex const& parent_index) { VERIFY(model()); @@ -206,7 +206,7 @@ void ColumnsView::update_column_sizes() set_content_size({ total_width, total_height }); } -ModelIndex ColumnsView::index_at_event_position(const Gfx::IntPoint& a_position) const +ModelIndex ColumnsView::index_at_event_position(Gfx::IntPoint const& a_position) const { if (!model()) return {}; @@ -306,7 +306,7 @@ void ColumnsView::move_cursor(CursorMovement movement, SelectionUpdate selection set_cursor(new_index, selection_update); } -Gfx::IntRect ColumnsView::content_rect(const ModelIndex& index) const +Gfx::IntRect ColumnsView::content_rect(ModelIndex const& index) const { if (!index.is_valid()) return {}; diff --git a/Userland/Libraries/LibGUI/ColumnsView.h b/Userland/Libraries/LibGUI/ColumnsView.h index 3f37463106..f0d1ffea14 100644 --- a/Userland/Libraries/LibGUI/ColumnsView.h +++ b/Userland/Libraries/LibGUI/ColumnsView.h @@ -18,14 +18,14 @@ public: int model_column() const { return m_model_column; } void set_model_column(int column) { m_model_column = column; } - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override; - virtual Gfx::IntRect content_rect(const ModelIndex&) const override; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override; + virtual Gfx::IntRect content_rect(ModelIndex const&) const override; virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override; private: ColumnsView(); virtual ~ColumnsView() override = default; - void push_column(const ModelIndex& parent_index); + void push_column(ModelIndex const& parent_index); void update_column_sizes(); int item_height() const { return 18; } diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index 294461fc45..4f82b9fea3 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -145,7 +145,7 @@ void ComboBox::set_editor_placeholder(StringView placeholder) m_editor->set_placeholder(placeholder); } -const String& ComboBox::editor_placeholder() const +String const& ComboBox::editor_placeholder() const { return m_editor->placeholder(); } @@ -170,7 +170,7 @@ void ComboBox::navigate_relative(int delta) on_change(m_editor->text(), current_selected); } -void ComboBox::selection_updated(const ModelIndex& index) +void ComboBox::selection_updated(ModelIndex const& index) { if (index.is_valid()) m_selected_index = index; @@ -274,7 +274,7 @@ String ComboBox::text() const return m_editor->text(); } -void ComboBox::set_text(const String& text) +void ComboBox::set_text(String const& text) { m_editor->set_text(text); } @@ -292,7 +292,7 @@ Model* ComboBox::model() return m_list_view->model(); } -const Model* ComboBox::model() const +Model const* ComboBox::model() const { return m_list_view->model(); } diff --git a/Userland/Libraries/LibGUI/ComboBox.h b/Userland/Libraries/LibGUI/ComboBox.h index 4db98b30e9..07955c3f7b 100644 --- a/Userland/Libraries/LibGUI/ComboBox.h +++ b/Userland/Libraries/LibGUI/ComboBox.h @@ -21,14 +21,14 @@ public: virtual ~ComboBox() override; String text() const; - void set_text(const String&); + void set_text(String const&); void open(); void close(); void select_all(); Model* model(); - const Model* model() const; + Model const* model() const; void set_model(NonnullRefPtr<Model>); size_t selected_index() const; @@ -41,9 +41,9 @@ public: void set_model_column(int); void set_editor_placeholder(StringView placeholder); - const String& editor_placeholder() const; + String const& editor_placeholder() const; - Function<void(const String&, const ModelIndex&)> on_change; + Function<void(String const&, ModelIndex const&)> on_change; Function<void()> on_return_pressed; protected: @@ -51,7 +51,7 @@ protected: virtual void resize_event(ResizeEvent&) override; private: - void selection_updated(const ModelIndex&); + void selection_updated(ModelIndex const&); void navigate(AbstractView::CursorMovement); void navigate_relative(int); diff --git a/Userland/Libraries/LibGUI/CommonActions.cpp b/Userland/Libraries/LibGUI/CommonActions.cpp index 27c3e8cfb8..4255ca6ad8 100644 --- a/Userland/Libraries/LibGUI/CommonActions.cpp +++ b/Userland/Libraries/LibGUI/CommonActions.cpp @@ -15,7 +15,7 @@ namespace GUI { namespace CommonActions { -NonnullRefPtr<Action> make_about_action(const String& app_name, const Icon& app_icon, Window* parent) +NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_icon, Window* parent) { auto weak_parent = AK::make_weak_ptr_if_nonnull<Window>(parent); auto action = Action::create(String::formatted("&About {}", app_name), app_icon.bitmap_for_size(16), [=](auto&) { diff --git a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp index 29d1f10b7f..a06a32f7b4 100644 --- a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp +++ b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp @@ -36,7 +36,7 @@ static void initialize_if_needed() s_initialized = true; } -void CommonLocationsProvider::load_from_json(const String& json_path) +void CommonLocationsProvider::load_from_json(String const& json_path) { auto file = Core::File::construct(json_path); if (!file->open(Core::OpenMode::ReadOnly)) { @@ -69,7 +69,7 @@ void CommonLocationsProvider::load_from_json(const String& json_path) s_initialized = true; } -const Vector<CommonLocationsProvider::CommonLocation>& CommonLocationsProvider::common_locations() +Vector<CommonLocationsProvider::CommonLocation> const& CommonLocationsProvider::common_locations() { initialize_if_needed(); return s_common_locations; diff --git a/Userland/Libraries/LibGUI/CommonLocationsProvider.h b/Userland/Libraries/LibGUI/CommonLocationsProvider.h index 813439195d..0de400a83e 100644 --- a/Userland/Libraries/LibGUI/CommonLocationsProvider.h +++ b/Userland/Libraries/LibGUI/CommonLocationsProvider.h @@ -20,8 +20,8 @@ public: String path; }; - static void load_from_json(const String& json_path); - static const Vector<CommonLocation>& common_locations(); + static void load_from_json(String const& json_path); + static Vector<CommonLocation> const& common_locations(); }; } diff --git a/Userland/Libraries/LibGUI/ConnectionToWindowMangerServer.cpp b/Userland/Libraries/LibGUI/ConnectionToWindowMangerServer.cpp index 006e41d02b..e5b8e482d9 100644 --- a/Userland/Libraries/LibGUI/ConnectionToWindowMangerServer.cpp +++ b/Userland/Libraries/LibGUI/ConnectionToWindowMangerServer.cpp @@ -27,7 +27,7 @@ void ConnectionToWindowMangerServer::window_state_changed(i32 wm_id, i32 client_ Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(client_id, window_id, parent_client_id, parent_window_id, title, rect, workspace_row, workspace_column, is_active, is_modal, static_cast<WindowType>(window_type), is_minimized, is_frameless, progress)); } -void ConnectionToWindowMangerServer::applet_area_size_changed(i32 wm_id, const Gfx::IntSize& size) +void ConnectionToWindowMangerServer::applet_area_size_changed(i32 wm_id, Gfx::IntSize const& size) { if (auto* window = Window::from_window_id(wm_id)) Core::EventLoop::current().post_event(*window, make<WMAppletAreaSizeChangedEvent>(size)); diff --git a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp index d7cb7517e9..93c49ae504 100644 --- a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp +++ b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp @@ -68,7 +68,7 @@ void ConnectionToWindowServer::update_system_theme(Core::AnonymousBuffer const& }); } -void ConnectionToWindowServer::update_system_fonts(const String& default_font_query, const String& fixed_width_font_query) +void ConnectionToWindowServer::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query) { Gfx::FontDatabase::set_default_font_query(default_font_query); Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); diff --git a/Userland/Libraries/LibGUI/Desktop.cpp b/Userland/Libraries/LibGUI/Desktop.cpp index f962a005c9..74e443557c 100644 --- a/Userland/Libraries/LibGUI/Desktop.cpp +++ b/Userland/Libraries/LibGUI/Desktop.cpp @@ -22,7 +22,7 @@ Desktop& Desktop::the() return s_the; } -void Desktop::did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns) +void Desktop::did_receive_screen_rects(Badge<ConnectionToWindowServer>, Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns) { m_main_screen_index = main_screen_index; m_rects = rects; diff --git a/Userland/Libraries/LibGUI/Desktop.h b/Userland/Libraries/LibGUI/Desktop.h index 82f5143fb3..952977997f 100644 --- a/Userland/Libraries/LibGUI/Desktop.h +++ b/Userland/Libraries/LibGUI/Desktop.h @@ -35,7 +35,7 @@ public: bool set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<String> path); Gfx::IntRect rect() const { return m_bounding_rect; } - const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; } + Vector<Gfx::IntRect, 4> const& rects() const { return m_rects; } size_t main_screen_index() const { return m_main_screen_index; } unsigned workspace_rows() const { return m_workspace_rows; } @@ -43,7 +43,7 @@ public: int taskbar_height() const { return TaskbarWindow::taskbar_height(); } - void did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned); + void did_receive_screen_rects(Badge<ConnectionToWindowServer>, Vector<Gfx::IntRect, 4> const&, size_t, unsigned, unsigned); template<typename F> void on_receive_screen_rects(F&& callback) diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index 839b1f8aef..349c230246 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -73,20 +73,20 @@ void DragOperation::notify_cancelled(Badge<ConnectionToWindowServer>) s_current_drag_operation->done(Outcome::Cancelled); } -void DragOperation::set_text(const String& text) +void DragOperation::set_text(String const& text) { if (!m_mime_data) m_mime_data = Core::MimeData::construct(); m_mime_data->set_text(text); } -void DragOperation::set_bitmap(const Gfx::Bitmap* bitmap) +void DragOperation::set_bitmap(Gfx::Bitmap const* bitmap) { if (!m_mime_data) m_mime_data = Core::MimeData::construct(); if (bitmap) m_mime_data->set_data("image/x-raw-bitmap", bitmap->serialize_to_byte_buffer()); } -void DragOperation::set_data(const String& data_type, const String& data) +void DragOperation::set_data(String const& data_type, String const& data) { if (!m_mime_data) m_mime_data = Core::MimeData::construct(); diff --git a/Userland/Libraries/LibGUI/DragOperation.h b/Userland/Libraries/LibGUI/DragOperation.h index 647e728d7c..b9419af34e 100644 --- a/Userland/Libraries/LibGUI/DragOperation.h +++ b/Userland/Libraries/LibGUI/DragOperation.h @@ -27,9 +27,9 @@ public: virtual ~DragOperation() override = default; void set_mime_data(RefPtr<Core::MimeData> mime_data) { m_mime_data = move(mime_data); } - void set_text(const String& text); - void set_bitmap(const Gfx::Bitmap* bitmap); - void set_data(const String& data_type, const String& data); + void set_text(String const& text); + void set_bitmap(Gfx::Bitmap const* bitmap); + void set_data(String const& data_type, String const& data); Outcome exec(); Outcome outcome() const { return m_outcome; } diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp index 0141ffee11..34f6f56e69 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.cpp +++ b/Userland/Libraries/LibGUI/EditingEngine.cpp @@ -33,7 +33,7 @@ void EditingEngine::detach() m_editor = nullptr; } -bool EditingEngine::on_key(const KeyEvent& event) +bool EditingEngine::on_key(KeyEvent const& event) { if (event.key() == KeyCode::Key_Left) { if (!event.shift() && m_editor->selection().is_valid()) { @@ -268,7 +268,7 @@ void EditingEngine::move_to_logical_line_end() m_editor->set_cursor({ m_editor->cursor().line(), m_editor->current_line().length() }); } -void EditingEngine::move_one_up(const KeyEvent& event) +void EditingEngine::move_one_up(KeyEvent const& event) { if (m_editor->cursor().line() > 0 || m_editor->is_wrapping_enabled()) { if (event.ctrl() && event.shift()) { @@ -288,7 +288,7 @@ void EditingEngine::move_one_up(const KeyEvent& event) } }; -void EditingEngine::move_one_down(const KeyEvent& event) +void EditingEngine::move_one_down(KeyEvent const& event) { if (m_editor->cursor().line() < (m_editor->line_count() - 1) || m_editor->is_wrapping_enabled()) { if (event.ctrl() && event.shift()) { @@ -406,7 +406,7 @@ TextPosition EditingEngine::find_beginning_of_next_word() for (size_t column_index = 0; column_index < lines.at(line_index).length(); column_index++) { if (line_index == cursor.line() && column_index < cursor.column()) continue; - const u32* line_chars = line.view().code_points(); + u32 const* line_chars = line.view().code_points(); const u32 current_char = line_chars[column_index]; if (started_on_punct && is_vim_alphanumeric(current_char)) { @@ -470,7 +470,7 @@ TextPosition EditingEngine::find_end_of_next_word() if (line_index == cursor.line() && column_index < cursor.column()) continue; - const u32* line_chars = line.view().code_points(); + u32 const* line_chars = line.view().code_points(); const u32 current_char = line_chars[column_index]; if (column_index == lines.at(line_index).length() - 1 && !is_first_iteration && (is_vim_alphanumeric(current_char) || is_vim_punctuation(current_char))) @@ -526,7 +526,7 @@ TextPosition EditingEngine::find_end_of_previous_word() if (line_index == cursor.line() && column_index > cursor.column()) continue; - const u32* line_chars = line.view().code_points(); + u32 const* line_chars = line.view().code_points(); const u32 current_char = line_chars[column_index]; if (started_on_punct && is_vim_alphanumeric(current_char)) { @@ -591,7 +591,7 @@ TextPosition EditingEngine::find_beginning_of_previous_word() continue; } - const u32* line_chars = line.view().code_points(); + u32 const* line_chars = line.view().code_points(); const u32 current_char = line_chars[column_index]; if (column_index == 0 && !is_first_iteration && (is_vim_alphanumeric(current_char) || is_vim_punctuation(current_char))) { diff --git a/Userland/Libraries/LibGUI/EditingEngine.h b/Userland/Libraries/LibGUI/EditingEngine.h index 3b0e617cc7..bef68b2200 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.h +++ b/Userland/Libraries/LibGUI/EditingEngine.h @@ -40,7 +40,7 @@ public: return *m_editor.unsafe_ptr(); } - virtual bool on_key(const KeyEvent& event); + virtual bool on_key(KeyEvent const& event); bool is_regular() const { return engine_type() == EngineType::Regular; } bool is_vim() const { return engine_type() == EngineType::Vim; } @@ -52,8 +52,8 @@ protected: void move_one_left(); void move_one_right(); - void move_one_up(const KeyEvent& event); - void move_one_down(const KeyEvent& event); + void move_one_up(KeyEvent const& event); + void move_one_down(KeyEvent const& event); void move_to_previous_span(); void move_to_next_span(); void move_to_logical_line_beginning(); diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.h b/Userland/Libraries/LibGUI/EmojiInputDialog.h index 739c09abb2..e291887ecd 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.h +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.h @@ -14,7 +14,7 @@ class EmojiInputDialog final : public Dialog { C_OBJECT(EmojiInputDialog); public: - const String& selected_emoji_text() const { return m_selected_emoji_text; } + String const& selected_emoji_text() const { return m_selected_emoji_text; } private: virtual void event(Core::Event&) override; diff --git a/Userland/Libraries/LibGUI/Event.cpp b/Userland/Libraries/LibGUI/Event.cpp index 414e21576d..88c8089702 100644 --- a/Userland/Libraries/LibGUI/Event.cpp +++ b/Userland/Libraries/LibGUI/Event.cpp @@ -12,7 +12,7 @@ namespace GUI { -DropEvent::DropEvent(const Gfx::IntPoint& position, const String& text, NonnullRefPtr<Core::MimeData> mime_data) +DropEvent::DropEvent(Gfx::IntPoint const& position, String const& text, NonnullRefPtr<Core::MimeData> mime_data) : Event(Event::Drop) , m_position(position) , m_text(text) diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index 90cae6e922..a0b013b0c1 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -133,13 +133,13 @@ private: class WMAppletAreaSizeChangedEvent : public WMEvent { public: - explicit WMAppletAreaSizeChangedEvent(const Gfx::IntSize& size) + explicit WMAppletAreaSizeChangedEvent(Gfx::IntSize const& size) : WMEvent(Event::Type::WM_AppletAreaSizeChanged, 0, 0) , m_size(size) { } - const Gfx::IntSize& size() const { return m_size; } + Gfx::IntSize const& size() const { return m_size; } private: Gfx::IntSize m_size; @@ -155,7 +155,7 @@ public: class WMWindowStateChangedEvent : public WMEvent { public: - WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, StringView title, const Gfx::IntRect& rect, unsigned workspace_row, unsigned workspace_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress) + WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, StringView title, Gfx::IntRect const& rect, unsigned workspace_row, unsigned workspace_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress) : WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id) , m_parent_client_id(parent_client_id) , m_parent_window_id(parent_window_id) @@ -174,8 +174,8 @@ public: int parent_client_id() const { return m_parent_client_id; } int parent_window_id() const { return m_parent_window_id; } - const String& title() const { return m_title; } - const Gfx::IntRect& rect() const { return m_rect; } + String const& title() const { return m_title; } + Gfx::IntRect const& rect() const { return m_rect; } bool is_active() const { return m_active; } bool is_modal() const { return m_modal; } WindowType window_type() const { return m_window_type; } @@ -202,13 +202,13 @@ private: class WMWindowRectChangedEvent : public WMEvent { public: - WMWindowRectChangedEvent(int client_id, int window_id, const Gfx::IntRect& rect) + WMWindowRectChangedEvent(int client_id, int window_id, Gfx::IntRect const& rect) : WMEvent(Event::Type::WM_WindowRectChanged, client_id, window_id) , m_rect(rect) { } - const Gfx::IntRect& rect() const { return m_rect; } + Gfx::IntRect const& rect() const { return m_rect; } private: Gfx::IntRect m_rect; @@ -216,13 +216,13 @@ private: class WMWindowIconBitmapChangedEvent : public WMEvent { public: - WMWindowIconBitmapChangedEvent(int client_id, int window_id, const Gfx::Bitmap* bitmap) + WMWindowIconBitmapChangedEvent(int client_id, int window_id, Gfx::Bitmap const* bitmap) : WMEvent(Event::Type::WM_WindowIconBitmapChanged, client_id, window_id) , m_bitmap(move(bitmap)) { } - const Gfx::Bitmap* bitmap() const { return m_bitmap; } + Gfx::Bitmap const* bitmap() const { return m_bitmap; } private: RefPtr<Gfx::Bitmap> m_bitmap; @@ -241,8 +241,8 @@ public: unsigned current_column() const { return m_current_column; } private: - const unsigned m_current_row; - const unsigned m_current_column; + unsigned const m_current_row; + unsigned const m_current_column; }; class WMKeymapChangedEvent : public WMEvent { @@ -268,8 +268,8 @@ public: { } - const Vector<Gfx::IntRect, 32>& rects() const { return m_rects; } - const Gfx::IntSize& window_size() const { return m_window_size; } + Vector<Gfx::IntRect, 32> const& rects() const { return m_rects; } + Gfx::IntSize const& window_size() const { return m_window_size; } private: Vector<Gfx::IntRect, 32> m_rects; @@ -278,15 +278,15 @@ private: class PaintEvent final : public Event { public: - explicit PaintEvent(const Gfx::IntRect& rect, const Gfx::IntSize& window_size = {}) + explicit PaintEvent(Gfx::IntRect const& rect, Gfx::IntSize const& window_size = {}) : Event(Event::Paint) , m_rect(rect) , m_window_size(window_size) { } - const Gfx::IntRect& rect() const { return m_rect; } - const Gfx::IntSize& window_size() const { return m_window_size; } + Gfx::IntRect const& rect() const { return m_rect; } + Gfx::IntSize const& window_size() const { return m_window_size; } private: Gfx::IntRect m_rect; @@ -295,13 +295,13 @@ private: class ResizeEvent final : public Event { public: - explicit ResizeEvent(const Gfx::IntSize& size) + explicit ResizeEvent(Gfx::IntSize const& size) : Event(Event::Resize) , m_size(size) { } - const Gfx::IntSize& size() const { return m_size; } + Gfx::IntSize const& size() const { return m_size; } private: Gfx::IntSize m_size; @@ -309,15 +309,15 @@ private: class ContextMenuEvent final : public Event { public: - explicit ContextMenuEvent(const Gfx::IntPoint& position, const Gfx::IntPoint& screen_position) + explicit ContextMenuEvent(Gfx::IntPoint const& position, Gfx::IntPoint const& screen_position) : Event(Event::ContextMenu) , m_position(position) , m_screen_position(screen_position) { } - const Gfx::IntPoint& position() const { return m_position; } - const Gfx::IntPoint& screen_position() const { return m_screen_position; } + Gfx::IntPoint const& position() const { return m_position; } + Gfx::IntPoint const& screen_position() const { return m_screen_position; } private: Gfx::IntPoint m_position; @@ -401,7 +401,7 @@ private: class MouseEvent final : public Event { public: - MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y, int wheel_raw_delta_x, int wheel_raw_delta_y) + MouseEvent(Type type, Gfx::IntPoint const& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y, int wheel_raw_delta_x, int wheel_raw_delta_y) : Event(type) , m_position(position) , m_buttons(buttons) @@ -414,7 +414,7 @@ public: { } - const Gfx::IntPoint& position() const { return m_position; } + Gfx::IntPoint const& position() const { return m_position; } int x() const { return m_position.x(); } int y() const { return m_position.y(); } MouseButton button() const { return m_button; } @@ -442,15 +442,15 @@ private: class DragEvent final : public Event { public: - DragEvent(Type type, const Gfx::IntPoint& position, Vector<String> mime_types) + DragEvent(Type type, Gfx::IntPoint const& position, Vector<String> mime_types) : Event(type) , m_position(position) , m_mime_types(move(mime_types)) { } - const Gfx::IntPoint& position() const { return m_position; } - const Vector<String>& mime_types() const { return m_mime_types; } + Gfx::IntPoint const& position() const { return m_position; } + Vector<String> const& mime_types() const { return m_mime_types; } private: Gfx::IntPoint m_position; @@ -459,13 +459,13 @@ private: class DropEvent final : public Event { public: - DropEvent(const Gfx::IntPoint&, const String& text, NonnullRefPtr<Core::MimeData> mime_data); + DropEvent(Gfx::IntPoint const&, String const& text, NonnullRefPtr<Core::MimeData> mime_data); ~DropEvent() = default; - const Gfx::IntPoint& position() const { return m_position; } - const String& text() const { return m_text; } - const Core::MimeData& mime_data() const { return m_mime_data; } + Gfx::IntPoint const& position() const { return m_position; } + String const& text() const { return m_text; } + Core::MimeData const& mime_data() const { return m_mime_data; } private: Gfx::IntPoint m_position; @@ -491,14 +491,14 @@ public: class ScreenRectsChangeEvent final : public Event { public: - explicit ScreenRectsChangeEvent(const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index) + explicit ScreenRectsChangeEvent(Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index) : Event(Type::ScreenRectsChange) , m_rects(rects) , m_main_screen_index(main_screen_index) { } - const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; } + Vector<Gfx::IntRect, 4> const& rects() const { return m_rects; } size_t main_screen_index() const { return m_main_screen_index; } private: diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp index 821af95491..495cae5b3f 100644 --- a/Userland/Libraries/LibGUI/FileIconProvider.cpp +++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp @@ -129,7 +129,7 @@ Icon FileIconProvider::filetype_image_icon() return s_filetype_image_icon; } -Icon FileIconProvider::icon_for_path(const String& path) +Icon FileIconProvider::icon_for_path(String const& path) { struct stat stat; if (::stat(path.characters(), &stat) < 0) @@ -137,7 +137,7 @@ Icon FileIconProvider::icon_for_path(const String& path) return icon_for_path(path, stat.st_mode); } -Icon FileIconProvider::icon_for_executable(const String& path) +Icon FileIconProvider::icon_for_executable(String const& path) { static HashMap<String, Icon> app_icon_cache; @@ -167,7 +167,7 @@ Icon FileIconProvider::icon_for_executable(const String& path) return s_executable_icon; } - auto image = ELF::Image((const u8*)mapped_file->data(), mapped_file->size()); + auto image = ELF::Image((u8 const*)mapped_file->data(), mapped_file->size()); if (!image.is_valid()) { app_icon_cache.set(path, s_executable_icon); return s_executable_icon; @@ -176,7 +176,7 @@ Icon FileIconProvider::icon_for_executable(const String& path) // If any of the required sections are missing then use the defaults Icon icon; struct IconSection { - const char* section_name; + char const* section_name; int image_size; }; @@ -186,7 +186,7 @@ Icon FileIconProvider::icon_for_executable(const String& path) }; bool had_error = false; - for (const auto& icon_section : icon_sections) { + for (auto const& icon_section : icon_sections) { auto section = image.lookup_section(icon_section.section_name); RefPtr<Gfx::Bitmap> bitmap; @@ -217,7 +217,7 @@ Icon FileIconProvider::icon_for_executable(const String& path) return icon; } -Icon FileIconProvider::icon_for_path(const String& path, mode_t mode) +Icon FileIconProvider::icon_for_path(String const& path, mode_t mode) { initialize_if_needed(); if (path == "/") diff --git a/Userland/Libraries/LibGUI/FileIconProvider.h b/Userland/Libraries/LibGUI/FileIconProvider.h index afd3c44202..89aa8a3709 100644 --- a/Userland/Libraries/LibGUI/FileIconProvider.h +++ b/Userland/Libraries/LibGUI/FileIconProvider.h @@ -14,9 +14,9 @@ namespace GUI { class FileIconProvider { public: - static Icon icon_for_path(const String&, mode_t); - static Icon icon_for_path(const String&); - static Icon icon_for_executable(const String&); + static Icon icon_for_path(String const&, mode_t); + static Icon icon_for_path(String const&); + static Icon icon_for_executable(String const&); static Icon filetype_image_icon(); static Icon directory_icon(); diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 4d7001cab7..20333b91f0 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -32,7 +32,7 @@ namespace GUI { -Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, StringView path, bool folder, ScreenPosition screen_position) +Optional<String> FilePicker::get_open_filepath(Window* parent_window, String const& window_title, StringView path, bool folder, ScreenPosition screen_position) { auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, "", path, screen_position); @@ -50,7 +50,7 @@ Optional<String> FilePicker::get_open_filepath(Window* parent_window, const Stri return {}; } -Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path, ScreenPosition screen_position) +Optional<String> FilePicker::get_save_filepath(Window* parent_window, String const& title, String const& extension, StringView path, ScreenPosition screen_position) { auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension), path, screen_position); @@ -115,7 +115,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St }; auto open_parent_directory_action = Action::create( - "Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [this](const Action&) { + "Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) { set_path(String::formatted("{}/..", m_model->root_path())); }, this); @@ -129,7 +129,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St toolbar.add_separator(); auto mkdir_action = Action::create( - "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const Action&) { + "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) { String value; if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value)); @@ -286,7 +286,7 @@ void FilePicker::on_file_return() done(ExecOK); } -void FilePicker::set_path(const String& path) +void FilePicker::set_path(String const& path) { if (access(path.characters(), R_OK | X_OK) == -1) { GUI::MessageBox::show(this, String::formatted("Could not open '{}':\n{}", path, strerror(errno)), "Error", GUI::MessageBox::Type::Error); diff --git a/Userland/Libraries/LibGUI/FilePicker.h b/Userland/Libraries/LibGUI/FilePicker.h index 1152e95f4a..441cfeaefa 100644 --- a/Userland/Libraries/LibGUI/FilePicker.h +++ b/Userland/Libraries/LibGUI/FilePicker.h @@ -28,8 +28,8 @@ public: Save }; - static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); - static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); + static Optional<String> get_open_filepath(Window* parent_window, String const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); + static Optional<String> get_save_filepath(Window* parent_window, String const& title, String const& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); virtual ~FilePicker() override; @@ -38,7 +38,7 @@ public: private: void on_file_return(); - void set_path(const String&); + void set_path(String const&); // ^GUI::ModelClient virtual void model_did_update(unsigned) override; diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index 6fd6c9baf4..a796c93a84 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -110,7 +110,7 @@ public: String full_path(ModelIndex const&) const; ModelIndex index(String path, int column) const; - void update_node_on_selection(ModelIndex const&, const bool); + void update_node_on_selection(ModelIndex const&, bool const); ModelIndex m_previously_selected_index {}; Node const& node(ModelIndex const& index) const; diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp index 6def60e8f4..bba820f0c9 100644 --- a/Userland/Libraries/LibGUI/FontPicker.cpp +++ b/Userland/Libraries/LibGUI/FontPicker.cpp @@ -18,7 +18,7 @@ namespace GUI { -FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, bool fixed_width_only) +FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, bool fixed_width_only) : Dialog(parent_window) , m_fixed_width_only(fixed_width_only) { @@ -170,7 +170,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo set_font(current_font); } -void FontPicker::set_font(const Gfx::Font* font) +void FontPicker::set_font(Gfx::Font const* font) { if (m_font == font) return; diff --git a/Userland/Libraries/LibGUI/FontPicker.h b/Userland/Libraries/LibGUI/FontPicker.h index a40a28f168..376bcfa881 100644 --- a/Userland/Libraries/LibGUI/FontPicker.h +++ b/Userland/Libraries/LibGUI/FontPicker.h @@ -20,14 +20,14 @@ public: virtual ~FontPicker() override = default; RefPtr<Gfx::Font> font() const { return m_font; } - void set_font(const Gfx::Font*); + void set_font(Gfx::Font const*); private: - FontPicker(Window* parent_window = nullptr, const Gfx::Font* current_font = nullptr, bool fixed_width_only = false); + FontPicker(Window* parent_window = nullptr, Gfx::Font const* current_font = nullptr, bool fixed_width_only = false); void update_font(); - const bool m_fixed_width_only; + bool const m_fixed_width_only; RefPtr<Gfx::Font> m_font; diff --git a/Userland/Libraries/LibGUI/Frame.h b/Userland/Libraries/LibGUI/Frame.h index 5bd7ead299..91c1f42241 100644 --- a/Userland/Libraries/LibGUI/Frame.h +++ b/Userland/Libraries/LibGUI/Frame.h @@ -28,7 +28,7 @@ public: Gfx::FrameShape frame_shape() const { return m_shape; } void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; } - Gfx::IntRect frame_inner_rect_for_size(const Gfx::IntSize& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; } + Gfx::IntRect frame_inner_rect_for_size(Gfx::IntSize const& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; } Gfx::IntRect frame_inner_rect() const { return frame_inner_rect_for_size(size()); } virtual Gfx::IntRect children_clip_rect() const override; diff --git a/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.cpp b/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.cpp index 41c9de0446..b6a262f8e5 100644 --- a/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.cpp +++ b/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.cpp @@ -11,7 +11,7 @@ namespace GUI::GML { -static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, Token::Type type) +static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, Token::Type type) { switch (type) { case Token::Type::LeftCurly: @@ -38,7 +38,7 @@ bool SyntaxHighlighter::is_identifier(u64 token) const return ini_token == Token::Type::Identifier; } -void SyntaxHighlighter::rehighlight(const Palette& palette) +void SyntaxHighlighter::rehighlight(Palette const& palette) { auto text = m_client->get_text(); Lexer lexer(text); diff --git a/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.h b/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.h index 0c2961e90a..7a660a73c4 100644 --- a/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.h +++ b/Userland/Libraries/LibGUI/GML/SyntaxHighlighter.h @@ -19,7 +19,7 @@ public: virtual bool is_identifier(u64) const override; virtual Syntax::Language language() const override { return Syntax::Language::GML; } - virtual void rehighlight(const Palette&) override; + virtual void rehighlight(Palette const&) override; protected: virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override; diff --git a/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.cpp b/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.cpp index abc597861c..e531479730 100644 --- a/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.cpp +++ b/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.cpp @@ -10,7 +10,7 @@ #include <LibGfx/Palette.h> namespace GUI { -static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, GitCommitToken::Type type) +static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, GitCommitToken::Type type) { switch (type) { case GitCommitToken::Type::Comment: diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 0eacc7e284..590035b2f9 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -433,7 +433,7 @@ Model* HeaderView::model() return m_table_view.model(); } -const Model* HeaderView::model() const +Model const* HeaderView::model() const { return m_table_view.model(); } diff --git a/Userland/Libraries/LibGUI/HeaderView.h b/Userland/Libraries/LibGUI/HeaderView.h index 89c98ede6d..333761b743 100644 --- a/Userland/Libraries/LibGUI/HeaderView.h +++ b/Userland/Libraries/LibGUI/HeaderView.h @@ -21,7 +21,7 @@ public: Gfx::Orientation orientation() const { return m_orientation; } Model* model(); - const Model* model() const; + Model const* model() const; void set_section_size(int section, int size); int section_size(int section) const; diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp index aa592bc624..1a3af61faf 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -16,12 +16,12 @@ Icon::Icon() { } -Icon::Icon(const IconImpl& impl) +Icon::Icon(IconImpl const& impl) : m_impl(const_cast<IconImpl&>(impl)) { } -Icon::Icon(const Icon& other) +Icon::Icon(Icon const& other) : m_impl(other.m_impl) { } @@ -46,14 +46,14 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2) } } -const Gfx::Bitmap* IconImpl::bitmap_for_size(int size) const +Gfx::Bitmap const* IconImpl::bitmap_for_size(int size) const { auto it = m_bitmaps.find(size); if (it != m_bitmaps.end()) return it->value.ptr(); int best_diff_so_far = INT32_MAX; - const Gfx::Bitmap* best_fit = nullptr; + Gfx::Bitmap const* best_fit = nullptr; for (auto& it : m_bitmaps) { int abs_diff = abs(it.key - size); if (abs_diff < best_diff_so_far) { diff --git a/Userland/Libraries/LibGUI/Icon.h b/Userland/Libraries/LibGUI/Icon.h index a8592082d5..b11cbcf42b 100644 --- a/Userland/Libraries/LibGUI/Icon.h +++ b/Userland/Libraries/LibGUI/Icon.h @@ -20,7 +20,7 @@ public: static NonnullRefPtr<IconImpl> create() { return adopt_ref(*new IconImpl); } ~IconImpl() = default; - const Gfx::Bitmap* bitmap_for_size(int) const; + Gfx::Bitmap const* bitmap_for_size(int) const; void set_bitmap_for_size(int, RefPtr<Gfx::Bitmap>&&); Vector<int> sizes() const @@ -41,24 +41,24 @@ public: Icon(); explicit Icon(RefPtr<Gfx::Bitmap>&&); explicit Icon(RefPtr<Gfx::Bitmap>&&, RefPtr<Gfx::Bitmap>&&); - explicit Icon(const IconImpl&); - Icon(const Icon&); + explicit Icon(IconImpl const&); + Icon(Icon const&); ~Icon() = default; static Icon default_icon(StringView); static ErrorOr<Icon> try_create_default_icon(StringView); - Icon& operator=(const Icon& other) + Icon& operator=(Icon const& other) { if (this != &other) m_impl = other.m_impl; return *this; } - const Gfx::Bitmap* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); } + Gfx::Bitmap const* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); } void set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); } - const IconImpl& impl() const { return *m_impl; } + IconImpl const& impl() const { return *m_impl; } Vector<int> sizes() const { return m_impl->sizes(); } diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index 1d6717d210..991ef68017 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -40,7 +40,7 @@ void IconView::select_all() } } -void IconView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) +void IconView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) { if (!index.is_valid()) return; @@ -106,7 +106,7 @@ auto IconView::get_item_data(int item_index) const -> ItemData& return item_data; } -auto IconView::item_data_from_content_position(const Gfx::IntPoint& content_position) const -> ItemData* +auto IconView::item_data_from_content_position(Gfx::IntPoint const& content_position) const -> ItemData* { if (!m_visual_row_count || !m_visual_column_count) return nullptr; @@ -195,7 +195,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const }; } -ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const +ModelIndex IconView::index_at_event_position(Gfx::IntPoint const& position) const { VERIFY(model()); auto adjusted_position = to_content_position(position); @@ -244,7 +244,7 @@ void IconView::mouseup_event(MouseEvent& event) AbstractView::mouseup_event(event); } -bool IconView::update_rubber_banding(const Gfx::IntPoint& input_position) +bool IconView::update_rubber_banding(Gfx::IntPoint const& input_position) { auto adjusted_position = to_content_position(input_position.constrained(widget_inner_rect())); if (m_rubber_band_current != adjusted_position) { @@ -378,7 +378,7 @@ Gfx::IntRect IconView::editing_rect(ModelIndex const& index) const return editing_rect; } -void IconView::editing_widget_did_change(const ModelIndex& index) +void IconView::editing_widget_did_change(ModelIndex const& index) { if (m_editing_delegate->value().is_string()) { auto text_width = font_for_index(index)->width(m_editing_delegate->value().as_string()); @@ -389,7 +389,7 @@ void IconView::editing_widget_did_change(const ModelIndex& index) } Gfx::IntRect -IconView::paint_invalidation_rect(const ModelIndex& index) const +IconView::paint_invalidation_rect(ModelIndex const& index) const { if (!index.is_valid()) return {}; @@ -397,7 +397,7 @@ IconView::paint_invalidation_rect(const ModelIndex& index) const return item_data.rect(true); } -void IconView::did_change_hovered_index(const ModelIndex& old_index, const ModelIndex& new_index) +void IconView::did_change_hovered_index(ModelIndex const& old_index, ModelIndex const& new_index) { AbstractView::did_change_hovered_index(old_index, new_index); if (old_index.is_valid()) @@ -406,7 +406,7 @@ void IconView::did_change_hovered_index(const ModelIndex& old_index, const Model get_item_rects(new_index.row(), get_item_data(new_index.row()), font_for_index(new_index)); } -void IconView::did_change_cursor_index(const ModelIndex& old_index, const ModelIndex& new_index) +void IconView::did_change_cursor_index(ModelIndex const& old_index, ModelIndex const& new_index) { AbstractView::did_change_cursor_index(old_index, new_index); if (old_index.is_valid()) @@ -415,7 +415,7 @@ void IconView::did_change_cursor_index(const ModelIndex& old_index, const ModelI get_item_rects(new_index.row(), get_item_data(new_index.row()), font_for_index(new_index)); } -void IconView::get_item_rects(int item_index, ItemData& item_data, const Gfx::Font& font) const +void IconView::get_item_rects(int item_index, ItemData& item_data, Gfx::Font const& font) const { auto item_rect = this->item_rect(item_index); item_data.icon_rect = Gfx::IntRect(0, 0, 32, 32).centered_within(item_rect); @@ -589,7 +589,7 @@ void IconView::did_update_selection() // Selection was modified externally, we need to synchronize our cache do_clear_selection(); - selection().for_each_index([&](const ModelIndex& index) { + selection().for_each_index([&](ModelIndex const& index) { if (index.is_valid()) { auto item_index = model_index_to_item_index(index); if ((size_t)item_index < m_item_data_cache.size()) @@ -639,7 +639,7 @@ void IconView::add_selection(ItemData& item_data) AbstractView::add_selection(item_data.index); } -void IconView::add_selection(const ModelIndex& new_index) +void IconView::add_selection(ModelIndex const& new_index) { TemporaryChange change(m_changing_selection, true); auto item_index = model_index_to_item_index(new_index); @@ -654,7 +654,7 @@ void IconView::toggle_selection(ItemData& item_data) remove_item_selection(item_data); } -void IconView::toggle_selection(const ModelIndex& new_index) +void IconView::toggle_selection(ModelIndex const& new_index) { TemporaryChange change(m_changing_selection, true); auto item_index = model_index_to_item_index(new_index); @@ -684,7 +684,7 @@ void IconView::remove_item_selection(ItemData& item_data) AbstractView::remove_selection(item_data.index); } -void IconView::set_selection(const ModelIndex& new_index) +void IconView::set_selection(ModelIndex const& new_index) { TemporaryChange change(m_changing_selection, true); do_clear_selection(); @@ -775,7 +775,7 @@ void IconView::set_flow_direction(FlowDirection flow_direction) } template<typename Function> -inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const +inline IterationDecision IconView::for_each_item_intersecting_rect(Gfx::IntRect const& rect, Function f) const { VERIFY(model()); if (rect.is_empty()) @@ -814,7 +814,7 @@ inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::In } template<typename Function> -inline IterationDecision IconView::for_each_item_intersecting_rects(const Vector<Gfx::IntRect>& rects, Function f) const +inline IterationDecision IconView::for_each_item_intersecting_rects(Vector<Gfx::IntRect> const& rects, Function f) const { for (auto& rect : rects) { auto decision = for_each_item_intersecting_rect(rect, f); diff --git a/Userland/Libraries/LibGUI/IconView.h b/Userland/Libraries/LibGUI/IconView.h index 787d21cb1a..e94a994f62 100644 --- a/Userland/Libraries/LibGUI/IconView.h +++ b/Userland/Libraries/LibGUI/IconView.h @@ -29,7 +29,7 @@ public: int horizontal_padding() const { return m_horizontal_padding; } - virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override; + virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally = true, bool scroll_vertically = true) override; Gfx::IntSize effective_item_size() const { return m_effective_item_size; } @@ -39,8 +39,8 @@ public: int model_column() const { return m_model_column; } void set_model_column(int column) { m_model_column = column; } - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override; - virtual Gfx::IntRect content_rect(const ModelIndex&) const override; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override; + virtual Gfx::IntRect content_rect(ModelIndex const&) const override; virtual Gfx::IntRect editing_rect(ModelIndex const&) const override; virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override; @@ -56,9 +56,9 @@ private: virtual void mousedown_event(MouseEvent&) override; virtual void mousemove_event(MouseEvent&) override; virtual void mouseup_event(MouseEvent&) override; - virtual void did_change_hovered_index(const ModelIndex& old_index, const ModelIndex& new_index) override; - virtual void did_change_cursor_index(const ModelIndex& old_index, const ModelIndex& new_index) override; - virtual void editing_widget_did_change(const ModelIndex& index) override; + virtual void did_change_hovered_index(ModelIndex const& old_index, ModelIndex const& new_index) override; + virtual void did_change_cursor_index(ModelIndex const& old_index, ModelIndex const& new_index) override; + virtual void editing_widget_did_change(ModelIndex const& index) override; virtual void move_cursor(CursorMovement, SelectionUpdate) override; @@ -87,13 +87,13 @@ private: Gfx::IntRect hot_icon_rect() const { return icon_rect.inflated(10, 10); } Gfx::IntRect hot_text_rect() const { return text_rect.inflated(2, 2); } - bool is_intersecting(const Gfx::IntRect& rect) const + bool is_intersecting(Gfx::IntRect const& rect) const { VERIFY(valid); return hot_icon_rect().intersects(rect) || hot_text_rect().intersects(rect); } - bool is_containing(const Gfx::IntPoint& point) const + bool is_containing(Gfx::IntPoint const& point) const { VERIFY(valid); return hot_icon_rect().contains(point) || hot_text_rect().contains(point); @@ -108,12 +108,12 @@ private: }; template<typename Function> - IterationDecision for_each_item_intersecting_rect(const Gfx::IntRect&, Function) const; + IterationDecision for_each_item_intersecting_rect(Gfx::IntRect const&, Function) const; template<typename Function> - IterationDecision for_each_item_intersecting_rects(const Vector<Gfx::IntRect>&, Function) const; + IterationDecision for_each_item_intersecting_rects(Vector<Gfx::IntRect> const&, Function) const; - void column_row_from_content_position(const Gfx::IntPoint& content_position, int& row, int& column) const + void column_row_from_content_position(Gfx::IntPoint const& content_position, int& row, int& column) const { row = max(0, min(m_visual_row_count - 1, content_position.y() / effective_item_size().height())); column = max(0, min(m_visual_column_count - 1, content_position.x() / effective_item_size().width())); @@ -123,12 +123,12 @@ private: Gfx::IntRect item_rect(int item_index) const; void update_content_size(); void update_item_rects(int item_index, ItemData& item_data) const; - void get_item_rects(int item_index, ItemData& item_data, const Gfx::Font&) const; - bool update_rubber_banding(const Gfx::IntPoint&); + void get_item_rects(int item_index, ItemData& item_data, Gfx::Font const&) const; + bool update_rubber_banding(Gfx::IntPoint const&); int items_per_page() const; void rebuild_item_cache() const; - int model_index_to_item_index(const ModelIndex& model_index) const + int model_index_to_item_index(ModelIndex const& model_index) const { VERIFY(model_index.row() < item_count()); return model_index.row(); @@ -136,12 +136,12 @@ private: virtual void did_update_selection() override; virtual void clear_selection() override; - virtual void add_selection(const ModelIndex& new_index) override; - virtual void set_selection(const ModelIndex& new_index) override; - virtual void toggle_selection(const ModelIndex& new_index) override; + virtual void add_selection(ModelIndex const& new_index) override; + virtual void set_selection(ModelIndex const& new_index) override; + virtual void toggle_selection(ModelIndex const& new_index) override; ItemData& get_item_data(int) const; - ItemData* item_data_from_content_position(const Gfx::IntPoint&) const; + ItemData* item_data_from_content_position(Gfx::IntPoint const&) const; void do_clear_selection(); bool do_add_selection(ItemData&); void add_selection(ItemData&); diff --git a/Userland/Libraries/LibGUI/ImageWidget.cpp b/Userland/Libraries/LibGUI/ImageWidget.cpp index c59620db91..27667a21d1 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.cpp +++ b/Userland/Libraries/LibGUI/ImageWidget.cpp @@ -28,7 +28,7 @@ ImageWidget::ImageWidget(StringView) REGISTER_BOOL_PROPERTY("should_stretch", should_stretch, set_should_stretch); } -void ImageWidget::set_bitmap(const Gfx::Bitmap* bitmap) +void ImageWidget::set_bitmap(Gfx::Bitmap const* bitmap) { if (m_bitmap == bitmap) return; diff --git a/Userland/Libraries/LibGUI/ImageWidget.h b/Userland/Libraries/LibGUI/ImageWidget.h index e0fb19838d..80669ee51b 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.h +++ b/Userland/Libraries/LibGUI/ImageWidget.h @@ -18,7 +18,7 @@ class ImageWidget : public Frame { public: virtual ~ImageWidget() override = default; - void set_bitmap(const Gfx::Bitmap*); + void set_bitmap(Gfx::Bitmap const*); Gfx::Bitmap* bitmap() { return m_bitmap.ptr(); } Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); } diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp index 51b8ff9632..40435417b7 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp +++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp @@ -59,7 +59,7 @@ bool JsonArrayModel::store() return true; } -bool JsonArrayModel::add(const Vector<JsonValue>&& values) +bool JsonArrayModel::add(Vector<JsonValue> const&& values) { VERIFY(values.size() == m_fields.size()); JsonObject obj; @@ -108,7 +108,7 @@ bool JsonArrayModel::remove(int row) return true; } -Variant JsonArrayModel::data(const ModelIndex& index, ModelRole role) const +Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const { auto& field_spec = m_fields[index.column()]; auto& object = m_array.at(index.row()).as_object(); @@ -142,7 +142,7 @@ Variant JsonArrayModel::data(const ModelIndex& index, ModelRole role) const return {}; } -void JsonArrayModel::set_json_path(const String& json_path) +void JsonArrayModel::set_json_path(String const& json_path) { if (m_json_path == json_path) return; diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.h b/Userland/Libraries/LibGUI/JsonArrayModel.h index fcdb4ecfd3..62107a02bd 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.h +++ b/Userland/Libraries/LibGUI/JsonArrayModel.h @@ -16,7 +16,7 @@ namespace GUI { class JsonArrayModel final : public Model { public: struct FieldSpec { - FieldSpec(const String& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(const JsonObject&)>&& a_massage_for_display, Function<Variant(const JsonObject&)>&& a_massage_for_sort = {}, Function<Variant(const JsonObject&)>&& a_massage_for_custom = {}) + FieldSpec(String const& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(JsonObject const&)>&& a_massage_for_display, Function<Variant(JsonObject const&)>&& a_massage_for_sort = {}, Function<Variant(JsonObject const&)>&& a_massage_for_custom = {}) : column_name(a_column_name) , text_alignment(a_text_alignment) , massage_for_display(move(a_massage_for_display)) @@ -25,7 +25,7 @@ public: { } - FieldSpec(const String& a_json_field_name, const String& a_column_name, Gfx::TextAlignment a_text_alignment) + FieldSpec(String const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment) : json_field_name(a_json_field_name) , column_name(a_column_name) , text_alignment(a_text_alignment) @@ -35,35 +35,35 @@ public: String json_field_name; String column_name; Gfx::TextAlignment text_alignment; - Function<Variant(const JsonObject&)> massage_for_display; - Function<Variant(const JsonObject&)> massage_for_sort; - Function<Variant(const JsonObject&)> massage_for_custom; + Function<Variant(JsonObject const&)> massage_for_display; + Function<Variant(JsonObject const&)> massage_for_sort; + Function<Variant(JsonObject const&)> massage_for_custom; }; - static NonnullRefPtr<JsonArrayModel> create(const String& json_path, Vector<FieldSpec>&& fields) + static NonnullRefPtr<JsonArrayModel> create(String const& json_path, Vector<FieldSpec>&& fields) { return adopt_ref(*new JsonArrayModel(json_path, move(fields))); } virtual ~JsonArrayModel() override = default; - virtual int row_count(const ModelIndex& = ModelIndex()) const override { return m_array.size(); } - virtual int column_count(const ModelIndex& = ModelIndex()) const override { return m_fields.size(); } + virtual int row_count(ModelIndex const& = ModelIndex()) const override { return m_array.size(); } + virtual int column_count(ModelIndex const& = ModelIndex()) const override { return m_fields.size(); } virtual String column_name(int column) const override { return m_fields[column].column_name; } - virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override; + virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override; virtual void invalidate() override; virtual void update(); - const String& json_path() const { return m_json_path; } - void set_json_path(const String& json_path); + String const& json_path() const { return m_json_path; } + void set_json_path(String const& json_path); - bool add(const Vector<JsonValue>&& fields); + bool add(Vector<JsonValue> const&& fields); bool set(int row, Vector<JsonValue>&& fields); bool remove(int row); bool store(); private: - JsonArrayModel(const String& json_path, Vector<FieldSpec>&& fields) + JsonArrayModel(String const& json_path, Vector<FieldSpec>&& fields) : m_json_path(json_path) , m_fields(move(fields)) { diff --git a/Userland/Libraries/LibGUI/Label.cpp b/Userland/Libraries/LibGUI/Label.cpp index 8745611ed2..d41237803a 100644 --- a/Userland/Libraries/LibGUI/Label.cpp +++ b/Userland/Libraries/LibGUI/Label.cpp @@ -43,7 +43,7 @@ void Label::set_autosize(bool autosize) size_to_fit(); } -void Label::set_icon(const Gfx::Bitmap* icon) +void Label::set_icon(Gfx::Bitmap const* icon) { if (m_icon == icon) return; diff --git a/Userland/Libraries/LibGUI/Label.h b/Userland/Libraries/LibGUI/Label.h index 97e4493ddc..dac18da10b 100644 --- a/Userland/Libraries/LibGUI/Label.h +++ b/Userland/Libraries/LibGUI/Label.h @@ -22,9 +22,9 @@ public: String text() const { return m_text; } void set_text(String); - void set_icon(const Gfx::Bitmap*); + void set_icon(Gfx::Bitmap const*); void set_icon_from_path(String const&); - const Gfx::Bitmap* icon() const { return m_icon.ptr(); } + Gfx::Bitmap const* icon() const { return m_icon.ptr(); } Gfx::Bitmap* icon() { return m_icon.ptr(); } Gfx::TextAlignment text_alignment() const { return m_text_alignment; } diff --git a/Userland/Libraries/LibGUI/Layout.cpp b/Userland/Libraries/LibGUI/Layout.cpp index 3c54efda78..807b26446a 100644 --- a/Userland/Libraries/LibGUI/Layout.cpp +++ b/Userland/Libraries/LibGUI/Layout.cpp @@ -140,7 +140,7 @@ void Layout::set_spacing(int spacing) m_owner->notify_layout_changed({}); } -void Layout::set_margins(const Margins& margins) +void Layout::set_margins(Margins const& margins) { if (m_margins == margins) return; diff --git a/Userland/Libraries/LibGUI/Layout.h b/Userland/Libraries/LibGUI/Layout.h index cd2fa5f23b..ef9a01f0cf 100644 --- a/Userland/Libraries/LibGUI/Layout.h +++ b/Userland/Libraries/LibGUI/Layout.h @@ -53,8 +53,8 @@ public: void notify_adopted(Badge<Widget>, Widget&); void notify_disowned(Badge<Widget>, Widget&); - const Margins& margins() const { return m_margins; } - void set_margins(const Margins&); + Margins const& margins() const { return m_margins; } + void set_margins(Margins const&); int spacing() const { return m_spacing; } void set_spacing(int); diff --git a/Userland/Libraries/LibGUI/ListView.cpp b/Userland/Libraries/LibGUI/ListView.cpp index fecd4b8d80..ab66cc9a1d 100644 --- a/Userland/Libraries/LibGUI/ListView.cpp +++ b/Userland/Libraries/LibGUI/ListView.cpp @@ -69,12 +69,12 @@ Gfx::IntRect ListView::content_rect(int row) const return { 0, row * item_height(), content_width(), item_height() }; } -Gfx::IntRect ListView::content_rect(const ModelIndex& index) const +Gfx::IntRect ListView::content_rect(ModelIndex const& index) const { return content_rect(index.row()); } -ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const +ModelIndex ListView::index_at_event_position(Gfx::IntPoint const& point) const { VERIFY(model()); @@ -87,7 +87,7 @@ ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const return {}; } -Gfx::IntPoint ListView::adjusted_position(const Gfx::IntPoint& position) const +Gfx::IntPoint ListView::adjusted_position(Gfx::IntPoint const& position) const { return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness()); } @@ -255,7 +255,7 @@ void ListView::move_cursor(CursorMovement movement, SelectionUpdate selection_up set_cursor(new_index, selection_update); } -void ListView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) +void ListView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) { if (!model()) return; diff --git a/Userland/Libraries/LibGUI/ListView.h b/Userland/Libraries/LibGUI/ListView.h index 3edbfece64..0f471e927f 100644 --- a/Userland/Libraries/LibGUI/ListView.h +++ b/Userland/Libraries/LibGUI/ListView.h @@ -26,12 +26,12 @@ public: int horizontal_padding() const { return m_horizontal_padding; } int vertical_padding() const { return m_vertical_padding; } - virtual void scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) override; + virtual void scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) override; - Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) const; + Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const; - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override; - virtual Gfx::IntRect content_rect(const ModelIndex&) const override; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override; + virtual Gfx::IntRect content_rect(ModelIndex const&) const override; int model_column() const { return m_model_column; } void set_model_column(int column) { m_model_column = column; } diff --git a/Userland/Libraries/LibGUI/Margins.h b/Userland/Libraries/LibGUI/Margins.h index 71232a0bec..f1a3405cad 100644 --- a/Userland/Libraries/LibGUI/Margins.h +++ b/Userland/Libraries/LibGUI/Margins.h @@ -65,7 +65,7 @@ public: void set_bottom(int value) { m_bottom = value; } void set_left(int value) { m_left = value; } - bool operator==(const Margins& other) const + bool operator==(Margins const& other) const { return m_left == other.m_left && m_top == other.m_top diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index 340c0b211e..7363688f57 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -42,7 +42,7 @@ Menu::~Menu() unrealize_menu(); } -void Menu::set_icon(const Gfx::Bitmap* icon) +void Menu::set_icon(Gfx::Bitmap const* icon) { m_icon = icon; } @@ -110,13 +110,13 @@ void Menu::add_separator() MUST(try_add_separator()); } -void Menu::realize_if_needed(const RefPtr<Action>& default_action) +void Menu::realize_if_needed(RefPtr<Action> const& default_action) { if (m_menu_id == -1 || m_current_default_action.ptr() != default_action) realize_menu(default_action); } -void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action) +void Menu::popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action) { realize_if_needed(default_action); ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position); diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h index 2d60d51c38..79c7000e35 100644 --- a/Userland/Libraries/LibGUI/Menu.h +++ b/Userland/Libraries/LibGUI/Menu.h @@ -26,9 +26,9 @@ public: static Menu* from_menu_id(int); int menu_id() const { return m_menu_id; } - const String& name() const { return m_name; } - const Gfx::Bitmap* icon() const { return m_icon.ptr(); } - void set_icon(const Gfx::Bitmap*); + String const& name() const { return m_name; } + Gfx::Bitmap const* icon() const { return m_icon.ptr(); } + void set_icon(Gfx::Bitmap const*); Action* action_at(size_t); @@ -41,7 +41,7 @@ public: Menu& add_submenu(String name); void remove_all_actions(); - void popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action = nullptr); + void popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action = nullptr); void dismiss(); void visibility_did_change(Badge<ConnectionToWindowServer>, bool visible); @@ -61,7 +61,7 @@ private: int realize_menu(RefPtr<Action> default_action = nullptr); void unrealize_menu(); - void realize_if_needed(const RefPtr<Action>& default_action); + void realize_if_needed(RefPtr<Action> const& default_action); void realize_menu_item(MenuItem&, int item_id); diff --git a/Userland/Libraries/LibGUI/MenuItem.h b/Userland/Libraries/LibGUI/MenuItem.h index 7e5fd1c8ff..c98cb94abb 100644 --- a/Userland/Libraries/LibGUI/MenuItem.h +++ b/Userland/Libraries/LibGUI/MenuItem.h @@ -29,12 +29,12 @@ public: Type type() const { return m_type; } - const Action* action() const { return m_action.ptr(); } + Action const* action() const { return m_action.ptr(); } Action* action() { return m_action.ptr(); } unsigned identifier() const { return m_identifier; } Menu* submenu() { return m_submenu.ptr(); } - const Menu* submenu() const { return m_submenu.ptr(); } + Menu const* submenu() const { return m_submenu.ptr(); } bool is_checkable() const { return m_checkable; } void set_checkable(bool checkable) { m_checkable = checkable; } diff --git a/Userland/Libraries/LibGUI/ModelEditingDelegate.h b/Userland/Libraries/LibGUI/ModelEditingDelegate.h index e02a61efaa..56a1ee5307 100644 --- a/Userland/Libraries/LibGUI/ModelEditingDelegate.h +++ b/Userland/Libraries/LibGUI/ModelEditingDelegate.h @@ -22,7 +22,7 @@ public: virtual ~ModelEditingDelegate() = default; - void bind(Model& model, const ModelIndex& index) + void bind(Model& model, ModelIndex const& index) { if (m_model.ptr() == &model && m_index == index) return; @@ -32,7 +32,7 @@ public: } Widget* widget() { return m_widget; } - const Widget* widget() const { return m_widget; } + Widget const* widget() const { return m_widget; } Function<void()> on_commit; Function<void()> on_rollback; @@ -63,7 +63,7 @@ protected: on_change(); } - const ModelIndex& index() const { return m_index; } + ModelIndex const& index() const { return m_index; } private: RefPtr<Model> m_model; @@ -92,7 +92,7 @@ public: }; return textbox; } - virtual Variant value() const override { return static_cast<const TextBox*>(widget())->text(); } + virtual Variant value() const override { return static_cast<TextBox const*>(widget())->text(); } virtual void set_value(Variant const& value, SelectionBehavior selection_behavior) override { auto& textbox = static_cast<TextBox&>(*widget()); diff --git a/Userland/Libraries/LibGUI/ModelIndex.cpp b/Userland/Libraries/LibGUI/ModelIndex.cpp index e095764d4d..a9d3f82910 100644 --- a/Userland/Libraries/LibGUI/ModelIndex.cpp +++ b/Userland/Libraries/LibGUI/ModelIndex.cpp @@ -19,7 +19,7 @@ Variant ModelIndex::data(ModelRole role) const return model()->data(*this, role); } -bool ModelIndex::is_parent_of(const ModelIndex& child) const +bool ModelIndex::is_parent_of(ModelIndex const& child) const { auto current_index = child.parent(); while (current_index.is_valid()) { diff --git a/Userland/Libraries/LibGUI/ModelIndex.h b/Userland/Libraries/LibGUI/ModelIndex.h index 07743383a5..c143f49ac1 100644 --- a/Userland/Libraries/LibGUI/ModelIndex.h +++ b/Userland/Libraries/LibGUI/ModelIndex.h @@ -26,19 +26,19 @@ public: void* internal_data() const { return m_internal_data; } ModelIndex parent() const; - bool is_parent_of(const ModelIndex&) const; + bool is_parent_of(ModelIndex const&) const; - bool operator==(const ModelIndex& other) const + bool operator==(ModelIndex const& other) const { return m_model == other.m_model && m_row == other.m_row && m_column == other.m_column && m_internal_data == other.m_internal_data; } - bool operator!=(const ModelIndex& other) const + bool operator!=(ModelIndex const& other) const { return !(*this == other); } - const Model* model() const { return m_model; } + Model const* model() const { return m_model; } Variant data(ModelRole = ModelRole::Display) const; @@ -46,7 +46,7 @@ public: ModelIndex sibling_at_column(int column) const; private: - ModelIndex(const Model& model, int row, int column, void* internal_data) + ModelIndex(Model const& model, int row, int column, void* internal_data) : m_model(&model) , m_row(row) , m_column(column) @@ -54,7 +54,7 @@ private: { } - const Model* m_model { nullptr }; + Model const* m_model { nullptr }; int m_row { -1 }; int m_column { -1 }; void* m_internal_data { nullptr }; diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index 825384c280..8e11c3f423 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -16,7 +16,7 @@ void ModelSelection::remove_all_matching(Function<bool(ModelIndex const&)> filte notify_selection_changed(); } -void ModelSelection::set(const ModelIndex& index) +void ModelSelection::set(ModelIndex const& index) { VERIFY(index.is_valid()); if (m_indices.size() == 1 && m_indices.contains(index)) @@ -26,14 +26,14 @@ void ModelSelection::set(const ModelIndex& index) notify_selection_changed(); } -void ModelSelection::add(const ModelIndex& index) +void ModelSelection::add(ModelIndex const& index) { VERIFY(index.is_valid()); if (m_indices.set(index) == AK::HashSetResult::InsertedNewEntry) notify_selection_changed(); } -void ModelSelection::add_all(const Vector<ModelIndex>& indices) +void ModelSelection::add_all(Vector<ModelIndex> const& indices) { { TemporaryChange notify_change { m_disable_notify, true }; @@ -45,7 +45,7 @@ void ModelSelection::add_all(const Vector<ModelIndex>& indices) notify_selection_changed(); } -void ModelSelection::toggle(const ModelIndex& index) +void ModelSelection::toggle(ModelIndex const& index) { VERIFY(index.is_valid()); if (m_indices.contains(index)) @@ -55,7 +55,7 @@ void ModelSelection::toggle(const ModelIndex& index) notify_selection_changed(); } -bool ModelSelection::remove(const ModelIndex& index) +bool ModelSelection::remove(ModelIndex const& index) { VERIFY(index.is_valid()); if (!m_indices.contains(index)) diff --git a/Userland/Libraries/LibGUI/ModelSelection.h b/Userland/Libraries/LibGUI/ModelSelection.h index 85305246be..b89d632012 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.h +++ b/Userland/Libraries/LibGUI/ModelSelection.h @@ -27,7 +27,7 @@ public: int size() const { return m_indices.size(); } bool is_empty() const { return m_indices.is_empty(); } - bool contains(const ModelIndex& index) const { return m_indices.contains(index); } + bool contains(ModelIndex const& index) const { return m_indices.contains(index); } bool contains_row(int row) const { for (auto& index : m_indices) { @@ -37,11 +37,11 @@ public: return false; } - void set(const ModelIndex&); - void add(const ModelIndex&); - void add_all(const Vector<ModelIndex>&); - void toggle(const ModelIndex&); - bool remove(const ModelIndex&); + void set(ModelIndex const&); + void add(ModelIndex const&); + void add_all(Vector<ModelIndex> const&); + void toggle(ModelIndex const&); + bool remove(ModelIndex const&); void clear(); template<typename Callback> diff --git a/Userland/Libraries/LibGUI/MultiView.h b/Userland/Libraries/LibGUI/MultiView.h index a4436fe08d..3bcf52623f 100644 --- a/Userland/Libraries/LibGUI/MultiView.h +++ b/Userland/Libraries/LibGUI/MultiView.h @@ -23,10 +23,10 @@ public: void refresh(); Function<void()> on_selection_change; - Function<void(const ModelIndex&)> on_activation; - Function<void(const ModelIndex&)> on_selection; - Function<void(const ModelIndex&, const ContextMenuEvent&)> on_context_menu_request; - Function<void(const ModelIndex&, const DropEvent&)> on_drop; + Function<void(ModelIndex const&)> on_activation; + Function<void(ModelIndex const&)> on_selection; + Function<void(ModelIndex const&, ContextMenuEvent const&)> on_context_menu_request; + Function<void(ModelIndex const&, DropEvent const&)> on_drop; enum ViewMode { Invalid, @@ -58,7 +58,7 @@ public: } } - const ModelSelection& selection() const { return const_cast<MultiView&>(*this).current_view().selection(); } + ModelSelection const& selection() const { return const_cast<MultiView&>(*this).current_view().selection(); } ModelSelection& selection() { return current_view().selection(); } template<typename Callback> @@ -70,7 +70,7 @@ public: } Model* model() { return m_model; } - const Model* model() const { return m_model; } + Model const* model() const { return m_model; } void set_model(RefPtr<Model>); diff --git a/Userland/Libraries/LibGUI/Notification.h b/Userland/Libraries/LibGUI/Notification.h index c5d94aaccc..5f695597b6 100644 --- a/Userland/Libraries/LibGUI/Notification.h +++ b/Userland/Libraries/LibGUI/Notification.h @@ -21,22 +21,22 @@ class Notification : public Core::Object { public: virtual ~Notification() override; - const String& text() const { return m_text; } - void set_text(const String& text) + String const& text() const { return m_text; } + void set_text(String const& text) { m_text_dirty = true; m_text = text; } - const String& title() const { return m_title; } - void set_title(const String& title) + String const& title() const { return m_title; } + void set_title(String const& title) { m_title_dirty = true; m_title = title; } - const Gfx::Bitmap* icon() const { return m_icon; } - void set_icon(const Gfx::Bitmap* icon) + Gfx::Bitmap const* icon() const { return m_icon; } + void set_icon(Gfx::Bitmap const* icon) { m_icon_dirty = true; m_icon = icon; diff --git a/Userland/Libraries/LibGUI/OpacitySlider.cpp b/Userland/Libraries/LibGUI/OpacitySlider.cpp index 59cb22d2fa..cb8aff8d79 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.cpp +++ b/Userland/Libraries/LibGUI/OpacitySlider.cpp @@ -95,7 +95,7 @@ void OpacitySlider::paint_event(PaintEvent& event) Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2); } -int OpacitySlider::value_at(const Gfx::IntPoint& position) const +int OpacitySlider::value_at(Gfx::IntPoint const& position) const { auto inner_rect = frame_inner_rect(); if (position.x() < inner_rect.left()) diff --git a/Userland/Libraries/LibGUI/OpacitySlider.h b/Userland/Libraries/LibGUI/OpacitySlider.h index e4ab0560be..3c09c95c89 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.h +++ b/Userland/Libraries/LibGUI/OpacitySlider.h @@ -29,7 +29,7 @@ private: Gfx::IntRect frame_inner_rect() const; - int value_at(const Gfx::IntPoint&) const; + int value_at(Gfx::IntPoint const&) const; bool m_dragging { false }; }; diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 94c3e4781d..2a55fbee53 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -15,7 +15,7 @@ namespace GUI { -ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, const Gfx::Bitmap* window_icon, GUI::Window* parent_window) +ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, Gfx::Bitmap const* window_icon, GUI::Window* parent_window) : Dialog(parent_window) , m_window_title(window_title) , m_button_label(button_label) @@ -44,7 +44,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, m_process_model = process_model; - m_table_view->on_activation = [this](const ModelIndex& index) { set_pid_from_index_and_close(index); }; + m_table_view->on_activation = [this](ModelIndex const& index) { set_pid_from_index_and_close(index); }; auto& button_container = widget.add<GUI::Widget>(); button_container.set_fixed_height(30); @@ -99,7 +99,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, }; } -void ProcessChooser::set_pid_from_index_and_close(const ModelIndex& index) +void ProcessChooser::set_pid_from_index_and_close(ModelIndex const& index) { m_pid = index.data(GUI::ModelRole::Custom).as_i32(); done(ExecOK); diff --git a/Userland/Libraries/LibGUI/ProcessChooser.h b/Userland/Libraries/LibGUI/ProcessChooser.h index 23e3363a0e..e9467e5e1f 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.h +++ b/Userland/Libraries/LibGUI/ProcessChooser.h @@ -22,9 +22,9 @@ public: pid_t pid() const { return m_pid; } private: - ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", const Gfx::Bitmap* window_icon = nullptr, GUI::Window* parent_window = nullptr); + ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr); - void set_pid_from_index_and_close(const ModelIndex&); + void set_pid_from_index_and_close(ModelIndex const&); pid_t m_pid { 0 }; diff --git a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp index ff69f2dd74..347e42007b 100644 --- a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp @@ -15,7 +15,7 @@ CursorWidth RegularEditingEngine::cursor_width() const return CursorWidth::NARROW; } -bool RegularEditingEngine::on_key(const KeyEvent& event) +bool RegularEditingEngine::on_key(KeyEvent const& event) { if (EditingEngine::on_key(event)) return true; @@ -34,7 +34,7 @@ bool RegularEditingEngine::on_key(const KeyEvent& event) return false; } -static int strcmp_utf32(const u32* s1, const u32* s2, size_t n) +static int strcmp_utf32(u32 const* s1, u32 const* s2, size_t n) { while (n-- > 0) { if (*s1++ != *s2++) diff --git a/Userland/Libraries/LibGUI/RegularEditingEngine.h b/Userland/Libraries/LibGUI/RegularEditingEngine.h index 308bb353bc..82f0088b86 100644 --- a/Userland/Libraries/LibGUI/RegularEditingEngine.h +++ b/Userland/Libraries/LibGUI/RegularEditingEngine.h @@ -15,7 +15,7 @@ class RegularEditingEngine final : public EditingEngine { public: virtual CursorWidth cursor_width() const override; - virtual bool on_key(const KeyEvent& event) override; + virtual bool on_key(KeyEvent const& event) override; private: void sort_selected_lines(); diff --git a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp index 214ffe0401..85cc26eb50 100644 --- a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp +++ b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp @@ -83,7 +83,7 @@ void ScrollableContainerWidget::set_widget(GUI::Widget* widget) update_widget_position(); } -bool ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) +bool ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)) { if (is<GUI::GML::GMLFile>(ast.ptr())) return load_from_gml_ast(static_ptr_cast<GUI::GML::GMLFile>(ast)->main_class(), unregistered_child_handler); diff --git a/Userland/Libraries/LibGUI/ScrollableContainerWidget.h b/Userland/Libraries/LibGUI/ScrollableContainerWidget.h index 36c2cd734c..3064af9866 100644 --- a/Userland/Libraries/LibGUI/ScrollableContainerWidget.h +++ b/Userland/Libraries/LibGUI/ScrollableContainerWidget.h @@ -28,7 +28,7 @@ protected: private: void update_widget_size(); void update_widget_position(); - virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) override; + virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)) override; ScrollableContainerWidget(); diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp index ebb0499cb0..5843649dc1 100644 --- a/Userland/Libraries/LibGUI/Scrollbar.cpp +++ b/Userland/Libraries/LibGUI/Scrollbar.cpp @@ -352,7 +352,7 @@ void Scrollbar::set_automatic_scrolling_active(bool active, Component pressed_co } } -void Scrollbar::scroll_by_page(const Gfx::IntPoint& click_position) +void Scrollbar::scroll_by_page(Gfx::IntPoint const& click_position) { float range_size = max() - min(); float available = scrubbable_range_in_pixels(); @@ -368,7 +368,7 @@ void Scrollbar::scroll_by_page(const Gfx::IntPoint& click_position) } } -void Scrollbar::scroll_to_position(const Gfx::IntPoint& click_position) +void Scrollbar::scroll_to_position(Gfx::IntPoint const& click_position) { float range_size = max() - min(); float available = scrubbable_range_in_pixels(); @@ -378,7 +378,7 @@ void Scrollbar::scroll_to_position(const Gfx::IntPoint& click_position) set_target_value(min() + rel_x_or_y * range_size); } -Scrollbar::Component Scrollbar::component_at_position(const Gfx::IntPoint& position) +Scrollbar::Component Scrollbar::component_at_position(Gfx::IntPoint const& position) { if (scrubber_rect().contains(position)) return Component::Scrubber; diff --git a/Userland/Libraries/LibGUI/Scrollbar.h b/Userland/Libraries/LibGUI/Scrollbar.h index 0f6115055c..51aa86aea2 100644 --- a/Userland/Libraries/LibGUI/Scrollbar.h +++ b/Userland/Libraries/LibGUI/Scrollbar.h @@ -79,10 +79,10 @@ private: void on_automatic_scrolling_timer_fired(); void set_automatic_scrolling_active(bool, Component); - void scroll_to_position(const Gfx::IntPoint&); - void scroll_by_page(const Gfx::IntPoint&); + void scroll_to_position(Gfx::IntPoint const&); + void scroll_by_page(Gfx::IntPoint const&); - Component component_at_position(const Gfx::IntPoint&); + Component component_at_position(Gfx::IntPoint const&); void update_animated_scroll(); diff --git a/Userland/Libraries/LibGUI/Shortcut.h b/Userland/Libraries/LibGUI/Shortcut.h index 52d90a6f2d..856260e5d8 100644 --- a/Userland/Libraries/LibGUI/Shortcut.h +++ b/Userland/Libraries/LibGUI/Shortcut.h @@ -30,7 +30,7 @@ public: KeyCode key() const { return m_key; } String to_string() const; - bool operator==(const Shortcut& other) const + bool operator==(Shortcut const& other) const { return m_modifiers == other.m_modifiers && m_key == other.m_key; diff --git a/Userland/Libraries/LibGUI/Slider.cpp b/Userland/Libraries/LibGUI/Slider.cpp index b090f63c90..6ee7edc879 100644 --- a/Userland/Libraries/LibGUI/Slider.cpp +++ b/Userland/Libraries/LibGUI/Slider.cpp @@ -85,7 +85,7 @@ void Slider::mousedown_event(MouseEvent& event) return; } - const auto mouse_offset = event.position().primary_offset_for_orientation(orientation()); + auto const mouse_offset = event.position().primary_offset_for_orientation(orientation()); if (jump_to_cursor()) { float normalized_mouse_offset = 0.0f; diff --git a/Userland/Libraries/LibGUI/StackWidget.h b/Userland/Libraries/LibGUI/StackWidget.h index 0f9dc7170b..ad57814c2e 100644 --- a/Userland/Libraries/LibGUI/StackWidget.h +++ b/Userland/Libraries/LibGUI/StackWidget.h @@ -17,7 +17,7 @@ public: virtual ~StackWidget() override = default; Widget* active_widget() { return m_active_widget.ptr(); } - const Widget* active_widget() const { return m_active_widget.ptr(); } + Widget const* active_widget() const { return m_active_widget.ptr(); } void set_active_widget(Widget*); Function<void(Widget*)> on_active_widget_change; diff --git a/Userland/Libraries/LibGUI/TabWidget.cpp b/Userland/Libraries/LibGUI/TabWidget.cpp index 26e7a9f90e..c855b76d62 100644 --- a/Userland/Libraries/LibGUI/TabWidget.cpp +++ b/Userland/Libraries/LibGUI/TabWidget.cpp @@ -141,7 +141,7 @@ void TabWidget::resize_event(ResizeEvent& event) m_active_widget->set_relative_rect(child_rect_for_size(event.size())); } -Gfx::IntRect TabWidget::child_rect_for_size(const Gfx::IntSize& size) const +Gfx::IntRect TabWidget::child_rect_for_size(Gfx::IntSize const& size) const { Gfx::IntRect rect; switch (m_tab_position) { @@ -401,7 +401,7 @@ Gfx::IntRect TabWidget::close_button_rect(size_t index) const return close_button_rect; } -int TabWidget::TabData::width(const Gfx::Font& font) const +int TabWidget::TabData::width(Gfx::Font const& font) const { auto width = 16 + font.width(title) + (icon ? (16 + 4) : 0); // NOTE: This needs to always be an odd number, because the button rect @@ -553,7 +553,7 @@ void TabWidget::set_tab_title(Widget& tab, StringView title) } } -void TabWidget::set_tab_icon(Widget& tab, const Gfx::Bitmap* icon) +void TabWidget::set_tab_icon(Widget& tab, Gfx::Bitmap const* icon) { for (auto& t : m_tabs) { if (t.widget == &tab) { diff --git a/Userland/Libraries/LibGUI/TabWidget.h b/Userland/Libraries/LibGUI/TabWidget.h index c3a793374d..d723f3417b 100644 --- a/Userland/Libraries/LibGUI/TabWidget.h +++ b/Userland/Libraries/LibGUI/TabWidget.h @@ -28,7 +28,7 @@ public: Optional<size_t> active_tab_index() const; Widget* active_widget() { return m_active_widget.ptr(); } - const Widget* active_widget() const { return m_active_widget.ptr(); } + Widget const* active_widget() const { return m_active_widget.ptr(); } void set_active_widget(Widget*); void set_tab_index(int); @@ -62,7 +62,7 @@ public: void remove_all_tabs_except(Widget& tab); void set_tab_title(Widget& tab, StringView title); - void set_tab_icon(Widget& tab, const Gfx::Bitmap*); + void set_tab_icon(Widget& tab, Gfx::Bitmap const*); void activate_next_tab(); void activate_previous_tab(); @@ -86,7 +86,7 @@ public: Function<void(Widget&)> on_change; Function<void(Widget&)> on_middle_click; Function<void(Widget&)> on_tab_close_click; - Function<void(Widget&, const ContextMenuEvent&)> on_context_menu_request; + Function<void(Widget&, ContextMenuEvent const&)> on_context_menu_request; Function<void(Widget&)> on_double_click; protected: @@ -104,7 +104,7 @@ protected: virtual void doubleclick_event(MouseEvent&) override; private: - Gfx::IntRect child_rect_for_size(const Gfx::IntSize&) const; + Gfx::IntRect child_rect_for_size(Gfx::IntSize const&) const; Gfx::IntRect button_rect(size_t index) const; Gfx::IntRect close_button_rect(size_t index) const; Gfx::IntRect bar_rect() const; @@ -116,7 +116,7 @@ private: RefPtr<Widget> m_active_widget; struct TabData { - int width(const Gfx::Font&) const; + int width(Gfx::Font const&) const; String title; RefPtr<Gfx::Bitmap> icon; Widget* widget { nullptr }; diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index 8466107f80..6ffe48be38 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -171,7 +171,7 @@ void TextDocumentLine::clear(TextDocument& document) document.update_views({}); } -void TextDocumentLine::set_text(TextDocument& document, const Vector<u32> text) +void TextDocumentLine::set_text(TextDocument& document, Vector<u32> const text) { m_text = move(text); document.update_views({}); @@ -194,7 +194,7 @@ bool TextDocumentLine::set_text(TextDocument& document, StringView text) return true; } -void TextDocumentLine::append(TextDocument& document, const u32* code_points, size_t length) +void TextDocumentLine::append(TextDocument& document, u32 const* code_points, size_t length) { if (length == 0) return; @@ -313,7 +313,7 @@ void TextDocument::notify_did_change() m_regex_needs_update = true; } -void TextDocument::set_all_cursors(const TextPosition& position) +void TextDocument::set_all_cursors(TextPosition const& position) { if (m_client_notifications_enabled) { for (auto* client : m_clients) @@ -333,7 +333,7 @@ String TextDocument::text() const return builder.to_string(); } -String TextDocument::text_in_range(const TextRange& a_range) const +String TextDocument::text_in_range(TextRange const& a_range) const { auto range = a_range.normalized(); if (is_empty() || line_count() < range.end().line() - range.start().line()) @@ -359,7 +359,7 @@ String TextDocument::text_in_range(const TextRange& a_range) const return builder.to_string(); } -u32 TextDocument::code_point_at(const TextPosition& position) const +u32 TextDocument::code_point_at(TextPosition const& position) const { VERIFY(position.line() < line_count()); auto& line = this->line(position.line()); @@ -368,7 +368,7 @@ u32 TextDocument::code_point_at(const TextPosition& position) const return line.code_points()[position.column()]; } -TextPosition TextDocument::next_position_after(const TextPosition& position, SearchShouldWrap should_wrap) const +TextPosition TextDocument::next_position_after(TextPosition const& position, SearchShouldWrap should_wrap) const { auto& line = this->line(position.line()); if (position.column() == line.length()) { @@ -382,7 +382,7 @@ TextPosition TextDocument::next_position_after(const TextPosition& position, Sea return { position.line(), position.column() + 1 }; } -TextPosition TextDocument::previous_position_before(const TextPosition& position, SearchShouldWrap should_wrap) const +TextPosition TextDocument::previous_position_before(TextPosition const& position, SearchShouldWrap should_wrap) const { if (position.column() == 0) { if (position.line() == 0) { @@ -416,7 +416,7 @@ void TextDocument::update_regex_matches(StringView needle) } } -TextRange TextDocument::find_next(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) +TextRange TextDocument::find_next(StringView needle, TextPosition const& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) { if (needle.is_empty()) return {}; @@ -496,7 +496,7 @@ TextRange TextDocument::find_next(StringView needle, const TextPosition& start, return {}; } -TextRange TextDocument::find_previous(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) +TextRange TextDocument::find_previous(StringView needle, TextPosition const& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) { if (needle.is_empty()) return {}; @@ -595,7 +595,7 @@ Vector<TextRange> TextDocument::find_all(StringView needle, bool regmatch, bool return ranges; } -Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(const TextPosition& position) const +Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(TextPosition const& position) const { for (int i = m_spans.size() - 1; i >= 0; --i) { if (!m_spans[i].range.contains(position)) @@ -609,7 +609,7 @@ Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(const T return {}; } -Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(const TextPosition& position) const +Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(TextPosition const& position) const { size_t i = 0; // Find the first span containing the cursor @@ -633,7 +633,7 @@ Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(const Te return {}; } -TextPosition TextDocument::first_word_break_before(const TextPosition& position, bool start_at_column_before) const +TextPosition TextDocument::first_word_break_before(TextPosition const& position, bool start_at_column_before) const { if (position.column() == 0) { if (position.line() == 0) { @@ -663,7 +663,7 @@ TextPosition TextDocument::first_word_break_before(const TextPosition& position, return target; } -TextPosition TextDocument::first_word_break_after(const TextPosition& position) const +TextPosition TextDocument::first_word_break_after(TextPosition const& position) const { auto target = position; auto line = this->line(target.line()); @@ -689,7 +689,7 @@ TextPosition TextDocument::first_word_break_after(const TextPosition& position) return target; } -TextPosition TextDocument::first_word_before(const TextPosition& position, bool start_at_column_before) const +TextPosition TextDocument::first_word_before(TextPosition const& position, bool start_at_column_before) const { if (position.column() == 0) { if (position.line() == 0) { @@ -748,7 +748,7 @@ TextDocumentUndoCommand::TextDocumentUndoCommand(TextDocument& document) { } -InsertTextCommand::InsertTextCommand(TextDocument& document, const String& text, const TextPosition& position) +InsertTextCommand::InsertTextCommand(TextDocument& document, String const& text, TextPosition const& position) : TextDocumentUndoCommand(document) , m_text(text) , m_range({ position, position }) @@ -777,11 +777,11 @@ bool InsertTextCommand::merge_with(GUI::Command const& other) return true; } -void InsertTextCommand::perform_formatting(const TextDocument::Client& client) +void InsertTextCommand::perform_formatting(TextDocument::Client const& client) { const size_t tab_width = client.soft_tab_width(); - const auto& dest_line = m_document.line(m_range.start().line()); - const bool should_auto_indent = client.is_automatic_indentation_enabled(); + auto const& dest_line = m_document.line(m_range.start().line()); + bool const should_auto_indent = client.is_automatic_indentation_enabled(); StringBuilder builder; size_t column = m_range.start().column(); @@ -842,7 +842,7 @@ void InsertTextCommand::undo() m_document.set_all_cursors(m_range.start()); } -RemoveTextCommand::RemoveTextCommand(TextDocument& document, const String& text, const TextRange& range) +RemoveTextCommand::RemoveTextCommand(TextDocument& document, String const& text, TextRange const& range) : TextDocumentUndoCommand(document) , m_text(text) , m_range(range) @@ -884,7 +884,7 @@ void RemoveTextCommand::undo() m_document.set_all_cursors(new_cursor); } -TextPosition TextDocument::insert_at(const TextPosition& position, StringView text, const Client* client) +TextPosition TextDocument::insert_at(TextPosition const& position, StringView text, Client const* client) { TextPosition cursor = position; Utf8View utf8_view(text); @@ -893,7 +893,7 @@ TextPosition TextDocument::insert_at(const TextPosition& position, StringView te return cursor; } -TextPosition TextDocument::insert_at(const TextPosition& position, u32 code_point, const Client*) +TextPosition TextDocument::insert_at(TextPosition const& position, u32 code_point, Client const*) { if (code_point == '\n') { auto new_line = make<TextDocumentLine>(*this); @@ -909,7 +909,7 @@ TextPosition TextDocument::insert_at(const TextPosition& position, u32 code_poin } } -void TextDocument::remove(const TextRange& unnormalized_range) +void TextDocument::remove(TextRange const& unnormalized_range) { if (!unnormalized_range.is_valid()) return; @@ -970,7 +970,7 @@ TextRange TextDocument::range_for_entire_line(size_t line_index) const return { { line_index, 0 }, { line_index, line(line_index).length() } }; } -const TextDocumentSpan* TextDocument::span_at(const TextPosition& position) const +TextDocumentSpan const* TextDocument::span_at(TextPosition const& position) const { for (auto& span : m_spans) { if (span.range.contains(position)) diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h index c574d4b350..afef884465 100644 --- a/Userland/Libraries/LibGUI/TextDocument.h +++ b/Userland/Libraries/LibGUI/TextDocument.h @@ -48,7 +48,7 @@ public: virtual void document_did_remove_all_lines() = 0; virtual void document_did_change(AllowCallback = AllowCallback::Yes) = 0; virtual void document_did_set_text(AllowCallback = AllowCallback::Yes) = 0; - virtual void document_did_set_cursor(const TextPosition&) = 0; + virtual void document_did_set_cursor(TextPosition const&) = 0; virtual void document_did_update_undo_stack() = 0; virtual bool is_automatic_indentation_enabled() const = 0; @@ -59,22 +59,22 @@ public: virtual ~TextDocument() = default; size_t line_count() const { return m_lines.size(); } - const TextDocumentLine& line(size_t line_index) const { return m_lines[line_index]; } + TextDocumentLine const& line(size_t line_index) const { return m_lines[line_index]; } TextDocumentLine& line(size_t line_index) { return m_lines[line_index]; } void set_spans(u32 span_collection_index, Vector<TextDocumentSpan> spans); bool set_text(StringView, AllowCallback = AllowCallback::Yes); - const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return m_lines; } + NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return m_lines; } NonnullOwnPtrVector<TextDocumentLine>& lines() { return m_lines; } bool has_spans() const { return !m_spans.is_empty(); } Vector<TextDocumentSpan>& spans() { return m_spans; } - const Vector<TextDocumentSpan>& spans() const { return m_spans; } + Vector<TextDocumentSpan> const& spans() const { return m_spans; } void set_span_at_index(size_t index, TextDocumentSpan span) { m_spans[index] = move(span); } - const TextDocumentSpan* span_at(const TextPosition&) const; + TextDocumentSpan const* span_at(TextPosition const&) const; void append_line(NonnullOwnPtr<TextDocumentLine>); void remove_line(size_t line_index); @@ -87,28 +87,28 @@ public: void update_views(Badge<TextDocumentLine>); String text() const; - String text_in_range(const TextRange&) const; + String text_in_range(TextRange const&) const; Vector<TextRange> find_all(StringView needle, bool regmatch = false, bool match_case = true); void update_regex_matches(StringView); - TextRange find_next(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); - TextRange find_previous(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); + TextRange find_next(StringView, TextPosition const& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); + TextRange find_previous(StringView, TextPosition const& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); - TextPosition next_position_after(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const; - TextPosition previous_position_before(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const; + TextPosition next_position_after(TextPosition const&, SearchShouldWrap = SearchShouldWrap::Yes) const; + TextPosition previous_position_before(TextPosition const&, SearchShouldWrap = SearchShouldWrap::Yes) const; - u32 code_point_at(const TextPosition&) const; + u32 code_point_at(TextPosition const&) const; TextRange range_for_entire_line(size_t line_index) const; - Optional<TextDocumentSpan> first_non_skippable_span_before(const TextPosition&) const; - Optional<TextDocumentSpan> first_non_skippable_span_after(const TextPosition&) const; + Optional<TextDocumentSpan> first_non_skippable_span_before(TextPosition const&) const; + Optional<TextDocumentSpan> first_non_skippable_span_after(TextPosition const&) const; - TextPosition first_word_break_before(const TextPosition&, bool start_at_column_before) const; - TextPosition first_word_break_after(const TextPosition&) const; + TextPosition first_word_break_before(TextPosition const&, bool start_at_column_before) const; + TextPosition first_word_break_after(TextPosition const&) const; - TextPosition first_word_before(const TextPosition&, bool start_at_column_before) const; + TextPosition first_word_before(TextPosition const&, bool start_at_column_before) const; void add_to_undo_stack(NonnullOwnPtr<TextDocumentUndoCommand>); @@ -120,11 +120,11 @@ public: UndoStack const& undo_stack() const { return m_undo_stack; } void notify_did_change(); - void set_all_cursors(const TextPosition&); + void set_all_cursors(TextPosition const&); - TextPosition insert_at(const TextPosition&, u32, const Client* = nullptr); - TextPosition insert_at(const TextPosition&, StringView, const Client* = nullptr); - void remove(const TextRange&); + TextPosition insert_at(TextPosition const&, u32, Client const* = nullptr); + TextPosition insert_at(TextPosition const&, StringView, Client const* = nullptr); + void remove(TextRange const&); virtual bool is_code_document() const { return false; } @@ -163,7 +163,7 @@ public: String to_utf8() const; Utf32View view() const { return { code_points(), length() }; } - const u32* code_points() const { return m_text.data(); } + u32 const* code_points() const { return m_text.data(); } size_t length() const { return m_text.size(); } bool set_text(TextDocument&, StringView); void set_text(TextDocument&, Vector<u32>); @@ -171,7 +171,7 @@ public: void prepend(TextDocument&, u32); void insert(TextDocument&, size_t index, u32); void remove(TextDocument&, size_t index); - void append(TextDocument&, const u32*, size_t); + void append(TextDocument&, u32 const*, size_t); void truncate(TextDocument&, size_t length); void clear(TextDocument&); void remove_range(TextDocument&, size_t start, size_t length); @@ -192,9 +192,9 @@ class TextDocumentUndoCommand : public Command { public: TextDocumentUndoCommand(TextDocument&); virtual ~TextDocumentUndoCommand() = default; - virtual void perform_formatting(const TextDocument::Client&) { } + virtual void perform_formatting(TextDocument::Client const&) { } - void execute_from(const TextDocument::Client& client) + void execute_from(TextDocument::Client const& client) { m_client = &client; redo(); @@ -203,19 +203,19 @@ public: protected: TextDocument& m_document; - const TextDocument::Client* m_client { nullptr }; + TextDocument::Client const* m_client { nullptr }; }; class InsertTextCommand : public TextDocumentUndoCommand { public: - InsertTextCommand(TextDocument&, const String&, const TextPosition&); - virtual void perform_formatting(const TextDocument::Client&) override; + InsertTextCommand(TextDocument&, String const&, TextPosition const&); + virtual void perform_formatting(TextDocument::Client const&) override; virtual void undo() override; virtual void redo() override; virtual bool merge_with(GUI::Command const&) override; virtual String action_text() const override; - const String& text() const { return m_text; } - const TextRange& range() const { return m_range; } + String const& text() const { return m_text; } + TextRange const& range() const { return m_range; } private: String m_text; @@ -224,10 +224,10 @@ private: class RemoveTextCommand : public TextDocumentUndoCommand { public: - RemoveTextCommand(TextDocument&, const String&, const TextRange&); + RemoveTextCommand(TextDocument&, String const&, TextRange const&); virtual void undo() override; virtual void redo() override; - const TextRange& range() const { return m_range; } + TextRange const& range() const { return m_range; } virtual bool merge_with(GUI::Command const&) override; virtual String action_text() const override; diff --git a/Userland/Libraries/LibGUI/TextPosition.h b/Userland/Libraries/LibGUI/TextPosition.h index e779a02432..c6b0bf0225 100644 --- a/Userland/Libraries/LibGUI/TextPosition.h +++ b/Userland/Libraries/LibGUI/TextPosition.h @@ -27,11 +27,11 @@ public: void set_line(size_t line) { m_line = line; } void set_column(size_t column) { m_column = column; } - bool operator==(const TextPosition& other) const { return m_line == other.m_line && m_column == other.m_column; } - bool operator!=(const TextPosition& other) const { return m_line != other.m_line || m_column != other.m_column; } - bool operator<(const TextPosition& other) const { return m_line < other.m_line || (m_line == other.m_line && m_column < other.m_column); } - bool operator>(const TextPosition& other) const { return *this != other && !(*this < other); } - bool operator>=(const TextPosition& other) const { return *this > other || (*this == other); } + bool operator==(TextPosition const& other) const { return m_line == other.m_line && m_column == other.m_column; } + bool operator!=(TextPosition const& other) const { return m_line != other.m_line || m_column != other.m_column; } + bool operator<(TextPosition const& other) const { return m_line < other.m_line || (m_line == other.m_line && m_column < other.m_column); } + bool operator>(TextPosition const& other) const { return *this != other && !(*this < other); } + bool operator>=(TextPosition const& other) const { return *this > other || (*this == other); } private: size_t m_line { 0xffffffff }; diff --git a/Userland/Libraries/LibGUI/TextRange.h b/Userland/Libraries/LibGUI/TextRange.h index 736e2baa3d..2e0b7332ab 100644 --- a/Userland/Libraries/LibGUI/TextRange.h +++ b/Userland/Libraries/LibGUI/TextRange.h @@ -14,7 +14,7 @@ namespace GUI { class TextRange { public: TextRange() = default; - TextRange(const TextPosition& start, const TextPosition& end) + TextRange(TextPosition const& start, TextPosition const& end) : m_start(start) , m_end(end) { @@ -29,26 +29,26 @@ public: TextPosition& start() { return m_start; } TextPosition& end() { return m_end; } - const TextPosition& start() const { return m_start; } - const TextPosition& end() const { return m_end; } + TextPosition const& start() const { return m_start; } + TextPosition const& end() const { return m_end; } TextRange normalized() const { return TextRange(normalized_start(), normalized_end()); } - void set_start(const TextPosition& position) { m_start = position; } - void set_end(const TextPosition& position) { m_end = position; } + void set_start(TextPosition const& position) { m_start = position; } + void set_end(TextPosition const& position) { m_end = position; } - void set(const TextPosition& start, const TextPosition& end) + void set(TextPosition const& start, TextPosition const& end) { m_start = start; m_end = end; } - bool operator==(const TextRange& other) const + bool operator==(TextRange const& other) const { return m_start == other.m_start && m_end == other.m_end; } - bool contains(const TextPosition& position) const + bool contains(TextPosition const& position) const { if (!(position.line() > m_start.line() || (position.line() == m_start.line() && position.column() >= m_start.column()))) return false; diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index f42865341f..fee9db5daa 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -56,7 +56,7 @@ private: set_text(action.text()); set_button_style(Gfx::ButtonStyle::Coolbar); } - String tooltip(const Action& action) const + String tooltip(Action const& action) const { StringBuilder builder; builder.append(action.text()); diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index 50a20e9e94..681ab29094 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -21,7 +21,7 @@ struct TreeView::MetadataForIndex { bool open { false }; }; -TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex& index) const +TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(ModelIndex const& index) const { VERIFY(index.is_valid()); auto it = m_view_metadata.find(index.internal_data()); @@ -44,14 +44,14 @@ TreeView::TreeView() m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png").release_value_but_fixme_should_propagate_errors(); } -ModelIndex TreeView::index_at_event_position(const Gfx::IntPoint& a_position, bool& is_toggle) const +ModelIndex TreeView::index_at_event_position(Gfx::IntPoint const& a_position, bool& is_toggle) const { auto position = a_position.translated(0, -column_header().height()).translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness()); is_toggle = false; if (!model()) return {}; ModelIndex result; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect& toggle_rect, int) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& rect, Gfx::IntRect const& toggle_rect, int) { if (toggle_rect.contains(position)) { result = index; is_toggle = true; @@ -86,7 +86,7 @@ void TreeView::doubleclick_event(MouseEvent& event) } } -void TreeView::set_open_state_of_all_in_subtree(const ModelIndex& root, bool open) +void TreeView::set_open_state_of_all_in_subtree(ModelIndex const& root, bool open) { if (root.is_valid()) { ensure_metadata_for_index(root).open = open; @@ -103,7 +103,7 @@ void TreeView::set_open_state_of_all_in_subtree(const ModelIndex& root, bool ope } } -void TreeView::expand_all_parents_of(const ModelIndex& index) +void TreeView::expand_all_parents_of(ModelIndex const& index) { if (!model()) return; @@ -120,7 +120,7 @@ void TreeView::expand_all_parents_of(const ModelIndex& index) update(); } -void TreeView::expand_tree(const ModelIndex& root) +void TreeView::expand_tree(ModelIndex const& root) { if (!model()) return; @@ -130,7 +130,7 @@ void TreeView::expand_tree(const ModelIndex& root) update(); } -void TreeView::collapse_tree(const ModelIndex& root) +void TreeView::collapse_tree(ModelIndex const& root) { if (!model()) return; @@ -140,7 +140,7 @@ void TreeView::collapse_tree(const ModelIndex& root) update(); } -void TreeView::toggle_index(const ModelIndex& index) +void TreeView::toggle_index(ModelIndex const& index) { VERIFY(model()->row_count(index)); auto& metadata = ensure_metadata_for_index(index); @@ -166,7 +166,7 @@ void TreeView::traverse_in_paint_order(Callback callback) const int y_offset = 0; int tree_column_x_offset = this->tree_column_x_offset(); - Function<IterationDecision(const ModelIndex&)> traverse_index = [&](const ModelIndex& index) { + Function<IterationDecision(ModelIndex const&)> traverse_index = [&](ModelIndex const& index) { int row_count_at_index = model.row_count(index); if (index.is_valid()) { auto& metadata = ensure_metadata_for_index(index); @@ -234,7 +234,7 @@ void TreeView::paint_event(PaintEvent& event) int painted_row_index = 0; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& a_rect, const Gfx::IntRect& a_toggle_rect, int indent_level) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& a_rect, Gfx::IntRect const& a_toggle_rect, int indent_level) { if (!a_rect.intersects_vertically(visible_content_rect)) return IterationDecision::Continue; @@ -380,12 +380,12 @@ void TreeView::paint_event(PaintEvent& event) }); } -void TreeView::scroll_into_view(const ModelIndex& a_index, bool, bool scroll_vertically) +void TreeView::scroll_into_view(ModelIndex const& a_index, bool, bool scroll_vertically) { if (!a_index.is_valid()) return; Gfx::IntRect found_rect; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect&, int) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& rect, Gfx::IntRect const&, int) { if (index == a_index) { found_rect = rect; return IterationDecision::Break; @@ -582,7 +582,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up return; } case CursorMovement::PageUp: { - const int items_per_page = visible_content_rect().height() / row_height(); + int const items_per_page = visible_content_rect().height() / row_height(); auto new_index = cursor_index(); for (int step = 0; step < items_per_page; ++step) new_index = step_up(new_index); @@ -591,7 +591,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up return; } case CursorMovement::PageDown: { - const int items_per_page = visible_content_rect().height() / row_height(); + int const items_per_page = visible_content_rect().height() / row_height(); auto new_index = cursor_index(); for (int step = 0; step < items_per_page; ++step) new_index = step_down(new_index); @@ -609,7 +609,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up int TreeView::item_count() const { int count = 0; - traverse_in_paint_order([&](const ModelIndex&, const Gfx::IntRect&, const Gfx::IntRect&, int) { + traverse_in_paint_order([&](ModelIndex const&, Gfx::IntRect const&, Gfx::IntRect const&, int) { ++count; return IterationDecision::Continue; }); @@ -632,7 +632,7 @@ void TreeView::auto_resize_column(int column) int column_width = header_width; bool is_empty = true; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int indent_level) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int indent_level) { auto cell_data = model.index(index.row(), column, index.parent()).data(); int cell_width = 0; if (cell_data.is_icon()) { @@ -675,7 +675,7 @@ void TreeView::update_column_sizes() if (column == m_key_column && model.is_column_sortable(column)) header_width += font().width(" \xE2\xAC\x86"); int column_width = header_width; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int) { auto cell_data = model.index(index.row(), column, index.parent()).data(); int cell_width = 0; if (cell_data.is_icon()) { @@ -696,7 +696,7 @@ void TreeView::update_column_sizes() if (tree_column == m_key_column && model.is_column_sortable(tree_column)) tree_column_header_width += font().width(" \xE2\xAC\x86"); int tree_column_width = tree_column_header_width; - traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int indent_level) { + traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int indent_level) { auto cell_data = model.index(index.row(), tree_column, index.parent()).data(); int cell_width = 0; if (cell_data.is_valid()) { diff --git a/Userland/Libraries/LibGUI/TreeView.h b/Userland/Libraries/LibGUI/TreeView.h index abb9c40436..75ba2abe5d 100644 --- a/Userland/Libraries/LibGUI/TreeView.h +++ b/Userland/Libraries/LibGUI/TreeView.h @@ -17,17 +17,17 @@ class TreeView : public AbstractTableView { public: virtual ~TreeView() override = default; - virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally, bool scroll_vertically) override; + virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally, bool scroll_vertically) override; virtual int item_count() const override; - virtual void toggle_index(const ModelIndex&) override; + virtual void toggle_index(ModelIndex const&) override; - void expand_tree(const ModelIndex& root = {}); - void collapse_tree(const ModelIndex& root = {}); + void expand_tree(ModelIndex const& root = {}); + void collapse_tree(ModelIndex const& root = {}); - void expand_all_parents_of(const ModelIndex&); + void expand_all_parents_of(ModelIndex const&); - Function<void(const ModelIndex&, const bool)> on_toggle; + Function<void(ModelIndex const&, bool const)> on_toggle; void set_should_fill_selected_rows(bool fill) { m_should_fill_selected_rows = fill; } bool should_fill_selected_rows() const { return m_should_fill_selected_rows; } @@ -51,7 +51,7 @@ protected: virtual void move_cursor(CursorMovement, SelectionUpdate) override; private: - virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const override; + virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const override; int row_height() const { return 16; } int max_item_width() const { return frame_inner_rect().width(); } @@ -69,8 +69,8 @@ private: struct MetadataForIndex; - MetadataForIndex& ensure_metadata_for_index(const ModelIndex&) const; - void set_open_state_of_all_in_subtree(const ModelIndex& root, bool open); + MetadataForIndex& ensure_metadata_for_index(ModelIndex const&) const; + void set_open_state_of_all_in_subtree(ModelIndex const& root, bool open); mutable HashMap<void*, NonnullOwnPtr<MetadataForIndex>> m_view_metadata; diff --git a/Userland/Libraries/LibGUI/ValueSlider.cpp b/Userland/Libraries/LibGUI/ValueSlider.cpp index 6034361e07..c7bc87aa08 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.cpp +++ b/Userland/Libraries/LibGUI/ValueSlider.cpp @@ -21,7 +21,7 @@ ValueSlider::ValueSlider(Gfx::Orientation orientation, String suffix) : AbstractSlider(orientation) , m_suffix(move(suffix)) { - //FIXME: Implement vertical mode + // FIXME: Implement vertical mode VERIFY(orientation == Orientation::Horizontal); set_fixed_height(20); @@ -132,7 +132,7 @@ Gfx::IntRect ValueSlider::knob_rect() const return knob_rect; } -int ValueSlider::value_at(const Gfx::IntPoint& position) const +int ValueSlider::value_at(Gfx::IntPoint const& position) const { if (position.x() < bar_rect().left()) return min(); diff --git a/Userland/Libraries/LibGUI/ValueSlider.h b/Userland/Libraries/LibGUI/ValueSlider.h index 91aba6ab19..8b0291a0ae 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.h +++ b/Userland/Libraries/LibGUI/ValueSlider.h @@ -39,7 +39,7 @@ private: explicit ValueSlider(Gfx::Orientation = Gfx::Orientation::Horizontal, String suffix = ""); String formatted_value() const; - int value_at(const Gfx::IntPoint& position) const; + int value_at(Gfx::IntPoint const& position) const; Gfx::IntRect bar_rect() const; Gfx::IntRect knob_rect() const; diff --git a/Userland/Libraries/LibGUI/Variant.cpp b/Userland/Libraries/LibGUI/Variant.cpp index a519a92354..8649705b07 100644 --- a/Userland/Libraries/LibGUI/Variant.cpp +++ b/Userland/Libraries/LibGUI/Variant.cpp @@ -12,7 +12,7 @@ namespace GUI { -const char* to_string(Variant::Type type) +char const* to_string(Variant::Type type) { switch (type) { case Variant::Type::Invalid: @@ -162,12 +162,12 @@ Variant::Variant(bool value) m_value.as_bool = value; } -Variant::Variant(const char* cstring) +Variant::Variant(char const* cstring) : Variant(String(cstring)) { } -Variant::Variant(const FlyString& value) +Variant::Variant(FlyString const& value) : Variant(String(value.impl())) { } @@ -177,14 +177,14 @@ Variant::Variant(StringView value) { } -Variant::Variant(const String& value) +Variant::Variant(String const& value) : m_type(Type::String) { m_value.as_string = const_cast<StringImpl*>(value.impl()); AK::ref_if_not_null(m_value.as_string); } -Variant::Variant(const JsonValue& value) +Variant::Variant(JsonValue const& value) { if (value.is_null()) { m_value.as_string = nullptr; @@ -231,7 +231,7 @@ Variant::Variant(const JsonValue& value) VERIFY_NOT_REACHED(); } -Variant::Variant(const Gfx::Bitmap& value) +Variant::Variant(Gfx::Bitmap const& value) : m_type(Type::Bitmap) { m_value.as_bitmap = const_cast<Gfx::Bitmap*>(&value); @@ -245,7 +245,7 @@ Variant::Variant(const GUI::Icon& value) AK::ref_if_not_null(m_value.as_icon); } -Variant::Variant(const Gfx::Font& value) +Variant::Variant(Gfx::Font const& value) : m_type(Type::Font) { m_value.as_font = &const_cast<Gfx::Font&>(value); @@ -258,25 +258,25 @@ Variant::Variant(Color color) m_value.as_color = color.value(); } -Variant::Variant(const Gfx::IntPoint& point) +Variant::Variant(Gfx::IntPoint const& point) : m_type(Type::Point) { m_value.as_point = { point.x(), point.y() }; } -Variant::Variant(const Gfx::IntSize& size) +Variant::Variant(Gfx::IntSize const& size) : m_type(Type::Size) { m_value.as_size = { size.width(), size.height() }; } -Variant::Variant(const Gfx::IntRect& rect) +Variant::Variant(Gfx::IntRect const& rect) : m_type(Type::Rect) { - m_value.as_rect = (const RawRect&)rect; + m_value.as_rect = (RawRect const&)rect; } -Variant& Variant::operator=(const Variant& other) +Variant& Variant::operator=(Variant const& other) { if (&other == this) return *this; @@ -294,7 +294,7 @@ Variant& Variant::operator=(Variant&& other) return *this; } -Variant::Variant(const Variant& other) +Variant::Variant(Variant const& other) { copy_from(other); } @@ -307,7 +307,7 @@ void Variant::move_from(Variant&& other) other.m_value.as_string = nullptr; } -void Variant::copy_from(const Variant& other) +void Variant::copy_from(Variant const& other) { VERIFY(!is_valid()); m_type = other.m_type; @@ -381,7 +381,7 @@ void Variant::copy_from(const Variant& other) } } -bool Variant::operator==(const Variant& other) const +bool Variant::operator==(Variant const& other) const { if (m_type != other.m_type) return to_string() == other.to_string(); @@ -432,7 +432,7 @@ bool Variant::operator==(const Variant& other) const VERIFY_NOT_REACHED(); } -bool Variant::operator<(const Variant& other) const +bool Variant::operator<(Variant const& other) const { if (m_type != other.m_type) return to_string() < other.to_string(); diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index 8862bfa27f..1789a8fd1b 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -24,27 +24,27 @@ public: Variant(i64); Variant(u32); Variant(u64); - Variant(const char*); + Variant(char const*); Variant(StringView); - Variant(const String&); - Variant(const FlyString&); - Variant(const Gfx::Bitmap&); + Variant(String const&); + Variant(FlyString const&); + Variant(Gfx::Bitmap const&); Variant(const GUI::Icon&); - Variant(const Gfx::IntPoint&); - Variant(const Gfx::IntSize&); - Variant(const Gfx::IntRect&); - Variant(const Gfx::Font&); + Variant(Gfx::IntPoint const&); + Variant(Gfx::IntSize const&); + Variant(Gfx::IntRect const&); + Variant(Gfx::Font const&); Variant(const Gfx::TextAlignment); Variant(const Gfx::ColorRole); Variant(const Gfx::AlignmentRole); Variant(const Gfx::FlagRole); Variant(const Gfx::MetricRole); Variant(const Gfx::PathRole); - Variant(const JsonValue&); + Variant(JsonValue const&); Variant(Color); - Variant(const Variant&); - Variant& operator=(const Variant&); + Variant(Variant const&); + Variant& operator=(Variant const&); Variant(Variant&&) = delete; Variant& operator=(Variant&&); @@ -220,7 +220,7 @@ public: return m_value.as_string; } - const Gfx::Bitmap& as_bitmap() const + Gfx::Bitmap const& as_bitmap() const { VERIFY(type() == Type::Bitmap); return *m_value.as_bitmap; @@ -238,7 +238,7 @@ public: return Color::from_argb(m_value.as_color); } - const Gfx::Font& as_font() const + Gfx::Font const& as_font() const { VERIFY(type() == Type::Font); return *m_value.as_font; @@ -300,11 +300,11 @@ public: String to_string() const; - bool operator==(const Variant&) const; - bool operator<(const Variant&) const; + bool operator==(Variant const&) const; + bool operator<(Variant const&) const; private: - void copy_from(const Variant&); + void copy_from(Variant const&); void move_from(Variant&&); struct RawPoint { @@ -348,6 +348,6 @@ private: Type m_type { Type::Invalid }; }; -const char* to_string(Variant::Type); +char const* to_string(Variant::Type); } diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.cpp b/Userland/Libraries/LibGUI/VimEditingEngine.cpp index d69c3ed326..a12887a036 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/VimEditingEngine.cpp @@ -773,7 +773,7 @@ CursorWidth VimEditingEngine::cursor_width() const return m_vim_mode == VimMode::Insert ? CursorWidth::NARROW : CursorWidth::WIDE; } -bool VimEditingEngine::on_key(const KeyEvent& event) +bool VimEditingEngine::on_key(KeyEvent const& event) { switch (m_vim_mode) { case (VimMode::Insert): @@ -789,7 +789,7 @@ bool VimEditingEngine::on_key(const KeyEvent& event) return false; } -bool VimEditingEngine::on_key_in_insert_mode(const KeyEvent& event) +bool VimEditingEngine::on_key_in_insert_mode(KeyEvent const& event) { if (EditingEngine::on_key(event)) return true; @@ -819,7 +819,7 @@ bool VimEditingEngine::on_key_in_insert_mode(const KeyEvent& event) return false; } -bool VimEditingEngine::on_key_in_normal_mode(const KeyEvent& event) +bool VimEditingEngine::on_key_in_normal_mode(KeyEvent const& event) { // Ignore auxiliary keypress events. if (event.key() == KeyCode::Key_LeftShift @@ -1102,7 +1102,7 @@ bool VimEditingEngine::on_key_in_normal_mode(const KeyEvent& event) return true; } -bool VimEditingEngine::on_key_in_visual_mode(const KeyEvent& event) +bool VimEditingEngine::on_key_in_visual_mode(KeyEvent const& event) { // If the motion state machine requires the next character, feed it. if (m_motion.should_consume_next_character()) { diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.h b/Userland/Libraries/LibGUI/VimEditingEngine.h index 8be34cfbbd..b7216d0892 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.h +++ b/Userland/Libraries/LibGUI/VimEditingEngine.h @@ -146,7 +146,7 @@ class VimEditingEngine final : public EditingEngine { public: virtual CursorWidth cursor_width() const override; - virtual bool on_key(const KeyEvent& event) override; + virtual bool on_key(KeyEvent const& event) override; private: enum VimMode { @@ -184,9 +184,9 @@ private: void move_to_previous_empty_lines_block(); void move_to_next_empty_lines_block(); - bool on_key_in_insert_mode(const KeyEvent& event); - bool on_key_in_normal_mode(const KeyEvent& event); - bool on_key_in_visual_mode(const KeyEvent& event); + bool on_key_in_insert_mode(KeyEvent const& event); + bool on_key_in_normal_mode(KeyEvent const& event); + bool on_key_in_visual_mode(KeyEvent const& event); virtual EngineType engine_type() const override { return EngineType::Vim; } }; diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 7686960b5e..bc1036a145 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -217,7 +217,7 @@ void Widget::child_event(Core::ChildEvent& event) return Core::Object::child_event(event); } -void Widget::set_relative_rect(const Gfx::IntRect& a_rect) +void Widget::set_relative_rect(Gfx::IntRect const& a_rect) { // Get rid of negative width/height values. Gfx::IntRect rect = { @@ -596,7 +596,7 @@ void Widget::update() update(rect()); } -void Widget::update(const Gfx::IntRect& rect) +void Widget::update(Gfx::IntRect const& rect) { if (!is_visible()) return; @@ -653,7 +653,7 @@ Gfx::IntRect Widget::screen_relative_rect() const return window_relative_rect().translated(window_position); } -Widget* Widget::child_at(const Gfx::IntPoint& point) const +Widget* Widget::child_at(Gfx::IntPoint const& point) const { for (int i = children().size() - 1; i >= 0; --i) { if (!is<Widget>(children()[i])) @@ -667,7 +667,7 @@ Widget* Widget::child_at(const Gfx::IntPoint& point) const return nullptr; } -Widget::HitTestResult Widget::hit_test(const Gfx::IntPoint& position, ShouldRespectGreediness should_respect_greediness) +Widget::HitTestResult Widget::hit_test(Gfx::IntPoint const& position, ShouldRespectGreediness should_respect_greediness) { if (should_respect_greediness == ShouldRespectGreediness::Yes && is_greedy_for_hits()) return { this, position }; @@ -737,7 +737,7 @@ void Widget::set_focus(bool focus, FocusSource source) } } -void Widget::set_font(const Gfx::Font* font) +void Widget::set_font(Gfx::Font const* font) { if (m_font.ptr() == font) return; @@ -754,7 +754,7 @@ void Widget::set_font(const Gfx::Font* font) update(); } -void Widget::set_font_family(const String& family) +void Widget::set_font_family(String const& family) { set_font(Gfx::FontDatabase::the().get(family, m_font->presentation_size(), m_font->weight(), m_font->slope())); } @@ -777,7 +777,7 @@ void Widget::set_font_fixed_width(bool fixed_width) set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight(), m_font->slope())); } -void Widget::set_min_size(const Gfx::IntSize& size) +void Widget::set_min_size(Gfx::IntSize const& size) { if (m_min_size == size) return; @@ -785,7 +785,7 @@ void Widget::set_min_size(const Gfx::IntSize& size) invalidate_layout(); } -void Widget::set_max_size(const Gfx::IntSize& size) +void Widget::set_max_size(Gfx::IntSize const& size) { if (m_max_size == size) return; @@ -901,7 +901,7 @@ bool Widget::is_backmost() const return &parent->children().first() == this; } -Action* Widget::action_for_key_event(const KeyEvent& event) +Action* Widget::action_for_key_event(KeyEvent const& event) { Shortcut shortcut(event.modifiers(), (KeyCode)event.key()); @@ -970,7 +970,7 @@ Vector<Widget&> Widget::child_widgets() const return widgets; } -void Widget::set_palette(const Palette& palette) +void Widget::set_palette(Palette const& palette) { m_palette = palette.impl(); update(); @@ -1003,7 +1003,7 @@ void Widget::did_end_inspection() update(); } -void Widget::set_grabbable_margins(const Margins& margins) +void Widget::set_grabbable_margins(Margins const& margins) { if (m_grabbable_margins == margins) return; @@ -1061,13 +1061,13 @@ void Widget::set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr< bool Widget::load_from_gml(StringView gml_string) { - return load_from_gml(gml_string, [](const String& class_name) -> RefPtr<Core::Object> { + return load_from_gml(gml_string, [](String const& class_name) -> RefPtr<Core::Object> { dbgln("Class '{}' not registered", class_name); return nullptr; }); } -bool Widget::load_from_gml(StringView gml_string, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) +bool Widget::load_from_gml(StringView gml_string, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)) { auto value = GML::parse_gml(gml_string); if (value.is_error()) { @@ -1078,7 +1078,7 @@ bool Widget::load_from_gml(StringView gml_string, RefPtr<Core::Object> (*unregis return load_from_gml_ast(value.release_value(), unregistered_child_handler); } -bool Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) +bool Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)) { if (is<GUI::GML::GMLFile>(ast.ptr())) return load_from_gml_ast(static_ptr_cast<GUI::GML::GMLFile>(ast)->main_class(), unregistered_child_handler); diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index f6fb217c2e..bda60d956d 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -61,7 +61,7 @@ public: virtual ~Widget() override; Layout* layout() { return m_layout.ptr(); } - const Layout* layout() const { return m_layout.ptr(); } + Layout const* layout() const { return m_layout.ptr(); } void set_layout(NonnullRefPtr<Layout>); template<class T, class... Args> @@ -81,7 +81,7 @@ public: } Gfx::IntSize min_size() const { return m_min_size; } - void set_min_size(const Gfx::IntSize&); + void set_min_size(Gfx::IntSize const&); void set_min_size(int width, int height) { set_min_size({ width, height }); } int min_width() const { return m_min_size.width(); } @@ -90,7 +90,7 @@ public: void set_min_height(int height) { set_min_size(min_width(), height); } Gfx::IntSize max_size() const { return m_max_size; } - void set_max_size(const Gfx::IntSize&); + void set_max_size(Gfx::IntSize const&); void set_max_size(int width, int height) { set_max_size({ width, height }); } int max_width() const { return m_max_size.width(); } @@ -98,7 +98,7 @@ public: void set_max_width(int width) { set_max_size(width, max_height()); } void set_max_height(int height) { set_max_size(max_width(), height); } - void set_fixed_size(const Gfx::IntSize& size) + void set_fixed_size(Gfx::IntSize const& size) { set_min_size(size); set_max_size(size); @@ -154,7 +154,7 @@ public: // Invalidate the widget (or an area thereof), causing a repaint to happen soon. void update(); - void update(const Gfx::IntRect&); + void update(Gfx::IntRect const&); // Repaint the widget (or an area thereof) immediately. void repaint(); @@ -163,13 +163,13 @@ public: bool is_focused() const; void set_focus(bool, FocusSource = FocusSource::Programmatic); - Function<void(const bool, const FocusSource)> on_focus_change; + Function<void(bool const, const FocusSource)> on_focus_change; // Returns true if this widget or one of its descendants is focused. bool has_focus_within() const; Widget* focus_proxy() { return m_focus_proxy; } - const Widget* focus_proxy() const { return m_focus_proxy; } + Widget const* focus_proxy() const { return m_focus_proxy; } void set_focus_proxy(Widget*); void set_focus_policy(FocusPolicy policy); @@ -183,10 +183,10 @@ public: WeakPtr<Widget> widget; Gfx::IntPoint local_position; }; - HitTestResult hit_test(const Gfx::IntPoint&, ShouldRespectGreediness = ShouldRespectGreediness::Yes); - Widget* child_at(const Gfx::IntPoint&) const; + HitTestResult hit_test(Gfx::IntPoint const&, ShouldRespectGreediness = ShouldRespectGreediness::Yes); + Widget* child_at(Gfx::IntPoint const&) const; - void set_relative_rect(const Gfx::IntRect&); + void set_relative_rect(Gfx::IntRect const&); void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); } void set_x(int x) { set_relative_rect(x, y(), width(), height()); } @@ -194,13 +194,13 @@ public: void set_width(int width) { set_relative_rect(x(), y(), width, height()); } void set_height(int height) { set_relative_rect(x(), y(), width(), height); } - void move_to(const Gfx::IntPoint& point) { set_relative_rect({ point, relative_rect().size() }); } + void move_to(Gfx::IntPoint const& point) { set_relative_rect({ point, relative_rect().size() }); } void move_to(int x, int y) { move_to({ x, y }); } - void resize(const Gfx::IntSize& size) { set_relative_rect({ relative_rect().location(), size }); } + void resize(Gfx::IntSize const& size) { set_relative_rect({ relative_rect().location(), size }); } void resize(int width, int height) { resize({ width, height }); } void move_by(int x, int y) { move_by({ x, y }); } - void move_by(const Gfx::IntPoint& delta) { set_relative_rect({ relative_position().translated(delta), size() }); } + void move_by(Gfx::IntPoint const& delta) { set_relative_rect({ relative_position().translated(delta), size() }); } Gfx::ColorRole background_role() const { return m_background_role; } void set_background_role(Gfx::ColorRole); @@ -217,7 +217,7 @@ public: return m_window; } - const Window* window() const + Window const* window() const { if (auto* pw = parent_widget()) return pw->window(); @@ -227,17 +227,17 @@ public: void set_window(Window*); Widget* parent_widget(); - const Widget* parent_widget() const; + Widget const* parent_widget() const; void set_fill_with_background_color(bool b) { m_fill_with_background_color = b; } bool fill_with_background_color() const { return m_fill_with_background_color; } - const Gfx::Font& font() const { return *m_font; } + Gfx::Font const& font() const { return *m_font; } - void set_font(const Gfx::Font*); - void set_font(const Gfx::Font& font) { set_font(&font); } + void set_font(Gfx::Font const*); + void set_font(Gfx::Font const& font) { set_font(&font); } - void set_font_family(const String&); + void set_font_family(String const&); void set_font_size(unsigned); void set_font_weight(unsigned); void set_font_fixed_width(bool); @@ -259,7 +259,7 @@ public: bool is_frontmost() const; bool is_backmost() const; - Action* action_for_key_event(const KeyEvent&); + Action* action_for_key_event(KeyEvent const&); template<typename Callback> void for_each_child_widget(Callback callback) @@ -276,10 +276,10 @@ public: void do_layout(); Gfx::Palette palette() const; - void set_palette(const Gfx::Palette&); + void set_palette(Gfx::Palette const&); - const Margins& grabbable_margins() const { return m_grabbable_margins; } - void set_grabbable_margins(const Margins&); + Margins const& grabbable_margins() const { return m_grabbable_margins; } + void set_grabbable_margins(Margins const&); Gfx::IntRect relative_non_grabbable_rect() const; @@ -295,7 +295,7 @@ public: void set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>>); bool load_from_gml(StringView); - bool load_from_gml(StringView, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)); + bool load_from_gml(StringView, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)); void set_shrink_to_fit(bool); bool is_shrink_to_fit() const { return m_shrink_to_fit; } @@ -303,7 +303,7 @@ public: bool has_pending_drop() const; // In order for others to be able to call this, it needs to be public. - virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)); + virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)); protected: Widget(); @@ -403,7 +403,7 @@ inline Widget* Widget::parent_widget() return &verify_cast<Widget>(*parent()); return nullptr; } -inline const Widget* Widget::parent_widget() const +inline Widget const* Widget::parent_widget() const { if (parent() && is<Widget>(*parent())) return &verify_cast<const Widget>(*parent()); diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 1a7bf2aa79..7035d39c38 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -43,7 +43,7 @@ public: } Gfx::Bitmap& bitmap() { return *m_bitmap; } - const Gfx::Bitmap& bitmap() const { return *m_bitmap; } + Gfx::Bitmap const& bitmap() const { return *m_bitmap; } Gfx::IntSize size() const { return m_bitmap->size(); } @@ -255,7 +255,7 @@ Gfx::IntRect Window::rect() const return ConnectionToWindowServer::the().get_window_rect(m_window_id); } -void Window::set_rect(const Gfx::IntRect& a_rect) +void Window::set_rect(Gfx::IntRect const& a_rect) { if (a_rect.location() != m_rect_when_windowless.location()) { m_moved_by_client = true; @@ -284,7 +284,7 @@ Gfx::IntSize Window::minimum_size() const return ConnectionToWindowServer::the().get_window_minimum_size(m_window_id); } -void Window::set_minimum_size(const Gfx::IntSize& size) +void Window::set_minimum_size(Gfx::IntSize const& size) { m_minimum_size_modified = true; m_minimum_size_when_windowless = size; @@ -298,7 +298,7 @@ void Window::center_on_screen() set_rect(rect().centered_within(Desktop::the().rect())); } -void Window::center_within(const Window& other) +void Window::center_within(Window const& other) { if (this == &other) return; @@ -688,7 +688,7 @@ void Window::force_update() ConnectionToWindowServer::the().async_invalidate_rect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true); } -void Window::update(const Gfx::IntRect& a_rect) +void Window::update(Gfx::IntRect const& a_rect) { if (!is_visible()) return; @@ -847,7 +847,7 @@ void Window::set_current_backing_store(WindowBackingStore& backing_store, bool f ConnectionToWindowServer::the().set_window_backing_store(m_window_id, 32, bitmap.pitch(), bitmap.anonymous_buffer().fd(), backing_store.serial(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately); } -void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) +void Window::flip(Vector<Gfx::IntRect, 32> const& dirty_rects) { swap(m_front_store, m_back_store); @@ -869,7 +869,7 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects) m_back_store->bitmap().set_volatile(); } -OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size) +OwnPtr<WindowBackingStore> Window::create_backing_store(Gfx::IntSize const& size) { auto format = m_has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888; @@ -911,7 +911,7 @@ void Window::applet_area_rect_change_event(AppletAreaRectChangeEvent&) { } -void Window::set_icon(const Gfx::Bitmap* icon) +void Window::set_icon(Gfx::Bitmap const* icon) { if (m_icon == icon) return; @@ -1096,7 +1096,7 @@ void Window::notify_state_changed(Badge<ConnectionToWindowServer>, bool minimize } } -Action* Window::action_for_key_event(const KeyEvent& event) +Action* Window::action_for_key_event(KeyEvent const& event) { Shortcut shortcut(event.modifiers(), (KeyCode)event.key()); Action* found_action = nullptr; @@ -1110,7 +1110,7 @@ Action* Window::action_for_key_event(const KeyEvent& event) return found_action; } -void Window::set_base_size(const Gfx::IntSize& base_size) +void Window::set_base_size(Gfx::IntSize const& base_size) { if (m_base_size == base_size) return; @@ -1119,7 +1119,7 @@ void Window::set_base_size(const Gfx::IntSize& base_size) ConnectionToWindowServer::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment); } -void Window::set_size_increment(const Gfx::IntSize& size_increment) +void Window::set_size_increment(Gfx::IntSize const& size_increment) { if (m_size_increment == size_increment) return; @@ -1128,7 +1128,7 @@ void Window::set_size_increment(const Gfx::IntSize& size_increment) ConnectionToWindowServer::the().async_set_window_base_size_and_size_increment(m_window_id, m_base_size, m_size_increment); } -void Window::set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio) +void Window::set_resize_aspect_ratio(Optional<Gfx::IntSize> const& ratio) { if (m_resize_aspect_ratio == ratio) return; @@ -1219,7 +1219,7 @@ Menu& Window::add_menu(String name) return *menu; } -void Window::flash_menubar_menu_for(const MenuItem& menu_item) +void Window::flash_menubar_menu_for(MenuItem const& menu_item) { auto menu_id = menu_item.menu_id(); if (menu_id < 0) diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index 102d834eb7..d8c10ba877 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -93,23 +93,23 @@ public: Gfx::IntRect rect() const; Gfx::IntRect applet_rect_on_screen() const; Gfx::IntSize size() const { return rect().size(); } - void set_rect(const Gfx::IntRect&); + void set_rect(Gfx::IntRect const&); void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); } Gfx::IntPoint position() const { return rect().location(); } Gfx::IntSize minimum_size() const; - void set_minimum_size(const Gfx::IntSize&); + void set_minimum_size(Gfx::IntSize const&); void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); } void move_to(int x, int y) { move_to({ x, y }); } - void move_to(const Gfx::IntPoint& point) { set_rect({ point, size() }); } + void move_to(Gfx::IntPoint const& point) { set_rect({ point, size() }); } void resize(int width, int height) { resize({ width, height }); } - void resize(const Gfx::IntSize& size) { set_rect({ position(), size }); } + void resize(Gfx::IntSize const& size) { set_rect({ position(), size }); } void center_on_screen(); - void center_within(const Window&); + void center_within(Window const&); virtual void event(Core::Event&) override; @@ -128,7 +128,7 @@ public: void start_interactive_resize(); Widget* main_widget() { return m_main_widget; } - const Widget* main_widget() const { return m_main_widget; } + Widget const* main_widget() const { return m_main_widget; } void set_main_widget(Widget*); template<class T, class... Args> @@ -152,37 +152,37 @@ public: void set_default_return_key_widget(Widget*); Widget* focused_widget() { return m_focused_widget; } - const Widget* focused_widget() const { return m_focused_widget; } + Widget const* focused_widget() const { return m_focused_widget; } void set_focused_widget(Widget*, FocusSource = FocusSource::Programmatic); void update(); - void update(const Gfx::IntRect&); + void update(Gfx::IntRect const&); void set_automatic_cursor_tracking_widget(Widget*); Widget* automatic_cursor_tracking_widget() { return m_automatic_cursor_tracking_widget.ptr(); } - const Widget* automatic_cursor_tracking_widget() const { return m_automatic_cursor_tracking_widget.ptr(); } + Widget const* automatic_cursor_tracking_widget() const { return m_automatic_cursor_tracking_widget.ptr(); } Widget* hovered_widget() { return m_hovered_widget.ptr(); } - const Widget* hovered_widget() const { return m_hovered_widget.ptr(); } + Widget const* hovered_widget() const { return m_hovered_widget.ptr(); } void set_hovered_widget(Widget*); Gfx::Bitmap* back_bitmap(); Gfx::IntSize size_increment() const { return m_size_increment; } - void set_size_increment(const Gfx::IntSize&); + void set_size_increment(Gfx::IntSize const&); Gfx::IntSize base_size() const { return m_base_size; } - void set_base_size(const Gfx::IntSize&); - const Optional<Gfx::IntSize>& resize_aspect_ratio() const { return m_resize_aspect_ratio; } + void set_base_size(Gfx::IntSize const&); + Optional<Gfx::IntSize> const& resize_aspect_ratio() const { return m_resize_aspect_ratio; } void set_resize_aspect_ratio(int width, int height) { set_resize_aspect_ratio(Gfx::IntSize(width, height)); } void set_no_resize_aspect_ratio() { set_resize_aspect_ratio({}); } - void set_resize_aspect_ratio(const Optional<Gfx::IntSize>& ratio); + void set_resize_aspect_ratio(Optional<Gfx::IntSize> const& ratio); void set_cursor(Gfx::StandardCursor); void set_cursor(NonnullRefPtr<Gfx::Bitmap>); - void set_icon(const Gfx::Bitmap*); + void set_icon(Gfx::Bitmap const*); void apply_icon(); - const Gfx::Bitmap* icon() const { return m_icon.ptr(); } + Gfx::Bitmap const* icon() const { return m_icon.ptr(); } Vector<Widget&> focusable_widgets(FocusSource) const; @@ -196,7 +196,7 @@ public: virtual bool is_visible_for_timer_purposes() const override { return m_visible_for_timer_purposes; } - Action* action_for_key_event(const KeyEvent&); + Action* action_for_key_event(KeyEvent const&); void did_add_widget(Badge<Widget>, Widget&); void did_remove_widget(Badge<Widget>, Widget&); @@ -211,7 +211,7 @@ public: Menu& add_menu(String name); ErrorOr<NonnullRefPtr<Menu>> try_add_menu(String name); - void flash_menubar_menu_for(const MenuItem&); + void flash_menubar_menu_for(MenuItem const&); void flush_pending_paints_immediately(); @@ -249,9 +249,9 @@ private: void server_did_destroy(); - OwnPtr<WindowBackingStore> create_backing_store(const Gfx::IntSize&); + OwnPtr<WindowBackingStore> create_backing_store(Gfx::IntSize const&); void set_current_backing_store(WindowBackingStore&, bool flush_immediately = false); - void flip(const Vector<Gfx::IntRect, 32>& dirty_rects); + void flip(Vector<Gfx::IntRect, 32> const& dirty_rects); void force_update(); bool are_cursors_the_same(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> const&, AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> const&) const; diff --git a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp index 72f297c761..967671d951 100644 --- a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp +++ b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp @@ -36,12 +36,12 @@ CoverWizardPage::CoverWizardPage() m_body_label->set_text_alignment(Gfx::TextAlignment::TopLeft); } -void CoverWizardPage::set_header_text(const String& text) +void CoverWizardPage::set_header_text(String const& text) { m_header_label->set_text(text); } -void CoverWizardPage::set_body_text(const String& text) +void CoverWizardPage::set_body_text(String const& text) { m_body_label->set_text(text); } diff --git a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.h b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.h index 4c7e7c534e..753dd74723 100644 --- a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.h +++ b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.h @@ -18,8 +18,8 @@ class CoverWizardPage : public AbstractWizardPage { ImageWidget& banner_image_widget() { return *m_banner_image_widget; } - void set_header_text(const String& text); - void set_body_text(const String& text); + void set_header_text(String const& text); + void set_body_text(String const& text); private: explicit CoverWizardPage(); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp index a08f5e879f..d67ed97080 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp @@ -14,7 +14,7 @@ namespace GUI { -WizardPage::WizardPage(const String& title_text, const String& subtitle_text) +WizardPage::WizardPage(String const& title_text, String const& subtitle_text) : AbstractWizardPage() { set_layout<VerticalBoxLayout>(); @@ -44,12 +44,12 @@ WizardPage::WizardPage(const String& title_text, const String& subtitle_text) m_body_widget->layout()->set_margins(20); } -void WizardPage::set_page_title(const String& text) +void WizardPage::set_page_title(String const& text) { m_title_label->set_text(text); } -void WizardPage::set_page_subtitle(const String& text) +void WizardPage::set_page_subtitle(String const& text) { m_subtitle_label->set_text(text); } diff --git a/Userland/Libraries/LibGUI/Wizards/WizardPage.h b/Userland/Libraries/LibGUI/Wizards/WizardPage.h index b3c5d8e38e..3dfe2430ac 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardPage.h +++ b/Userland/Libraries/LibGUI/Wizards/WizardPage.h @@ -18,11 +18,11 @@ class WizardPage : public AbstractWizardPage { Widget& body_widget() { return *m_body_widget; }; - void set_page_title(const String& text); - void set_page_subtitle(const String& text); + void set_page_title(String const& text); + void set_page_subtitle(String const& text); private: - explicit WizardPage(const String& title_text, const String& subtitle_text); + explicit WizardPage(String const& title_text, String const& subtitle_text); RefPtr<Widget> m_body_widget; diff --git a/Userland/Libraries/LibGemini/Document.h b/Userland/Libraries/LibGemini/Document.h index 493dbc73fd..578ad24e3e 100644 --- a/Userland/Libraries/LibGemini/Document.h +++ b/Userland/Libraries/LibGemini/Document.h @@ -62,7 +62,7 @@ public: class Link : public Line { public: - Link(String line, const Document&); + Link(String line, Document const&); virtual ~Link() override = default; virtual String render_to_html() const override; diff --git a/Userland/Libraries/LibGemini/GeminiRequest.cpp b/Userland/Libraries/LibGemini/GeminiRequest.cpp index 4059ddec1b..eda8439b1d 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.cpp +++ b/Userland/Libraries/LibGemini/GeminiRequest.cpp @@ -18,7 +18,7 @@ ByteBuffer GeminiRequest::to_raw_request() const return builder.to_byte_buffer(); } -Optional<GeminiRequest> GeminiRequest::from_raw_request(const ByteBuffer& raw_request) +Optional<GeminiRequest> GeminiRequest::from_raw_request(ByteBuffer const& raw_request) { URL url = StringView(raw_request); if (!url.is_valid()) diff --git a/Userland/Libraries/LibGemini/GeminiRequest.h b/Userland/Libraries/LibGemini/GeminiRequest.h index 206ab2ad79..fdfa99739c 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.h +++ b/Userland/Libraries/LibGemini/GeminiRequest.h @@ -23,7 +23,7 @@ public: ByteBuffer to_raw_request() const; - static Optional<GeminiRequest> from_raw_request(const ByteBuffer&); + static Optional<GeminiRequest> from_raw_request(ByteBuffer const&); private: URL m_url; diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index 3051b626eb..5696a47632 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -12,7 +12,7 @@ namespace Gemini { -Job::Job(const GeminiRequest& request, Core::Stream::Stream& output_stream) +Job::Job(GeminiRequest const& request, Core::Stream::Stream& output_stream) : Core::NetworkJob(output_stream) , m_request(request) { diff --git a/Userland/Libraries/LibGemini/Job.h b/Userland/Libraries/LibGemini/Job.h index ca9342eb0c..7593f5345e 100644 --- a/Userland/Libraries/LibGemini/Job.h +++ b/Userland/Libraries/LibGemini/Job.h @@ -17,14 +17,14 @@ class Job : public Core::NetworkJob { C_OBJECT(Job); public: - explicit Job(const GeminiRequest&, Core::Stream::Stream&); + explicit Job(GeminiRequest const&, Core::Stream::Stream&); virtual ~Job() override = default; virtual void start(Core::Stream::Socket&) override; virtual void shutdown(ShutdownMode) override; GeminiResponse* response() { return static_cast<GeminiResponse*>(Core::NetworkJob::response()); } - const GeminiResponse* response() const { return static_cast<const GeminiResponse*>(Core::NetworkJob::response()); } + GeminiResponse const* response() const { return static_cast<GeminiResponse const*>(Core::NetworkJob::response()); } const URL& url() const { return m_request.url(); } Core::Stream::Socket const* socket() const { return m_socket; } diff --git a/Userland/Libraries/LibGemini/Line.cpp b/Userland/Libraries/LibGemini/Line.cpp index 8cfbe91344..5e5b2dd810 100644 --- a/Userland/Libraries/LibGemini/Line.cpp +++ b/Userland/Libraries/LibGemini/Line.cpp @@ -52,7 +52,7 @@ String Control::render_to_html() const } } -Link::Link(String text, const Document& document) +Link::Link(String text, Document const& document) : Line(move(text)) { size_t index = 2; diff --git a/Userland/Libraries/LibGfx/AffineTransform.cpp b/Userland/Libraries/LibGfx/AffineTransform.cpp index 2bd8f15f0c..3872c9be2e 100644 --- a/Userland/Libraries/LibGfx/AffineTransform.cpp +++ b/Userland/Libraries/LibGfx/AffineTransform.cpp @@ -60,7 +60,7 @@ AffineTransform& AffineTransform::scale(float sx, float sy) return *this; } -AffineTransform& AffineTransform::scale(const FloatPoint& s) +AffineTransform& AffineTransform::scale(FloatPoint const& s) { return scale(s.x(), s.y()); } @@ -74,7 +74,7 @@ AffineTransform& AffineTransform::set_scale(float sx, float sy) return *this; } -AffineTransform& AffineTransform::set_scale(const FloatPoint& s) +AffineTransform& AffineTransform::set_scale(FloatPoint const& s) { return set_scale(s.x(), s.y()); } @@ -86,7 +86,7 @@ AffineTransform& AffineTransform::translate(float tx, float ty) return *this; } -AffineTransform& AffineTransform::translate(const FloatPoint& t) +AffineTransform& AffineTransform::translate(FloatPoint const& t) { return translate(t.x(), t.y()); } @@ -98,12 +98,12 @@ AffineTransform& AffineTransform::set_translation(float tx, float ty) return *this; } -AffineTransform& AffineTransform::set_translation(const FloatPoint& t) +AffineTransform& AffineTransform::set_translation(FloatPoint const& t) { return set_translation(t.x(), t.y()); } -AffineTransform& AffineTransform::multiply(const AffineTransform& other) +AffineTransform& AffineTransform::multiply(AffineTransform const& other) { AffineTransform result; result.m_values[0] = other.a() * a() + other.b() * c(); @@ -147,7 +147,7 @@ void AffineTransform::map(float unmapped_x, float unmapped_y, float& mapped_x, f } template<> -IntPoint AffineTransform::map(const IntPoint& point) const +IntPoint AffineTransform::map(IntPoint const& point) const { float mapped_x; float mapped_y; @@ -156,7 +156,7 @@ IntPoint AffineTransform::map(const IntPoint& point) const } template<> -FloatPoint AffineTransform::map(const FloatPoint& point) const +FloatPoint AffineTransform::map(FloatPoint const& point) const { float mapped_x; float mapped_y; @@ -165,7 +165,7 @@ FloatPoint AffineTransform::map(const FloatPoint& point) const } template<> -IntSize AffineTransform::map(const IntSize& size) const +IntSize AffineTransform::map(IntSize const& size) const { return { roundf(static_cast<float>(size.width()) * x_scale()), @@ -174,7 +174,7 @@ IntSize AffineTransform::map(const IntSize& size) const } template<> -FloatSize AffineTransform::map(const FloatSize& size) const +FloatSize AffineTransform::map(FloatSize const& size) const { return { size.width() * x_scale(), size.height() * y_scale() }; } @@ -192,7 +192,7 @@ static T largest_of(T p1, T p2, T p3, T p4) } template<> -FloatRect AffineTransform::map(const FloatRect& rect) const +FloatRect AffineTransform::map(FloatRect const& rect) const { FloatPoint p1 = map(rect.top_left()); FloatPoint p2 = map(rect.top_right().translated(1, 0)); @@ -206,7 +206,7 @@ FloatRect AffineTransform::map(const FloatRect& rect) const } template<> -IntRect AffineTransform::map(const IntRect& rect) const +IntRect AffineTransform::map(IntRect const& rect) const { return enclosing_int_rect(map(FloatRect(rect))); } diff --git a/Userland/Libraries/LibGfx/AffineTransform.h b/Userland/Libraries/LibGfx/AffineTransform.h index c2fc79820e..87a8f30b7a 100644 --- a/Userland/Libraries/LibGfx/AffineTransform.h +++ b/Userland/Libraries/LibGfx/AffineTransform.h @@ -29,13 +29,13 @@ public: void map(float unmapped_x, float unmapped_y, float& mapped_x, float& mapped_y) const; template<typename T> - Point<T> map(const Point<T>&) const; + Point<T> map(Point<T> const&) const; template<typename T> - Size<T> map(const Size<T>&) const; + Size<T> map(Size<T> const&) const; template<typename T> - Rect<T> map(const Rect<T>&) const; + Rect<T> map(Rect<T> const&) const; [[nodiscard]] ALWAYS_INLINE float a() const { return m_values[0]; } [[nodiscard]] ALWAYS_INLINE float b() const { return m_values[1]; } @@ -52,15 +52,15 @@ public: [[nodiscard]] FloatPoint translation() const; AffineTransform& scale(float sx, float sy); - AffineTransform& scale(const FloatPoint& s); + AffineTransform& scale(FloatPoint const& s); AffineTransform& set_scale(float sx, float sy); - AffineTransform& set_scale(const FloatPoint& s); + AffineTransform& set_scale(FloatPoint const& s); AffineTransform& translate(float tx, float ty); - AffineTransform& translate(const FloatPoint& t); + AffineTransform& translate(FloatPoint const& t); AffineTransform& set_translation(float tx, float ty); - AffineTransform& set_translation(const FloatPoint& t); + AffineTransform& set_translation(FloatPoint const& t); AffineTransform& rotate_radians(float); - AffineTransform& multiply(const AffineTransform&); + AffineTransform& multiply(AffineTransform const&); Optional<AffineTransform> inverse() const; diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp index 8d6cbe1010..b4a3bcd001 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp @@ -179,7 +179,7 @@ void Gfx::AntiAliasingPainter::draw_quadratic_bezier_curve(FloatPoint const& con }); } -void Gfx::AntiAliasingPainter::draw_cubic_bezier_curve(const FloatPoint& control_point_0, const FloatPoint& control_point_1, const FloatPoint& p1, const FloatPoint& p2, Color color, float thickness, Painter::LineStyle style) +void Gfx::AntiAliasingPainter::draw_cubic_bezier_curve(FloatPoint const& control_point_0, FloatPoint const& control_point_1, FloatPoint const& p1, FloatPoint const& p2, Color color, float thickness, Painter::LineStyle style) { Gfx::Painter::for_each_line_segment_on_cubic_bezier_curve(control_point_0, control_point_1, p1, p2, [&](FloatPoint const& fp1, FloatPoint const& fp2) { draw_line(fp1, fp2, color, thickness, style); @@ -200,9 +200,9 @@ void Gfx::AntiAliasingPainter::draw_circle(IntPoint center, int radius, Color co // These happen to be the same here, but are treated separately in the paper: // intensity is the fill alpha - const int intensity = color.alpha(); + int const intensity = color.alpha(); // 0 to subpixel_resolution is the range of alpha values for the circle edges - const int subpixel_resolution = intensity; + int const subpixel_resolution = intensity; // Note: Variable names below are based off the paper diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 841e50aef6..38f3098a63 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -130,7 +130,7 @@ struct BMPLoadingContext { }; State state { State::NotDecoded }; - const u8* file_bytes { nullptr }; + u8 const* file_bytes { nullptr }; size_t file_size { 0 }; u32 data_offset { 0 }; @@ -167,7 +167,7 @@ struct BMPLoadingContext { class InputStreamer { public: - InputStreamer(const u8* data, size_t size) + InputStreamer(u8 const* data, size_t size) : m_data_ptr(data) , m_size_remaining(size) { @@ -217,7 +217,7 @@ public: size_t remaining() const { return m_size_remaining; } private: - const u8* m_data_ptr { nullptr }; + u8 const* m_data_ptr { nullptr }; size_t m_size_remaining { 0 }; }; @@ -1300,7 +1300,7 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context) return true; } -BMPImageDecoderPlugin::BMPImageDecoderPlugin(const u8* data, size_t data_size) +BMPImageDecoderPlugin::BMPImageDecoderPlugin(u8 const* data, size_t data_size) { m_context = make<BMPLoadingContext>(); m_context->file_bytes = data; diff --git a/Userland/Libraries/LibGfx/BMPLoader.h b/Userland/Libraries/LibGfx/BMPLoader.h index a690f32619..4351d6f4b4 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.h +++ b/Userland/Libraries/LibGfx/BMPLoader.h @@ -15,7 +15,7 @@ struct BMPLoadingContext; class BMPImageDecoderPlugin final : public ImageDecoderPlugin { public: virtual ~BMPImageDecoderPlugin() override; - BMPImageDecoderPlugin(const u8*, size_t); + BMPImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; diff --git a/Userland/Libraries/LibGfx/BMPWriter.cpp b/Userland/Libraries/LibGfx/BMPWriter.cpp index 0de6bf3417..9b4a9c08ec 100644 --- a/Userland/Libraries/LibGfx/BMPWriter.cpp +++ b/Userland/Libraries/LibGfx/BMPWriter.cpp @@ -42,7 +42,7 @@ private: u8* m_data; }; -static ByteBuffer write_pixel_data(const RefPtr<Bitmap> bitmap, int pixel_row_data_size, int bytes_per_pixel, bool include_alpha_channel) +static ByteBuffer write_pixel_data(RefPtr<Bitmap> const bitmap, int pixel_row_data_size, int bytes_per_pixel, bool include_alpha_channel) { int image_size = pixel_row_data_size * bitmap->height(); auto buffer_result = ByteBuffer::create_uninitialized(image_size); @@ -67,7 +67,7 @@ static ByteBuffer write_pixel_data(const RefPtr<Bitmap> bitmap, int pixel_row_da return buffer; } -static ByteBuffer compress_pixel_data(const ByteBuffer& pixel_data, BMPWriter::Compression compression) +static ByteBuffer compress_pixel_data(ByteBuffer const& pixel_data, BMPWriter::Compression compression) { switch (compression) { case BMPWriter::Compression::BI_BITFIELDS: @@ -78,7 +78,7 @@ static ByteBuffer compress_pixel_data(const ByteBuffer& pixel_data, BMPWriter::C VERIFY_NOT_REACHED(); } -ByteBuffer BMPWriter::dump(const RefPtr<Bitmap> bitmap, DibHeader dib_header) +ByteBuffer BMPWriter::dump(RefPtr<Bitmap> const bitmap, DibHeader dib_header) { switch (dib_header) { diff --git a/Userland/Libraries/LibGfx/BMPWriter.h b/Userland/Libraries/LibGfx/BMPWriter.h index fad1c1820a..0dc3c2c0ba 100644 --- a/Userland/Libraries/LibGfx/BMPWriter.h +++ b/Userland/Libraries/LibGfx/BMPWriter.h @@ -27,7 +27,7 @@ public: V4 = 108, }; - ByteBuffer dump(const RefPtr<Bitmap>, DibHeader dib_header = DibHeader::V4); + ByteBuffer dump(RefPtr<Bitmap> const, DibHeader dib_header = DibHeader::V4); inline void set_compression(Compression compression) { m_compression = compression; } diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index 3a4d3b416e..22cb56ff64 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -173,7 +173,7 @@ BitmapFont::~BitmapFont() RefPtr<BitmapFont> BitmapFont::load_from_memory(u8 const* data) { - auto const& header = *reinterpret_cast<const FontFileHeader*>(data); + auto const& header = *reinterpret_cast<FontFileHeader const*>(data); if (memcmp(header.magic, "!Fnt", 4)) { dbgln("header.magic != '!Fnt', instead it's '{:c}{:c}{:c}{:c}'", header.magic[0], header.magic[1], header.magic[2], header.magic[3]); return nullptr; diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp index 1451e5ba89..77f1bff323 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -16,7 +16,7 @@ namespace Gfx { static constexpr int menubar_height = 20; -Gfx::IntRect ClassicWindowTheme::titlebar_icon_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const +Gfx::IntRect ClassicWindowTheme::titlebar_icon_rect(WindowType window_type, IntRect const& window_rect, Palette const& palette) const { if (window_type == WindowType::ToolWindow) return {}; @@ -33,7 +33,7 @@ Gfx::IntRect ClassicWindowTheme::titlebar_icon_rect(WindowType window_type, cons return icon_rect; } -Gfx::IntRect ClassicWindowTheme::titlebar_text_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const +Gfx::IntRect ClassicWindowTheme::titlebar_text_rect(WindowType window_type, IntRect const& window_rect, Palette const& palette) const { auto titlebar_rect = this->titlebar_rect(window_type, window_rect, palette); auto titlebar_icon_rect = this->titlebar_icon_rect(window_type, window_rect, palette); @@ -45,7 +45,7 @@ Gfx::IntRect ClassicWindowTheme::titlebar_text_rect(WindowType window_type, cons }; } -void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, [[maybe_unused]] bool window_modified) const +void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, IntRect const& window_rect, StringView window_title, Bitmap const& icon, Palette const& palette, IntRect const& leftmost_button_rect, int menu_row_count, [[maybe_unused]] bool window_modified) const { auto frame_rect = frame_rect_for_window(WindowType::Normal, window_rect, palette, menu_row_count); frame_rect.set_location({ 0, 0 }); @@ -112,7 +112,7 @@ void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window painter.draw_scaled_bitmap(titlebar_icon_rect, icon, icon.rect()); } -void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView title_text, const Palette& palette, const IntRect& leftmost_button_rect) const +void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState window_state, IntRect const& window_rect, StringView title_text, Palette const& palette, IntRect const& leftmost_button_rect) const { auto frame_rect = frame_rect_for_window(WindowType::ToolWindow, window_rect, palette, 0); frame_rect.set_location({ 0, 0 }); @@ -143,14 +143,14 @@ void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState w } } -IntRect ClassicWindowTheme::menubar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette, int menu_row_count) const +IntRect ClassicWindowTheme::menubar_rect(WindowType window_type, IntRect const& window_rect, Palette const& palette, int menu_row_count) const { if (window_type != WindowType::Normal) return {}; return { palette.window_border_thickness(), palette.window_border_thickness() - 1 + titlebar_height(window_type, palette) + 2, window_rect.width(), menubar_height * menu_row_count }; } -IntRect ClassicWindowTheme::titlebar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const +IntRect ClassicWindowTheme::titlebar_rect(WindowType window_type, IntRect const& window_rect, Palette const& palette) const { auto& title_font = FontDatabase::default_font().bold_variant(); auto window_titlebar_height = titlebar_height(window_type, palette); @@ -162,7 +162,7 @@ IntRect ClassicWindowTheme::titlebar_rect(WindowType window_type, const IntRect& return { palette.window_border_thickness(), palette.window_border_thickness(), window_rect.width(), window_titlebar_height }; } -ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowState state, const Palette& palette) const +ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowState state, Palette const& palette) const { switch (state) { case WindowState::Highlighted: @@ -178,7 +178,7 @@ ClassicWindowTheme::FrameColors ClassicWindowTheme::compute_frame_colors(WindowS } } -void ClassicWindowTheme::paint_notification_frame(Painter& painter, const IntRect& window_rect, const Palette& palette, const IntRect& close_button_rect) const +void ClassicWindowTheme::paint_notification_frame(Painter& painter, IntRect const& window_rect, Palette const& palette, IntRect const& close_button_rect) const { auto frame_rect = frame_rect_for_window(WindowType::Notification, window_rect, palette, 0); frame_rect.set_location({ 0, 0 }); @@ -198,7 +198,7 @@ void ClassicWindowTheme::paint_notification_frame(Painter& painter, const IntRec } } -IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const IntRect& window_rect, const Gfx::Palette& palette, int menu_row_count) const +IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, IntRect const& window_rect, Gfx::Palette const& palette, int menu_row_count) const { auto window_titlebar_height = titlebar_height(window_type, palette); auto border_thickness = palette.window_border_thickness(); @@ -224,7 +224,7 @@ IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const } } -Vector<IntRect> ClassicWindowTheme::layout_buttons(WindowType window_type, const IntRect& window_rect, const Palette& palette, size_t buttons) const +Vector<IntRect> ClassicWindowTheme::layout_buttons(WindowType window_type, IntRect const& window_rect, Palette const& palette, size_t buttons) const { int window_button_width = palette.window_title_button_width(); int window_button_height = palette.window_title_button_height(); @@ -252,7 +252,7 @@ Vector<IntRect> ClassicWindowTheme::layout_buttons(WindowType window_type, const return button_rects; } -int ClassicWindowTheme::titlebar_height(WindowType window_type, const Palette& palette) const +int ClassicWindowTheme::titlebar_height(WindowType window_type, Palette const& palette) const { auto& title_font = FontDatabase::default_font().bold_variant(); switch (window_type) { diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.h b/Userland/Libraries/LibGfx/ClassicWindowTheme.h index 0aaa7f101e..8e2aff0fb1 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.h +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.h @@ -16,22 +16,22 @@ public: ClassicWindowTheme() = default; virtual ~ClassicWindowTheme() override = default; - virtual void paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const override; - virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Palette&, const IntRect& leftmost_button_rect) const override; - virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const override; + virtual void paint_normal_frame(Painter& painter, WindowState window_state, IntRect const& window_rect, StringView window_title, Bitmap const& icon, Palette const& palette, IntRect const& leftmost_button_rect, int menu_row_count, bool window_modified) const override; + virtual void paint_tool_window_frame(Painter&, WindowState, IntRect const& window_rect, StringView title, Palette const&, IntRect const& leftmost_button_rect) const override; + virtual void paint_notification_frame(Painter&, IntRect const& window_rect, Palette const&, IntRect const& close_button_rect) const override; - virtual int titlebar_height(WindowType, const Palette&) const override; - virtual IntRect titlebar_rect(WindowType, const IntRect& window_rect, const Palette&) const override; - virtual IntRect titlebar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const override; - virtual IntRect titlebar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const override; + virtual int titlebar_height(WindowType, Palette const&) const override; + virtual IntRect titlebar_rect(WindowType, IntRect const& window_rect, Palette const&) const override; + virtual IntRect titlebar_icon_rect(WindowType, IntRect const& window_rect, Palette const&) const override; + virtual IntRect titlebar_text_rect(WindowType, IntRect const& window_rect, Palette const&) const override; - virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; + virtual IntRect menubar_rect(WindowType, IntRect const& window_rect, Palette const&, int menu_row_count) const override; - virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; + virtual IntRect frame_rect_for_window(WindowType, IntRect const& window_rect, Palette const&, int menu_row_count) const override; - virtual Vector<IntRect> layout_buttons(WindowType, const IntRect& window_rect, const Palette&, size_t buttons) const override; + virtual Vector<IntRect> layout_buttons(WindowType, IntRect const& window_rect, Palette const&, size_t buttons) const override; virtual bool is_simple_rect_frame() const override { return true; } - virtual bool frame_uses_alpha(WindowState state, const Palette& palette) const override + virtual bool frame_uses_alpha(WindowState state, Palette const& palette) const override { return compute_frame_colors(state, palette).uses_alpha(); } @@ -54,7 +54,7 @@ private: } }; - FrameColors compute_frame_colors(WindowState, const Palette&) const; + FrameColors compute_frame_colors(WindowState, Palette const&) const; }; } diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index 1c158dd8d0..900e23f6b9 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -185,7 +185,7 @@ public: source.blue() }; - const int d = 255 * (alpha() + source.alpha()) - alpha() * source.alpha(); + int const d = 255 * (alpha() + source.alpha()) - alpha() * source.alpha(); const i32x4 out = (color * alpha() * (255 - source.alpha()) + 255 * source.alpha() * source_color) / d; return Color(out[0], out[1], out[2], d / 255); #else diff --git a/Userland/Libraries/LibGfx/DDSLoader.cpp b/Userland/Libraries/LibGfx/DDSLoader.cpp index 64ef66267b..d6a78b4997 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.cpp +++ b/Userland/Libraries/LibGfx/DDSLoader.cpp @@ -34,7 +34,7 @@ struct DDSLoadingContext { State state { State::NotDecoded }; - const u8* data { nullptr }; + u8 const* data { nullptr }; size_t data_size { 0 }; DDSHeader header; @@ -937,7 +937,7 @@ void DDSLoadingContext::dump_debug() dbgln("{}", builder.to_string()); } -DDSImageDecoderPlugin::DDSImageDecoderPlugin(const u8* data, size_t size) +DDSImageDecoderPlugin::DDSImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<DDSLoadingContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/DDSLoader.h b/Userland/Libraries/LibGfx/DDSLoader.h index a313d7d3e2..87321d79df 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.h +++ b/Userland/Libraries/LibGfx/DDSLoader.h @@ -236,7 +236,7 @@ struct DDSLoadingContext; class DDSImageDecoderPlugin final : public ImageDecoderPlugin { public: virtual ~DDSImageDecoderPlugin() override; - DDSImageDecoderPlugin(const u8*, size_t); + DDSImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; diff --git a/Userland/Libraries/LibGfx/DisjointRectSet.cpp b/Userland/Libraries/LibGfx/DisjointRectSet.cpp index e2a4a0b181..20a95bc4c8 100644 --- a/Userland/Libraries/LibGfx/DisjointRectSet.cpp +++ b/Userland/Libraries/LibGfx/DisjointRectSet.cpp @@ -8,7 +8,7 @@ namespace Gfx { -bool DisjointRectSet::add_no_shatter(const IntRect& new_rect) +bool DisjointRectSet::add_no_shatter(IntRect const& new_rect) { if (new_rect.is_empty()) return false; @@ -59,7 +59,7 @@ void DisjointRectSet::move_by(int dx, int dy) r.translate_by(dx, dy); } -bool DisjointRectSet::contains(const IntRect& rect) const +bool DisjointRectSet::contains(IntRect const& rect) const { if (is_empty() || rect.is_empty()) return false; @@ -75,7 +75,7 @@ bool DisjointRectSet::contains(const IntRect& rect) const return false; } -bool DisjointRectSet::intersects(const IntRect& rect) const +bool DisjointRectSet::intersects(IntRect const& rect) const { for (auto& r : m_rects) { if (r.intersects(rect)) @@ -84,7 +84,7 @@ bool DisjointRectSet::intersects(const IntRect& rect) const return false; } -bool DisjointRectSet::intersects(const DisjointRectSet& rects) const +bool DisjointRectSet::intersects(DisjointRectSet const& rects) const { if (this == &rects) return true; @@ -98,7 +98,7 @@ bool DisjointRectSet::intersects(const DisjointRectSet& rects) const return false; } -DisjointRectSet DisjointRectSet::intersected(const IntRect& rect) const +DisjointRectSet DisjointRectSet::intersected(IntRect const& rect) const { DisjointRectSet intersected_rects; intersected_rects.m_rects.ensure_capacity(m_rects.capacity()); @@ -111,7 +111,7 @@ DisjointRectSet DisjointRectSet::intersected(const IntRect& rect) const return intersected_rects; } -DisjointRectSet DisjointRectSet::intersected(const DisjointRectSet& rects) const +DisjointRectSet DisjointRectSet::intersected(DisjointRectSet const& rects) const { if (&rects == this) return clone(); @@ -131,7 +131,7 @@ DisjointRectSet DisjointRectSet::intersected(const DisjointRectSet& rects) const return intersected_rects; } -DisjointRectSet DisjointRectSet::shatter(const IntRect& hammer) const +DisjointRectSet DisjointRectSet::shatter(IntRect const& hammer) const { if (hammer.is_empty()) return clone(); @@ -145,7 +145,7 @@ DisjointRectSet DisjointRectSet::shatter(const IntRect& hammer) const return shards; } -DisjointRectSet DisjointRectSet::shatter(const DisjointRectSet& hammer) const +DisjointRectSet DisjointRectSet::shatter(DisjointRectSet const& hammer) const { if (this == &hammer) return {}; diff --git a/Userland/Libraries/LibGfx/DisjointRectSet.h b/Userland/Libraries/LibGfx/DisjointRectSet.h index 9a256566e8..d6ce6fa074 100644 --- a/Userland/Libraries/LibGfx/DisjointRectSet.h +++ b/Userland/Libraries/LibGfx/DisjointRectSet.h @@ -14,13 +14,13 @@ namespace Gfx { class DisjointRectSet { public: - DisjointRectSet(const DisjointRectSet&) = delete; - DisjointRectSet& operator=(const DisjointRectSet&) = delete; + DisjointRectSet(DisjointRectSet const&) = delete; + DisjointRectSet& operator=(DisjointRectSet const&) = delete; DisjointRectSet() = default; ~DisjointRectSet() = default; - DisjointRectSet(const IntRect& rect) + DisjointRectSet(IntRect const& rect) { m_rects.append(rect); } @@ -36,22 +36,22 @@ public: } void move_by(int dx, int dy); - void move_by(const IntPoint& delta) + void move_by(IntPoint const& delta) { move_by(delta.x(), delta.y()); } - void add(const IntRect& rect) + void add(IntRect const& rect) { if (add_no_shatter(rect) && m_rects.size() > 1) shatter(); } template<typename Container> - void add_many(const Container& rects) + void add_many(Container const& rects) { bool added = false; - for (const auto& rect : rects) { + for (auto const& rect : rects) { if (add_no_shatter(rect)) added = true; } @@ -59,7 +59,7 @@ public: shatter(); } - void add(const DisjointRectSet& rect_set) + void add(DisjointRectSet const& rect_set) { if (this == &rect_set) return; @@ -70,17 +70,17 @@ public: } } - DisjointRectSet shatter(const IntRect&) const; - DisjointRectSet shatter(const DisjointRectSet& hammer) const; + DisjointRectSet shatter(IntRect const&) const; + DisjointRectSet shatter(DisjointRectSet const& hammer) const; - bool contains(const IntRect&) const; - bool intersects(const IntRect&) const; - bool intersects(const DisjointRectSet&) const; - DisjointRectSet intersected(const IntRect&) const; - DisjointRectSet intersected(const DisjointRectSet&) const; + bool contains(IntRect const&) const; + bool intersects(IntRect const&) const; + bool intersects(DisjointRectSet const&) const; + DisjointRectSet intersected(IntRect const&) const; + DisjointRectSet intersected(DisjointRectSet const&) const; template<typename Function> - IterationDecision for_each_intersected(const IntRect& rect, Function f) const + IterationDecision for_each_intersected(IntRect const& rect, Function f) const { if (is_empty() || rect.is_empty()) return IterationDecision::Continue; @@ -96,7 +96,7 @@ public: } template<typename Function> - IterationDecision for_each_intersected(const DisjointRectSet& rects, Function f) const + IterationDecision for_each_intersected(DisjointRectSet const& rects, Function f) const { if (is_empty() || rects.is_empty()) return IterationDecision::Continue; @@ -126,7 +126,7 @@ public: void clear() { m_rects.clear(); } void clear_with_capacity() { m_rects.clear_with_capacity(); } - const Vector<IntRect, 32>& rects() const { return m_rects; } + Vector<IntRect, 32> const& rects() const { return m_rects; } Vector<IntRect, 32> take_rects() { return move(m_rects); } void translate_by(int dx, int dy) @@ -141,7 +141,7 @@ public: } private: - bool add_no_shatter(const IntRect&); + bool add_no_shatter(IntRect const&); void shatter(); Vector<IntRect, 32> m_rects; diff --git a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h index f42659fadc..e6c7384cd7 100644 --- a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h +++ b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h @@ -34,14 +34,14 @@ class GenericConvolutionFilter : public Filter { public: class Parameters : public Filter::Parameters { public: - Parameters(const Gfx::Matrix<N, float>& kernel, bool should_wrap = false) + Parameters(Gfx::Matrix<N, float> const& kernel, bool should_wrap = false) : m_kernel(kernel) , m_should_wrap(should_wrap) { } - const Gfx::Matrix<N, float>& kernel() const { return m_kernel; } + Gfx::Matrix<N, float> const& kernel() const { return m_kernel; } Gfx::Matrix<N, float>& kernel() { return m_kernel; } bool should_wrap() const { return m_should_wrap; } @@ -64,16 +64,16 @@ public: virtual StringView class_name() const override { return "GenericConvolutionFilter"sv; } - virtual void apply(Bitmap& target_bitmap, const IntRect& target_rect, const Bitmap& source_bitmap, const IntRect& source_rect, const Filter::Parameters& parameters) override + virtual void apply(Bitmap& target_bitmap, IntRect const& target_rect, Bitmap const& source_bitmap, IntRect const& source_rect, Filter::Parameters const& parameters) override { VERIFY(parameters.is_generic_convolution_filter()); - auto& gcf_params = static_cast<const GenericConvolutionFilter::Parameters&>(parameters); + auto& gcf_params = static_cast<GenericConvolutionFilter::Parameters const&>(parameters); ApplyCache apply_cache; apply_with_cache(target_bitmap, target_rect, source_bitmap, source_rect, gcf_params, apply_cache); } - void apply_with_cache(Bitmap& target, IntRect target_rect, const Bitmap& source, const IntRect& source_rect, const GenericConvolutionFilter::Parameters& parameters, ApplyCache& apply_cache) + void apply_with_cache(Bitmap& target, IntRect target_rect, Bitmap const& source, IntRect const& source_rect, GenericConvolutionFilter::Parameters const& parameters, ApplyCache& apply_cache) { // The target area (where the filter is applied) must be entirely // contained by the source area. source_rect should be describing diff --git a/Userland/Libraries/LibGfx/Font.h b/Userland/Libraries/LibGfx/Font.h index fa0f29bc2b..be60b72546 100644 --- a/Userland/Libraries/LibGfx/Font.h +++ b/Userland/Libraries/LibGfx/Font.h @@ -22,7 +22,7 @@ namespace Gfx { class GlyphBitmap { public: GlyphBitmap() = default; - GlyphBitmap(const u8* rows, size_t start_index, IntSize size) + GlyphBitmap(u8 const* rows, size_t start_index, IntSize size) : m_rows(rows) , m_start_index(start_index) , m_size(size) @@ -48,14 +48,14 @@ private: return { const_cast<u8*>(m_rows) + bytes_per_row() * (m_start_index + y), bytes_per_row() * 8 }; } - const u8* m_rows { nullptr }; + u8 const* m_rows { nullptr }; size_t m_start_index { 0 }; IntSize m_size { 0, 0 }; }; class Glyph { public: - Glyph(const GlyphBitmap& glyph_bitmap, int left_bearing, int advance, int ascent) + Glyph(GlyphBitmap const& glyph_bitmap, int left_bearing, int advance, int ascent) : m_glyph_bitmap(glyph_bitmap) , m_left_bearing(left_bearing) , m_advance(advance) @@ -140,8 +140,8 @@ public: virtual u8 mean_line() const = 0; virtual int width(StringView) const = 0; - virtual int width(const Utf8View&) const = 0; - virtual int width(const Utf32View&) const = 0; + virtual int width(Utf8View const&) const = 0; + virtual int width(Utf32View const&) const = 0; virtual String name() const = 0; diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index e761f5d89b..9a7645a17f 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -119,7 +119,7 @@ FontDatabase::FontDatabase() } } -void FontDatabase::for_each_font(Function<void(const Gfx::Font&)> callback) +void FontDatabase::for_each_font(Function<void(Gfx::Font const&)> callback) { Vector<RefPtr<Gfx::Font>> fonts; fonts.ensure_capacity(m_private->full_name_to_font_map.size()); @@ -130,7 +130,7 @@ void FontDatabase::for_each_font(Function<void(const Gfx::Font&)> callback) callback(*font); } -void FontDatabase::for_each_fixed_width_font(Function<void(const Gfx::Font&)> callback) +void FontDatabase::for_each_fixed_width_font(Function<void(Gfx::Font const&)> callback) { Vector<RefPtr<Gfx::Font>> fonts; fonts.ensure_capacity(m_private->full_name_to_font_map.size()); @@ -179,7 +179,7 @@ RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& va return nullptr; } -RefPtr<Typeface> FontDatabase::get_or_create_typeface(const String& family, const String& variant) +RefPtr<Typeface> FontDatabase::get_or_create_typeface(String const& family, String const& variant) { for (auto typeface : m_private->typefaces) { if (typeface->family() == family && typeface->variant() == variant) @@ -190,7 +190,7 @@ RefPtr<Typeface> FontDatabase::get_or_create_typeface(const String& family, cons return typeface; } -void FontDatabase::for_each_typeface(Function<void(const Typeface&)> callback) +void FontDatabase::for_each_typeface(Function<void(Typeface const&)> callback) { for (auto typeface : m_private->typefaces) { callback(*typeface); diff --git a/Userland/Libraries/LibGfx/FontDatabase.h b/Userland/Libraries/LibGfx/FontDatabase.h index effc8259ec..90ba0587d8 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.h +++ b/Userland/Libraries/LibGfx/FontDatabase.h @@ -47,16 +47,16 @@ public: RefPtr<Gfx::Font> get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); RefPtr<Gfx::Font> get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); RefPtr<Gfx::Font> get_by_name(StringView); - void for_each_font(Function<void(const Gfx::Font&)>); - void for_each_fixed_width_font(Function<void(const Gfx::Font&)>); + void for_each_font(Function<void(Gfx::Font const&)>); + void for_each_fixed_width_font(Function<void(Gfx::Font const&)>); - void for_each_typeface(Function<void(const Typeface&)>); + void for_each_typeface(Function<void(Typeface const&)>); private: FontDatabase(); ~FontDatabase() = default; - RefPtr<Typeface> get_or_create_typeface(const String& family, const String& variant); + RefPtr<Typeface> get_or_create_typeface(String const& family, String const& variant); struct Private; OwnPtr<Private> m_private; diff --git a/Userland/Libraries/LibGfx/FontStyleMapping.h b/Userland/Libraries/LibGfx/FontStyleMapping.h index 7c499c35b9..1653dd0e43 100644 --- a/Userland/Libraries/LibGfx/FontStyleMapping.h +++ b/Userland/Libraries/LibGfx/FontStyleMapping.h @@ -12,7 +12,7 @@ namespace Gfx { struct FontStyleMapping { - constexpr FontStyleMapping(int s, const char* n) + constexpr FontStyleMapping(int s, char const* n) : style(s) , name(n) { diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index 9943eaf719..a51261f037 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -70,7 +70,7 @@ struct GIFLoadingContext { FailedToLoadFrameDescriptors, }; ErrorState error_state { NoError }; - const u8* data { nullptr }; + u8 const* data { nullptr }; size_t data_size { 0 }; LogicalScreen logical_screen {}; u8 background_color_index { 0 }; @@ -110,7 +110,7 @@ private: static constexpr int max_code_size = 12; public: - explicit LZWDecoder(const Vector<u8>& lzw_bytes, u8 min_code_size) + explicit LZWDecoder(Vector<u8> const& lzw_bytes, u8 min_code_size) : m_lzw_bytes(lzw_bytes) , m_code_size(min_code_size) , m_original_code_size(min_code_size) @@ -160,7 +160,7 @@ public: for (int i = 0; current_byte_index + i < m_lzw_bytes.size(); ++i) { padded_last_bytes[i] = m_lzw_bytes[current_byte_index + i]; } - const u32* addr = (const u32*)&padded_last_bytes; + u32 const* addr = (u32 const*)&padded_last_bytes; m_current_code = (*addr & mask) >> current_bit_offset; } else { u32 tmp_word; @@ -213,7 +213,7 @@ private: m_original_code_table = m_code_table; } - void extend_code_table(const Vector<u8>& entry) + void extend_code_table(Vector<u8> const& entry) { if (entry.size() > 1 && m_code_table.size() < 4096) { m_code_table.append(entry); @@ -224,7 +224,7 @@ private: } } - const Vector<u8>& m_lzw_bytes; + Vector<u8> const& m_lzw_bytes; int m_current_bit_index { 0 }; @@ -240,13 +240,13 @@ private: Vector<u8> m_output {}; }; -static void copy_frame_buffer(Bitmap& dest, const Bitmap& src) +static void copy_frame_buffer(Bitmap& dest, Bitmap const& src) { VERIFY(dest.size_in_bytes() == src.size_in_bytes()); memcpy(dest.scanline(0), src.scanline(0), dest.size_in_bytes()); } -static void clear_rect(Bitmap& bitmap, const IntRect& rect, Color color) +static void clear_rect(Bitmap& bitmap, IntRect const& rect, Color color) { auto intersection_rect = rect.intersected(bitmap.rect()); if (intersection_rect.is_empty()) @@ -293,7 +293,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index) for (size_t i = start_frame; i <= frame_index; ++i) { auto& image = context.images.at(i); - const auto previous_image_disposal_method = i > 0 ? context.images.at(i - 1).disposal_method : GIFImageDescriptor::DisposalMethod::None; + auto const previous_image_disposal_method = i > 0 ? context.images.at(i - 1).disposal_method : GIFImageDescriptor::DisposalMethod::None; if (i == 0) { context.frame_buffer->fill(Color::Transparent); @@ -324,10 +324,10 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index) LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size); // Add GIF-specific control codes - const int clear_code = decoder.add_control_code(); - const int end_of_information_code = decoder.add_control_code(); + int const clear_code = decoder.add_control_code(); + int const end_of_information_code = decoder.add_control_code(); - const auto& color_map = image.use_global_color_map ? context.logical_screen.color_map : image.color_map; + auto const& color_map = image.use_global_color_map ? context.logical_screen.color_map : image.color_map; int pixel_index = 0; int row = 0; @@ -349,7 +349,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index) continue; auto colors = decoder.get_output(); - for (const auto& color : colors) { + for (auto const& color : colors) { auto c = color_map[color]; int x = pixel_index % image.width + image.x; @@ -599,7 +599,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) return true; } -GIFImageDecoderPlugin::GIFImageDecoderPlugin(const u8* data, size_t size) +GIFImageDecoderPlugin::GIFImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<GIFLoadingContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/GIFLoader.h b/Userland/Libraries/LibGfx/GIFLoader.h index e42de30106..dbc6065d2a 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.h +++ b/Userland/Libraries/LibGfx/GIFLoader.h @@ -16,7 +16,7 @@ struct GIFLoadingContext; class GIFImageDecoderPlugin final : public ImageDecoderPlugin { public: virtual ~GIFImageDecoderPlugin() override; - GIFImageDecoderPlugin(const u8*, size_t); + GIFImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index 245b337189..0bdcb05854 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -83,7 +83,7 @@ struct ICOLoadingContext { BitmapDecoded }; State state { NotDecoded }; - const u8* data { nullptr }; + u8 const* data { nullptr }; size_t data_size { 0 }; Vector<ICOImageDescriptor> images; size_t largest_index; @@ -117,12 +117,12 @@ static Optional<ICOImageDescriptor> decode_ico_direntry(InputMemoryStream& strea return { desc }; } -static size_t find_largest_image(const ICOLoadingContext& context) +static size_t find_largest_image(ICOLoadingContext const& context) { size_t max_area = 0; size_t index = 0; size_t largest_index = 0; - for (const auto& desc : context.images) { + for (auto const& desc : context.images) { if (desc.width * desc.height > max_area) { max_area = desc.width * desc.height; largest_index = index; @@ -227,11 +227,11 @@ static bool load_ico_bmp(ICOLoadingContext& context, ICOImageDescriptor& desc) return false; desc.bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors(); Bitmap& bitmap = *desc.bitmap; - const u8* image_base = context.data + desc.offset + sizeof(info); + u8 const* image_base = context.data + desc.offset + sizeof(info); const BMP_ARGB* data_base = (const BMP_ARGB*)image_base; - const u8* mask_base = image_base + desc.width * desc.height * sizeof(BMP_ARGB); + u8 const* mask_base = image_base + desc.width * desc.height * sizeof(BMP_ARGB); for (int y = 0; y < desc.height; y++) { - const u8* row_mask = mask_base + mask_row_len * y; + u8 const* row_mask = mask_base + mask_row_len * y; const BMP_ARGB* row_data = data_base + desc.width * y; for (int x = 0; x < desc.width; x++) { u8 mask = !!(row_mask[x / 8] & (0x80 >> (x % 8))); @@ -279,7 +279,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index) } } -ICOImageDecoderPlugin::ICOImageDecoderPlugin(const u8* data, size_t size) +ICOImageDecoderPlugin::ICOImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<ICOLoadingContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/ICOLoader.h b/Userland/Libraries/LibGfx/ICOLoader.h index b99afcd662..334e60f09c 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.h +++ b/Userland/Libraries/LibGfx/ICOLoader.h @@ -15,7 +15,7 @@ struct ICOLoadingContext; class ICOImageDecoderPlugin final : public ImageDecoderPlugin { public: virtual ~ICOImageDecoderPlugin() override; - ICOImageDecoderPlugin(const u8*, size_t); + ICOImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 2ff7f82aee..63c5a7395b 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -172,7 +172,7 @@ struct JPGLoadingContext { }; State state { State::NotDecoded }; - const u8* data { nullptr }; + u8 const* data { nullptr }; size_t data_size { 0 }; u32 luma_table[64] = { 0 }; u32 chroma_table[64] = { 0 }; @@ -224,7 +224,7 @@ static Optional<size_t> read_huffman_bits(HuffmanStreamState& hstream, size_t co return value; } -static Optional<u8> get_next_symbol(HuffmanStreamState& hstream, const HuffmanTableSpec& table) +static Optional<u8> get_next_symbol(HuffmanStreamState& hstream, HuffmanTableSpec const& table) { unsigned code = 0; size_t code_cursor = 0; @@ -649,7 +649,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con return true; } -static inline bool validate_luma_and_modify_context(const ComponentSpec& luma, JPGLoadingContext& context) +static inline bool validate_luma_and_modify_context(ComponentSpec const& luma, JPGLoadingContext& context) { if ((luma.hsample_factor == 1 || luma.hsample_factor == 2) && (luma.vsample_factor == 1 || luma.vsample_factor == 2)) { context.mblock_meta.hpadded_count += luma.hsample_factor == 1 ? 0 : context.mblock_meta.hcount % 2; @@ -847,7 +847,7 @@ static void dequantize(JPGLoadingContext& context, Vector<Macroblock>& macrobloc for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) { for (u32 i = 0; i < context.component_count; i++) { auto& component = context.components[i]; - const u32* table = component.qtable_id == 0 ? context.luma_table : context.chroma_table; + u32 const* table = component.qtable_id == 0 ? context.luma_table : context.chroma_table; for (u32 vfactor_i = 0; vfactor_i < component.vsample_factor; vfactor_i++) { for (u32 hfactor_i = 0; hfactor_i < component.hsample_factor; hfactor_i++) { u32 mb_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor); @@ -862,22 +862,22 @@ static void dequantize(JPGLoadingContext& context, Vector<Macroblock>& macrobloc } } -static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& macroblocks) +static void inverse_dct(JPGLoadingContext const& context, Vector<Macroblock>& macroblocks) { - static const float m0 = 2.0 * AK::cos(1.0 / 16.0 * 2.0 * AK::Pi<double>); - static const float m1 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>); - static const float m3 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>); - static const float m5 = 2.0 * AK::cos(3.0 / 16.0 * 2.0 * AK::Pi<double>); - static const float m2 = m0 - m5; - static const float m4 = m0 + m5; - static const float s0 = AK::cos(0.0 / 16.0 * AK::Pi<double>) / sqrt(8); - static const float s1 = AK::cos(1.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s2 = AK::cos(2.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s3 = AK::cos(3.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s4 = AK::cos(4.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s5 = AK::cos(5.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s6 = AK::cos(6.0 / 16.0 * AK::Pi<double>) / 2.0; - static const float s7 = AK::cos(7.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const m0 = 2.0 * AK::cos(1.0 / 16.0 * 2.0 * AK::Pi<double>); + static float const m1 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>); + static float const m3 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>); + static float const m5 = 2.0 * AK::cos(3.0 / 16.0 * 2.0 * AK::Pi<double>); + static float const m2 = m0 - m5; + static float const m4 = m0 + m5; + static float const s0 = AK::cos(0.0 / 16.0 * AK::Pi<double>) / sqrt(8); + static float const s1 = AK::cos(1.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s2 = AK::cos(2.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s3 = AK::cos(3.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s4 = AK::cos(4.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s5 = AK::cos(5.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s6 = AK::cos(6.0 / 16.0 * AK::Pi<double>) / 2.0; + static float const s7 = AK::cos(7.0 / 16.0 * AK::Pi<double>) / 2.0; for (u32 vcursor = 0; vcursor < context.mblock_meta.vcount; vcursor += context.vsample_factor) { for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) { @@ -889,62 +889,62 @@ static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& ma Macroblock& block = macroblocks[mb_index]; i32* block_component = get_component(block, component_i); for (u32 k = 0; k < 8; ++k) { - const float g0 = block_component[0 * 8 + k] * s0; - const float g1 = block_component[4 * 8 + k] * s4; - const float g2 = block_component[2 * 8 + k] * s2; - const float g3 = block_component[6 * 8 + k] * s6; - const float g4 = block_component[5 * 8 + k] * s5; - const float g5 = block_component[1 * 8 + k] * s1; - const float g6 = block_component[7 * 8 + k] * s7; - const float g7 = block_component[3 * 8 + k] * s3; - - const float f0 = g0; - const float f1 = g1; - const float f2 = g2; - const float f3 = g3; - const float f4 = g4 - g7; - const float f5 = g5 + g6; - const float f6 = g5 - g6; - const float f7 = g4 + g7; - - const float e0 = f0; - const float e1 = f1; - const float e2 = f2 - f3; - const float e3 = f2 + f3; - const float e4 = f4; - const float e5 = f5 - f7; - const float e6 = f6; - const float e7 = f5 + f7; - const float e8 = f4 + f6; - - const float d0 = e0; - const float d1 = e1; - const float d2 = e2 * m1; - const float d3 = e3; - const float d4 = e4 * m2; - const float d5 = e5 * m3; - const float d6 = e6 * m4; - const float d7 = e7; - const float d8 = e8 * m5; - - const float c0 = d0 + d1; - const float c1 = d0 - d1; - const float c2 = d2 - d3; - const float c3 = d3; - const float c4 = d4 + d8; - const float c5 = d5 + d7; - const float c6 = d6 - d8; - const float c7 = d7; - const float c8 = c5 - c6; - - const float b0 = c0 + c3; - const float b1 = c1 + c2; - const float b2 = c1 - c2; - const float b3 = c0 - c3; - const float b4 = c4 - c8; - const float b5 = c8; - const float b6 = c6 - c7; - const float b7 = c7; + float const g0 = block_component[0 * 8 + k] * s0; + float const g1 = block_component[4 * 8 + k] * s4; + float const g2 = block_component[2 * 8 + k] * s2; + float const g3 = block_component[6 * 8 + k] * s6; + float const g4 = block_component[5 * 8 + k] * s5; + float const g5 = block_component[1 * 8 + k] * s1; + float const g6 = block_component[7 * 8 + k] * s7; + float const g7 = block_component[3 * 8 + k] * s3; + + float const f0 = g0; + float const f1 = g1; + float const f2 = g2; + float const f3 = g3; + float const f4 = g4 - g7; + float const f5 = g5 + g6; + float const f6 = g5 - g6; + float const f7 = g4 + g7; + + float const e0 = f0; + float const e1 = f1; + float const e2 = f2 - f3; + float const e3 = f2 + f3; + float const e4 = f4; + float const e5 = f5 - f7; + float const e6 = f6; + float const e7 = f5 + f7; + float const e8 = f4 + f6; + + float const d0 = e0; + float const d1 = e1; + float const d2 = e2 * m1; + float const d3 = e3; + float const d4 = e4 * m2; + float const d5 = e5 * m3; + float const d6 = e6 * m4; + float const d7 = e7; + float const d8 = e8 * m5; + + float const c0 = d0 + d1; + float const c1 = d0 - d1; + float const c2 = d2 - d3; + float const c3 = d3; + float const c4 = d4 + d8; + float const c5 = d5 + d7; + float const c6 = d6 - d8; + float const c7 = d7; + float const c8 = c5 - c6; + + float const b0 = c0 + c3; + float const b1 = c1 + c2; + float const b2 = c1 - c2; + float const b3 = c0 - c3; + float const b4 = c4 - c8; + float const b5 = c8; + float const b6 = c6 - c7; + float const b7 = c7; block_component[0 * 8 + k] = b0 + b7; block_component[1 * 8 + k] = b1 + b6; @@ -956,62 +956,62 @@ static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& ma block_component[7 * 8 + k] = b0 - b7; } for (u32 l = 0; l < 8; ++l) { - const float g0 = block_component[l * 8 + 0] * s0; - const float g1 = block_component[l * 8 + 4] * s4; - const float g2 = block_component[l * 8 + 2] * s2; - const float g3 = block_component[l * 8 + 6] * s6; - const float g4 = block_component[l * 8 + 5] * s5; - const float g5 = block_component[l * 8 + 1] * s1; - const float g6 = block_component[l * 8 + 7] * s7; - const float g7 = block_component[l * 8 + 3] * s3; - - const float f0 = g0; - const float f1 = g1; - const float f2 = g2; - const float f3 = g3; - const float f4 = g4 - g7; - const float f5 = g5 + g6; - const float f6 = g5 - g6; - const float f7 = g4 + g7; - - const float e0 = f0; - const float e1 = f1; - const float e2 = f2 - f3; - const float e3 = f2 + f3; - const float e4 = f4; - const float e5 = f5 - f7; - const float e6 = f6; - const float e7 = f5 + f7; - const float e8 = f4 + f6; - - const float d0 = e0; - const float d1 = e1; - const float d2 = e2 * m1; - const float d3 = e3; - const float d4 = e4 * m2; - const float d5 = e5 * m3; - const float d6 = e6 * m4; - const float d7 = e7; - const float d8 = e8 * m5; - - const float c0 = d0 + d1; - const float c1 = d0 - d1; - const float c2 = d2 - d3; - const float c3 = d3; - const float c4 = d4 + d8; - const float c5 = d5 + d7; - const float c6 = d6 - d8; - const float c7 = d7; - const float c8 = c5 - c6; - - const float b0 = c0 + c3; - const float b1 = c1 + c2; - const float b2 = c1 - c2; - const float b3 = c0 - c3; - const float b4 = c4 - c8; - const float b5 = c8; - const float b6 = c6 - c7; - const float b7 = c7; + float const g0 = block_component[l * 8 + 0] * s0; + float const g1 = block_component[l * 8 + 4] * s4; + float const g2 = block_component[l * 8 + 2] * s2; + float const g3 = block_component[l * 8 + 6] * s6; + float const g4 = block_component[l * 8 + 5] * s5; + float const g5 = block_component[l * 8 + 1] * s1; + float const g6 = block_component[l * 8 + 7] * s7; + float const g7 = block_component[l * 8 + 3] * s3; + + float const f0 = g0; + float const f1 = g1; + float const f2 = g2; + float const f3 = g3; + float const f4 = g4 - g7; + float const f5 = g5 + g6; + float const f6 = g5 - g6; + float const f7 = g4 + g7; + + float const e0 = f0; + float const e1 = f1; + float const e2 = f2 - f3; + float const e3 = f2 + f3; + float const e4 = f4; + float const e5 = f5 - f7; + float const e6 = f6; + float const e7 = f5 + f7; + float const e8 = f4 + f6; + + float const d0 = e0; + float const d1 = e1; + float const d2 = e2 * m1; + float const d3 = e3; + float const d4 = e4 * m2; + float const d5 = e5 * m3; + float const d6 = e6 * m4; + float const d7 = e7; + float const d8 = e8 * m5; + + float const c0 = d0 + d1; + float const c1 = d0 - d1; + float const c2 = d2 - d3; + float const c3 = d3; + float const c4 = d4 + d8; + float const c5 = d5 + d7; + float const c6 = d6 - d8; + float const c7 = d7; + float const c8 = c5 - c6; + + float const b0 = c0 + c3; + float const b1 = c1 + c2; + float const b2 = c1 - c2; + float const b3 = c0 - c3; + float const b4 = c4 - c8; + float const b5 = c8; + float const b6 = c6 - c7; + float const b7 = c7; block_component[l * 8 + 0] = b0 + b7; block_component[l * 8 + 1] = b1 + b6; @@ -1029,12 +1029,12 @@ static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& ma } } -static void ycbcr_to_rgb(const JPGLoadingContext& context, Vector<Macroblock>& macroblocks) +static void ycbcr_to_rgb(JPGLoadingContext const& context, Vector<Macroblock>& macroblocks) { for (u32 vcursor = 0; vcursor < context.mblock_meta.vcount; vcursor += context.vsample_factor) { for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) { const u32 chroma_block_index = vcursor * context.mblock_meta.hpadded_count + hcursor; - const Macroblock& chroma = macroblocks[chroma_block_index]; + Macroblock const& chroma = macroblocks[chroma_block_index]; // Overflows are intentional. for (u8 vfactor_i = context.vsample_factor - 1; vfactor_i < context.vsample_factor; --vfactor_i) { for (u8 hfactor_i = context.hsample_factor - 1; hfactor_i < context.hsample_factor; --hfactor_i) { @@ -1062,7 +1062,7 @@ static void ycbcr_to_rgb(const JPGLoadingContext& context, Vector<Macroblock>& m } } -static bool compose_bitmap(JPGLoadingContext& context, const Vector<Macroblock>& macroblocks) +static bool compose_bitmap(JPGLoadingContext& context, Vector<Macroblock> const& macroblocks) { auto bitmap_or_error = Bitmap::try_create(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height }); if (bitmap_or_error.is_error()) @@ -1224,7 +1224,7 @@ static bool decode_jpg(JPGLoadingContext& context) return true; } -JPGImageDecoderPlugin::JPGImageDecoderPlugin(const u8* data, size_t size) +JPGImageDecoderPlugin::JPGImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<JPGLoadingContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/JPGLoader.h b/Userland/Libraries/LibGfx/JPGLoader.h index 0813319177..592f8a93a0 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.h +++ b/Userland/Libraries/LibGfx/JPGLoader.h @@ -15,7 +15,7 @@ struct JPGLoadingContext; class JPGImageDecoderPlugin : public ImageDecoderPlugin { public: virtual ~JPGImageDecoderPlugin() override; - JPGImageDecoderPlugin(const u8*, size_t); + JPGImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; [[nodiscard]] virtual bool set_nonvolatile(bool& was_purged) override; diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index 78be55f48f..cbb81daa3c 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -36,12 +36,12 @@ public: { } - Matrix(const Matrix& other) + Matrix(Matrix const& other) { __builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N); } - Matrix& operator=(const Matrix& other) + Matrix& operator=(Matrix const& other) { __builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N); return *this; @@ -50,7 +50,7 @@ public: constexpr auto elements() const { return m_elements; } constexpr auto elements() { return m_elements; } - constexpr Matrix operator*(const Matrix& other) const + constexpr Matrix operator*(Matrix const& other) const { Matrix product; for (size_t i = 0; i < N; ++i) { diff --git a/Userland/Libraries/LibGfx/Matrix4x4.h b/Userland/Libraries/LibGfx/Matrix4x4.h index ed767e48c9..7ff3ecad99 100644 --- a/Userland/Libraries/LibGfx/Matrix4x4.h +++ b/Userland/Libraries/LibGfx/Matrix4x4.h @@ -17,7 +17,7 @@ template<typename T> using Matrix4x4 = Matrix<4, T>; template<typename T> -constexpr static Vector4<T> operator*(const Matrix4x4<T>& m, const Vector4<T>& v) +constexpr static Vector4<T> operator*(Matrix4x4<T> const& m, Vector4<T> const& v) { auto const& elements = m.elements(); return Vector4<T>( @@ -30,7 +30,7 @@ constexpr static Vector4<T> operator*(const Matrix4x4<T>& m, const Vector4<T>& v // FIXME: this is a specific Matrix4x4 * Vector3 interaction that implies W=1; maybe move this out of LibGfx // or replace a Matrix4x4 * Vector4 operation? template<typename T> -constexpr static Vector3<T> transform_point(const Matrix4x4<T>& m, const Vector3<T>& p) +constexpr static Vector3<T> transform_point(Matrix4x4<T> const& m, Vector3<T> const& p) { auto const& elements = m.elements(); return Vector3<T>( @@ -40,7 +40,7 @@ constexpr static Vector3<T> transform_point(const Matrix4x4<T>& m, const Vector3 } template<typename T> -constexpr static Matrix4x4<T> translation_matrix(const Vector3<T>& p) +constexpr static Matrix4x4<T> translation_matrix(Vector3<T> const& p) { return Matrix4x4<T>( 1, 0, 0, p.x(), @@ -50,7 +50,7 @@ constexpr static Matrix4x4<T> translation_matrix(const Vector3<T>& p) } template<typename T> -constexpr static Matrix4x4<T> scale_matrix(const Vector3<T>& s) +constexpr static Matrix4x4<T> scale_matrix(Vector3<T> const& s) { return Matrix4x4<T>( s.x(), 0, 0, 0, @@ -60,7 +60,7 @@ constexpr static Matrix4x4<T> scale_matrix(const Vector3<T>& s) } template<typename T> -constexpr static Matrix4x4<T> rotation_matrix(const Vector3<T>& axis, T angle) +constexpr static Matrix4x4<T> rotation_matrix(Vector3<T> const& axis, T angle) { T c, s; AK::sincos(angle, s, c); diff --git a/Userland/Libraries/LibGfx/PGMLoader.cpp b/Userland/Libraries/LibGfx/PGMLoader.cpp index 6e52ef0815..a211209f83 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -13,7 +13,7 @@ namespace Gfx { -static void set_adjusted_pixels(PGMLoadingContext& context, const Vector<Gfx::Color>& color_data) +static void set_adjusted_pixels(PGMLoadingContext& context, Vector<Gfx::Color> const& color_data) { size_t index = 0; for (size_t y = 0; y < context.height; ++y) { diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 12237b5793..1a5a5247be 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -83,7 +83,7 @@ struct PNGLoadingContext { BitmapDecoded, }; State state { State::NotDecoded }; - const u8* data { nullptr }; + u8 const* data { nullptr }; size_t data_size { 0 }; int width { -1 }; int height { -1 }; @@ -119,7 +119,7 @@ struct PNGLoadingContext { class Streamer { public: - Streamer(const u8* data, size_t size) + Streamer(u8 const* data, size_t size) : m_data_ptr(data) , m_size_remaining(size) { @@ -130,7 +130,7 @@ public: { if (m_size_remaining < sizeof(T)) return false; - value = *((const NetworkOrdered<T>*)m_data_ptr); + value = *((NetworkOrdered<T> const*)m_data_ptr); m_data_ptr += sizeof(T); m_size_remaining -= sizeof(T); return true; @@ -159,7 +159,7 @@ public: bool at_end() const { return !m_size_remaining; } private: - const u8* m_data_ptr { nullptr }; + u8 const* m_data_ptr { nullptr }; size_t m_size_remaining { 0 }; }; @@ -191,9 +191,9 @@ union [[gnu::packed]] Pixel { static_assert(AssertSize<Pixel, 4>()); template<bool has_alpha, u8 filter_type> -ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* dummy_scanline_data) +ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, void const* dummy_scanline_data) { - auto* dummy_scanline = (const Pixel*)dummy_scanline_data; + auto* dummy_scanline = (Pixel const*)dummy_scanline_data; if constexpr (filter_type == 0) { auto* pixels = (Pixel*)bitmap.scanline(y); for (int i = 0; i < bitmap.width(); ++i) { @@ -208,7 +208,7 @@ ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* for (int i = 1; i < bitmap.width(); ++i) { auto& x = pixels[i]; swap(x.r, x.b); - auto& a = (const Pixel&)pixels[i - 1]; + auto& a = (Pixel const&)pixels[i - 1]; x.v[0] += a.v[0]; x.v[1] += a.v[1]; x.v[2] += a.v[2]; @@ -219,11 +219,11 @@ ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* } if constexpr (filter_type == 2) { auto* pixels = (Pixel*)bitmap.scanline(y); - auto* pixels_y_minus_1 = y == 0 ? dummy_scanline : (const Pixel*)bitmap.scanline(y - 1); + auto* pixels_y_minus_1 = y == 0 ? dummy_scanline : (Pixel const*)bitmap.scanline(y - 1); for (int i = 0; i < bitmap.width(); ++i) { auto& x = pixels[i]; swap(x.r, x.b); - const Pixel& b = pixels_y_minus_1[i]; + Pixel const& b = pixels_y_minus_1[i]; x.v[0] += b.v[0]; x.v[1] += b.v[1]; x.v[2] += b.v[2]; @@ -234,14 +234,14 @@ ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* } if constexpr (filter_type == 3) { auto* pixels = (Pixel*)bitmap.scanline(y); - auto* pixels_y_minus_1 = y == 0 ? dummy_scanline : (const Pixel*)bitmap.scanline(y - 1); + auto* pixels_y_minus_1 = y == 0 ? dummy_scanline : (Pixel const*)bitmap.scanline(y - 1); for (int i = 0; i < bitmap.width(); ++i) { auto& x = pixels[i]; swap(x.r, x.b); Pixel a; if (i != 0) a = pixels[i - 1]; - const Pixel& b = pixels_y_minus_1[i]; + Pixel const& b = pixels_y_minus_1[i]; x.v[0] = x.v[0] + ((a.v[0] + b.v[0]) / 2); x.v[1] = x.v[1] + ((a.v[1] + b.v[1]) / 2); x.v[2] = x.v[2] + ((a.v[2] + b.v[2]) / 2); @@ -257,7 +257,7 @@ ALWAYS_INLINE static void unfilter_impl(Gfx::Bitmap& bitmap, int y, const void* auto& x = pixels[i]; swap(x.r, x.b); Pixel a; - const Pixel& b = pixels_y_minus_1[i]; + Pixel const& b = pixels_y_minus_1[i]; Pixel c; if (i != 0) { a = pixels[i - 1]; @@ -291,7 +291,7 @@ template<typename T> ALWAYS_INLINE static void unpack_grayscale_with_alpha(PNGLoadingContext& context) { for (int y = 0; y < context.height; ++y) { - auto* tuples = reinterpret_cast<const Tuple<T>*>(context.scanlines[y].data.data()); + auto* tuples = reinterpret_cast<Tuple<T> const*>(context.scanlines[y].data.data()); for (int i = 0; i < context.width; ++i) { auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; pixel.r = tuples[i].gray; @@ -306,7 +306,7 @@ template<typename T> ALWAYS_INLINE static void unpack_triplets_without_alpha(PNGLoadingContext& context) { for (int y = 0; y < context.height; ++y) { - auto* triplets = reinterpret_cast<const Triplet<T>*>(context.scanlines[y].data.data()); + auto* triplets = reinterpret_cast<Triplet<T> const*>(context.scanlines[y].data.data()); for (int i = 0; i < context.width; ++i) { auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; pixel.r = triplets[i].r; @@ -321,7 +321,7 @@ template<typename T> ALWAYS_INLINE static void unpack_triplets_with_transparency_value(PNGLoadingContext& context, Triplet<T> transparency_value) { for (int y = 0; y < context.height; ++y) { - auto* triplets = reinterpret_cast<const Triplet<T>*>(context.scanlines[y].data.data()); + auto* triplets = reinterpret_cast<Triplet<T> const*>(context.scanlines[y].data.data()); for (int i = 0; i < context.width; ++i) { auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; pixel.r = triplets[i].r; @@ -401,7 +401,7 @@ NEVER_INLINE FLATTEN static ErrorOr<void> unfilter(PNGLoadingContext& context) } } else if (context.bit_depth == 16) { for (int y = 0; y < context.height; ++y) { - auto* triplets = reinterpret_cast<const Quad<u16>*>(context.scanlines[y].data.data()); + auto* triplets = reinterpret_cast<Quad<u16> const*>(context.scanlines[y].data.data()); for (int i = 0; i < context.width; ++i) { auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; pixel.r = triplets[i].r & 0xFF; @@ -538,7 +538,7 @@ static bool decode_png_size(PNGLoadingContext& context) return false; } - const u8* data_ptr = context.data + sizeof(png_header); + u8 const* data_ptr = context.data + sizeof(png_header); size_t data_remaining = context.data_size - sizeof(png_header); Streamer streamer(data_ptr, data_remaining); @@ -566,7 +566,7 @@ static bool decode_png_chunks(PNGLoadingContext& context) return false; } - const u8* data_ptr = context.data + sizeof(png_header); + u8 const* data_ptr = context.data + sizeof(png_header); int data_remaining = context.data_size - sizeof(png_header); context.compressed_data.ensure_capacity(context.data_size); @@ -861,7 +861,7 @@ static bool process_IDAT(ReadonlyBytes data, PNGLoadingContext& context) static bool process_PLTE(ReadonlyBytes data, PNGLoadingContext& context) { - context.palette_data.append((const PaletteEntry*)data.data(), data.size() / 3); + context.palette_data.append((PaletteEntry const*)data.data(), data.size() / 3); return true; } @@ -902,18 +902,18 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context) } dbgln_if(PNG_DEBUG, "Chunk type: '{}', size: {}, crc: {:x}", chunk_type, chunk_size, chunk_crc); - if (!strcmp((const char*)chunk_type, "IHDR")) + if (!strcmp((char const*)chunk_type, "IHDR")) return process_IHDR(chunk_data, context); - if (!strcmp((const char*)chunk_type, "IDAT")) + if (!strcmp((char const*)chunk_type, "IDAT")) return process_IDAT(chunk_data, context); - if (!strcmp((const char*)chunk_type, "PLTE")) + if (!strcmp((char const*)chunk_type, "PLTE")) return process_PLTE(chunk_data, context); - if (!strcmp((const char*)chunk_type, "tRNS")) + if (!strcmp((char const*)chunk_type, "tRNS")) return process_tRNS(chunk_data, context); return true; } -PNGImageDecoderPlugin::PNGImageDecoderPlugin(const u8* data, size_t size) +PNGImageDecoderPlugin::PNGImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<PNGLoadingContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/PNGLoader.h b/Userland/Libraries/LibGfx/PNGLoader.h index 9f7c0e7b6c..8e11319b5b 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.h +++ b/Userland/Libraries/LibGfx/PNGLoader.h @@ -15,7 +15,7 @@ struct PNGLoadingContext; class PNGImageDecoderPlugin final : public ImageDecoderPlugin { public: virtual ~PNGImageDecoderPlugin() override; - PNGImageDecoderPlugin(const u8*, size_t); + PNGImageDecoderPlugin(u8 const*, size_t); virtual IntSize size() override; virtual void set_volatile() override; diff --git a/Userland/Libraries/LibGfx/Palette.cpp b/Userland/Libraries/LibGfx/Palette.cpp index b6d6711a47..504cdf6b2a 100644 --- a/Userland/Libraries/LibGfx/Palette.cpp +++ b/Userland/Libraries/LibGfx/Palette.cpp @@ -22,7 +22,7 @@ PaletteImpl::PaletteImpl(Core::AnonymousBuffer buffer) { } -Palette::Palette(const PaletteImpl& impl) +Palette::Palette(PaletteImpl const& impl) : m_impl(impl) { } diff --git a/Userland/Libraries/LibGfx/Palette.h b/Userland/Libraries/LibGfx/Palette.h index 365e8cc2e0..2d88cddc1b 100644 --- a/Userland/Libraries/LibGfx/Palette.h +++ b/Userland/Libraries/LibGfx/Palette.h @@ -46,7 +46,7 @@ public: int metric(MetricRole) const; String path(PathRole) const; - const SystemTheme& theme() const { return *m_theme_buffer.data<SystemTheme>(); } + SystemTheme const& theme() const { return *m_theme_buffer.data<SystemTheme>(); } void replace_internal_buffer(Badge<GUI::Application>, Core::AnonymousBuffer buffer); @@ -59,7 +59,7 @@ private: class Palette { public: - explicit Palette(const PaletteImpl&); + explicit Palette(PaletteImpl const&); ~Palette() = default; Color accent() const { return color(ColorRole::Accent); } @@ -169,10 +169,10 @@ public: void set_metric(MetricRole, int); void set_path(PathRole, String); - const SystemTheme& theme() const { return m_impl->theme(); } + SystemTheme const& theme() const { return m_impl->theme(); } PaletteImpl& impl() { return *m_impl; } - const PaletteImpl& impl() const { return *m_impl; } + PaletteImpl const& impl() const { return *m_impl; } private: NonnullRefPtr<PaletteImpl> m_impl; diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index 7b40796f52..85500700aa 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -14,7 +14,7 @@ namespace Gfx { -void Path::elliptical_arc_to(const FloatPoint& point, const FloatPoint& radii, double x_axis_rotation, bool large_arc, bool sweep) +void Path::elliptical_arc_to(FloatPoint const& point, FloatPoint const& radii, double x_axis_rotation, bool large_arc, bool sweep) { auto next_point = point; @@ -207,16 +207,16 @@ String Path::to_string() const switch (segment.type()) { case Segment::Type::QuadraticBezierCurveTo: builder.append(", "); - builder.append(static_cast<const QuadraticBezierCurveSegment&>(segment).through().to_string()); + builder.append(static_cast<QuadraticBezierCurveSegment const&>(segment).through().to_string()); break; case Segment::Type::CubicBezierCurveTo: builder.append(", "); - builder.append(static_cast<const CubicBezierCurveSegment&>(segment).through_0().to_string()); + builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_0().to_string()); builder.append(", "); - builder.append(static_cast<const CubicBezierCurveSegment&>(segment).through_1().to_string()); + builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_1().to_string()); break; case Segment::Type::EllipticalArcTo: { - auto& arc = static_cast<const EllipticalArcSegment&>(segment); + auto& arc = static_cast<EllipticalArcSegment const&>(segment); builder.appendff(", {}, {}, {}, {}, {}", arc.radii().to_string().characters(), arc.center().to_string().characters(), @@ -243,7 +243,7 @@ void Path::segmentize_path() float max_x = 0; float max_y = 0; - auto add_point_to_bbox = [&](const Gfx::FloatPoint& point) { + auto add_point_to_bbox = [&](Gfx::FloatPoint const& point) { float x = point.x(); float y = point.y(); min_x = min(min_x, x); @@ -252,7 +252,7 @@ void Path::segmentize_path() max_y = max(max_y, y); }; - auto add_line = [&](const auto& p0, const auto& p1) { + auto add_line = [&](auto const& p0, auto const& p1) { float ymax = p0.y(), ymin = p1.y(), x_of_ymin = p1.x(), x_of_ymax = p0.x(); auto slope = p0.x() == p1.x() ? 0 : ((float)(p0.y() - p1.y())) / ((float)(p0.x() - p1.x())); if (p0.y() < p1.y()) { @@ -292,7 +292,7 @@ void Path::segmentize_path() } case Segment::Type::QuadraticBezierCurveTo: { auto& control = static_cast<QuadraticBezierCurveSegment&>(segment).through(); - Painter::for_each_line_segment_on_bezier_curve(control, cursor, segment.point(), [&](const FloatPoint& p0, const FloatPoint& p1) { + Painter::for_each_line_segment_on_bezier_curve(control, cursor, segment.point(), [&](FloatPoint const& p0, FloatPoint const& p1) { add_line(p0, p1); }); cursor = segment.point(); @@ -302,7 +302,7 @@ void Path::segmentize_path() auto& curve = static_cast<CubicBezierCurveSegment const&>(segment); auto& control_0 = curve.through_0(); auto& control_1 = curve.through_1(); - Painter::for_each_line_segment_on_cubic_bezier_curve(control_0, control_1, cursor, segment.point(), [&](const FloatPoint& p0, const FloatPoint& p1) { + Painter::for_each_line_segment_on_cubic_bezier_curve(control_0, control_1, cursor, segment.point(), [&](FloatPoint const& p0, FloatPoint const& p1) { add_line(p0, p1); }); cursor = segment.point(); @@ -310,7 +310,7 @@ void Path::segmentize_path() } case Segment::Type::EllipticalArcTo: { auto& arc = static_cast<EllipticalArcSegment&>(segment); - Painter::for_each_line_segment_on_elliptical_arc(cursor, arc.point(), arc.center(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), [&](const FloatPoint& p0, const FloatPoint& p1) { + Painter::for_each_line_segment_on_elliptical_arc(cursor, arc.point(), arc.center(), arc.radii(), arc.x_axis_rotation(), arc.theta_1(), arc.theta_delta(), [&](FloatPoint const& p0, FloatPoint const& p1) { add_line(p0, p1); }); cursor = segment.point(); @@ -324,7 +324,7 @@ void Path::segmentize_path() } // sort segments by ymax - quick_sort(segments, [](const auto& line0, const auto& line1) { + quick_sort(segments, [](auto const& line0, auto const& line1) { return line1.maximum_y < line0.maximum_y; }); diff --git a/Userland/Libraries/LibGfx/Path.h b/Userland/Libraries/LibGfx/Path.h index cad1c88099..7c0ba83090 100644 --- a/Userland/Libraries/LibGfx/Path.h +++ b/Userland/Libraries/LibGfx/Path.h @@ -28,14 +28,14 @@ public: EllipticalArcTo, }; - Segment(const FloatPoint& point) + Segment(FloatPoint const& point) : m_point(point) { } virtual ~Segment() = default; - const FloatPoint& point() const { return m_point; } + FloatPoint const& point() const { return m_point; } virtual Type type() const = 0; protected: @@ -44,7 +44,7 @@ protected: class MoveSegment final : public Segment { public: - MoveSegment(const FloatPoint& point) + MoveSegment(FloatPoint const& point) : Segment(point) { } @@ -55,7 +55,7 @@ private: class LineSegment final : public Segment { public: - LineSegment(const FloatPoint& point) + LineSegment(FloatPoint const& point) : Segment(point) { } @@ -68,7 +68,7 @@ private: class QuadraticBezierCurveSegment final : public Segment { public: - QuadraticBezierCurveSegment(const FloatPoint& point, const FloatPoint& through) + QuadraticBezierCurveSegment(FloatPoint const& point, FloatPoint const& through) : Segment(point) , m_through(through) { @@ -76,7 +76,7 @@ public: virtual ~QuadraticBezierCurveSegment() override = default; - const FloatPoint& through() const { return m_through; } + FloatPoint const& through() const { return m_through; } private: virtual Type type() const override { return Segment::Type::QuadraticBezierCurveTo; } @@ -86,7 +86,7 @@ private: class CubicBezierCurveSegment final : public Segment { public: - CubicBezierCurveSegment(const FloatPoint& point, const FloatPoint& through_0, const FloatPoint& through_1) + CubicBezierCurveSegment(FloatPoint const& point, FloatPoint const& through_0, FloatPoint const& through_1) : Segment(point) , m_through_0(through_0) , m_through_1(through_1) @@ -95,8 +95,8 @@ public: virtual ~CubicBezierCurveSegment() override = default; - const FloatPoint& through_0() const { return m_through_0; } - const FloatPoint& through_1() const { return m_through_1; } + FloatPoint const& through_0() const { return m_through_0; } + FloatPoint const& through_1() const { return m_through_1; } private: virtual Type type() const override { return Segment::Type::CubicBezierCurveTo; } @@ -107,7 +107,7 @@ private: class EllipticalArcSegment final : public Segment { public: - EllipticalArcSegment(const FloatPoint& point, const FloatPoint& center, const FloatPoint radii, float x_axis_rotation, float theta_1, float theta_delta, bool large_arc, bool sweep) + EllipticalArcSegment(FloatPoint const& point, FloatPoint const& center, const FloatPoint radii, float x_axis_rotation, float theta_1, float theta_delta, bool large_arc, bool sweep) : Segment(point) , m_center(center) , m_radii(radii) @@ -121,8 +121,8 @@ public: virtual ~EllipticalArcSegment() override = default; - const FloatPoint& center() const { return m_center; } - const FloatPoint& radii() const { return m_radii; } + FloatPoint const& center() const { return m_center; } + FloatPoint const& radii() const { return m_radii; } float x_axis_rotation() const { return m_x_axis_rotation; } float theta_1() const { return m_theta_1; } float theta_delta() const { return m_theta_delta; } @@ -145,12 +145,12 @@ class Path { public: Path() = default; - void move_to(const FloatPoint& point) + void move_to(FloatPoint const& point) { append_segment<MoveSegment>(point); } - void line_to(const FloatPoint& point) + void line_to(FloatPoint const& point) { append_segment<LineSegment>(point); invalidate_split_lines(); @@ -172,7 +172,7 @@ public: line_to({ previous_x, y }); } - void quadratic_bezier_curve_to(const FloatPoint& through, const FloatPoint& point) + void quadratic_bezier_curve_to(FloatPoint const& through, FloatPoint const& point) { append_segment<QuadraticBezierCurveSegment>(point, through); invalidate_split_lines(); @@ -184,14 +184,14 @@ public: invalidate_split_lines(); } - void elliptical_arc_to(const FloatPoint& point, const FloatPoint& radii, double x_axis_rotation, bool large_arc, bool sweep); - void arc_to(const FloatPoint& point, float radius, bool large_arc, bool sweep) + void elliptical_arc_to(FloatPoint const& point, FloatPoint const& radii, double x_axis_rotation, bool large_arc, bool sweep); + void arc_to(FloatPoint const& point, float radius, bool large_arc, bool sweep) { elliptical_arc_to(point, { radius, radius }, 0, large_arc, sweep); } // Note: This does not do any sanity checks! - void elliptical_arc_to(const FloatPoint& endpoint, const FloatPoint& center, const FloatPoint& radii, double x_axis_rotation, double theta, double theta_delta, bool large_arc, bool sweep) + void elliptical_arc_to(FloatPoint const& endpoint, FloatPoint const& center, FloatPoint const& radii, double x_axis_rotation, double theta, double theta_delta, bool large_arc, bool sweep) { append_segment<EllipticalArcSegment>( endpoint, @@ -218,7 +218,7 @@ public: float x; }; - const NonnullRefPtrVector<Segment>& segments() const { return m_segments; } + NonnullRefPtrVector<Segment> const& segments() const { return m_segments; } auto& split_lines() const { if (!m_split_lines.has_value()) { diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h index c5cb419095..c1a67a3b23 100644 --- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h +++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h @@ -45,7 +45,7 @@ static bool read_number(Streamer& streamer, TValue* value) sb.append(byte); } - const auto opt_value = sb.to_string().to_uint(); + auto const opt_value = sb.to_string().to_uint(); if (!opt_value.has_value()) { *value = 0; return false; @@ -133,7 +133,7 @@ static bool read_whitespace(TContext& context, Streamer& streamer) template<typename TContext> static bool read_width(TContext& context, Streamer& streamer) { - if (const bool result = read_number(streamer, &context.width); + if (bool const result = read_number(streamer, &context.width); !result || context.width == 0) { return false; } @@ -145,7 +145,7 @@ static bool read_width(TContext& context, Streamer& streamer) template<typename TContext> static bool read_height(TContext& context, Streamer& streamer) { - if (const bool result = read_number(streamer, &context.height); + if (bool const result = read_number(streamer, &context.height); !result || context.height == 0) { return false; } @@ -157,7 +157,7 @@ static bool read_height(TContext& context, Streamer& streamer) template<typename TContext> static bool read_max_val(TContext& context, Streamer& streamer) { - if (const bool result = read_number(streamer, &context.format_details.max_val); + if (bool const result = read_number(streamer, &context.format_details.max_val); !result || context.format_details.max_val == 0) { return false; } @@ -185,7 +185,7 @@ static bool create_bitmap(TContext& context) } template<typename TContext> -static void set_pixels(TContext& context, const Vector<Gfx::Color>& color_data) +static void set_pixels(TContext& context, Vector<Gfx::Color> const& color_data) { size_t index = 0; for (size_t y = 0; y < context.height; ++y) { @@ -248,7 +248,7 @@ static bool decode(TContext& context) } template<typename TContext> -static RefPtr<Gfx::Bitmap> load_impl(const u8* data, size_t data_size) +static RefPtr<Gfx::Bitmap> load_impl(u8 const* data, size_t data_size) { TContext context {}; context.data = data; diff --git a/Userland/Libraries/LibGfx/PortableImageMapLoader.h b/Userland/Libraries/LibGfx/PortableImageMapLoader.h index f854cd75eb..994a86961c 100644 --- a/Userland/Libraries/LibGfx/PortableImageMapLoader.h +++ b/Userland/Libraries/LibGfx/PortableImageMapLoader.h @@ -49,7 +49,7 @@ struct PortableImageMapLoadingContext { template<typename TContext> class PortableImageDecoderPlugin final : public ImageDecoderPlugin { public: - PortableImageDecoderPlugin(const u8*, size_t); + PortableImageDecoderPlugin(u8 const*, size_t); virtual ~PortableImageDecoderPlugin() override = default; virtual IntSize size() override; @@ -69,7 +69,7 @@ private: }; template<typename TContext> -PortableImageDecoderPlugin<TContext>::PortableImageDecoderPlugin(const u8* data, size_t size) +PortableImageDecoderPlugin<TContext>::PortableImageDecoderPlugin(u8 const* data, size_t size) { m_context = make<TContext>(); m_context->data = data; diff --git a/Userland/Libraries/LibGfx/Rect.cpp b/Userland/Libraries/LibGfx/Rect.cpp index 3c8714195a..64db8e6270 100644 --- a/Userland/Libraries/LibGfx/Rect.cpp +++ b/Userland/Libraries/LibGfx/Rect.cpp @@ -170,7 +170,7 @@ Point<T> Rect<T>::closest_to(Point<T> const& point) const return {}; Optional<Point<T>> closest_point; float closest_distance = 0.0; - auto check_distance = [&](const Line<T>& line) { + auto check_distance = [&](Line<T> const& line) { auto point_on_line = line.closest_to(point); auto distance = Line { point_on_line, point }.length(); if (!closest_point.has_value() || distance < closest_distance) { diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h index 57b7d249c6..82534cae6f 100644 --- a/Userland/Libraries/LibGfx/Rect.h +++ b/Userland/Libraries/LibGfx/Rect.h @@ -752,7 +752,7 @@ struct Formatter<Gfx::Rect<T>> : Formatter<StringView> { namespace IPC { -bool encode(Encoder&, const Gfx::IntRect&); +bool encode(Encoder&, Gfx::IntRect const&); ErrorOr<void> decode(Decoder&, Gfx::IntRect&); } diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp index f76be7d897..2be857d4de 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp @@ -22,7 +22,7 @@ ShareableBitmap::ShareableBitmap(NonnullRefPtr<Bitmap> bitmap, Tag) namespace IPC { -bool encode(Encoder& encoder, const Gfx::ShareableBitmap& shareable_bitmap) +bool encode(Encoder& encoder, Gfx::ShareableBitmap const& shareable_bitmap) { encoder << shareable_bitmap.is_valid(); if (!shareable_bitmap.is_valid()) diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.h b/Userland/Libraries/LibGfx/ShareableBitmap.h index 3eefade8ac..04e5985582 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.h +++ b/Userland/Libraries/LibGfx/ShareableBitmap.h @@ -21,7 +21,7 @@ public: bool is_valid() const { return m_bitmap; } - const Bitmap* bitmap() const { return m_bitmap; } + Bitmap const* bitmap() const { return m_bitmap; } Bitmap* bitmap() { return m_bitmap; } private: @@ -34,7 +34,7 @@ private: namespace IPC { -bool encode(Encoder&, const Gfx::ShareableBitmap&); +bool encode(Encoder&, Gfx::ShareableBitmap const&); ErrorOr<void> decode(Decoder&, Gfx::ShareableBitmap&); } diff --git a/Userland/Libraries/LibGfx/Streamer.h b/Userland/Libraries/LibGfx/Streamer.h index 1de269e7fe..15acbd1106 100644 --- a/Userland/Libraries/LibGfx/Streamer.h +++ b/Userland/Libraries/LibGfx/Streamer.h @@ -16,7 +16,7 @@ namespace Gfx { class Streamer { public: - constexpr Streamer(const u8* data, size_t size) + constexpr Streamer(u8 const* data, size_t size) : m_data_ptr(data) , m_size_remaining(size) { @@ -52,7 +52,7 @@ public: } private: - const u8* m_data_ptr { nullptr }; + u8 const* m_data_ptr { nullptr }; size_t m_size_remaining { 0 }; }; diff --git a/Userland/Libraries/LibGfx/StylePainter.cpp b/Userland/Libraries/LibGfx/StylePainter.cpp index 286fc03684..8fbec27c83 100644 --- a/Userland/Libraries/LibGfx/StylePainter.cpp +++ b/Userland/Libraries/LibGfx/StylePainter.cpp @@ -18,42 +18,42 @@ BaseStylePainter& StylePainter::current() return style; } -void StylePainter::paint_tab_button(Painter& painter, const IntRect& rect, const Palette& palette, bool active, bool hovered, bool enabled, bool top, bool in_active_window) +void StylePainter::paint_tab_button(Painter& painter, IntRect const& rect, Palette const& palette, bool active, bool hovered, bool enabled, bool top, bool in_active_window) { current().paint_tab_button(painter, rect, palette, active, hovered, enabled, top, in_active_window); } -void StylePainter::paint_button(Painter& painter, const IntRect& rect, const Palette& palette, ButtonStyle button_style, bool pressed, bool hovered, bool checked, bool enabled, bool focused, bool default_button) +void StylePainter::paint_button(Painter& painter, IntRect const& rect, Palette const& palette, ButtonStyle button_style, bool pressed, bool hovered, bool checked, bool enabled, bool focused, bool default_button) { current().paint_button(painter, rect, palette, button_style, pressed, hovered, checked, enabled, focused, default_button); } -void StylePainter::paint_frame(Painter& painter, const IntRect& rect, const Palette& palette, FrameShape shape, FrameShadow shadow, int thickness, bool skip_vertical_lines) +void StylePainter::paint_frame(Painter& painter, IntRect const& rect, Palette const& palette, FrameShape shape, FrameShadow shadow, int thickness, bool skip_vertical_lines) { current().paint_frame(painter, rect, palette, shape, shadow, thickness, skip_vertical_lines); } -void StylePainter::paint_window_frame(Painter& painter, const IntRect& rect, const Palette& palette) +void StylePainter::paint_window_frame(Painter& painter, IntRect const& rect, Palette const& palette) { current().paint_window_frame(painter, rect, palette); } -void StylePainter::paint_progressbar(Painter& painter, const IntRect& rect, const Palette& palette, int min, int max, int value, StringView text, Orientation orientation) +void StylePainter::paint_progressbar(Painter& painter, IntRect const& rect, Palette const& palette, int min, int max, int value, StringView text, Orientation orientation) { current().paint_progressbar(painter, rect, palette, min, max, value, text, orientation); } -void StylePainter::paint_radio_button(Painter& painter, const IntRect& rect, const Palette& palette, bool is_checked, bool is_being_pressed) +void StylePainter::paint_radio_button(Painter& painter, IntRect const& rect, Palette const& palette, bool is_checked, bool is_being_pressed) { current().paint_radio_button(painter, rect, palette, is_checked, is_being_pressed); } -void StylePainter::paint_check_box(Painter& painter, const IntRect& rect, const Palette& palette, bool is_enabled, bool is_checked, bool is_being_pressed) +void StylePainter::paint_check_box(Painter& painter, IntRect const& rect, Palette const& palette, bool is_enabled, bool is_checked, bool is_being_pressed) { current().paint_check_box(painter, rect, palette, is_enabled, is_checked, is_being_pressed); } -void StylePainter::paint_transparency_grid(Painter& painter, const IntRect& rect, const Palette& palette) +void StylePainter::paint_transparency_grid(Painter& painter, IntRect const& rect, Palette const& palette) { current().paint_transparency_grid(painter, rect, palette); } diff --git a/Userland/Libraries/LibGfx/SystemTheme.cpp b/Userland/Libraries/LibGfx/SystemTheme.cpp index ed52299c08..815d0a62cc 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.cpp +++ b/Userland/Libraries/LibGfx/SystemTheme.cpp @@ -13,7 +13,7 @@ namespace Gfx { static SystemTheme dummy_theme; -static const SystemTheme* theme_page = &dummy_theme; +static SystemTheme const* theme_page = &dummy_theme; static Core::AnonymousBuffer theme_buffer; Core::AnonymousBuffer& current_system_theme_buffer() diff --git a/Userland/Libraries/LibGfx/SystemTheme.h b/Userland/Libraries/LibGfx/SystemTheme.h index 769760c6dd..bc712ca7eb 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.h +++ b/Userland/Libraries/LibGfx/SystemTheme.h @@ -135,7 +135,7 @@ enum class ColorRole { DisabledText = ThreedShadow1, }; -inline const char* to_string(ColorRole role) +inline char const* to_string(ColorRole role) { switch (role) { case ColorRole::NoRole: @@ -162,7 +162,7 @@ enum class AlignmentRole { __Count, }; -inline const char* to_string(AlignmentRole role) +inline char const* to_string(AlignmentRole role) { switch (role) { case AlignmentRole::NoRole: @@ -189,7 +189,7 @@ enum class FlagRole { __Count, }; -inline const char* to_string(FlagRole role) +inline char const* to_string(FlagRole role) { switch (role) { case FlagRole::NoRole: @@ -216,7 +216,7 @@ enum class MetricRole { __Count, }; -inline const char* to_string(MetricRole role) +inline char const* to_string(MetricRole role) { switch (role) { case MetricRole::NoRole: @@ -243,7 +243,7 @@ enum class PathRole { __Count, }; -inline const char* to_string(PathRole role) +inline char const* to_string(PathRole role) { switch (role) { case PathRole::NoRole: diff --git a/Userland/Libraries/LibGfx/TextAlignment.h b/Userland/Libraries/LibGfx/TextAlignment.h index 9c0f7a38d2..9d869fd3e1 100644 --- a/Userland/Libraries/LibGfx/TextAlignment.h +++ b/Userland/Libraries/LibGfx/TextAlignment.h @@ -62,7 +62,7 @@ inline Optional<TextAlignment> text_alignment_from_string(StringView string) return {}; } -inline const char* to_string(TextAlignment text_alignment) +inline char const* to_string(TextAlignment text_alignment) { #define __ENUMERATE(x) \ if (text_alignment == TextAlignment::x) \ diff --git a/Userland/Libraries/LibGfx/TextDirection.h b/Userland/Libraries/LibGfx/TextDirection.h index dc5ef5b184..20ac54d4b2 100644 --- a/Userland/Libraries/LibGfx/TextDirection.h +++ b/Userland/Libraries/LibGfx/TextDirection.h @@ -20,7 +20,7 @@ enum class BidirectionalClass { NEUTRAL, }; -extern const Array<BidirectionalClass, 0x1F000> char_bidi_class_lookup_table; +extern Array<BidirectionalClass, 0x1F000> const char_bidi_class_lookup_table; constexpr BidirectionalClass get_char_bidi_class(u32 ch) { diff --git a/Userland/Libraries/LibGfx/Typeface.cpp b/Userland/Libraries/LibGfx/Typeface.cpp index 87ba7eaf40..4c6f2be4c4 100644 --- a/Userland/Libraries/LibGfx/Typeface.cpp +++ b/Userland/Libraries/LibGfx/Typeface.cpp @@ -77,7 +77,7 @@ RefPtr<Font> Typeface::get_font(float point_size, Font::AllowInexactSizeMatch al return {}; } -void Typeface::for_each_fixed_size_font(Function<void(const Font&)> callback) const +void Typeface::for_each_fixed_size_font(Function<void(Font const&)> callback) const { for (auto font : m_bitmap_fonts) { callback(*font); diff --git a/Userland/Libraries/LibGfx/Typeface.h b/Userland/Libraries/LibGfx/Typeface.h index 10b865d8bc..fb2600862d 100644 --- a/Userland/Libraries/LibGfx/Typeface.h +++ b/Userland/Libraries/LibGfx/Typeface.h @@ -18,7 +18,7 @@ namespace Gfx { class Typeface : public RefCounted<Typeface> { public: - Typeface(const String& family, const String& variant) + Typeface(String const& family, String const& variant) : m_family(family) , m_variant(variant) { @@ -31,7 +31,7 @@ public: bool is_fixed_width() const; bool is_fixed_size() const { return !m_bitmap_fonts.is_empty(); } - void for_each_fixed_size_font(Function<void(const Font&)>) const; + void for_each_fixed_size_font(Function<void(Font const&)>) const; void add_bitmap_font(RefPtr<BitmapFont>); void set_ttf_font(RefPtr<TTF::Font>); diff --git a/Userland/Libraries/LibGfx/VectorN.h b/Userland/Libraries/LibGfx/VectorN.h index a8b64e723d..6e07a3b49d 100644 --- a/Userland/Libraries/LibGfx/VectorN.h +++ b/Userland/Libraries/LibGfx/VectorN.h @@ -62,7 +62,7 @@ public: return m_data[index]; } - constexpr VectorN& operator+=(const VectorN& other) + constexpr VectorN& operator+=(VectorN const& other) { UNROLL_LOOP for (auto i = 0u; i < N; ++i) @@ -70,7 +70,7 @@ public: return *this; } - constexpr VectorN& operator-=(const VectorN& other) + constexpr VectorN& operator-=(VectorN const& other) { UNROLL_LOOP for (auto i = 0u; i < N; ++i) @@ -86,7 +86,7 @@ public: return *this; } - [[nodiscard]] constexpr VectorN operator+(const VectorN& other) const + [[nodiscard]] constexpr VectorN operator+(VectorN const& other) const { VectorN result; UNROLL_LOOP @@ -95,7 +95,7 @@ public: return result; } - [[nodiscard]] constexpr VectorN operator-(const VectorN& other) const + [[nodiscard]] constexpr VectorN operator-(VectorN const& other) const { VectorN result; UNROLL_LOOP @@ -104,7 +104,7 @@ public: return result; } - [[nodiscard]] constexpr VectorN operator*(const VectorN& other) const + [[nodiscard]] constexpr VectorN operator*(VectorN const& other) const { VectorN result; UNROLL_LOOP @@ -122,7 +122,7 @@ public: return result; } - [[nodiscard]] constexpr VectorN operator/(const VectorN& other) const + [[nodiscard]] constexpr VectorN operator/(VectorN const& other) const { VectorN result; UNROLL_LOOP @@ -151,7 +151,7 @@ public: return result; } - [[nodiscard]] constexpr T dot(const VectorN& other) const + [[nodiscard]] constexpr T dot(VectorN const& other) const { T result {}; UNROLL_LOOP @@ -160,7 +160,7 @@ public: return result; } - [[nodiscard]] constexpr VectorN cross(const VectorN& other) const requires(N == 3) + [[nodiscard]] constexpr VectorN cross(VectorN const& other) const requires(N == 3) { return VectorN( y() * other.z() - z() * other.y(), diff --git a/Userland/Libraries/LibGfx/WindowTheme.h b/Userland/Libraries/LibGfx/WindowTheme.h index d307099983..4d7e07b2ae 100644 --- a/Userland/Libraries/LibGfx/WindowTheme.h +++ b/Userland/Libraries/LibGfx/WindowTheme.h @@ -31,22 +31,22 @@ public: static WindowTheme& current(); - virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const = 0; - virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Palette&, const IntRect& leftmost_button_rect) const = 0; - virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const = 0; + virtual void paint_normal_frame(Painter&, WindowState, IntRect const& window_rect, StringView title, Bitmap const& icon, Palette const&, IntRect const& leftmost_button_rect, int menu_row_count, bool window_modified) const = 0; + virtual void paint_tool_window_frame(Painter&, WindowState, IntRect const& window_rect, StringView title, Palette const&, IntRect const& leftmost_button_rect) const = 0; + virtual void paint_notification_frame(Painter&, IntRect const& window_rect, Palette const&, IntRect const& close_button_rect) const = 0; - virtual int titlebar_height(WindowType, const Palette&) const = 0; - virtual IntRect titlebar_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; - virtual IntRect titlebar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; - virtual IntRect titlebar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; + virtual int titlebar_height(WindowType, Palette const&) const = 0; + virtual IntRect titlebar_rect(WindowType, IntRect const& window_rect, Palette const&) const = 0; + virtual IntRect titlebar_icon_rect(WindowType, IntRect const& window_rect, Palette const&) const = 0; + virtual IntRect titlebar_text_rect(WindowType, IntRect const& window_rect, Palette const&) const = 0; - virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; + virtual IntRect menubar_rect(WindowType, IntRect const& window_rect, Palette const&, int menu_row_count) const = 0; - virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; + virtual IntRect frame_rect_for_window(WindowType, IntRect const& window_rect, Palette const&, int menu_row_count) const = 0; - virtual Vector<IntRect> layout_buttons(WindowType, const IntRect& window_rect, const Palette&, size_t buttons) const = 0; + virtual Vector<IntRect> layout_buttons(WindowType, IntRect const& window_rect, Palette const&, size_t buttons) const = 0; virtual bool is_simple_rect_frame() const = 0; - virtual bool frame_uses_alpha(WindowState, const Palette&) const = 0; + virtual bool frame_uses_alpha(WindowState, Palette const&) const = 0; virtual float frame_alpha_hit_threshold(WindowState) const = 0; protected: diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 8a5ea6cc4a..6ae5ecf281 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -17,7 +17,7 @@ namespace HTTP { -static Optional<ByteBuffer> handle_content_encoding(const ByteBuffer& buf, const String& content_encoding) +static Optional<ByteBuffer> handle_content_encoding(ByteBuffer const& buf, String const& content_encoding) { dbgln_if(JOB_DEBUG, "Job::handle_content_encoding: buf has content_encoding={}", content_encoding); diff --git a/Userland/Libraries/LibHTTP/Job.h b/Userland/Libraries/LibHTTP/Job.h index eef352410d..27736e78ba 100644 --- a/Userland/Libraries/LibHTTP/Job.h +++ b/Userland/Libraries/LibHTTP/Job.h @@ -30,7 +30,7 @@ public: URL url() const { return m_request.url(); } HttpResponse* response() { return static_cast<HttpResponse*>(Core::NetworkJob::response()); } - const HttpResponse* response() const { return static_cast<const HttpResponse*>(Core::NetworkJob::response()); } + HttpResponse const* response() const { return static_cast<HttpResponse const*>(Core::NetworkJob::response()); } protected: void finish_up(); diff --git a/Userland/Libraries/LibIMAP/Client.cpp b/Userland/Libraries/LibIMAP/Client.cpp index 318239205e..dfb99ec918 100644 --- a/Userland/Libraries/LibIMAP/Client.cpp +++ b/Userland/Libraries/LibIMAP/Client.cpp @@ -316,7 +316,7 @@ RefPtr<Promise<Optional<SolidResponse>>> Client::search(Optional<String> charset args.append("CHARSET "); args.append(charset.value()); } - for (const auto& item : keys) { + for (auto const& item : keys) { args.append(item.serialize()); } auto command = Command { uid ? CommandType::UIDSearch : CommandType::Search, m_current_command, args }; diff --git a/Userland/Libraries/LibIMAP/Objects.h b/Userland/Libraries/LibIMAP/Objects.h index 4609503613..88aa8426fa 100644 --- a/Userland/Libraries/LibIMAP/Objects.h +++ b/Userland/Libraries/LibIMAP/Objects.h @@ -505,7 +505,7 @@ public: ResponseData(ResponseData&) = delete; ResponseData(ResponseData&&) = default; - ResponseData& operator=(const ResponseData&) = delete; + ResponseData& operator=(ResponseData const&) = delete; ResponseData& operator=(ResponseData&&) = default; [[nodiscard]] bool contains_response_type(ResponseType response_type) const diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp index 111df5686c..5de66aa0f2 100644 --- a/Userland/Libraries/LibIPC/Connection.cpp +++ b/Userland/Libraries/LibIPC/Connection.cpp @@ -34,7 +34,7 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer) // Prepend the message size. uint32_t message_size = buffer.data.size(); - TRY(buffer.data.try_prepend(reinterpret_cast<const u8*>(&message_size), sizeof(message_size))); + TRY(buffer.data.try_prepend(reinterpret_cast<u8 const*>(&message_size), sizeof(message_size))); #ifdef __serenity__ for (auto& fd : buffer.fds) { diff --git a/Userland/Libraries/LibIPC/ConnectionFromClient.h b/Userland/Libraries/LibIPC/ConnectionFromClient.h index e18a7bea2e..8710dad444 100644 --- a/Userland/Libraries/LibIPC/ConnectionFromClient.h +++ b/Userland/Libraries/LibIPC/ConnectionFromClient.h @@ -46,7 +46,7 @@ public: this->shutdown(); } - void did_misbehave(const char* message) + void did_misbehave(char const* message) { dbgln("{} (id={}) misbehaved ({}), disconnecting.", *this, m_client_id, message); this->shutdown(); diff --git a/Userland/Libraries/LibIPC/Dictionary.h b/Userland/Libraries/LibIPC/Dictionary.h index 97a5eed718..42d85452c3 100644 --- a/Userland/Libraries/LibIPC/Dictionary.h +++ b/Userland/Libraries/LibIPC/Dictionary.h @@ -16,7 +16,7 @@ class Dictionary { public: Dictionary() = default; - Dictionary(const HashMap<String, String>& initial_entries) + Dictionary(HashMap<String, String> const& initial_entries) : m_entries(initial_entries) { } @@ -37,7 +37,7 @@ public: } } - const HashMap<String, String>& entries() const { return m_entries; } + HashMap<String, String> const& entries() const { return m_entries; } private: HashMap<String, String> m_entries; diff --git a/Userland/Libraries/LibIPC/Message.h b/Userland/Libraries/LibIPC/Message.h index 4dcaef9584..4690b1d505 100644 --- a/Userland/Libraries/LibIPC/Message.h +++ b/Userland/Libraries/LibIPC/Message.h @@ -52,7 +52,7 @@ public: virtual u32 endpoint_magic() const = 0; virtual int message_id() const = 0; - virtual const char* message_name() const = 0; + virtual char const* message_name() const = 0; virtual bool valid() const = 0; virtual MessageBuffer encode() const = 0; diff --git a/Userland/Libraries/LibIPC/Stub.h b/Userland/Libraries/LibIPC/Stub.h index 49ec6de666..7c72550df9 100644 --- a/Userland/Libraries/LibIPC/Stub.h +++ b/Userland/Libraries/LibIPC/Stub.h @@ -25,7 +25,7 @@ public: virtual u32 magic() const = 0; virtual String name() const = 0; - virtual OwnPtr<MessageBuffer> handle(const Message&) = 0; + virtual OwnPtr<MessageBuffer> handle(Message const&) = 0; protected: Stub() = default; diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 141f4ae590..0cce9e4665 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -1955,7 +1955,7 @@ void ScopeNode::dump(int indent) const void BinaryExpression::dump(int indent) const { - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case BinaryOp::Addition: op_string = "+"; @@ -2035,7 +2035,7 @@ void BinaryExpression::dump(int indent) const void LogicalExpression::dump(int indent) const { - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case LogicalOp::And: op_string = "&&"; @@ -2058,7 +2058,7 @@ void LogicalExpression::dump(int indent) const void UnaryExpression::dump(int indent) const { - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case UnaryOp::BitwiseNot: op_string = "~"; @@ -2153,7 +2153,7 @@ void ClassMethod::dump(int indent) const outln("(Key)"); m_key->dump(indent + 1); - const char* kind_string = nullptr; + char const* kind_string = nullptr; switch (m_kind) { case Kind::Method: kind_string = "Method"; @@ -2346,7 +2346,7 @@ void FunctionDeclaration::dump(int indent) const FunctionNode::dump(indent, class_name()); } -ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<const FlyString&>&& callback) const +ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const { if (name().is_empty()) return {}; @@ -2757,7 +2757,7 @@ Completion UpdateExpression::execute(Interpreter& interpreter, GlobalObject& glo void AssignmentExpression::dump(int indent) const { - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case AssignmentOp::Assignment: op_string = "="; @@ -2818,7 +2818,7 @@ void AssignmentExpression::dump(int indent) const void UpdateExpression::dump(int indent) const { - const char* op_string = nullptr; + char const* op_string = nullptr; switch (m_op) { case UpdateOp::Increment: op_string = "++"; @@ -2903,7 +2903,7 @@ ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletion void VariableDeclaration::dump(int indent) const { - const char* declaration_kind_string = nullptr; + char const* declaration_kind_string = nullptr; switch (m_declaration_kind) { case DeclarationKind::Let: declaration_kind_string = "Let"; @@ -2927,7 +2927,7 @@ void VariableDeclaration::dump(int indent) const void VariableDeclarator::dump(int indent) const { ASTNode::dump(indent); - m_target.visit([indent](const auto& value) { value->dump(indent + 1); }); + m_target.visit([indent](auto const& value) { value->dump(indent + 1); }); if (m_init) m_init->dump(indent + 1); } diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h index ea9b283116..87b5a4e2af 100644 --- a/Userland/Libraries/LibJS/AST.h +++ b/Userland/Libraries/LibJS/AST.h @@ -190,8 +190,8 @@ concept ThrowCompletionOrVoidFunction = requires(Func func, Args... args) { { func(args...) - } - ->SameAs<ThrowCompletionOr<void>>; + } + -> SameAs<ThrowCompletionOr<void>>; }; template<typename... Args> diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 2ade544fe7..249e53b99d 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -1216,7 +1216,7 @@ Bytecode::CodeGenerationErrorOr<void> CallExpression::generate_bytecode(Bytecode "Unimplemented callee kind: SuperExpression"sv, }; } else if (is<MemberExpression>(*m_callee)) { - auto& member_expression = static_cast<const MemberExpression&>(*m_callee); + auto& member_expression = static_cast<MemberExpression const&>(*m_callee); if (is<SuperExpression>(member_expression.object())) { return Bytecode::CodeGenerationError { this, diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 7886f5f363..1623a31063 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -794,7 +794,7 @@ String NewArray::to_string_impl(Bytecode::Executable const&) const return builder.to_string(); } -String IteratorToArray::to_string_impl(const Bytecode::Executable&) const +String IteratorToArray::to_string_impl(Bytecode::Executable const&) const { return "IteratorToArray"; } @@ -814,7 +814,7 @@ String NewRegExp::to_string_impl(Bytecode::Executable const& executable) const return String::formatted("NewRegExp source:{} (\"{}\") flags:{} (\"{}\")", m_source_index, executable.get_string(m_source_index), m_flags_index, executable.get_string(m_flags_index)); } -String CopyObjectExcludingProperties::to_string_impl(const Bytecode::Executable&) const +String CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const&) const { StringBuilder builder; builder.appendff("CopyObjectExcludingProperties from:{}", m_from_object); @@ -859,7 +859,7 @@ String CreateVariable::to_string_impl(Bytecode::Executable const& executable) co return String::formatted("CreateVariable env:{} immutable:{} {} ({})", mode_string, m_is_immutable, m_identifier, executable.identifier_table->get(m_identifier)); } -String EnterObjectEnvironment::to_string_impl(const Executable&) const +String EnterObjectEnvironment::to_string_impl(Executable const&) const { return String::formatted("EnterObjectEnvironment"); } @@ -975,7 +975,7 @@ String EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const return String::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point); } -String FinishUnwind::to_string_impl(const Bytecode::Executable&) const +String FinishUnwind::to_string_impl(Bytecode::Executable const&) const { return String::formatted("FinishUnwind next:{}", m_next_target); } @@ -998,7 +998,7 @@ String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target); } -String PushDeclarativeEnvironment::to_string_impl(const Bytecode::Executable& executable) const +String PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& executable) const { StringBuilder builder; builder.append("PushDeclarativeEnvironment"); @@ -1020,12 +1020,12 @@ String Yield::to_string_impl(Bytecode::Executable const&) const return String::formatted("Yield return"); } -String GetByValue::to_string_impl(const Bytecode::Executable&) const +String GetByValue::to_string_impl(Bytecode::Executable const&) const { return String::formatted("GetByValue base:{}", m_base); } -String PutByValue::to_string_impl(const Bytecode::Executable&) const +String PutByValue::to_string_impl(Bytecode::Executable const&) const { auto kind = m_kind == PropertyKind::Getter ? "getter" @@ -1046,7 +1046,7 @@ String GetIterator::to_string_impl(Executable const&) const return "GetIterator"; } -String GetObjectPropertyIterator::to_string_impl(const Bytecode::Executable&) const +String GetObjectPropertyIterator::to_string_impl(Bytecode::Executable const&) const { return "GetObjectPropertyIterator"; } diff --git a/Userland/Libraries/LibJS/Console.h b/Userland/Libraries/LibJS/Console.h index 30a67364c2..3928882a39 100644 --- a/Userland/Libraries/LibJS/Console.h +++ b/Userland/Libraries/LibJS/Console.h @@ -58,13 +58,13 @@ public: void set_client(ConsoleClient& client) { m_client = &client; } GlobalObject& global_object() { return m_global_object; } - const GlobalObject& global_object() const { return m_global_object; } + GlobalObject const& global_object() const { return m_global_object; } VM& vm(); Vector<Value> vm_arguments(); HashMap<String, unsigned>& counters() { return m_counters; } - const HashMap<String, unsigned>& counters() const { return m_counters; } + HashMap<String, unsigned> const& counters() const { return m_counters; } ThrowCompletionOr<Value> debug(); ThrowCompletionOr<Value> error(); @@ -119,7 +119,7 @@ protected: VM& vm(); GlobalObject& global_object() { return m_console.global_object(); } - const GlobalObject& global_object() const { return m_console.global_object(); } + GlobalObject const& global_object() const { return m_console.global_object(); } Console& m_console; }; diff --git a/Userland/Libraries/LibJS/Heap/Handle.h b/Userland/Libraries/LibJS/Heap/Handle.h index d353279e5d..3fa2a01c29 100644 --- a/Userland/Libraries/LibJS/Heap/Handle.h +++ b/Userland/Libraries/LibJS/Heap/Handle.h @@ -25,7 +25,7 @@ public: ~HandleImpl(); Cell* cell() { return m_cell; } - const Cell* cell() const { return m_cell; } + Cell const* cell() const { return m_cell; } private: template<class T> diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index fcc8575af5..ca50bc28d0 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -156,15 +156,15 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has for (auto possible_pointer : possible_pointers) { if (!possible_pointer) continue; - dbgln_if(HEAP_DEBUG, " ? {}", (const void*)possible_pointer); - auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<const Cell*>(possible_pointer)); + dbgln_if(HEAP_DEBUG, " ? {}", (void const*)possible_pointer); + auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<Cell const*>(possible_pointer)); if (all_live_heap_blocks.contains(possible_heap_block)) { if (auto* cell = possible_heap_block->cell_from_possible_pointer(possible_pointer)) { if (cell->state() == Cell::State::Live) { - dbgln_if(HEAP_DEBUG, " ?-> {}", (const void*)cell); + dbgln_if(HEAP_DEBUG, " ?-> {}", (void const*)cell); roots.set(cell); } else { - dbgln_if(HEAP_DEBUG, " #-> {}", (const void*)cell); + dbgln_if(HEAP_DEBUG, " #-> {}", (void const*)cell); } } } @@ -186,7 +186,7 @@ public: } }; -void Heap::mark_live_cells(const HashTable<Cell*>& roots) +void Heap::mark_live_cells(HashTable<Cell*> const& roots) { dbgln_if(HEAP_DEBUG, "mark_live_cells:"); @@ -200,7 +200,7 @@ void Heap::mark_live_cells(const HashTable<Cell*>& roots) m_uprooted_cells.clear(); } -void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measurement_timer) +void Heap::sweep_dead_cells(bool print_report, Core::ElapsedTimer const& measurement_timer) { dbgln_if(HEAP_DEBUG, "sweep_dead_cells:"); Vector<HeapBlock*, 32> empty_blocks; diff --git a/Userland/Libraries/LibJS/Heap/Heap.h b/Userland/Libraries/LibJS/Heap/Heap.h index 470f11a1af..752a2a97d8 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.h +++ b/Userland/Libraries/LibJS/Heap/Heap.h @@ -84,8 +84,8 @@ private: void gather_roots(HashTable<Cell*>&); void gather_conservative_roots(HashTable<Cell*>&); - void mark_live_cells(const HashTable<Cell*>& live_cells); - void sweep_dead_cells(bool print_report, const Core::ElapsedTimer&); + void mark_live_cells(HashTable<Cell*> const& live_cells); + void sweep_dead_cells(bool print_report, Core::ElapsedTimer const&); CellAllocator& allocator_for_size(size_t); diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.h b/Userland/Libraries/LibJS/Heap/HeapBlock.h index 750394862c..891cc89fed 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.h +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.h @@ -68,7 +68,7 @@ public: Heap& heap() { return m_heap; } - static HeapBlock* from_cell(const Cell* cell) + static HeapBlock* from_cell(Cell const* cell) { return reinterpret_cast<HeapBlock*>((FlatPtr)cell & ~(block_size - 1)); } @@ -84,7 +84,7 @@ public: return cell(cell_index); } - bool is_valid_cell_pointer(const Cell* cell) + bool is_valid_cell_pointer(Cell const* cell) { return cell_from_possible_pointer((FlatPtr)cell); } diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 513e5a9f91..6d997698ba 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -148,9 +148,9 @@ GlobalObject& Interpreter::global_object() return static_cast<GlobalObject&>(*m_global_object.cell()); } -const GlobalObject& Interpreter::global_object() const +GlobalObject const& Interpreter::global_object() const { - return static_cast<const GlobalObject&>(*m_global_object.cell()); + return static_cast<GlobalObject const&>(*m_global_object.cell()); } Realm& Interpreter::realm() @@ -158,9 +158,9 @@ Realm& Interpreter::realm() return static_cast<Realm&>(*m_realm.cell()); } -const Realm& Interpreter::realm() const +Realm const& Interpreter::realm() const { - return static_cast<const Realm&>(*m_realm.cell()); + return static_cast<Realm const&>(*m_realm.cell()); } } diff --git a/Userland/Libraries/LibJS/Interpreter.h b/Userland/Libraries/LibJS/Interpreter.h index 8d31526610..ce3e8dfefd 100644 --- a/Userland/Libraries/LibJS/Interpreter.h +++ b/Userland/Libraries/LibJS/Interpreter.h @@ -31,7 +31,7 @@ namespace JS { struct ExecutingASTNodeChain { ExecutingASTNodeChain* previous { nullptr }; - const ASTNode& node; + ASTNode const& node; }; class Interpreter : public Weakable<Interpreter> { @@ -107,7 +107,7 @@ public: ThrowCompletionOr<Value> run(SourceTextModule&); GlobalObject& global_object(); - const GlobalObject& global_object() const; + GlobalObject const& global_object() const; Realm& realm(); Realm const& realm() const; @@ -130,7 +130,7 @@ public: m_ast_node_chain = m_ast_node_chain->previous; } - const ASTNode* current_node() const { return m_ast_node_chain ? &m_ast_node_chain->node : nullptr; } + ASTNode const* current_node() const { return m_ast_node_chain ? &m_ast_node_chain->node : nullptr; } private: explicit Interpreter(VM&); diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index 6a5d5c776d..4f9d4bdc88 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -64,7 +64,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has if (value.is_object()) { auto& object = value.as_object(); if (is<Array>(object)) - return array_to_html(static_cast<const Array&>(object), output_html, seen_objects); + return array_to_html(static_cast<Array const&>(object), output_html, seen_objects); output_html.append(wrap_string_in_style(object.class_name(), StyleType::ObjectType)); if (object.is_function()) return function_to_html(object, output_html, seen_objects); @@ -91,7 +91,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has output_html.append("</span>"); } -void MarkupGenerator::array_to_html(const Array& array, StringBuilder& html_output, HashTable<Object*>& seen_objects) +void MarkupGenerator::array_to_html(Array const& array, StringBuilder& html_output, HashTable<Object*>& seen_objects) { html_output.append(wrap_string_in_style("[ ", StyleType::Punctuation)); bool first = true; @@ -105,7 +105,7 @@ void MarkupGenerator::array_to_html(const Array& array, StringBuilder& html_outp html_output.append(wrap_string_in_style(" ]", StyleType::Punctuation)); } -void MarkupGenerator::object_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>& seen_objects) +void MarkupGenerator::object_to_html(Object const& object, StringBuilder& html_output, HashTable<Object*>& seen_objects) { html_output.append(wrap_string_in_style("{ ", StyleType::Punctuation)); bool first = true; @@ -135,17 +135,17 @@ void MarkupGenerator::object_to_html(const Object& object, StringBuilder& html_o html_output.append(wrap_string_in_style(" }", StyleType::Punctuation)); } -void MarkupGenerator::function_to_html(const Object& function, StringBuilder& html_output, HashTable<Object*>&) +void MarkupGenerator::function_to_html(Object const& function, StringBuilder& html_output, HashTable<Object*>&) { html_output.appendff("[{}]", function.class_name()); } -void MarkupGenerator::date_to_html(const Object& date, StringBuilder& html_output, HashTable<Object*>&) +void MarkupGenerator::date_to_html(Object const& date, StringBuilder& html_output, HashTable<Object*>&) { html_output.appendff("Date {}", JS::to_date_string(static_cast<JS::Date const&>(date).date_value())); } -void MarkupGenerator::error_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>&) +void MarkupGenerator::error_to_html(Object const& object, StringBuilder& html_output, HashTable<Object*>&) { auto& vm = object.vm(); auto name = object.get_without_side_effects(vm.names.name).value_or(JS::js_undefined()); diff --git a/Userland/Libraries/LibJS/MarkupGenerator.h b/Userland/Libraries/LibJS/MarkupGenerator.h index 97940d64cb..f8bc16849c 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.h +++ b/Userland/Libraries/LibJS/MarkupGenerator.h @@ -33,11 +33,11 @@ private: }; static void value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {}); - static void array_to_html(const Array&, StringBuilder& output_html, HashTable<Object*>&); - static void object_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&); - static void function_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&); - static void date_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&); - static void error_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&); + static void array_to_html(Array const&, StringBuilder& output_html, HashTable<Object*>&); + static void object_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&); + static void function_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&); + static void date_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&); + static void error_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&); static String style_from_style_type(StyleType); static StyleType style_type_for_token(Token); diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index 3246f1c56b..31e2ce68a4 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -1798,7 +1798,7 @@ NonnullRefPtr<ArrayExpression> Parser::parse_array_expression() return create_ast_node<ArrayExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, move(elements)); } -NonnullRefPtr<StringLiteral> Parser::parse_string_literal(const Token& token, bool in_template_literal) +NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token const& token, bool in_template_literal) { auto rule_start = push_start(); auto status = Token::StringValueStatus::Ok; @@ -3919,7 +3919,7 @@ Token Parser::consume_and_validate_numeric_literal() return token; } -void Parser::expected(const char* what) +void Parser::expected(char const* what) { auto message = m_state.current_token.message(); if (message.is_empty()) @@ -3936,7 +3936,7 @@ Position Parser::position() const }; } -bool Parser::try_parse_arrow_function_expression_failed_at_position(const Position& position) const +bool Parser::try_parse_arrow_function_expression_failed_at_position(Position const& position) const { auto it = m_token_memoizations.find(position); if (it == m_token_memoizations.end()) @@ -3945,12 +3945,12 @@ bool Parser::try_parse_arrow_function_expression_failed_at_position(const Positi return (*it).value.try_parse_arrow_function_expression_failed; } -void Parser::set_try_parse_arrow_function_expression_failed_at_position(const Position& position, bool failed) +void Parser::set_try_parse_arrow_function_expression_failed_at_position(Position const& position, bool failed) { m_token_memoizations.set(position, { failed }); } -void Parser::syntax_error(const String& message, Optional<Position> position) +void Parser::syntax_error(String const& message, Optional<Position> position) { if (!position.has_value()) position = this->position(); diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index 4d1eeb378d..10d708c1ed 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -135,7 +135,7 @@ public: NonnullRefPtr<RegExpLiteral> parse_regexp_literal(); NonnullRefPtr<ObjectExpression> parse_object_expression(); NonnullRefPtr<ArrayExpression> parse_array_expression(); - NonnullRefPtr<StringLiteral> parse_string_literal(const Token& token, bool in_template_literal = false); + NonnullRefPtr<StringLiteral> parse_string_literal(Token const& token, bool in_template_literal = false); NonnullRefPtr<TemplateLiteral> parse_template_literal(bool is_tagged); ExpressionResult parse_secondary_expression(NonnullRefPtr<Expression>, int min_precedence, Associativity associate = Associativity::Right, ForbiddenTokens forbidden = {}); NonnullRefPtr<Expression> parse_call_expression(NonnullRefPtr<Expression>); @@ -169,7 +169,7 @@ public: return String::formatted("{} (line: {}, column: {})", message, position.value().line, position.value().column); } - String source_location_hint(StringView source, const char spacer = ' ', const char indicator = '^') const + String source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const { if (!position.has_value()) return {}; @@ -187,7 +187,7 @@ public: }; bool has_errors() const { return m_state.errors.size(); } - const Vector<Error>& errors() const { return m_state.errors; } + Vector<Error> const& errors() const { return m_state.errors; } void print_errors(bool print_hint = true) const { for (auto& error : m_state.errors) { @@ -229,8 +229,8 @@ private: bool is_private_identifier_valid() const; bool match(TokenType type) const; bool done() const; - void expected(const char* what); - void syntax_error(const String& message, Optional<Position> = {}); + void expected(char const* what); + void syntax_error(String const& message, Optional<Position> = {}); Token consume(); Token consume_identifier(); Token consume_identifier_reference(); @@ -248,8 +248,8 @@ private: void check_identifier_name_for_assignment_validity(FlyString const&, bool force_strict = false); - bool try_parse_arrow_function_expression_failed_at_position(const Position&) const; - void set_try_parse_arrow_function_expression_failed_at_position(const Position&, bool); + bool try_parse_arrow_function_expression_failed_at_position(Position const&) const; + void set_try_parse_arrow_function_expression_failed_at_position(Position const&, bool); bool match_invalid_escaped_keyword() const; @@ -278,7 +278,7 @@ private: VERIFY(last.column == m_position.column); } - const Position& position() const { return m_position; } + Position const& position() const { return m_position; } private: Parser& m_parser; @@ -316,12 +316,12 @@ private: class PositionKeyTraits { public: - static int hash(const Position& position) + static int hash(Position const& position) { return int_hash(position.line) ^ int_hash(position.column); } - static bool equals(const Position& a, const Position& b) + static bool equals(Position const& a, Position const& b) { return a.column == b.column && a.line == b.line; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h index 9e33b5c1a5..7a728a7965 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h @@ -36,7 +36,7 @@ public: size_t byte_length() const { return buffer_impl().size(); } size_t max_byte_length() const { return m_max_byte_length.value(); } // Will VERIFY() that it has value ByteBuffer& buffer() { return buffer_impl(); } - const ByteBuffer& buffer() const { return buffer_impl(); } + ByteBuffer const& buffer() const { return buffer_impl(); } // Used by allocate_array_buffer() to attach the data block after construction void set_buffer(ByteBuffer buffer) { m_buffer = move(buffer); } @@ -71,7 +71,7 @@ private: return *ptr; } - const ByteBuffer& buffer_impl() const { return const_cast<ArrayBuffer*>(this)->buffer_impl(); } + ByteBuffer const& buffer_impl() const { return const_cast<ArrayBuffer*>(this)->buffer_impl(); } Variant<Empty, ByteBuffer, ByteBuffer*> m_buffer; // The various detach related members of ArrayBuffer are not used by any ECMA262 functionality, diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.h b/Userland/Libraries/LibJS/Runtime/BigInt.h index bdba742c50..9290c554f2 100644 --- a/Userland/Libraries/LibJS/Runtime/BigInt.h +++ b/Userland/Libraries/LibJS/Runtime/BigInt.h @@ -17,7 +17,7 @@ public: explicit BigInt(Crypto::SignedBigInteger); virtual ~BigInt() override = default; - const Crypto::SignedBigInteger& big_integer() const { return m_big_integer; } + Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; } const String to_string() const { return String::formatted("{}n", m_big_integer.to_base(10)); } private: diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index e3f3fcb0d8..cee8afe7b8 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -35,7 +35,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string) if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean"); - bool bool_value = static_cast<const BooleanObject&>(this_value.as_object()).boolean(); + bool bool_value = static_cast<BooleanObject const&>(this_value.as_object()).boolean(); return js_string(vm, bool_value ? "true" : "false"); } @@ -48,6 +48,6 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of) if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean"); - return Value(static_cast<const BooleanObject&>(this_value.as_object()).boolean()); + return Value(static_cast<BooleanObject const&>(this_value.as_object()).boolean()); } } diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.h b/Userland/Libraries/LibJS/Runtime/BoundFunction.h index 35d5c2a7fc..9993ffcc4a 100644 --- a/Userland/Libraries/LibJS/Runtime/BoundFunction.h +++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.h @@ -23,7 +23,7 @@ public: virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override; - virtual const FlyString& name() const override { return m_name; } + virtual FlyString const& name() const override { return m_name; } virtual bool is_strict_mode() const override { return m_bound_target_function->is_strict_mode(); } virtual bool has_constructor() const override { return m_bound_target_function->has_constructor(); } diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index 115d928a98..fb48a87a97 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -23,7 +23,7 @@ namespace JS { // 21.4.3.2 Date.parse ( string ), https://tc39.es/ecma262/#sec-date.parse -static Value parse_simplified_iso8601(GlobalObject& global_object, const String& iso_8601) +static Value parse_simplified_iso8601(GlobalObject& global_object, String const& iso_8601) { // 21.4.1.15 Date Time String Format, https://tc39.es/ecma262/#sec-date-time-string-format GenericLexer lexer(iso_8601); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index f7318c9d17..dcb04428b3 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -875,7 +875,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body() VERIFY_NOT_REACHED(); } -void ECMAScriptFunctionObject::set_name(const FlyString& name) +void ECMAScriptFunctionObject::set_name(FlyString const& name) { VERIFY(!name.is_null()); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h index 843a9878ab..2f6377c9b9 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h @@ -47,8 +47,8 @@ public: Statement const& ecmascript_code() const { return m_ecmascript_code; } Vector<FunctionNode::Parameter> const& formal_parameters() const { return m_formal_parameters; }; - virtual const FlyString& name() const override { return m_name; }; - void set_name(const FlyString& name); + virtual FlyString const& name() const override { return m_name; }; + void set_name(FlyString const& name); void set_is_class_constructor() { m_is_class_constructor = true; }; diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index 91f4019f41..90b51982ed 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -302,18 +302,18 @@ public: JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR) #undef __ENUMERATE_JS_ERROR - const char* message() const + char const* message() const { return m_message; } private: - explicit ErrorType(const char* message) + explicit ErrorType(char const* message) : m_message(message) { } - const char* m_message; + char const* m_message; }; } diff --git a/Userland/Libraries/LibJS/Runtime/FunctionObject.h b/Userland/Libraries/LibJS/Runtime/FunctionObject.h index 12ba18359f..38b1b6fe9f 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionObject.h @@ -27,7 +27,7 @@ public: virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) = 0; virtual ThrowCompletionOr<Object*> internal_construct([[maybe_unused]] MarkedVector<Value> arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } - virtual const FlyString& name() const = 0; + virtual FlyString const& name() const = 0; void set_function_name(Variant<PropertyKey, PrivateName> const& name_arg, Optional<StringView> const& prefix = {}); void set_function_length(double length); diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 144e0551df..84f83e394c 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -488,7 +488,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval) } // 19.2.6.1.1 Encode ( string, unescapedSet ), https://tc39.es/ecma262/#sec-encode -static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& global_object, const String& string, StringView unescaped_set) +static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& global_object, String const& string, StringView unescaped_set) { auto& vm = global_object.vm(); auto utf16_string = Utf16String(string); @@ -544,7 +544,7 @@ static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& globa } // 19.2.6.1.2 Decode ( string, reservedSet ), https://tc39.es/ecma262/#sec-decode -static ThrowCompletionOr<String> decode(JS::GlobalObject& global_object, const String& string, StringView reserved_set) +static ThrowCompletionOr<String> decode(JS::GlobalObject& global_object, String const& string, StringView reserved_set) { StringBuilder decoded_builder; auto code_point_start_offset = 0u; diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp index aa1274a2c9..e0245cb3f0 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -177,7 +177,7 @@ bool GenericIndexedPropertyStorage::set_array_like_size(size_t new_size) return !any_failed; } -IndexedPropertyIterator::IndexedPropertyIterator(const IndexedProperties& indexed_properties, u32 staring_index, bool skip_empty) +IndexedPropertyIterator::IndexedPropertyIterator(IndexedProperties const& indexed_properties, u32 staring_index, bool skip_empty) : m_indexed_properties(indexed_properties) , m_index(staring_index) , m_skip_empty(skip_empty) @@ -203,7 +203,7 @@ IndexedPropertyIterator& IndexedPropertyIterator::operator*() return *this; } -bool IndexedPropertyIterator::operator!=(const IndexedPropertyIterator& other) const +bool IndexedPropertyIterator::operator!=(IndexedPropertyIterator const& other) const { return m_index != other.m_index; } @@ -265,7 +265,7 @@ size_t IndexedProperties::real_size() const if (!m_storage) return 0; if (m_storage->is_simple_storage()) { - auto& packed_elements = static_cast<const SimpleIndexedPropertyStorage&>(*m_storage).elements(); + auto& packed_elements = static_cast<SimpleIndexedPropertyStorage const&>(*m_storage).elements(); size_t size = 0; for (auto& element : packed_elements) { if (!element.is_empty()) @@ -273,7 +273,7 @@ size_t IndexedProperties::real_size() const } return size; } - return static_cast<const GenericIndexedPropertyStorage&>(*m_storage).size(); + return static_cast<GenericIndexedPropertyStorage const&>(*m_storage).size(); } Vector<u32> IndexedProperties::indices() const @@ -281,8 +281,8 @@ Vector<u32> IndexedProperties::indices() const if (!m_storage) return {}; if (m_storage->is_simple_storage()) { - const auto& storage = static_cast<const SimpleIndexedPropertyStorage&>(*m_storage); - const auto& elements = storage.elements(); + auto const& storage = static_cast<SimpleIndexedPropertyStorage const&>(*m_storage); + auto const& elements = storage.elements(); Vector<u32> indices; indices.ensure_capacity(storage.array_like_size()); for (size_t i = 0; i < elements.size(); ++i) { @@ -291,7 +291,7 @@ Vector<u32> IndexedProperties::indices() const } return indices; } - const auto& storage = static_cast<const GenericIndexedPropertyStorage&>(*m_storage); + auto const& storage = static_cast<GenericIndexedPropertyStorage const&>(*m_storage); auto indices = storage.sparse_elements().keys(); quick_sort(indices); return indices; diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.h b/Userland/Libraries/LibJS/Runtime/IndexedProperties.h index 8e4f965dae..b972362952 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.h +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.h @@ -58,7 +58,7 @@ public: virtual bool set_array_like_size(size_t new_size) override; virtual bool is_simple_storage() const override { return true; } - const Vector<Value>& elements() const { return m_packed_elements; } + Vector<Value> const& elements() const { return m_packed_elements; } private: friend GenericIndexedPropertyStorage; @@ -86,7 +86,7 @@ public: virtual size_t array_like_size() const override { return m_array_size; } virtual bool set_array_like_size(size_t new_size) override; - const HashMap<u32, ValueAndAttributes>& sparse_elements() const { return m_sparse_elements; } + HashMap<u32, ValueAndAttributes> const& sparse_elements() const { return m_sparse_elements; } private: size_t m_array_size { 0 }; @@ -95,18 +95,18 @@ private: class IndexedPropertyIterator { public: - IndexedPropertyIterator(const IndexedProperties&, u32 starting_index, bool skip_empty); + IndexedPropertyIterator(IndexedProperties const&, u32 starting_index, bool skip_empty); IndexedPropertyIterator& operator++(); IndexedPropertyIterator& operator*(); - bool operator!=(const IndexedPropertyIterator&) const; + bool operator!=(IndexedPropertyIterator const&) const; u32 index() const { return m_index; }; private: void skip_empty_indices(); - const IndexedProperties& m_indexed_properties; + IndexedProperties const& m_indexed_properties; Vector<u32> m_cached_indices; u32 m_index { 0 }; bool m_skip_empty { false }; @@ -149,7 +149,7 @@ public: for (auto& value : static_cast<SimpleIndexedPropertyStorage&>(*m_storage).elements()) callback(value); } else { - for (auto& element : static_cast<const GenericIndexedPropertyStorage&>(*m_storage).sparse_elements()) + for (auto& element : static_cast<GenericIndexedPropertyStorage const&>(*m_storage).sparse_elements()) callback(element.value.value); } } diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index ac412398a5..60118b8832 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -122,7 +122,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify) } // 25.5.2.1 SerializeJSONProperty ( state, key, holder ), https://tc39.es/ecma262/#sec-serializejsonproperty -ThrowCompletionOr<String> JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, const PropertyKey& key, Object* holder) +ThrowCompletionOr<String> JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, PropertyKey const& key, Object* holder) { auto& vm = global_object.vm(); @@ -229,7 +229,7 @@ ThrowCompletionOr<String> JSONObject::serialize_json_object(GlobalObject& global state.indent = String::formatted("{}{}", state.indent, state.gap); Vector<String> property_strings; - auto process_property = [&](const PropertyKey& key) -> ThrowCompletionOr<void> { + auto process_property = [&](PropertyKey const& key) -> ThrowCompletionOr<void> { if (key.is_symbol()) return {}; auto serialized_property_string = TRY(serialize_json_property(global_object, state, key, &object)); @@ -408,7 +408,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::parse) return unfiltered; } -Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue& value) +Value JSONObject::parse_json_value(GlobalObject& global_object, JsonValue const& value) { if (value.is_object()) return Value(parse_json_object(global_object, value.as_object())); @@ -427,7 +427,7 @@ Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue& VERIFY_NOT_REACHED(); } -Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObject& json_object) +Object* JSONObject::parse_json_object(GlobalObject& global_object, JsonObject const& json_object) { auto* object = Object::create(global_object, global_object.object_prototype()); json_object.for_each_member([&](auto& key, auto& value) { @@ -436,7 +436,7 @@ Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObj return object; } -Array* JSONObject::parse_json_array(GlobalObject& global_object, const JsonArray& json_array) +Array* JSONObject::parse_json_array(GlobalObject& global_object, JsonArray const& json_array) { auto* array = MUST(Array::create(global_object, 0)); size_t index = 0; @@ -455,7 +455,7 @@ ThrowCompletionOr<Value> JSONObject::internalize_json_property(GlobalObject& glo auto is_array = TRY(value.is_array(global_object)); auto& value_object = value.as_object(); - auto process_property = [&](const PropertyKey& key) -> ThrowCompletionOr<void> { + auto process_property = [&](PropertyKey const& key) -> ThrowCompletionOr<void> { auto element = TRY(internalize_json_property(global_object, &value_object, key, reviver)); if (element.is_undefined()) TRY(value_object.internal_delete(key)); diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.h b/Userland/Libraries/LibJS/Runtime/JSONObject.h index 3aa2cd97d8..98c25d9169 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.h +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.h @@ -22,7 +22,7 @@ public: // test-js to communicate between the JS tests and the C++ test runner. static ThrowCompletionOr<String> stringify_impl(GlobalObject&, Value value, Value replacer, Value space); - static Value parse_json_value(GlobalObject&, const JsonValue&); + static Value parse_json_value(GlobalObject&, JsonValue const&); private: struct StringifyState { @@ -34,14 +34,14 @@ private: }; // Stringify helpers - static ThrowCompletionOr<String> serialize_json_property(GlobalObject&, StringifyState&, const PropertyKey& key, Object* holder); + static ThrowCompletionOr<String> serialize_json_property(GlobalObject&, StringifyState&, PropertyKey const& key, Object* holder); static ThrowCompletionOr<String> serialize_json_object(GlobalObject&, StringifyState&, Object&); static ThrowCompletionOr<String> serialize_json_array(GlobalObject&, StringifyState&, Object&); static String quote_json_string(String); // Parse helpers - static Object* parse_json_object(GlobalObject&, const JsonObject&); - static Array* parse_json_array(GlobalObject&, const JsonArray&); + static Object* parse_json_object(GlobalObject&, JsonObject const&); + static Array* parse_json_array(GlobalObject&, JsonArray const&); static ThrowCompletionOr<Value> internalize_json_property(GlobalObject&, Object* holder, PropertyKey const& name, FunctionObject& reviver); JS_DECLARE_NATIVE_FUNCTION(stringify); diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp index 998c80943b..978095470e 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -51,7 +51,7 @@ NativeFunction* NativeFunction::create(GlobalObject& global_object, Function<Thr return function; } -NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyString& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> function) +NativeFunction* NativeFunction::create(GlobalObject& global_object, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> function) { return global_object.heap().allocate<NativeFunction>(global_object, name, move(function), *global_object.function_prototype()); } diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.h b/Userland/Libraries/LibJS/Runtime/NativeFunction.h index 27c85c83d1..cc76a46e2b 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.h @@ -21,7 +21,7 @@ class NativeFunction : public FunctionObject { public: static NativeFunction* create(GlobalObject&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> = {}, Optional<Object*> prototype = {}, Optional<StringView> const& prefix = {}); - static NativeFunction* create(GlobalObject&, const FlyString& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>); + static NativeFunction* create(GlobalObject&, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>); NativeFunction(GlobalObject&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, Object* prototype, Realm& realm); NativeFunction(FlyString name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, Object& prototype); @@ -36,7 +36,7 @@ public: virtual ThrowCompletionOr<Value> call(); virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target); - virtual const FlyString& name() const override { return m_name; }; + virtual FlyString const& name() const override { return m_name; }; virtual bool is_strict_mode() const override; virtual bool has_constructor() const override { return false; } virtual Realm* realm() const override { return m_realm; } diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp index b0ae3e98d4..d1392def42 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -16,9 +16,9 @@ # define MAX_SAFE_INTEGER_VALUE AK::exp2(53.) - 1 # define MIN_SAFE_INTEGER_VALUE -(AK::exp2(53.) - 1) #else -constexpr const double EPSILON_VALUE { __builtin_exp2(-52) }; -constexpr const double MAX_SAFE_INTEGER_VALUE { __builtin_exp2(53) - 1 }; -constexpr const double MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) }; +constexpr double const EPSILON_VALUE { __builtin_exp2(-52) }; +constexpr double const MAX_SAFE_INTEGER_VALUE { __builtin_exp2(53) - 1 }; +constexpr double const MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) }; #endif namespace JS { diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index d83d9fc3b0..956921cbcd 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1083,7 +1083,7 @@ void Object::ensure_shape_is_unique() } // Simple side-effect free property lookup, following the prototype chain. Non-standard. -Value Object::get_without_side_effects(const PropertyKey& property_key) const +Value Object::get_without_side_effects(PropertyKey const& property_key) const { auto* object = this; while (object) { diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index f7675dced5..1aa7d361ad 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -149,7 +149,7 @@ public: // Non-standard methods - Value get_without_side_effects(const PropertyKey&) const; + Value get_without_side_effects(PropertyKey const&) const; void define_direct_property(PropertyKey const& property_key, Value value, PropertyAttributes attributes) { storage_set(property_key, { value, attributes }); }; void define_direct_accessor(PropertyKey const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes); @@ -176,7 +176,7 @@ public: Value get_direct(size_t index) const { return m_storage[index]; } - const IndexedProperties& indexed_properties() const { return m_indexed_properties; } + IndexedProperties const& indexed_properties() const { return m_indexed_properties; } IndexedProperties& indexed_properties() { return m_indexed_properties; } void set_indexed_property_elements(Vector<Value>&& values) { m_indexed_properties = IndexedProperties(move(values)); } diff --git a/Userland/Libraries/LibJS/Runtime/PromiseReaction.h b/Userland/Libraries/LibJS/Runtime/PromiseReaction.h index 71f1905fc6..bafd443ed5 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseReaction.h +++ b/Userland/Libraries/LibJS/Runtime/PromiseReaction.h @@ -74,10 +74,10 @@ public: virtual ~PromiseReaction() = default; Type type() const { return m_type; } - const Optional<PromiseCapability>& capability() const { return m_capability; } + Optional<PromiseCapability> const& capability() const { return m_capability; } Optional<JobCallback>& handler() { return m_handler; } - const Optional<JobCallback>& handler() const { return m_handler; } + Optional<JobCallback> const& handler() const { return m_handler; } private: virtual StringView class_name() const override { return "PromiseReaction"sv; } diff --git a/Userland/Libraries/LibJS/Runtime/PropertyAttributes.h b/Userland/Libraries/LibJS/Runtime/PropertyAttributes.h index f00020246a..1c558e67ff 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyAttributes.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyAttributes.h @@ -58,8 +58,8 @@ public: m_bits &= ~Attribute::Configurable; } - bool operator==(const PropertyAttributes& other) const { return m_bits == other.m_bits; } - bool operator!=(const PropertyAttributes& other) const { return m_bits != other.m_bits; } + bool operator==(PropertyAttributes const& other) const { return m_bits == other.m_bits; } + bool operator!=(PropertyAttributes const& other) const { return m_bits != other.m_bits; } [[nodiscard]] u8 bits() const { return m_bits; } diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index e0571d357f..e2e9406a41 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -219,7 +219,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_prevent_extensions() } // 10.5.5 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p -ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(const PropertyKey& property_key) const +ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(PropertyKey const& property_key) const { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -858,7 +858,7 @@ void ProxyObject::visit_edges(Cell::Visitor& visitor) visitor.visit(&m_handler); } -const FlyString& ProxyObject::name() const +FlyString const& ProxyObject::name() const { VERIFY(is_function()); return static_cast<FunctionObject&>(m_target).name(); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.h b/Userland/Libraries/LibJS/Runtime/ProxyObject.h index dc31bb9c2a..572bafc64d 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.h @@ -21,11 +21,11 @@ public: ProxyObject(Object& target, Object& handler, Object& prototype); virtual ~ProxyObject() override = default; - virtual const FlyString& name() const override; + virtual FlyString const& name() const override; virtual bool has_constructor() const override; - const Object& target() const { return m_target; } - const Object& handler() const { return m_handler; } + Object const& target() const { return m_target; } + Object const& handler() const { return m_handler; } bool is_revoked() const { return m_is_revoked; } void revoke() { m_is_revoked = true; } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpObject.h b/Userland/Libraries/LibJS/Runtime/RegExpObject.h index 1e76ebf7e6..7ae8f74f4d 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpObject.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpObject.h @@ -44,10 +44,10 @@ public: virtual void initialize(GlobalObject&) override; virtual ~RegExpObject() override = default; - const String& pattern() const { return m_pattern; } - const String& flags() const { return m_flags; } - const Regex<ECMA262>& regex() { return *m_regex; } - const Regex<ECMA262>& regex() const { return *m_regex; } + String const& pattern() const { return m_pattern; } + String const& flags() const { return m_flags; } + Regex<ECMA262> const& regex() { return *m_regex; } + Regex<ECMA262> const& regex() const { return *m_regex; } private: String m_pattern; diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp index 691bc6a35c..b8f820e3c9 100644 --- a/Userland/Libraries/LibJS/Runtime/Shape.cpp +++ b/Userland/Libraries/LibJS/Runtime/Shape.cpp @@ -53,7 +53,7 @@ Shape* Shape::get_or_prune_cached_prototype_transition(Object* prototype) return it->value; } -Shape* Shape::create_put_transition(const StringOrSymbol& property_key, PropertyAttributes attributes) +Shape* Shape::create_put_transition(StringOrSymbol const& property_key, PropertyAttributes attributes) { TransitionKey key { property_key, attributes }; if (auto* existing_shape = get_or_prune_cached_forward_transition(key)) @@ -65,7 +65,7 @@ Shape* Shape::create_put_transition(const StringOrSymbol& property_key, Property return new_shape; } -Shape* Shape::create_configure_transition(const StringOrSymbol& property_key, PropertyAttributes attributes) +Shape* Shape::create_configure_transition(StringOrSymbol const& property_key, PropertyAttributes attributes) { TransitionKey key { property_key, attributes }; if (auto* existing_shape = get_or_prune_cached_forward_transition(key)) @@ -93,7 +93,7 @@ Shape::Shape(Object& global_object) { } -Shape::Shape(Shape& previous_shape, const StringOrSymbol& property_key, PropertyAttributes attributes, TransitionType transition_type) +Shape::Shape(Shape& previous_shape, StringOrSymbol const& property_key, PropertyAttributes attributes, TransitionType transition_type) : m_global_object(previous_shape.m_global_object) , m_previous(&previous_shape) , m_property_key(property_key) @@ -126,7 +126,7 @@ void Shape::visit_edges(Cell::Visitor& visitor) } } -Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_key) const +Optional<PropertyMetadata> Shape::lookup(StringOrSymbol const& property_key) const { if (m_property_count == 0) return {}; @@ -162,7 +162,7 @@ void Shape::ensure_property_table() const u32 next_offset = 0; - Vector<const Shape*, 64> transition_chain; + Vector<Shape const*, 64> transition_chain; for (auto* shape = m_previous; shape; shape = shape->m_previous) { if (shape->m_property_table) { *m_property_table = *shape->m_property_table; @@ -189,7 +189,7 @@ void Shape::ensure_property_table() const } } -void Shape::add_property_to_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes) +void Shape::add_property_to_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes) { VERIFY(is_unique()); VERIFY(m_property_table); @@ -200,7 +200,7 @@ void Shape::add_property_to_unique_shape(const StringOrSymbol& property_key, Pro ++m_property_count; } -void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes) +void Shape::reconfigure_property_in_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes) { VERIFY(is_unique()); VERIFY(m_property_table); @@ -210,7 +210,7 @@ void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_ m_property_table->set(property_key, it->value); } -void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_key, size_t offset) +void Shape::remove_property_from_unique_shape(StringOrSymbol const& property_key, size_t offset) { VERIFY(is_unique()); VERIFY(m_property_table); diff --git a/Userland/Libraries/LibJS/Runtime/Shape.h b/Userland/Libraries/LibJS/Runtime/Shape.h index a4221c7c49..9ae5166082 100644 --- a/Userland/Libraries/LibJS/Runtime/Shape.h +++ b/Userland/Libraries/LibJS/Runtime/Shape.h @@ -28,7 +28,7 @@ struct TransitionKey { StringOrSymbol property_key; PropertyAttributes attributes { 0 }; - bool operator==(const TransitionKey& other) const + bool operator==(TransitionKey const& other) const { return property_key == other.property_key && attributes == other.attributes; } @@ -51,14 +51,14 @@ public: explicit Shape(ShapeWithoutGlobalObjectTag) {}; explicit Shape(Object& global_object); - Shape(Shape& previous_shape, const StringOrSymbol& property_key, PropertyAttributes attributes, TransitionType); + Shape(Shape& previous_shape, StringOrSymbol const& property_key, PropertyAttributes attributes, TransitionType); Shape(Shape& previous_shape, Object* new_prototype); - Shape* create_put_transition(const StringOrSymbol&, PropertyAttributes attributes); - Shape* create_configure_transition(const StringOrSymbol&, PropertyAttributes attributes); + Shape* create_put_transition(StringOrSymbol const&, PropertyAttributes attributes); + Shape* create_configure_transition(StringOrSymbol const&, PropertyAttributes attributes); Shape* create_prototype_transition(Object* new_prototype); - void add_property_without_transition(const StringOrSymbol&, PropertyAttributes); + void add_property_without_transition(StringOrSymbol const&, PropertyAttributes); void add_property_without_transition(PropertyKey const&, PropertyAttributes); bool is_unique() const { return m_unique; } @@ -67,10 +67,10 @@ public: GlobalObject* global_object() const; Object* prototype() { return m_prototype; } - const Object* prototype() const { return m_prototype; } + Object const* prototype() const { return m_prototype; } - Optional<PropertyMetadata> lookup(const StringOrSymbol&) const; - const HashMap<StringOrSymbol, PropertyMetadata>& property_table() const; + Optional<PropertyMetadata> lookup(StringOrSymbol const&) const; + HashMap<StringOrSymbol, PropertyMetadata> const& property_table() const; u32 property_count() const { return m_property_count; } struct Property { @@ -82,9 +82,9 @@ public: void set_prototype_without_transition(Object* new_prototype) { m_prototype = new_prototype; } - void remove_property_from_unique_shape(const StringOrSymbol&, size_t offset); - void add_property_to_unique_shape(const StringOrSymbol&, PropertyAttributes attributes); - void reconfigure_property_in_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes); + void remove_property_from_unique_shape(StringOrSymbol const&, size_t offset); + void add_property_to_unique_shape(StringOrSymbol const&, PropertyAttributes attributes); + void reconfigure_property_in_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes); private: virtual StringView class_name() const override { return "Shape"sv; } diff --git a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp index bc2deecf54..767161ac96 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw) if (literal_segments == 0) return js_string(vm, ""); - const auto number_of_substituions = vm.argument_count() - 1; + auto const number_of_substituions = vm.argument_count() - 1; StringBuilder builder; for (size_t i = 0; i < literal_segments; ++i) { diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 2826c9d292..22a8664251 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -931,7 +931,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::search) } // B.2.2.2.1 CreateHTML ( string, tag, attribute, value ), https://tc39.es/ecma262/#sec-createhtml -static ThrowCompletionOr<Value> create_html(GlobalObject& global_object, Value string, const String& tag, const String& attribute, Value value) +static ThrowCompletionOr<Value> create_html(GlobalObject& global_object, Value string, String const& tag, String const& attribute, Value value) { auto& vm = global_object.vm(); TRY(require_object_coercible(global_object, string)); diff --git a/Userland/Libraries/LibJS/Runtime/Symbol.h b/Userland/Libraries/LibJS/Runtime/Symbol.h index 955e3fde56..b4ae8dc148 100644 --- a/Userland/Libraries/LibJS/Runtime/Symbol.h +++ b/Userland/Libraries/LibJS/Runtime/Symbol.h @@ -21,7 +21,7 @@ public: virtual ~Symbol() = default; String description() const { return m_description.value_or(""); } - const Optional<String>& raw_description() const { return m_description; } + Optional<String> const& raw_description() const { return m_description; } bool is_global() const { return m_is_global; } String to_string() const { return String::formatted("Symbol({})", description()); } diff --git a/Userland/Libraries/LibJS/Runtime/SymbolObject.h b/Userland/Libraries/LibJS/Runtime/SymbolObject.h index fdb2e626db..8d3ba8607c 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolObject.h +++ b/Userland/Libraries/LibJS/Runtime/SymbolObject.h @@ -21,7 +21,7 @@ public: virtual ~SymbolObject() override = default; Symbol& primitive_symbol() { return m_symbol; } - const Symbol& primitive_symbol() const { return m_symbol; } + Symbol const& primitive_symbol() const { return m_symbol; } String description() const { return m_symbol.description(); } bool is_global() const { return m_symbol.is_global(); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h index ae76fd2a83..2943a16ca7 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h @@ -32,9 +32,9 @@ private: }; // -86400 * 10^17 -const auto INSTANT_NANOSECONDS_MIN = "-8640000000000000000000"_sbigint; +auto const INSTANT_NANOSECONDS_MIN = "-8640000000000000000000"_sbigint; // +86400 * 10^17 -const auto INSTANT_NANOSECONDS_MAX = "8640000000000000000000"_sbigint; +auto const INSTANT_NANOSECONDS_MAX = "8640000000000000000000"_sbigint; bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds); ThrowCompletionOr<Instant*> create_temporal_instant(GlobalObject&, BigInt const& nanoseconds, FunctionObject const* new_target = nullptr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp index e290a2157a..6b179621c5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp @@ -74,9 +74,9 @@ BigInt* get_epoch_from_iso_parts(GlobalObject& global_object, i32 year, u8 month } // -864 * 10^19 - 864 * 10^11 -const auto DATETIME_NANOSECONDS_MIN = "-8640000086400000000000"_sbigint; +auto const DATETIME_NANOSECONDS_MIN = "-8640000086400000000000"_sbigint; // +864 * 10^19 + 864 * 10^11 -const auto DATETIME_NANOSECONDS_MAX = "8640000086400000000000"_sbigint; +auto const DATETIME_NANOSECONDS_MAX = "8640000086400000000000"_sbigint; // 5.5.2 ISODateTimeWithinLimits ( year, month, day, hour, minute, second, millisecond, microsecond, nanosecond ), https://tc39.es/proposal-temporal/#sec-temporal-isodatetimewithinlimits bool iso_date_time_within_limits(GlobalObject& global_object, i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond) diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index bf6eb8a426..f428f2e2b5 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp @@ -230,7 +230,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_typed_array(GlobalObj // 23.2.5.1.5 InitializeTypedArrayFromArrayLike, https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike template<typename T> -static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObject& global_object, TypedArray<T>& typed_array, const Object& array_like) +static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObject& global_object, TypedArray<T>& typed_array, Object const& array_like) { auto& vm = global_object.vm(); @@ -291,7 +291,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObje // 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist template<typename T> -static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, const MarkedVector<Value>& list) +static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, MarkedVector<Value> const& list) { auto& vm = global_object.vm(); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index 4e81d0eb38..d8f27ac701 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -425,7 +425,7 @@ public: Span<const UnderlyingBufferDataType> data() const { - return { reinterpret_cast<const UnderlyingBufferDataType*>(m_viewed_array_buffer->buffer().data() + m_byte_offset), m_array_length }; + return { reinterpret_cast<UnderlyingBufferDataType const*>(m_viewed_array_buffer->buffer().data() + m_byte_offset), m_array_length }; } Span<UnderlyingBufferDataType> data() { diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 0d9cc8dac5..a6f014319f 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -11,7 +11,7 @@ namespace JS { -TypedArrayConstructor::TypedArrayConstructor(const FlyString& name, Object& prototype) +TypedArrayConstructor::TypedArrayConstructor(FlyString const& name, Object& prototype) : NativeFunction(name, prototype) { } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h index fa7ed0e9b4..6d53099685 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h @@ -14,7 +14,7 @@ class TypedArrayConstructor : public NativeFunction { JS_OBJECT(TypedArrayConstructor, NativeFunction); public: - TypedArrayConstructor(const FlyString& name, Object& prototype); + TypedArrayConstructor(FlyString const& name, Object& prototype); explicit TypedArrayConstructor(GlobalObject&); virtual void initialize(GlobalObject&) override; virtual ~TypedArrayConstructor() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index 39cb7dfc10..edf9773165 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -82,7 +82,7 @@ static ThrowCompletionOr<TypedArrayBase*> validate_typed_array_from_this(GlobalO return typed_array; } -static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& global_object, const String& name) +static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& global_object, String const& name) { auto& vm = global_object.vm(); if (vm.argument_count() < 1) @@ -93,7 +93,7 @@ static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& globa return &callback.as_function(); } -static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback) +static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object, String const& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback) { auto* typed_array = TRY(validate_typed_array_from_this(global_object)); @@ -115,7 +115,7 @@ static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object return {}; } -static ThrowCompletionOr<void> for_each_item_from_last(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback) +static ThrowCompletionOr<void> for_each_item_from_last(VM& vm, GlobalObject& global_object, String const& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback) { auto* typed_array = TRY(validate_typed_array_from_this(global_object)); diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 82f3aa4083..7d66de9f66 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -216,7 +216,7 @@ void VM::gather_roots(HashTable<Cell*>& roots) roots.set(finalization_registry); } -Symbol* VM::get_global_symbol(const String& description) +Symbol* VM::get_global_symbol(String const& description) { auto result = m_global_symbol_map.get(description); if (result.has_value()) diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 1295c2f01b..94495e1984 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -45,7 +45,7 @@ public: }; Heap& heap() { return m_heap; } - const Heap& heap() const { return m_heap; } + Heap const& heap() const { return m_heap; } Interpreter& interpreter(); Interpreter* interpreter_if_exists(); @@ -73,7 +73,7 @@ public: JS_ENUMERATE_WELL_KNOWN_SYMBOLS #undef __JS_ENUMERATE - Symbol* get_global_symbol(const String& description); + Symbol* get_global_symbol(String const& description); HashMap<String, PrimitiveString*>& string_cache() { return m_string_cache; } PrimitiveString& empty_string() { return *m_empty_string; } @@ -158,7 +158,7 @@ public: ThrowCompletionOr<Value> resolve_this_binding(GlobalObject&); - const StackInfo& stack_info() const { return m_stack_info; }; + StackInfo const& stack_info() const { return m_stack_info; }; u32 execution_generation() const { return m_execution_generation; } void finish_execution_generation() { ++m_execution_generation; } diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 06fdd8c0c7..7f5c80a90c 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -39,7 +39,7 @@ namespace JS { -static inline bool same_type_for_equality(const Value& lhs, const Value& rhs) +static inline bool same_type_for_equality(Value const& lhs, Value const& rhs) { if (lhs.type() == rhs.type()) return true; @@ -50,12 +50,12 @@ static inline bool same_type_for_equality(const Value& lhs, const Value& rhs) static const Crypto::SignedBigInteger BIGINT_ZERO { 0 }; -ALWAYS_INLINE bool both_number(const Value& lhs, const Value& rhs) +ALWAYS_INLINE bool both_number(Value const& lhs, Value const& rhs) { return lhs.is_number() && rhs.is_number(); } -ALWAYS_INLINE bool both_bigint(const Value& lhs, const Value& rhs) +ALWAYS_INLINE bool both_bigint(Value const& lhs, Value const& rhs) { return lhs.is_bigint() && rhs.is_bigint(); } @@ -1295,7 +1295,7 @@ ThrowCompletionOr<Value> ordinary_has_instance(GlobalObject& global_object, Valu auto& rhs_function = rhs.as_function(); if (is<BoundFunction>(rhs_function)) { - auto& bound_target = static_cast<const BoundFunction&>(rhs_function); + auto& bound_target = static_cast<BoundFunction const&>(rhs_function); return instance_of(global_object, lhs, Value(&bound_target.bound_target_function())); } diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 364c410c2e..0b1f1aac59 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -178,31 +178,31 @@ public: m_value.as_i32 = value; } - Value(const Object* object) + Value(Object const* object) : m_type(object ? Type::Object : Type::Null) { m_value.as_object = const_cast<Object*>(object); } - Value(const PrimitiveString* string) + Value(PrimitiveString const* string) : m_type(Type::String) { m_value.as_string = const_cast<PrimitiveString*>(string); } - Value(const Symbol* symbol) + Value(Symbol const* symbol) : m_type(Type::Symbol) { m_value.as_symbol = const_cast<Symbol*>(symbol); } - Value(const Accessor* accessor) + Value(Accessor const* accessor) : m_type(Type::Accessor) { m_value.as_accessor = const_cast<Accessor*>(accessor); } - Value(const BigInt* bigint) + Value(BigInt const* bigint) : m_type(Type::BigInt) { m_value.as_bigint = const_cast<BigInt*>(bigint); @@ -235,7 +235,7 @@ public: return *m_value.as_object; } - const Object& as_object() const + Object const& as_object() const { VERIFY(type() == Type::Object); return *m_value.as_object; @@ -247,7 +247,7 @@ public: return *m_value.as_string; } - const PrimitiveString& as_string() const + PrimitiveString const& as_string() const { VERIFY(is_string()); return *m_value.as_string; @@ -259,7 +259,7 @@ public: return *m_value.as_symbol; } - const Symbol& as_symbol() const + Symbol const& as_symbol() const { VERIFY(is_symbol()); return *m_value.as_symbol; diff --git a/Userland/Libraries/LibJS/SyntaxHighlighter.cpp b/Userland/Libraries/LibJS/SyntaxHighlighter.cpp index 737f9315b4..c527dc42b3 100644 --- a/Userland/Libraries/LibJS/SyntaxHighlighter.cpp +++ b/Userland/Libraries/LibJS/SyntaxHighlighter.cpp @@ -12,7 +12,7 @@ namespace JS { -static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, JS::TokenType type) +static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, JS::TokenType type) { switch (JS::Token::category(type)) { case JS::TokenCategory::Invalid: @@ -47,7 +47,7 @@ bool SyntaxHighlighter::is_navigatable([[maybe_unused]] u64 token) const return false; } -void SyntaxHighlighter::rehighlight(const Palette& palette) +void SyntaxHighlighter::rehighlight(Palette const& palette) { auto text = m_client->get_text(); diff --git a/Userland/Libraries/LibJS/SyntaxHighlighter.h b/Userland/Libraries/LibJS/SyntaxHighlighter.h index d3929937f0..e1667cac70 100644 --- a/Userland/Libraries/LibJS/SyntaxHighlighter.h +++ b/Userland/Libraries/LibJS/SyntaxHighlighter.h @@ -19,7 +19,7 @@ public: virtual bool is_navigatable(u64) const override; virtual Syntax::Language language() const override { return Syntax::Language::JavaScript; } - virtual void rehighlight(const Palette&) override; + virtual void rehighlight(Palette const&) override; protected: virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override; diff --git a/Userland/Libraries/LibJS/Token.cpp b/Userland/Libraries/LibJS/Token.cpp index 9a51a15508..1d84a4aeaf 100644 --- a/Userland/Libraries/LibJS/Token.cpp +++ b/Userland/Libraries/LibJS/Token.cpp @@ -13,7 +13,7 @@ namespace JS { -const char* Token::name(TokenType type) +char const* Token::name(TokenType type) { switch (type) { #define __ENUMERATE_JS_TOKEN(type, category) \ @@ -27,7 +27,7 @@ const char* Token::name(TokenType type) } } -const char* Token::name() const +char const* Token::name() const { return name(m_type); } diff --git a/Userland/Libraries/LibJS/Token.h b/Userland/Libraries/LibJS/Token.h index 0e7d282aa2..086c1df3a3 100644 --- a/Userland/Libraries/LibJS/Token.h +++ b/Userland/Libraries/LibJS/Token.h @@ -14,12 +14,12 @@ namespace JS { // U+2028 LINE SEPARATOR -constexpr const char line_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa8, 0 }; +constexpr char const line_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa8, 0 }; constexpr const StringView LINE_SEPARATOR_STRING { line_separator_chars }; constexpr const u32 LINE_SEPARATOR { 0x2028 }; // U+2029 PARAGRAPH SEPARATOR -constexpr const char paragraph_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa9, 0 }; +constexpr char const paragraph_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa9, 0 }; constexpr const StringView PARAGRAPH_SEPARATOR_STRING { paragraph_separator_chars }; constexpr const u32 PARAGRAPH_SEPARATOR { 0x2029 }; @@ -197,10 +197,10 @@ public: TokenType type() const { return m_type; } TokenCategory category() const; static TokenCategory category(TokenType); - const char* name() const; - static const char* name(TokenType); + char const* name() const; + static char const* name(TokenType); - const String& message() const { return m_message; } + String const& message() const { return m_message; } StringView trivia() const { return m_trivia; } StringView original_value() const { return m_original_value; } StringView value() const diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.cpp b/Userland/Libraries/LibKeyboard/CharacterMap.cpp index dec8014d0e..85b6df3e8e 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMap.cpp @@ -12,14 +12,14 @@ namespace Keyboard { -ErrorOr<CharacterMap> CharacterMap::load_from_file(const String& map_name) +ErrorOr<CharacterMap> CharacterMap::load_from_file(String const& map_name) { auto result = TRY(CharacterMapFile::load_from_file(map_name)); return CharacterMap(map_name, result); } -CharacterMap::CharacterMap(const String& map_name, const CharacterMapData& map_data) +CharacterMap::CharacterMap(String const& map_name, CharacterMapData const& map_data) : m_character_map_data(map_data) , m_character_map_name(map_name) { @@ -41,7 +41,7 @@ ErrorOr<CharacterMap> CharacterMap::fetch_system_map() return CharacterMap { keymap_name, map_data }; } -const String& CharacterMap::character_map_name() const +String const& CharacterMap::character_map_name() const { return m_character_map_name; } diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.h b/Userland/Libraries/LibKeyboard/CharacterMap.h index 7d3e96f176..9990077bb0 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.h +++ b/Userland/Libraries/LibKeyboard/CharacterMap.h @@ -15,14 +15,14 @@ namespace Keyboard { class CharacterMap { public: - CharacterMap(const String& map_name, const CharacterMapData& map_data); - static ErrorOr<CharacterMap> load_from_file(const String& filename); + CharacterMap(String const& map_name, CharacterMapData const& map_data); + static ErrorOr<CharacterMap> load_from_file(String const& filename); int set_system_map(); static ErrorOr<CharacterMap> fetch_system_map(); - const CharacterMapData& character_map_data() const { return m_character_map_data; }; - const String& character_map_name() const; + CharacterMapData const& character_map_data() const { return m_character_map_data; }; + String const& character_map_name() const; private: CharacterMapData m_character_map_data; diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp index 233e94e793..838de4e35c 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp @@ -11,7 +11,7 @@ namespace Keyboard { -ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(const String& filename) +ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(String const& filename) { auto path = filename; if (!path.ends_with(".json")) { @@ -25,7 +25,7 @@ ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(const String& filenam auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); auto file_contents = file->read_all(); auto json_result = TRY(JsonValue::from_string(file_contents)); - const auto& json = json_result.as_object(); + auto const& json = json_result.as_object(); Vector<u32> map = read_map(json, "map"); Vector<u32> shift_map = read_map(json, "shift_map"); @@ -55,7 +55,7 @@ ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(const String& filenam return character_map; } -Vector<u32> CharacterMapFile::read_map(const JsonObject& json, const String& name) +Vector<u32> CharacterMapFile::read_map(JsonObject const& json, String const& name) { if (!json.has(name)) return {}; diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.h b/Userland/Libraries/LibKeyboard/CharacterMapFile.h index 986278f71a..ad79e017f9 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMapFile.h +++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.h @@ -14,10 +14,10 @@ namespace Keyboard { class CharacterMapFile { public: - static ErrorOr<CharacterMapData> load_from_file(const String& filename); + static ErrorOr<CharacterMapData> load_from_file(String const& filename); private: - static Vector<u32> read_map(const JsonObject& json, const String& name); + static Vector<u32> read_map(JsonObject const& json, String const& name); }; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index c2bd3c3a5b..0d2baf01b4 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -2040,7 +2040,7 @@ size_t StringMetrics::offset_with_addition(StringMetrics const& offset, size_t c bool Editor::Spans::contains_up_to_offset(Spans const& other, size_t offset) const { - auto compare = [&]<typename K, typename V>(const HashMap<K, HashMap<K, V>>& left, const HashMap<K, HashMap<K, V>>& right) -> bool { + auto compare = [&]<typename K, typename V>(HashMap<K, HashMap<K, V>> const& left, HashMap<K, HashMap<K, V>> const& right) -> bool { for (auto& entry : right) { if (entry.key > offset + 1) continue; diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h index bc835398e3..e6a62dfedf 100644 --- a/Userland/Libraries/LibLine/Editor.h +++ b/Userland/Libraries/LibLine/Editor.h @@ -191,7 +191,7 @@ public: cursor = m_buffer.size(); m_cursor = cursor; } - const Vector<u32, 1024>& buffer() const { return m_buffer; } + Vector<u32, 1024> const& buffer() const { return m_buffer; } u32 buffer_at(size_t pos) const { return m_buffer.at(pos); } String line() const { return line(m_buffer.size()); } String line(size_t up_to_index) const; diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp index ba57fab492..7bfec19a9c 100644 --- a/Userland/Libraries/LibLine/InternalFunctions.cpp +++ b/Userland/Libraries/LibLine/InternalFunctions.cpp @@ -516,7 +516,7 @@ void Editor::uppercase_word() void Editor::edit_in_external_editor() { - const auto* editor_command = getenv("EDITOR"); + auto const* editor_command = getenv("EDITOR"); if (!editor_command) editor_command = m_configuration.m_default_text_editor.characters(); @@ -553,7 +553,7 @@ void Editor::edit_in_external_editor() } }; - Vector<const char*> args { editor_command, file_path, nullptr }; + Vector<char const*> args { editor_command, file_path, nullptr }; auto pid = fork(); if (pid == -1) { diff --git a/Userland/Libraries/LibLine/KeyCallbackMachine.h b/Userland/Libraries/LibLine/KeyCallbackMachine.h index 82900471b0..4d09ee1012 100644 --- a/Userland/Libraries/LibLine/KeyCallbackMachine.h +++ b/Userland/Libraries/LibLine/KeyCallbackMachine.h @@ -80,7 +80,7 @@ struct Traits<Line::Key> : public GenericTraits<Line::Key> { template<> struct Traits<Vector<Line::Key>> : public GenericTraits<Vector<Line::Key>> { static constexpr bool is_trivial() { return false; } - static unsigned hash(const Vector<Line::Key>& ks) + static unsigned hash(Vector<Line::Key> const& ks) { unsigned h = 0; for (auto& k : ks) diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp index 94d2e350f8..f3760cccd2 100644 --- a/Userland/Libraries/LibM/math.cpp +++ b/Userland/Libraries/LibM/math.cpp @@ -340,17 +340,17 @@ static FloatT internal_gamma(FloatT x) NOEXCEPT extern "C" { -float nanf(const char* s) NOEXCEPT +float nanf(char const* s) NOEXCEPT { return __builtin_nanf(s); } -double nan(const char* s) NOEXCEPT +double nan(char const* s) NOEXCEPT { return __builtin_nan(s); } -long double nanl(const char* s) NOEXCEPT +long double nanl(char const* s) NOEXCEPT { return __builtin_nanl(s); } diff --git a/Userland/Libraries/LibM/math.h b/Userland/Libraries/LibM/math.h index a54e81ac63..b5269044b0 100644 --- a/Userland/Libraries/LibM/math.h +++ b/Userland/Libraries/LibM/math.h @@ -128,9 +128,9 @@ float fminf(float, float) NOEXCEPT; long double remainderl(long double, long double) NOEXCEPT; double remainder(double, double) NOEXCEPT; float remainderf(float, float) NOEXCEPT; -long double nanl(const char*) NOEXCEPT; -double nan(const char*) NOEXCEPT; -float nanf(const char*) NOEXCEPT; +long double nanl(char const*) NOEXCEPT; +double nan(char const*) NOEXCEPT; +float nanf(char const*) NOEXCEPT; /* Exponential functions */ long double expl(long double) NOEXCEPT; diff --git a/Userland/Libraries/LibMarkdown/Document.cpp b/Userland/Libraries/LibMarkdown/Document.cpp index 2d00188ee2..a4fa2307ae 100644 --- a/Userland/Libraries/LibMarkdown/Document.cpp +++ b/Userland/Libraries/LibMarkdown/Document.cpp @@ -53,7 +53,7 @@ RecursionDecision Document::walk(Visitor& visitor) const OwnPtr<Document> Document::parse(StringView str) { - const Vector<StringView> lines_vec = str.lines(); + Vector<StringView> const lines_vec = str.lines(); LineIterator lines(lines_vec.begin()); return make<Document>(ContainerBlock::parse(lines)); } diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp index 2ecd58401e..d98288f355 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -16,7 +16,7 @@ String List::render_to_html(bool) const { StringBuilder builder; - const char* tag = m_is_ordered ? "ol" : "ul"; + char const* tag = m_is_ordered ? "ol" : "ul"; builder.appendff("<{}", tag); if (m_start_number != 1) diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index 445b969ea3..5cf26bd48e 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -16,7 +16,7 @@ String Table::render_for_terminal(size_t view_width) const auto unit_width_length = view_width == 0 ? 4 : ((float)(view_width - m_columns.size()) / (float)m_total_width); StringBuilder builder; - auto write_aligned = [&](const auto& text, auto width, auto alignment) { + auto write_aligned = [&](auto const& text, auto width, auto alignment) { size_t original_length = text.terminal_length(); auto string = text.render_for_terminal(); if (alignment == Alignment::Center) { diff --git a/Userland/Libraries/LibPCIDB/Database.cpp b/Userland/Libraries/LibPCIDB/Database.cpp index ce23b80994..bffd5b7d07 100644 --- a/Userland/Libraries/LibPCIDB/Database.cpp +++ b/Userland/Libraries/LibPCIDB/Database.cpp @@ -12,7 +12,7 @@ namespace PCIDB { -RefPtr<Database> Database::open(const String& filename) +RefPtr<Database> Database::open(String const& filename) { auto file_or_error = Core::MappedFile::map(filename); if (file_or_error.is_error()) @@ -25,7 +25,7 @@ RefPtr<Database> Database::open(const String& filename) const StringView Database::get_vendor(u16 vendor_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) return ""; return vendor.value()->name; @@ -33,10 +33,10 @@ const StringView Database::get_vendor(u16 vendor_id) const const StringView Database::get_device(u16 vendor_id, u16 device_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) return ""; - const auto& device = vendor.value()->devices.get(device_id); + auto const& device = vendor.value()->devices.get(device_id); if (!device.has_value()) return ""; return device.value()->name; @@ -44,13 +44,13 @@ const StringView Database::get_device(u16 vendor_id, u16 device_id) const const StringView Database::get_subsystem(u16 vendor_id, u16 device_id, u16 subvendor_id, u16 subdevice_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) return ""; - const auto& device = vendor.value()->devices.get(device_id); + auto const& device = vendor.value()->devices.get(device_id); if (!device.has_value()) return ""; - const auto& subsystem = device.value()->subsystems.get((subvendor_id << 16) + subdevice_id); + auto const& subsystem = device.value()->subsystems.get((subvendor_id << 16) + subdevice_id); if (!subsystem.has_value()) return ""; return subsystem.value()->name; @@ -58,7 +58,7 @@ const StringView Database::get_subsystem(u16 vendor_id, u16 device_id, u16 subve const StringView Database::get_class(u8 class_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; return xclass.value()->name; @@ -66,10 +66,10 @@ const StringView Database::get_class(u8 class_id) const const StringView Database::get_subclass(u8 class_id, u8 subclass_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; - const auto& subclass = xclass.value()->subclasses.get(subclass_id); + auto const& subclass = xclass.value()->subclasses.get(subclass_id); if (!subclass.has_value()) return ""; return subclass.value()->name; @@ -77,13 +77,13 @@ const StringView Database::get_subclass(u8 class_id, u8 subclass_id) const const StringView Database::get_programming_interface(u8 class_id, u8 subclass_id, u8 programming_interface_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; - const auto& subclass = xclass.value()->subclasses.get(subclass_id); + auto const& subclass = xclass.value()->subclasses.get(subclass_id); if (!subclass.has_value()) return ""; - const auto& programming_interface = subclass.value()->programming_interfaces.get(programming_interface_id); + auto const& programming_interface = subclass.value()->programming_interfaces.get(programming_interface_id); if (!programming_interface.has_value()) return ""; return programming_interface.value()->name; diff --git a/Userland/Libraries/LibPCIDB/Database.h b/Userland/Libraries/LibPCIDB/Database.h index 7577f55898..2145a2dbfa 100644 --- a/Userland/Libraries/LibPCIDB/Database.h +++ b/Userland/Libraries/LibPCIDB/Database.h @@ -53,7 +53,7 @@ struct Class { class Database : public RefCounted<Database> { public: - static RefPtr<Database> open(const String& filename); + static RefPtr<Database> open(String const& filename); static RefPtr<Database> open() { return open("/res/pci.ids"); }; const StringView get_vendor(u16 vendor_id) const; diff --git a/Userland/Libraries/LibPDF/Filter.cpp b/Userland/Libraries/LibPDF/Filter.cpp index c6c93d781c..5d7da106b4 100644 --- a/Userland/Libraries/LibPDF/Filter.cpp +++ b/Userland/Libraries/LibPDF/Filter.cpp @@ -47,11 +47,11 @@ ErrorOr<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes bytes) auto output = TRY(ByteBuffer::create_zeroed(bytes.size() / 2 + 1)); for (size_t i = 0; i < bytes.size() / 2; ++i) { - const auto c1 = decode_hex_digit(static_cast<char>(bytes[i * 2])); + auto const c1 = decode_hex_digit(static_cast<char>(bytes[i * 2])); if (c1 >= 16) return Error::from_string_literal("Hex string contains invalid digit"); - const auto c2 = decode_hex_digit(static_cast<char>(bytes[i * 2 + 1])); + auto const c2 = decode_hex_digit(static_cast<char>(bytes[i * 2 + 1])); if (c2 >= 16) return Error::from_string_literal("Hex string contains invalid digit"); diff --git a/Userland/Libraries/LibPDF/Object.h b/Userland/Libraries/LibPDF/Object.h index 71b6bb9a4c..b1ff82d0b3 100644 --- a/Userland/Libraries/LibPDF/Object.h +++ b/Userland/Libraries/LibPDF/Object.h @@ -19,7 +19,7 @@ namespace { template<PDF::IsObject T> -const char* object_name() +char const* object_name() { # define ENUMERATE_TYPE(class_name, snake_name) \ if constexpr (IsSame<PDF::class_name, T>) { \ @@ -73,7 +73,7 @@ public: return NonnullRefPtr<T>(static_cast<T const&>(*this)); } - virtual const char* type_name() const = 0; + virtual char const* type_name() const = 0; virtual String to_string(int indent) const = 0; protected: diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.h b/Userland/Libraries/LibPDF/ObjectDerivatives.h index 769d0c2d40..c719ef2f27 100644 --- a/Userland/Libraries/LibPDF/ObjectDerivatives.h +++ b/Userland/Libraries/LibPDF/ObjectDerivatives.h @@ -31,7 +31,7 @@ public: [[nodiscard]] ALWAYS_INLINE bool is_binary() const { return m_is_binary; } void set_string(String string) { m_string = move(string); } - const char* type_name() const override { return "string"; } + char const* type_name() const override { return "string"; } String to_string(int indent) const override; protected: @@ -53,7 +53,7 @@ public: [[nodiscard]] ALWAYS_INLINE FlyString const& name() const { return m_name; } - const char* type_name() const override { return "name"; } + char const* type_name() const override { return "name"; } String to_string(int indent) const override; protected: @@ -86,7 +86,7 @@ public: ENUMERATE_OBJECT_TYPES(DEFINE_INDEXER) #undef DEFINE_INDEXER - const char* type_name() const override + char const* type_name() const override { return "array"; } @@ -129,7 +129,7 @@ public: ENUMERATE_OBJECT_TYPES(DEFINE_GETTER) #undef DEFINE_GETTER - const char* type_name() const override + char const* type_name() const override { return "dict"; } @@ -156,7 +156,7 @@ public: [[nodiscard]] ReadonlyBytes bytes() const { return m_buffer.bytes(); }; [[nodiscard]] ByteBuffer& buffer() { return m_buffer; }; - const char* type_name() const override { return "stream"; } + char const* type_name() const override { return "stream"; } String to_string(int indent) const override; private: @@ -180,7 +180,7 @@ public: [[nodiscard]] ALWAYS_INLINE u32 index() const { return m_index; } [[nodiscard]] ALWAYS_INLINE Value const& value() const { return m_value; } - const char* type_name() const override { return "indirect_object"; } + char const* type_name() const override { return "indirect_object"; } String to_string(int indent) const override; protected: diff --git a/Userland/Libraries/LibPDF/Operator.h b/Userland/Libraries/LibPDF/Operator.h index 88ee18991c..89e66b8690 100644 --- a/Userland/Libraries/LibPDF/Operator.h +++ b/Userland/Libraries/LibPDF/Operator.h @@ -114,7 +114,7 @@ public: VERIFY_NOT_REACHED(); } - static const char* operator_name(OperatorType operator_type) + static char const* operator_name(OperatorType operator_type) { #define V(name, snake_name, symbol) \ if (operator_type == OperatorType::name) \ @@ -130,7 +130,7 @@ public: VERIFY_NOT_REACHED(); } - static const char* operator_symbol(OperatorType operator_type) + static char const* operator_symbol(OperatorType operator_type) { #define V(name, snake_name, symbol) \ if (operator_type == OperatorType::name) \ diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index 00be30bb34..81988d3191 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -49,7 +49,7 @@ PDFErrorOr<void> Parser::initialize() { TRY(parse_header()); - const auto linearization_result = TRY(initialize_linearization_dict()); + auto const linearization_result = TRY(initialize_linearization_dict()); if (linearization_result == LinearizationResult::NotLinearized) return initialize_non_linearized_xref_table(); diff --git a/Userland/Libraries/LibPDF/Reader.h b/Userland/Libraries/LibPDF/Reader.h index d9ae301ac8..862decb8e1 100644 --- a/Userland/Libraries/LibPDF/Reader.h +++ b/Userland/Libraries/LibPDF/Reader.h @@ -79,7 +79,7 @@ public: return !done() && peek() == ch; } - bool matches(const char* chars) const + bool matches(char const* chars) const { String string(chars); if (remaining() < string.length()) diff --git a/Userland/Libraries/LibProtocol/Request.cpp b/Userland/Libraries/LibProtocol/Request.cpp index ccbb3d6e29..484b5a7142 100644 --- a/Userland/Libraries/LibProtocol/Request.cpp +++ b/Userland/Libraries/LibProtocol/Request.cpp @@ -128,7 +128,7 @@ void Request::did_progress(Badge<RequestClient>, Optional<u32> total_size, u32 d on_progress(total_size, downloaded_size); } -void Request::did_receive_headers(Badge<RequestClient>, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code) +void Request::did_receive_headers(Badge<RequestClient>, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code) { if (on_headers_received) on_headers_received(response_headers, response_code); diff --git a/Userland/Libraries/LibProtocol/Request.h b/Userland/Libraries/LibProtocol/Request.h index b649a208ae..f004935175 100644 --- a/Userland/Libraries/LibProtocol/Request.h +++ b/Userland/Libraries/LibProtocol/Request.h @@ -46,15 +46,15 @@ public: void set_should_buffer_all_input(bool); /// Note: Must be set before `set_should_buffer_all_input(true)`. - Function<void(bool success, u32 total_size, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code, ReadonlyBytes payload)> on_buffered_request_finish; + Function<void(bool success, u32 total_size, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code, ReadonlyBytes payload)> on_buffered_request_finish; Function<void(bool success, u32 total_size)> on_finish; Function<void(Optional<u32> total_size, u32 downloaded_size)> on_progress; - Function<void(const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code)> on_headers_received; + Function<void(HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code)> on_headers_received; Function<CertificateAndKey()> on_certificate_requested; void did_finish(Badge<RequestClient>, bool success, u32 total_size); void did_progress(Badge<RequestClient>, Optional<u32> total_size, u32 downloaded_size); - void did_receive_headers(Badge<RequestClient>, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code); + void did_receive_headers(Badge<RequestClient>, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code); void did_request_certificates(Badge<RequestClient>); RefPtr<Core::Notifier>& write_notifier(Badge<RequestClient>) { return m_write_notifier; } diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.cpp b/Userland/Libraries/LibProtocol/WebSocketClient.cpp index 43dccd76c2..5c84919bfc 100644 --- a/Userland/Libraries/LibProtocol/WebSocketClient.cpp +++ b/Userland/Libraries/LibProtocol/WebSocketClient.cpp @@ -14,7 +14,7 @@ WebSocketClient::WebSocketClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket { } -RefPtr<WebSocket> WebSocketClient::connect(const URL& url, const String& origin, const Vector<String>& protocols, const Vector<String>& extensions, const HashMap<String, String>& request_headers) +RefPtr<WebSocket> WebSocketClient::connect(const URL& url, String const& origin, Vector<String> const& protocols, Vector<String> const& extensions, HashMap<String, String> const& request_headers) { IPC::Dictionary header_dictionary; for (auto& it : request_headers) diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.h b/Userland/Libraries/LibProtocol/WebSocketClient.h index 37226c4275..f802c73597 100644 --- a/Userland/Libraries/LibProtocol/WebSocketClient.h +++ b/Userland/Libraries/LibProtocol/WebSocketClient.h @@ -21,7 +21,7 @@ class WebSocketClient final IPC_CLIENT_CONNECTION(WebSocketClient, "/tmp/portal/websocket") public: - RefPtr<WebSocket> connect(const URL&, const String& origin = {}, const Vector<String>& protocols = {}, const Vector<String>& extensions = {}, const HashMap<String, String>& request_headers = {}); + RefPtr<WebSocket> connect(const URL&, String const& origin = {}, Vector<String> const& protocols = {}, Vector<String> const& extensions = {}, HashMap<String, String> const& request_headers = {}); u32 ready_state(Badge<WebSocket>, WebSocket&); void send(Badge<WebSocket>, WebSocket&, ByteBuffer, bool is_text); diff --git a/Userland/Libraries/LibPthread/pthread.cpp b/Userland/Libraries/LibPthread/pthread.cpp index 38997a8139..ea1b5b3227 100644 --- a/Userland/Libraries/LibPthread/pthread.cpp +++ b/Userland/Libraries/LibPthread/pthread.cpp @@ -176,7 +176,7 @@ int pthread_detach(pthread_t thread) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_sigmask.html -int pthread_sigmask(int how, const sigset_t* set, sigset_t* old_set) +int pthread_sigmask(int how, sigset_t const* set, sigset_t* old_set) { if (sigprocmask(how, set, old_set)) return errno; @@ -184,7 +184,7 @@ int pthread_sigmask(int how, const sigset_t* set, sigset_t* old_set) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_init.html -int pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attributes) +int pthread_mutex_init(pthread_mutex_t* mutex, pthread_mutexattr_t const* attributes) { return __pthread_mutex_init(mutex, attributes); } @@ -269,9 +269,9 @@ int pthread_attr_destroy(pthread_attr_t* attributes) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getdetachstate.html -int pthread_attr_getdetachstate(const pthread_attr_t* attributes, int* p_detach_state) +int pthread_attr_getdetachstate(pthread_attr_t const* attributes, int* p_detach_state) { - auto* attributes_impl = *(reinterpret_cast<const PthreadAttrImpl* const*>(attributes)); + auto* attributes_impl = *(reinterpret_cast<PthreadAttrImpl const* const*>(attributes)); if (!attributes_impl || !p_detach_state) return EINVAL; @@ -305,9 +305,9 @@ int pthread_attr_setdetachstate(pthread_attr_t* attributes, int detach_state) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getguardsize.html -int pthread_attr_getguardsize(const pthread_attr_t* attributes, size_t* p_guard_size) +int pthread_attr_getguardsize(pthread_attr_t const* attributes, size_t* p_guard_size) { - auto* attributes_impl = *(reinterpret_cast<const PthreadAttrImpl* const*>(attributes)); + auto* attributes_impl = *(reinterpret_cast<PthreadAttrImpl const* const*>(attributes)); if (!attributes_impl || !p_guard_size) return EINVAL; @@ -349,9 +349,9 @@ int pthread_attr_setguardsize(pthread_attr_t* attributes, size_t guard_size) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getschedparam.html -int pthread_attr_getschedparam(const pthread_attr_t* attributes, struct sched_param* p_sched_param) +int pthread_attr_getschedparam(pthread_attr_t const* attributes, struct sched_param* p_sched_param) { - auto* attributes_impl = *(reinterpret_cast<const PthreadAttrImpl* const*>(attributes)); + auto* attributes_impl = *(reinterpret_cast<PthreadAttrImpl const* const*>(attributes)); if (!attributes_impl || !p_sched_param) return EINVAL; @@ -384,9 +384,9 @@ int pthread_attr_setschedparam(pthread_attr_t* attributes, const struct sched_pa } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getstack.html -int pthread_attr_getstack(const pthread_attr_t* attributes, void** p_stack_ptr, size_t* p_stack_size) +int pthread_attr_getstack(pthread_attr_t const* attributes, void** p_stack_ptr, size_t* p_stack_size) { - auto* attributes_impl = *(reinterpret_cast<const PthreadAttrImpl* const*>(attributes)); + auto* attributes_impl = *(reinterpret_cast<PthreadAttrImpl const* const*>(attributes)); if (!attributes_impl || !p_stack_ptr || !p_stack_size) return EINVAL; @@ -429,9 +429,9 @@ int pthread_attr_setstack(pthread_attr_t* attributes, void* p_stack, size_t stac } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getstacksize.html -int pthread_attr_getstacksize(const pthread_attr_t* attributes, size_t* p_stack_size) +int pthread_attr_getstacksize(pthread_attr_t const* attributes, size_t* p_stack_size) { - auto* attributes_impl = *(reinterpret_cast<const PthreadAttrImpl* const*>(attributes)); + auto* attributes_impl = *(reinterpret_cast<PthreadAttrImpl const* const*>(attributes)); if (!attributes_impl || !p_stack_size) return EINVAL; @@ -465,7 +465,7 @@ int pthread_attr_setstacksize(pthread_attr_t* attributes, size_t stack_size) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getscope.html -int pthread_attr_getscope([[maybe_unused]] const pthread_attr_t* attributes, [[maybe_unused]] int* contention_scope) +int pthread_attr_getscope([[maybe_unused]] pthread_attr_t const* attributes, [[maybe_unused]] int* contention_scope) { return 0; } @@ -514,12 +514,12 @@ void* pthread_getspecific(pthread_key_t key) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_setspecific.html -int pthread_setspecific(pthread_key_t key, const void* value) +int pthread_setspecific(pthread_key_t key, void const* value) { return __pthread_setspecific(key, value); } -int pthread_setname_np(pthread_t thread, const char* name) +int pthread_setname_np(pthread_t thread, char const* name) { if (!name) return EFAULT; @@ -577,7 +577,7 @@ int pthread_spin_init(pthread_spinlock_t* lock, [[maybe_unused]] int shared) // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_spin_lock.html int pthread_spin_lock(pthread_spinlock_t* lock) { - const auto desired = gettid(); + auto const desired = gettid(); while (true) { auto current = AK::atomic_load(&lock->m_lock); @@ -647,7 +647,7 @@ constexpr static u32 writer_wake_mask = 1 << 31; constexpr static u32 writer_locked_mask = 1 << 17; constexpr static u32 writer_intent_mask = 1 << 16; // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_rwlock_init.html -int pthread_rwlock_init(pthread_rwlock_t* __restrict lockp, const pthread_rwlockattr_t* __restrict attr) +int pthread_rwlock_init(pthread_rwlock_t* __restrict lockp, pthread_rwlockattr_t const* __restrict attr) { // Just ignore the attributes. use defaults for now. (void)attr; @@ -868,7 +868,7 @@ int pthread_rwlockattr_destroy(pthread_rwlockattr_t*) } // https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_rwlockattr_getpshared.html -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict) +int pthread_rwlockattr_getpshared(pthread_rwlockattr_t const* __restrict, int* __restrict) { VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibPthread/pthread.h b/Userland/Libraries/LibPthread/pthread.h index 009ca6bd65..6260cd5454 100644 --- a/Userland/Libraries/LibPthread/pthread.h +++ b/Userland/Libraries/LibPthread/pthread.h @@ -24,7 +24,7 @@ int pthread_join(pthread_t, void**); int pthread_mutex_lock(pthread_mutex_t*); int pthread_mutex_trylock(pthread_mutex_t* mutex); int pthread_mutex_unlock(pthread_mutex_t*); -int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*); +int pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t const*); int pthread_mutex_destroy(pthread_mutex_t*); int pthread_attr_init(pthread_attr_t*); @@ -35,31 +35,31 @@ int pthread_attr_destroy(pthread_attr_t*); #define PTHREAD_CANCELED (-1) -int pthread_attr_getdetachstate(const pthread_attr_t*, int*); +int pthread_attr_getdetachstate(pthread_attr_t const*, int*); int pthread_attr_setdetachstate(pthread_attr_t*, int); -int pthread_attr_getguardsize(const pthread_attr_t*, size_t*); +int pthread_attr_getguardsize(pthread_attr_t const*, size_t*); int pthread_attr_setguardsize(pthread_attr_t*, size_t); -int pthread_attr_getschedparam(const pthread_attr_t*, struct sched_param*); +int pthread_attr_getschedparam(pthread_attr_t const*, struct sched_param*); int pthread_attr_setschedparam(pthread_attr_t*, const struct sched_param*); -int pthread_attr_getstack(const pthread_attr_t*, void**, size_t*); +int pthread_attr_getstack(pthread_attr_t const*, void**, size_t*); int pthread_attr_setstack(pthread_attr_t* attr, void*, size_t); -int pthread_attr_getstacksize(const pthread_attr_t*, size_t*); +int pthread_attr_getstacksize(pthread_attr_t const*, size_t*); int pthread_attr_setstacksize(pthread_attr_t*, size_t); #define PTHREAD_SCOPE_SYSTEM 0 #define PTHREAD_SCOPE_PROCESS 1 -int pthread_attr_getscope(const pthread_attr_t*, int*); +int pthread_attr_getscope(pthread_attr_t const*, int*); int pthread_attr_setscope(pthread_attr_t*, int); int pthread_once(pthread_once_t*, void (*)(void)); #define PTHREAD_ONCE_INIT 0 void* pthread_getspecific(pthread_key_t key); -int pthread_setspecific(pthread_key_t key, const void* value); +int pthread_setspecific(pthread_key_t key, void const* value); int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param); int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param); @@ -88,7 +88,7 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param int pthread_key_create(pthread_key_t* key, void (*destructor)(void*)); int pthread_key_delete(pthread_key_t key); int pthread_cond_broadcast(pthread_cond_t*); -int pthread_cond_init(pthread_cond_t*, const pthread_condattr_t*); +int pthread_cond_init(pthread_cond_t*, pthread_condattr_t const*); int pthread_cond_signal(pthread_cond_t*); int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*); int pthread_condattr_init(pthread_condattr_t*); @@ -122,13 +122,13 @@ int pthread_mutexattr_settype(pthread_mutexattr_t*, int); int pthread_mutexattr_gettype(pthread_mutexattr_t*, int*); int pthread_mutexattr_destroy(pthread_mutexattr_t*); -int pthread_setname_np(pthread_t, const char*); +int pthread_setname_np(pthread_t, char const*); int pthread_getname_np(pthread_t, char*, size_t); int pthread_equal(pthread_t t1, pthread_t t2); int pthread_rwlock_destroy(pthread_rwlock_t*); -int pthread_rwlock_init(pthread_rwlock_t* __restrict, const pthread_rwlockattr_t* __restrict); +int pthread_rwlock_init(pthread_rwlock_t* __restrict, pthread_rwlockattr_t const* __restrict); int pthread_rwlock_rdlock(pthread_rwlock_t*); int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict, const struct timespec* __restrict); @@ -137,7 +137,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t*); int pthread_rwlock_unlock(pthread_rwlock_t*); int pthread_rwlock_wrlock(pthread_rwlock_t*); int pthread_rwlockattr_destroy(pthread_rwlockattr_t*); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict, int* __restrict); +int pthread_rwlockattr_getpshared(pthread_rwlockattr_t const* __restrict, int* __restrict); int pthread_rwlockattr_init(pthread_rwlockattr_t*); int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int); diff --git a/Userland/Libraries/LibPthread/pthread_cond.cpp b/Userland/Libraries/LibPthread/pthread_cond.cpp index f63978c988..5ba15c368e 100644 --- a/Userland/Libraries/LibPthread/pthread_cond.cpp +++ b/Userland/Libraries/LibPthread/pthread_cond.cpp @@ -64,7 +64,7 @@ static constexpr u32 NEED_TO_WAKE_ALL = 2; static constexpr u32 INCREMENT = 4; // https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_init.html -int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr) +int pthread_cond_init(pthread_cond_t* cond, pthread_condattr_t const* attr) { cond->mutex = nullptr; cond->value = 0; diff --git a/Userland/Libraries/LibPthread/semaphore.cpp b/Userland/Libraries/LibPthread/semaphore.cpp index 380355fffe..81564b1422 100644 --- a/Userland/Libraries/LibPthread/semaphore.cpp +++ b/Userland/Libraries/LibPthread/semaphore.cpp @@ -17,7 +17,7 @@ static constexpr u32 POST_WAKES = 1 << 31; // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html -sem_t* sem_open(const char*, int, ...) +sem_t* sem_open(char const*, int, ...) { errno = ENOSYS; return nullptr; @@ -31,7 +31,7 @@ int sem_close(sem_t*) } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_unlink.html -int sem_unlink(const char*) +int sem_unlink(char const*) { errno = ENOSYS; return -1; diff --git a/Userland/Libraries/LibPthread/semaphore.h b/Userland/Libraries/LibPthread/semaphore.h index afcbe11283..d04c22943e 100644 --- a/Userland/Libraries/LibPthread/semaphore.h +++ b/Userland/Libraries/LibPthread/semaphore.h @@ -21,10 +21,10 @@ int sem_close(sem_t*); int sem_destroy(sem_t*); int sem_getvalue(sem_t*, int*); int sem_init(sem_t*, int, unsigned int); -sem_t* sem_open(const char*, int, ...); +sem_t* sem_open(char const*, int, ...); int sem_post(sem_t*); int sem_trywait(sem_t*); -int sem_unlink(const char*); +int sem_unlink(char const*); int sem_wait(sem_t*); int sem_timedwait(sem_t*, const struct timespec* abstime); diff --git a/Userland/Libraries/LibRegex/C/Regex.cpp b/Userland/Libraries/LibRegex/C/Regex.cpp index 14affd613c..a3b9abcc75 100644 --- a/Userland/Libraries/LibRegex/C/Regex.cpp +++ b/Userland/Libraries/LibRegex/C/Regex.cpp @@ -36,14 +36,14 @@ static internal_regex_t* impl_from(regex_t* re) return reinterpret_cast<internal_regex_t*>(re->__data); } -static const internal_regex_t* impl_from(const regex_t* re) +static internal_regex_t const* impl_from(regex_t const* re) { return impl_from(const_cast<regex_t*>(re)); } extern "C" { -int regcomp(regex_t* reg, const char* pattern, int cflags) +int regcomp(regex_t* reg, char const* pattern, int cflags) { if (!reg) return REG_ESPACE; @@ -80,7 +80,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags) return REG_NOERR; } -int regexec(const regex_t* reg, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags) +int regexec(regex_t const* reg, char const* string, size_t nmatch, regmatch_t pmatch[], int eflags) { auto const* preg = impl_from(reg); @@ -210,7 +210,7 @@ inline static String get_error(ReError errcode) return error; } -size_t regerror(int errcode, const regex_t* reg, char* errbuf, size_t errbuf_size) +size_t regerror(int errcode, regex_t const* reg, char* errbuf, size_t errbuf_size) { String error; auto const* preg = impl_from(reg); diff --git a/Userland/Libraries/LibSQL/AST/AST.h b/Userland/Libraries/LibSQL/AST/AST.h index cf58e78f13..d9e242e97c 100644 --- a/Userland/Libraries/LibSQL/AST/AST.h +++ b/Userland/Libraries/LibSQL/AST/AST.h @@ -62,8 +62,8 @@ public: VERIFY(m_signed_numbers.size() <= 2); } - const String& name() const { return m_name; } - const NonnullRefPtrVector<SignedNumber>& signed_numbers() const { return m_signed_numbers; } + String const& name() const { return m_name; } + NonnullRefPtrVector<SignedNumber> const& signed_numbers() const { return m_signed_numbers; } private: String m_name; @@ -78,8 +78,8 @@ public: { } - const String& name() const { return m_name; } - const NonnullRefPtr<TypeName>& type_name() const { return m_type_name; } + String const& name() const { return m_name; } + NonnullRefPtr<TypeName> const& type_name() const { return m_type_name; } private: String m_name; @@ -95,9 +95,9 @@ public: { } - const String& table_name() const { return m_table_name; } - const Vector<String>& column_names() const { return m_column_names; } - const NonnullRefPtr<Select>& select_statement() const { return m_select_statement; } + String const& table_name() const { return m_table_name; } + Vector<String> const& column_names() const { return m_column_names; } + NonnullRefPtr<Select> const& select_statement() const { return m_select_statement; } private: String m_table_name; @@ -115,7 +115,7 @@ public: } bool recursive() const { return m_recursive; } - const NonnullRefPtrVector<CommonTableExpression>& common_table_expressions() const { return m_common_table_expressions; } + NonnullRefPtrVector<CommonTableExpression> const& common_table_expressions() const { return m_common_table_expressions; } private: bool m_recursive; @@ -131,9 +131,9 @@ public: { } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } - const String& alias() const { return m_alias; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } + String const& alias() const { return m_alias; } private: String m_schema_name; @@ -156,7 +156,7 @@ public: } bool return_all_columns() const { return m_columns.is_empty(); }; - const Vector<ColumnClause>& columns() const { return m_columns; } + Vector<ColumnClause> const& columns() const { return m_columns; } private: Vector<ColumnClause> m_columns; @@ -188,11 +188,11 @@ public: ResultType type() const { return m_type; } bool select_from_table() const { return !m_table_name.is_null(); } - const String& table_name() const { return m_table_name; } + String const& table_name() const { return m_table_name; } bool select_from_expression() const { return !m_expression.is_null(); } - const RefPtr<Expression>& expression() const { return m_expression; } - const String& column_alias() const { return m_column_alias; } + RefPtr<Expression> const& expression() const { return m_expression; } + String const& column_alias() const { return m_column_alias; } private: ResultType m_type { ResultType::All }; @@ -212,8 +212,8 @@ public: VERIFY(!m_group_by_list.is_empty()); } - const NonnullRefPtrVector<Expression>& group_by_list() const { return m_group_by_list; } - const RefPtr<Expression>& having_clause() const { return m_having_clause; } + NonnullRefPtrVector<Expression> const& group_by_list() const { return m_group_by_list; } + RefPtr<Expression> const& having_clause() const { return m_having_clause; } private: NonnullRefPtrVector<Expression> m_group_by_list; @@ -239,12 +239,12 @@ public: } bool is_table() const { return m_is_table; } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } - const String& table_alias() const { return m_table_alias; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } + String const& table_alias() const { return m_table_alias; } bool is_subquery() const { return m_is_subquery; } - const NonnullRefPtrVector<TableOrSubquery>& subqueries() const { return m_subqueries; } + NonnullRefPtrVector<TableOrSubquery> const& subqueries() const { return m_subqueries; } private: bool m_is_table { false }; @@ -266,8 +266,8 @@ public: { } - const NonnullRefPtr<Expression>& expression() const { return m_expression; } - const String& collation_name() const { return m_collation_name; } + NonnullRefPtr<Expression> const& expression() const { return m_expression; } + String const& collation_name() const { return m_collation_name; } Order order() const { return m_order; } Nulls nulls() const { return m_nulls; } @@ -286,8 +286,8 @@ public: { } - const NonnullRefPtr<Expression>& limit_expression() const { return m_limit_expression; } - const RefPtr<Expression>& offset_expression() const { return m_offset_expression; } + NonnullRefPtr<Expression> const& limit_expression() const { return m_limit_expression; } + RefPtr<Expression> const& offset_expression() const { return m_offset_expression; } private: NonnullRefPtr<Expression> m_limit_expression; @@ -336,7 +336,7 @@ public: { } - const String& value() const { return m_value; } + String const& value() const { return m_value; } virtual ResultOr<Value> evaluate(ExecutionContext&) const override; private: @@ -350,7 +350,7 @@ public: { } - const String& value() const { return m_value; } + String const& value() const { return m_value; } private: String m_value; @@ -363,7 +363,7 @@ public: class NestedExpression : public Expression { public: - const NonnullRefPtr<Expression>& expression() const { return m_expression; } + NonnullRefPtr<Expression> const& expression() const { return m_expression; } virtual ResultOr<Value> evaluate(ExecutionContext&) const override; protected: @@ -378,8 +378,8 @@ private: class NestedDoubleExpression : public Expression { public: - const NonnullRefPtr<Expression>& lhs() const { return m_lhs; } - const NonnullRefPtr<Expression>& rhs() const { return m_rhs; } + NonnullRefPtr<Expression> const& lhs() const { return m_lhs; } + NonnullRefPtr<Expression> const& rhs() const { return m_rhs; } protected: NestedDoubleExpression(NonnullRefPtr<Expression> lhs, NonnullRefPtr<Expression> rhs) @@ -432,9 +432,9 @@ public: { } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } - const String& column_name() const { return m_column_name; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } + String const& column_name() const { return m_column_name; } virtual ResultOr<Value> evaluate(ExecutionContext&) const override; private: @@ -547,7 +547,7 @@ public: { } - const NonnullRefPtrVector<Expression>& expressions() const { return m_expressions; } + NonnullRefPtrVector<Expression> const& expressions() const { return m_expressions; } virtual ResultOr<Value> evaluate(ExecutionContext&) const override; private: @@ -562,7 +562,7 @@ public: { } - const NonnullRefPtr<TypeName>& type_name() const { return m_type_name; } + NonnullRefPtr<TypeName> const& type_name() const { return m_type_name; } private: NonnullRefPtr<TypeName> m_type_name; @@ -583,9 +583,9 @@ public: VERIFY(!m_when_then_clauses.is_empty()); } - const RefPtr<Expression>& case_expression() const { return m_case_expression; } - const Vector<WhenThenClause>& when_then_clauses() const { return m_when_then_clauses; } - const RefPtr<Expression>& else_expression() const { return m_else_expression; } + RefPtr<Expression> const& case_expression() const { return m_case_expression; } + Vector<WhenThenClause> const& when_then_clauses() const { return m_when_then_clauses; } + RefPtr<Expression> const& else_expression() const { return m_else_expression; } private: RefPtr<Expression> m_case_expression; @@ -601,7 +601,7 @@ public: { } - const NonnullRefPtr<Select>& select_statement() const { return m_select_statement; } + NonnullRefPtr<Select> const& select_statement() const { return m_select_statement; } bool invert_expression() const { return m_invert_expression; } private: @@ -617,7 +617,7 @@ public: { } - const String& collation_name() const { return m_collation_name; } + String const& collation_name() const { return m_collation_name; } private: String m_collation_name; @@ -640,7 +640,7 @@ public: } MatchOperator type() const { return m_type; } - const RefPtr<Expression>& escape() const { return m_escape; } + RefPtr<Expression> const& escape() const { return m_escape; } virtual ResultOr<Value> evaluate(ExecutionContext&) const override; private: @@ -672,7 +672,7 @@ public: { } - const NonnullRefPtr<Expression>& expression() const { return m_expression; } + NonnullRefPtr<Expression> const& expression() const { return m_expression; } private: NonnullRefPtr<Expression> m_expression; @@ -686,7 +686,7 @@ public: { } - const NonnullRefPtr<Select>& select_statement() const { return m_select_statement; } + NonnullRefPtr<Select> const& select_statement() const { return m_select_statement; } private: NonnullRefPtr<Select> m_select_statement; @@ -700,7 +700,7 @@ public: { } - const NonnullRefPtr<ChainedExpression>& expression_chain() const { return m_expression_chain; } + NonnullRefPtr<ChainedExpression> const& expression_chain() const { return m_expression_chain; } private: NonnullRefPtr<ChainedExpression> m_expression_chain; @@ -715,8 +715,8 @@ public: { } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } private: String m_schema_name; @@ -748,7 +748,7 @@ public: { } - const String& schema_name() const { return m_schema_name; } + String const& schema_name() const { return m_schema_name; } bool is_error_if_schema_exists() const { return m_is_error_if_schema_exists; } ResultOr<ResultSet> execute(ExecutionContext&) const override; @@ -778,14 +778,14 @@ public: { } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } bool has_selection() const { return !m_select_statement.is_null(); } - const RefPtr<Select>& select_statement() const { return m_select_statement; } + RefPtr<Select> const& select_statement() const { return m_select_statement; } bool has_columns() const { return !m_columns.is_empty(); } - const NonnullRefPtrVector<ColumnDefinition>& columns() const { return m_columns; } + NonnullRefPtrVector<ColumnDefinition> const& columns() const { return m_columns; } bool is_temporary() const { return m_is_temporary; } bool is_error_if_table_exists() const { return m_is_error_if_table_exists; } @@ -803,8 +803,8 @@ private: class AlterTable : public Statement { public: - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } protected: AlterTable(String schema_name, String table_name) @@ -826,7 +826,7 @@ public: { } - const String& new_table_name() const { return m_new_table_name; } + String const& new_table_name() const { return m_new_table_name; } private: String m_new_table_name; @@ -841,8 +841,8 @@ public: { } - const String& column_name() const { return m_column_name; } - const String& new_column_name() const { return m_new_column_name; } + String const& column_name() const { return m_column_name; } + String const& new_column_name() const { return m_new_column_name; } private: String m_column_name; @@ -857,7 +857,7 @@ public: { } - const NonnullRefPtr<ColumnDefinition>& column() const { return m_column; } + NonnullRefPtr<ColumnDefinition> const& column() const { return m_column; } private: NonnullRefPtr<ColumnDefinition> m_column; @@ -871,7 +871,7 @@ public: { } - const String& column_name() const { return m_column_name; } + String const& column_name() const { return m_column_name; } private: String m_column_name; @@ -886,8 +886,8 @@ public: { } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } bool is_error_if_table_does_not_exist() const { return m_is_error_if_table_does_not_exist; } private: @@ -938,20 +938,20 @@ public: { } - const RefPtr<CommonTableExpressionList>& common_table_expression_list() const { return m_common_table_expression_list; } + RefPtr<CommonTableExpressionList> const& common_table_expression_list() const { return m_common_table_expression_list; } ConflictResolution conflict_resolution() const { return m_conflict_resolution; } - const String& schema_name() const { return m_schema_name; } - const String& table_name() const { return m_table_name; } - const String& alias() const { return m_alias; } - const Vector<String>& column_names() const { return m_column_names; } + String const& schema_name() const { return m_schema_name; } + String const& table_name() const { return m_table_name; } + String const& alias() const { return m_alias; } + Vector<String> const& column_names() const { return m_column_names; } bool default_values() const { return !has_expressions() && !has_selection(); }; bool has_expressions() const { return !m_chained_expressions.is_empty(); } - const NonnullRefPtrVector<ChainedExpression>& chained_expressions() const { return m_chained_expressions; } + NonnullRefPtrVector<ChainedExpression> const& chained_expressions() const { return m_chained_expressions; } bool has_selection() const { return !m_select_statement.is_null(); } - const RefPtr<Select>& select_statement() const { return m_select_statement; } + RefPtr<Select> const& select_statement() const { return m_select_statement; } virtual ResultOr<ResultSet> execute(ExecutionContext&) const override; @@ -984,13 +984,13 @@ public: { } - const RefPtr<CommonTableExpressionList>& common_table_expression_list() const { return m_common_table_expression_list; } + RefPtr<CommonTableExpressionList> const& common_table_expression_list() const { return m_common_table_expression_list; } ConflictResolution conflict_resolution() const { return m_conflict_resolution; } - const NonnullRefPtr<QualifiedTableName>& qualified_table_name() const { return m_qualified_table_name; } - const Vector<UpdateColumns>& update_columns() const { return m_update_columns; } - const NonnullRefPtrVector<TableOrSubquery>& table_or_subquery_list() const { return m_table_or_subquery_list; } - const RefPtr<Expression>& where_clause() const { return m_where_clause; } - const RefPtr<ReturningClause>& returning_clause() const { return m_returning_clause; } + NonnullRefPtr<QualifiedTableName> const& qualified_table_name() const { return m_qualified_table_name; } + Vector<UpdateColumns> const& update_columns() const { return m_update_columns; } + NonnullRefPtrVector<TableOrSubquery> const& table_or_subquery_list() const { return m_table_or_subquery_list; } + RefPtr<Expression> const& where_clause() const { return m_where_clause; } + RefPtr<ReturningClause> const& returning_clause() const { return m_returning_clause; } private: RefPtr<CommonTableExpressionList> m_common_table_expression_list; @@ -1012,10 +1012,10 @@ public: { } - const RefPtr<CommonTableExpressionList>& common_table_expression_list() const { return m_common_table_expression_list; } - const NonnullRefPtr<QualifiedTableName>& qualified_table_name() const { return m_qualified_table_name; } - const RefPtr<Expression>& where_clause() const { return m_where_clause; } - const RefPtr<ReturningClause>& returning_clause() const { return m_returning_clause; } + RefPtr<CommonTableExpressionList> const& common_table_expression_list() const { return m_common_table_expression_list; } + NonnullRefPtr<QualifiedTableName> const& qualified_table_name() const { return m_qualified_table_name; } + RefPtr<Expression> const& where_clause() const { return m_where_clause; } + RefPtr<ReturningClause> const& returning_clause() const { return m_returning_clause; } private: RefPtr<CommonTableExpressionList> m_common_table_expression_list; @@ -1038,14 +1038,14 @@ public: { } - const RefPtr<CommonTableExpressionList>& common_table_expression_list() const { return m_common_table_expression_list; } + RefPtr<CommonTableExpressionList> const& common_table_expression_list() const { return m_common_table_expression_list; } bool select_all() const { return m_select_all; } - const NonnullRefPtrVector<ResultColumn>& result_column_list() const { return m_result_column_list; } - const NonnullRefPtrVector<TableOrSubquery>& table_or_subquery_list() const { return m_table_or_subquery_list; } - const RefPtr<Expression>& where_clause() const { return m_where_clause; } - const RefPtr<GroupByClause>& group_by_clause() const { return m_group_by_clause; } - const NonnullRefPtrVector<OrderingTerm>& ordering_term_list() const { return m_ordering_term_list; } - const RefPtr<LimitClause>& limit_clause() const { return m_limit_clause; } + NonnullRefPtrVector<ResultColumn> const& result_column_list() const { return m_result_column_list; } + NonnullRefPtrVector<TableOrSubquery> const& table_or_subquery_list() const { return m_table_or_subquery_list; } + RefPtr<Expression> const& where_clause() const { return m_where_clause; } + RefPtr<GroupByClause> const& group_by_clause() const { return m_group_by_clause; } + NonnullRefPtrVector<OrderingTerm> const& ordering_term_list() const { return m_ordering_term_list; } + RefPtr<LimitClause> const& limit_clause() const { return m_limit_clause; } ResultOr<ResultSet> execute(ExecutionContext&) const override; private: diff --git a/Userland/Libraries/LibSQL/AST/Parser.cpp b/Userland/Libraries/LibSQL/AST/Parser.cpp index b081183729..94ed6f55e3 100644 --- a/Userland/Libraries/LibSQL/AST/Parser.cpp +++ b/Userland/Libraries/LibSQL/AST/Parser.cpp @@ -809,7 +809,7 @@ RefPtr<Expression> Parser::parse_between_expression(NonnullRefPtr<Expression> ex return create_ast_node<ErrorExpression>(); } - const auto& binary_expression = static_cast<const BinaryOperatorExpression&>(*nested); + auto const& binary_expression = static_cast<BinaryOperatorExpression const&>(*nested); if (binary_expression.type() != BinaryOperator::And) { expected("AND Expression"); return create_ast_node<ErrorExpression>(); @@ -1030,7 +1030,7 @@ NonnullRefPtr<OrderingTerm> Parser::parse_ordering_term() String collation_name; if (is<CollateExpression>(*expression)) { - const auto& collate = static_cast<const CollateExpression&>(*expression); + auto const& collate = static_cast<CollateExpression const&>(*expression); collation_name = collate.collation_name(); expression = collate.expression(); } else if (consume_if(TokenType::Collate)) { diff --git a/Userland/Libraries/LibSQL/AST/Parser.h b/Userland/Libraries/LibSQL/AST/Parser.h index 6a4db5695d..9d35018d3f 100644 --- a/Userland/Libraries/LibSQL/AST/Parser.h +++ b/Userland/Libraries/LibSQL/AST/Parser.h @@ -38,7 +38,7 @@ public: NonnullRefPtr<Statement> next_statement(); bool has_errors() const { return m_parser_state.m_errors.size(); } - const Vector<Error>& errors() const { return m_parser_state.m_errors; } + Vector<Error> const& errors() const { return m_parser_state.m_errors; } protected: NonnullRefPtr<Expression> parse_expression(); // Protected for unit testing. diff --git a/Userland/Libraries/LibSQL/Meta.cpp b/Userland/Libraries/LibSQL/Meta.cpp index 5dab68e598..8202c9d9be 100644 --- a/Userland/Libraries/LibSQL/Meta.cpp +++ b/Userland/Libraries/LibSQL/Meta.cpp @@ -65,7 +65,7 @@ Key ColumnDef::key() const return key; } -void ColumnDef::set_default_value(const Value& default_value) +void ColumnDef::set_default_value(Value const& default_value) { VERIFY(default_value.type() == type()); m_default = default_value; diff --git a/Userland/Libraries/LibSQL/Tuple.cpp b/Userland/Libraries/LibSQL/Tuple.cpp index a25a057cbb..58a96fabe8 100644 --- a/Userland/Libraries/LibSQL/Tuple.cpp +++ b/Userland/Libraries/LibSQL/Tuple.cpp @@ -117,7 +117,7 @@ Value& Tuple::operator[](String const& name) return (*this)[index.value()]; } -void Tuple::append(const Value& value) +void Tuple::append(Value const& value) { VERIFY(descriptor()->size() >= size()); if (descriptor()->size() == size()) { @@ -198,7 +198,7 @@ Vector<String> Tuple::to_string_vector() const return ret; } -void Tuple::copy_from(const Tuple& other) +void Tuple::copy_from(Tuple const& other) { if (*m_descriptor != *other.m_descriptor) { m_descriptor->clear(); @@ -213,7 +213,7 @@ void Tuple::copy_from(const Tuple& other) m_pointer = other.pointer(); } -int Tuple::compare(const Tuple& other) const +int Tuple::compare(Tuple const& other) const { auto num_values = min(m_data.size(), other.m_data.size()); VERIFY(num_values > 0); @@ -228,7 +228,7 @@ int Tuple::compare(const Tuple& other) const return 0; } -int Tuple::match(const Tuple& other) const +int Tuple::match(Tuple const& other) const { auto other_index = 0u; for (auto& part : *other.descriptor()) { diff --git a/Userland/Libraries/LibSanitizer/UBSanitizer.cpp b/Userland/Libraries/LibSanitizer/UBSanitizer.cpp index 7411a34ff6..c86a74d9af 100644 --- a/Userland/Libraries/LibSanitizer/UBSanitizer.cpp +++ b/Userland/Libraries/LibSanitizer/UBSanitizer.cpp @@ -17,7 +17,7 @@ Atomic<bool> AK::UBSanitizer::g_ubsan_is_deadly; extern "C" { -static void print_location(const SourceLocation& location) +static void print_location(SourceLocation const& location) { if (!location.filename()) { WARNLN_AND_DBGLN("UBSAN: in unknown file"); @@ -76,8 +76,8 @@ void __ubsan_handle_nullability_arg(NonnullArgData& data) print_location(location); } -void __ubsan_handle_nonnull_return_v1(const NonnullReturnData&, SourceLocation&) __attribute__((used)); -void __ubsan_handle_nonnull_return_v1(const NonnullReturnData&, SourceLocation& location) +void __ubsan_handle_nonnull_return_v1(NonnullReturnData const&, SourceLocation&) __attribute__((used)); +void __ubsan_handle_nonnull_return_v1(NonnullReturnData const&, SourceLocation& location) { auto loc = location.permanently_clear(); if (!loc.needs_logging()) @@ -86,8 +86,8 @@ void __ubsan_handle_nonnull_return_v1(const NonnullReturnData&, SourceLocation& print_location(loc); } -void __ubsan_handle_nullability_return_v1(const NonnullReturnData& data, SourceLocation& location) __attribute__((used)); -void __ubsan_handle_nullability_return_v1(const NonnullReturnData&, SourceLocation& location) +void __ubsan_handle_nullability_return_v1(NonnullReturnData const& data, SourceLocation& location) __attribute__((used)); +void __ubsan_handle_nullability_return_v1(NonnullReturnData const&, SourceLocation& location) { auto loc = location.permanently_clear(); if (!loc.needs_logging()) @@ -258,8 +258,8 @@ void __ubsan_handle_implicit_conversion(ImplicitConversionData& data, ValueHandl auto location = data.location.permanently_clear(); if (!location.needs_logging()) return; - const char* src_signed = data.from_type.is_signed() ? "" : "un"; - const char* dst_signed = data.to_type.is_signed() ? "" : "un"; + char const* src_signed = data.from_type.is_signed() ? "" : "un"; + char const* dst_signed = data.to_type.is_signed() ? "" : "un"; WARNLN_AND_DBGLN("UBSAN: implicit conversion from type {} ({}-bit, {}signed) to type {} ({}-bit, {}signed)", data.from_type.name(), data.from_type.bit_width(), src_signed, data.to_type.name(), data.to_type.bit_width(), dst_signed); print_location(location); diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 3db74a188a..20dc857d1b 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -44,18 +44,18 @@ using AK::SIMD::to_f32x4; using AK::SIMD::to_u32x4; using AK::SIMD::u32x4; -constexpr static float edge_function(const FloatVector2& a, const FloatVector2& b, const FloatVector2& c) +constexpr static float edge_function(FloatVector2 const& a, FloatVector2 const& b, FloatVector2 const& c) { return (c.x() - a.x()) * (b.y() - a.y()) - (c.y() - a.y()) * (b.x() - a.x()); } -constexpr static f32x4 edge_function4(const FloatVector2& a, const FloatVector2& b, const Vector2<f32x4>& c) +constexpr static f32x4 edge_function4(FloatVector2 const& a, FloatVector2 const& b, Vector2<f32x4> const& c) { return (c.x() - a.x()) * (b.y() - a.y()) - (c.y() - a.y()) * (b.x() - a.x()); } template<typename T, typename U> -constexpr static auto interpolate(const T& v0, const T& v1, const T& v2, const Vector3<U>& barycentric_coords) +constexpr static auto interpolate(const T& v0, const T& v1, const T& v2, Vector3<U> const& barycentric_coords) { return v0 * barycentric_coords.x() + v1 * barycentric_coords.y() + v2 * barycentric_coords.z(); } @@ -175,7 +175,7 @@ void Device::setup_blend_factors() } } -void Device::rasterize_triangle(const Triangle& triangle) +void Device::rasterize_triangle(Triangle const& triangle) { INCREASE_STATISTICS_COUNTER(g_num_rasterized_triangles, 1); @@ -1190,7 +1190,7 @@ void Device::draw_statistics_overlay(Gfx::Bitmap& target) painter.draw_text(target.rect().translated(2, 2), debug_string, font, Gfx::TextAlignment::TopLeft, Gfx::Color::White); } -void Device::set_options(const RasterizerOptions& options) +void Device::set_options(RasterizerOptions const& options) { m_options = options; @@ -1198,7 +1198,7 @@ void Device::set_options(const RasterizerOptions& options) setup_blend_factors(); } -void Device::set_light_model_params(const LightModelParameters& lighting_model) +void Device::set_light_model_params(LightModelParameters const& lighting_model) { m_lighting_model = lighting_model; } diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h index aefc01aa96..86568ec57b 100644 --- a/Userland/Libraries/LibSoftGPU/Device.h +++ b/Userland/Libraries/LibSoftGPU/Device.h @@ -111,7 +111,7 @@ struct StencilConfiguration { class Device final { public: - Device(const Gfx::IntSize& min_size); + Device(Gfx::IntSize const& min_size); DeviceInfo info() const; @@ -123,8 +123,8 @@ public: void blit_color_buffer_to(Gfx::Bitmap& target); void blit_to_color_buffer_at_raster_position(Gfx::Bitmap const&); void blit_to_depth_buffer_at_raster_position(Vector<DepthType> const&, int, int); - void set_options(const RasterizerOptions&); - void set_light_model_params(const LightModelParameters&); + void set_options(RasterizerOptions const&); + void set_light_model_params(LightModelParameters const&); RasterizerOptions options() const { return m_options; } LightModelParameters light_model() const { return m_lighting_model; } ColorType get_color_buffer_pixel(int x, int y); @@ -145,7 +145,7 @@ private: void draw_statistics_overlay(Gfx::Bitmap&); Gfx::IntRect get_rasterization_rect_of_size(Gfx::IntSize size); - void rasterize_triangle(const Triangle& triangle); + void rasterize_triangle(Triangle const& triangle); void setup_blend_factors(); void shade_fragments(PixelQuad&); bool test_alpha(PixelQuad&); diff --git a/Userland/Libraries/LibSymbolication/Symbolication.cpp b/Userland/Libraries/LibSymbolication/Symbolication.cpp index 42852a0fb6..bef6ca0b2c 100644 --- a/Userland/Libraries/LibSymbolication/Symbolication.cpp +++ b/Userland/Libraries/LibSymbolication/Symbolication.cpp @@ -211,7 +211,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in bool first_frame = true; for (auto address : stack) { - const RegionWithSymbols* found_region = nullptr; + RegionWithSymbols const* found_region = nullptr; for (auto& region : regions) { FlatPtr region_end; if (Checked<FlatPtr>::addition_would_overflow(region.base, region.size)) diff --git a/Userland/Libraries/LibSyntax/Highlighter.h b/Userland/Libraries/LibSyntax/Highlighter.h index 984c52857d..e6a2cc487c 100644 --- a/Userland/Libraries/LibSyntax/Highlighter.h +++ b/Userland/Libraries/LibSyntax/Highlighter.h @@ -29,7 +29,7 @@ enum class Language { struct TextStyle { const Gfx::Color color; - const bool bold { false }; + bool const bold { false }; }; class Highlighter { @@ -41,7 +41,7 @@ public: virtual Language language() const = 0; StringView language_string(Language) const; - virtual void rehighlight(const Palette&) = 0; + virtual void rehighlight(Palette const&) = 0; virtual void highlight_matching_token_pair(); virtual bool is_identifier(u64) const { return false; }; @@ -125,7 +125,7 @@ public: private: virtual Vector<GUI::TextDocumentSpan>& spans() override { return m_spans; } - virtual const Vector<GUI::TextDocumentSpan>& spans() const override { return m_spans; } + virtual Vector<GUI::TextDocumentSpan> const& spans() const override { return m_spans; } virtual void set_span_at_index(size_t index, GUI::TextDocumentSpan span) override { m_spans.at(index) = move(span); } virtual String highlighter_did_request_text() const override { return m_text; } diff --git a/Userland/Libraries/LibSyntax/HighlighterClient.h b/Userland/Libraries/LibSyntax/HighlighterClient.h index 60ee1bb9ab..1edd69fac6 100644 --- a/Userland/Libraries/LibSyntax/HighlighterClient.h +++ b/Userland/Libraries/LibSyntax/HighlighterClient.h @@ -18,7 +18,7 @@ public: virtual ~HighlighterClient() = default; virtual Vector<GUI::TextDocumentSpan>& spans() = 0; - virtual const Vector<GUI::TextDocumentSpan>& spans() const = 0; + virtual Vector<GUI::TextDocumentSpan> const& spans() const = 0; virtual void set_span_at_index(size_t index, GUI::TextDocumentSpan span) = 0; virtual String highlighter_did_request_text() const = 0; diff --git a/Userland/Libraries/LibTLS/Certificate.h b/Userland/Libraries/LibTLS/Certificate.h index 15f352d50d..b806e4213e 100644 --- a/Userland/Libraries/LibTLS/Certificate.h +++ b/Userland/Libraries/LibTLS/Certificate.h @@ -63,7 +63,7 @@ class DefaultRootCACertificates { public: DefaultRootCACertificates(); - const Vector<Certificate>& certificates() const { return m_ca_certificates; } + Vector<Certificate> const& certificates() const { return m_ca_certificates; } static DefaultRootCACertificates& the() { return s_the; } diff --git a/Userland/Libraries/LibTLS/Handshake.cpp b/Userland/Libraries/LibTLS/Handshake.cpp index 6a7c160546..5720674be7 100644 --- a/Userland/Libraries/LibTLS/Handshake.cpp +++ b/Userland/Libraries/LibTLS/Handshake.cpp @@ -99,7 +99,7 @@ ByteBuffer TLSv12::build_hello() builder.append((u8)0); // SNI host length + value builder.append((u16)sni_length); - builder.append((const u8*)m_context.extensions.SNI.characters(), sni_length); + builder.append((u8 const*)m_context.extensions.SNI.characters(), sni_length); } // signature_algorithms extension @@ -180,7 +180,7 @@ ByteBuffer TLSv12::build_handshake_finished() auto digest = m_context.handshake_hash.digest(); auto hashbuf = ReadonlyBytes { digest.immutable_data(), m_context.handshake_hash.digest_size() }; - pseudorandom_function(outbuffer, m_context.master_key, (const u8*)"client finished", 15, hashbuf, dummy); + pseudorandom_function(outbuffer, m_context.master_key, (u8 const*)"client finished", 15, hashbuf, dummy); builder.append(outbuffer); auto packet = builder.build(); @@ -314,7 +314,7 @@ ssize_t TLSv12::handle_handshake_payload(ReadonlyBytes vbuffer) } payload_res = handle_certificate(buffer.slice(1, payload_size)); if (m_context.certificates.size()) { - auto it = m_context.certificates.find_if([](const auto& cert) { return cert.is_valid(); }); + auto it = m_context.certificates.find_if([](auto const& cert) { return cert.is_valid(); }); if (it.is_end()) { // no valid certificates diff --git a/Userland/Libraries/LibTLS/HandshakeClient.cpp b/Userland/Libraries/LibTLS/HandshakeClient.cpp index 1420e7a1ef..2f2efbccfd 100644 --- a/Userland/Libraries/LibTLS/HandshakeClient.cpp +++ b/Userland/Libraries/LibTLS/HandshakeClient.cpp @@ -36,7 +36,7 @@ bool TLSv12::expand_key() pseudorandom_function( key_buffer, m_context.master_key, - (const u8*)"key expansion", 13, + (u8 const*)"key expansion", 13, ReadonlyBytes { m_context.remote_random, sizeof(m_context.remote_random) }, ReadonlyBytes { m_context.local_random, sizeof(m_context.local_random) }); @@ -129,7 +129,7 @@ bool TLSv12::compute_master_secret_from_pre_master_secret(size_t length) pseudorandom_function( m_context.master_key, m_context.premaster_key, - (const u8*)"master secret", 13, + (u8 const*)"master secret", 13, ReadonlyBytes { m_context.local_random, sizeof(m_context.local_random) }, ReadonlyBytes { m_context.remote_random, sizeof(m_context.remote_random) }); @@ -211,7 +211,7 @@ void TLSv12::build_rsa_pre_master_secret(PacketBuilder& builder) } m_context.premaster_key = premaster_key_result.release_value(); - const auto& certificate_option = verify_chain_and_get_matching_certificate(m_context.extensions.SNI); // if the SNI is empty, we'll make a special case and match *a* leaf certificate. + auto const& certificate_option = verify_chain_and_get_matching_certificate(m_context.extensions.SNI); // if the SNI is empty, we'll make a special case and match *a* leaf certificate. if (!certificate_option.has_value()) { dbgln("certificate verification failed :("); alert(AlertLevel::Critical, AlertDescription::BadCertificate); diff --git a/Userland/Libraries/LibTLS/HandshakeServer.cpp b/Userland/Libraries/LibTLS/HandshakeServer.cpp index e263d82d4d..92ca783706 100644 --- a/Userland/Libraries/LibTLS/HandshakeServer.cpp +++ b/Userland/Libraries/LibTLS/HandshakeServer.cpp @@ -133,7 +133,7 @@ ssize_t TLSv12::handle_server_hello(ReadonlyBytes buffer, WritePacketStage& writ // Exactly one ServerName should be present if (buffer.size() - res < 3) return (i8)Error::NeedMoreData; - auto sni_name_type = (NameType)(*(const u8*)buffer.offset_pointer(res++)); + auto sni_name_type = (NameType)(*(u8 const*)buffer.offset_pointer(res++)); auto sni_name_length = AK::convert_between_host_and_network_endian(ByteReader::load16(buffer.offset_pointer(res += 2))); if (sni_name_type != NameType::HostName) @@ -145,7 +145,7 @@ ssize_t TLSv12::handle_server_hello(ReadonlyBytes buffer, WritePacketStage& writ // Read out the host_name if (buffer.size() - res < sni_name_length) return (i8)Error::NeedMoreData; - m_context.extensions.SNI = String { (const char*)buffer.offset_pointer(res), sni_name_length }; + m_context.extensions.SNI = String { (char const*)buffer.offset_pointer(res), sni_name_length }; res += sni_name_length; dbgln("SNI host_name: {}", m_context.extensions.SNI); } @@ -153,13 +153,13 @@ ssize_t TLSv12::handle_server_hello(ReadonlyBytes buffer, WritePacketStage& writ if (buffer.size() - res > 2) { auto alpn_length = AK::convert_between_host_and_network_endian(ByteReader::load16(buffer.offset_pointer(res))); if (alpn_length && alpn_length <= extension_length - 2) { - const u8* alpn = buffer.offset_pointer(res + 2); + u8 const* alpn = buffer.offset_pointer(res + 2); size_t alpn_position = 0; while (alpn_position < alpn_length) { u8 alpn_size = alpn[alpn_position++]; if (alpn_size + alpn_position >= extension_length) break; - String alpn_str { (const char*)alpn + alpn_position, alpn_length }; + String alpn_str { (char const*)alpn + alpn_position, alpn_length }; if (alpn_size && m_context.alpn.contains_slow(alpn_str)) { m_context.negotiated_alpn = alpn_str; dbgln("negotiated alpn: {}", alpn_str); diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 2063e168d9..00c63b38e9 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -274,20 +274,20 @@ void TLSv12::ensure_hmac(size_t digest_size, bool local) m_hmac_remote = move(hmac); } -ByteBuffer TLSv12::hmac_message(ReadonlyBytes buf, const Optional<ReadonlyBytes> buf2, size_t mac_length, bool local) +ByteBuffer TLSv12::hmac_message(ReadonlyBytes buf, Optional<ReadonlyBytes> const buf2, size_t mac_length, bool local) { u64 sequence_number = AK::convert_between_host_and_network_endian(local ? m_context.local_sequence_number : m_context.remote_sequence_number); ensure_hmac(mac_length, local); auto& hmac = local ? *m_hmac_local : *m_hmac_remote; if constexpr (TLS_DEBUG) { dbgln("========================= PACKET DATA =========================="); - print_buffer((const u8*)&sequence_number, sizeof(u64)); + print_buffer((u8 const*)&sequence_number, sizeof(u64)); print_buffer(buf.data(), buf.size()); if (buf2.has_value()) print_buffer(buf2.value().data(), buf2.value().size()); dbgln("========================= PACKET DATA =========================="); } - hmac.update((const u8*)&sequence_number, sizeof(u64)); + hmac.update((u8 const*)&sequence_number, sizeof(u64)); hmac.update(buf); if (buf2.has_value() && buf2.value().size()) { hmac.update(buf2.value()); diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index f63900d790..79ba5d08a7 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -71,7 +71,7 @@ ErrorOr<size_t> TLSv12::write(ReadonlyBytes bytes) return bytes.size(); } -ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(const String& host, u16 port, Options options) +ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, u16 port, Options options) { Core::EventLoop loop; OwnPtr<Core::Stream::Socket> tcp_socket = TRY(Core::Stream::TCPSocket::connect(host, port)); @@ -93,7 +93,7 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(const String& host, u16 port, Opt return AK::Error::from_string_literal(alert_name(static_cast<AlertDescription>(256 - result))); } -ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(const String& host, Core::Stream::Socket& underlying_stream, Options options) +ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, Core::Stream::Socket& underlying_stream, Options options) { StreamVariantType socket { &underlying_stream }; auto tls_socket = make<TLSv12>(&underlying_stream, move(options)); diff --git a/Userland/Libraries/LibTLS/TLSPacketBuilder.h b/Userland/Libraries/LibTLS/TLSPacketBuilder.h index fa43b2a40a..6c864a3700 100644 --- a/Userland/Libraries/LibTLS/TLSPacketBuilder.h +++ b/Userland/Libraries/LibTLS/TLSPacketBuilder.h @@ -46,11 +46,11 @@ public: inline void append(u16 value) { value = AK::convert_between_host_and_network_endian(value); - append((const u8*)&value, sizeof(value)); + append((u8 const*)&value, sizeof(value)); } inline void append(u8 value) { - append((const u8*)&value, sizeof(value)); + append((u8 const*)&value, sizeof(value)); } inline void append(ReadonlyBytes data) { @@ -67,7 +67,7 @@ public: append(buf, 3); } - inline void append(const u8* data, size_t bytes) + inline void append(u8 const* data, size_t bytes) { if (bytes == 0) return; diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp index bd9a2a4280..240cfd9399 100644 --- a/Userland/Libraries/LibTLS/TLSv12.cpp +++ b/Userland/Libraries/LibTLS/TLSv12.cpp @@ -191,7 +191,7 @@ bool Context::verify_chain() const if (!options.validate_certificates) return true; - const Vector<Certificate>* local_chain = nullptr; + Vector<Certificate> const* local_chain = nullptr; if (is_server) { dbgln("Unsupported: Server mode"); TODO(); @@ -236,7 +236,7 @@ bool Context::verify_chain() const } template<typename HMACType> -static void hmac_pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) +static void hmac_pseudorandom_function(Bytes output, ReadonlyBytes secret, u8 const* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) { if (!secret.size()) { dbgln("null secret"); @@ -274,7 +274,7 @@ static void hmac_pseudorandom_function(Bytes output, ReadonlyBytes secret, const } } -void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) +void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, u8 const* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) { // Simplification: We only support the HMAC PRF with the hash function SHA-256 or stronger. diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index cad8f945ba..d04d4ec830 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -28,12 +28,12 @@ inline void print_buffer(ReadonlyBytes buffer) dbgln("{:hex-dump}", buffer); } -inline void print_buffer(const ByteBuffer& buffer) +inline void print_buffer(ByteBuffer const& buffer) { print_buffer(buffer.bytes()); } -inline void print_buffer(const u8* buffer, size_t size) +inline void print_buffer(u8 const* buffer, size_t size) { print_buffer(ReadonlyBytes { buffer, size }); } @@ -75,7 +75,7 @@ enum class AlertDescription : u8 { #undef ENUMERATE_ALERT_DESCRIPTION }; -constexpr static const char* alert_name(AlertDescription descriptor) +constexpr static char const* alert_name(AlertDescription descriptor) { #define ENUMERATE_ALERT_DESCRIPTION(name, value) \ case AlertDescription::name: \ @@ -445,7 +445,7 @@ private: void consume(ReadonlyBytes record); - ByteBuffer hmac_message(ReadonlyBytes buf, const Optional<ReadonlyBytes> buf2, size_t mac_length, bool local = false); + ByteBuffer hmac_message(ReadonlyBytes buf, Optional<ReadonlyBytes> const buf2, size_t mac_length, bool local = false); void ensure_hmac(size_t digest_size, bool local); void update_packet(ByteBuffer& packet); @@ -486,7 +486,7 @@ private: ssize_t handle_message(ReadonlyBytes); ssize_t handle_random(ReadonlyBytes); - void pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b); + void pseudorandom_function(Bytes output, ReadonlyBytes secret, u8 const* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b); ssize_t verify_rsa_server_key_exchange(ReadonlyBytes server_key_info_buffer, ReadonlyBytes signature_buffer); diff --git a/Userland/Libraries/LibTest/CrashTest.cpp b/Userland/Libraries/LibTest/CrashTest.cpp index 419867342a..f77a1de069 100644 --- a/Userland/Libraries/LibTest/CrashTest.cpp +++ b/Userland/Libraries/LibTest/CrashTest.cpp @@ -78,7 +78,7 @@ bool Crash::do_report(Report report) out("\x1B[31mFAIL\x1B[0m: "); report.visit( - [&](const Failure& failure) { + [&](Failure const& failure) { switch (failure) { case Failure::DidNotCrash: out("Did not crash"); @@ -90,7 +90,7 @@ bool Crash::do_report(Report report) VERIFY_NOT_REACHED(); } }, - [&](const int& signal) { + [&](int const& signal) { out("Terminated with signal {}", signal); }); diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index 7c0cb92d7c..b9ab53af2d 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -96,7 +96,7 @@ { \ ::Test::JS::g_run_file = hook; \ } \ - static ::Test::JS::IntermediateRunFileResult hook(const String&, JS::Interpreter&, JS::ExecutionContext&); \ + static ::Test::JS::IntermediateRunFileResult hook(String const&, JS::Interpreter&, JS::ExecutionContext&); \ } __testjs_common_run_file {}; \ ::Test::JS::IntermediateRunFileResult __TestJS_run_file::hook(__VA_ARGS__) @@ -164,7 +164,7 @@ enum class RunFileHookResult { }; using IntermediateRunFileResult = AK::Result<JSFileResult, RunFileHookResult>; -extern IntermediateRunFileResult (*g_run_file)(const String&, JS::Interpreter&, JS::ExecutionContext&); +extern IntermediateRunFileResult (*g_run_file)(String const&, JS::Interpreter&, JS::ExecutionContext&); class TestRunner : public ::Test::TestRunner { public: @@ -178,10 +178,10 @@ public: virtual ~TestRunner() = default; protected: - virtual void do_run_single_test(const String& test_path, size_t, size_t) override; + virtual void do_run_single_test(String const& test_path, size_t, size_t) override; virtual Vector<String> get_test_paths() const override; - virtual JSFileResult run_file_test(const String& test_path); - void print_file_result(const JSFileResult& file_result) const; + virtual JSFileResult run_file_test(String const& test_path); + void print_file_result(JSFileResult const& file_result) const; String m_common_path; }; @@ -261,7 +261,7 @@ inline ErrorOr<JsonValue> get_test_results(JS::Interpreter& interpreter) return JsonValue::from_string(json_string); } -inline void TestRunner::do_run_single_test(const String& test_path, size_t, size_t) +inline void TestRunner::do_run_single_test(String const& test_path, size_t, size_t) { auto file_result = run_file_test(test_path); if (!m_print_json) @@ -274,7 +274,7 @@ inline void TestRunner::do_run_single_test(const String& test_path, size_t, size inline Vector<String> TestRunner::get_test_paths() const { Vector<String> paths; - iterate_directory_recursively(m_test_root, [&](const String& file_path) { + iterate_directory_recursively(m_test_root, [&](String const& file_path) { if (!file_path.ends_with(".js")) return; if (!file_path.ends_with("test-common.js")) @@ -284,7 +284,7 @@ inline Vector<String> TestRunner::get_test_paths() const return paths; } -inline JSFileResult TestRunner::run_file_test(const String& test_path) +inline JSFileResult TestRunner::run_file_test(String const& test_path) { g_currently_running_test = test_path; @@ -404,7 +404,7 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path) file_result.logged_messages.append(message.to_string_without_side_effects()); } - test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) { + test_json.value().as_object().for_each_member([&](String const& suite_name, JsonValue const& suite_value) { Test::Suite suite { test_path, suite_name }; VERIFY(suite_value.is_object()); @@ -461,7 +461,7 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path) return file_result; } -inline void TestRunner::print_file_result(const JSFileResult& file_result) const +inline void TestRunner::print_file_result(JSFileResult const& file_result) const { if (file_result.most_severe_test_result == Test::Result::Fail || file_result.error.has_value()) { print_modifiers({ BG_RED, FG_BLACK, FG_BOLD }); diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp index 7b5bc0df75..a4a6e41bd2 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp +++ b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp @@ -25,7 +25,7 @@ HashMap<String, FunctionWithLength> s_exposed_global_functions; Function<void()> g_main_hook; Function<NonnullOwnPtr<JS::Interpreter>()> g_create_interpreter_hook; HashMap<bool*, Tuple<String, String, char>> g_extra_args; -IntermediateRunFileResult (*g_run_file)(const String&, JS::Interpreter&, JS::ExecutionContext&) = nullptr; +IntermediateRunFileResult (*g_run_file)(String const&, JS::Interpreter&, JS::ExecutionContext&) = nullptr; String g_test_root; int g_test_argc; char** g_test_argv; @@ -88,7 +88,7 @@ int main(int argc, char** argv) #endif bool print_json = false; bool per_file = false; - const char* specified_test_root = nullptr; + char const* specified_test_root = nullptr; String common_path; String test_glob; diff --git a/Userland/Libraries/LibTest/Macros.h b/Userland/Libraries/LibTest/Macros.h index 6f32e0ae13..7fd1912c3e 100644 --- a/Userland/Libraries/LibTest/Macros.h +++ b/Userland/Libraries/LibTest/Macros.h @@ -14,7 +14,7 @@ namespace AK { template<typename... Parameters> -void warnln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&...); +void warnln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&...); } namespace Test { diff --git a/Userland/Libraries/LibTest/TestCase.h b/Userland/Libraries/LibTest/TestCase.h index 866bba5d2e..18efcccf90 100644 --- a/Userland/Libraries/LibTest/TestCase.h +++ b/Userland/Libraries/LibTest/TestCase.h @@ -20,7 +20,7 @@ using TestFunction = Function<void()>; class TestCase : public RefCounted<TestCase> { public: - TestCase(const String& name, TestFunction&& fn, bool is_benchmark) + TestCase(String const& name, TestFunction&& fn, bool is_benchmark) : m_name(name) , m_function(move(fn)) , m_is_benchmark(is_benchmark) @@ -28,8 +28,8 @@ public: } bool is_benchmark() const { return m_is_benchmark; } - const String& name() const { return m_name; } - const TestFunction& func() const { return m_function; } + String const& name() const { return m_name; } + TestFunction const& func() const { return m_function; } private: String m_name; @@ -38,7 +38,7 @@ private: }; // Helper to hide implementation of TestSuite from users -void add_test_case_to_suite(const NonnullRefPtr<TestCase>& test_case); +void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case); void set_suite_setup_function(Function<void()> setup); } diff --git a/Userland/Libraries/LibTest/TestRunner.h b/Userland/Libraries/LibTest/TestRunner.h index 4e8bad2a40..bde37c12bf 100644 --- a/Userland/Libraries/LibTest/TestRunner.h +++ b/Userland/Libraries/LibTest/TestRunner.h @@ -44,7 +44,7 @@ public: virtual void run(String test_glob); - const Test::Counts& counts() const { return m_counts; } + Test::Counts const& counts() const { return m_counts; } bool is_printing_progress() const { return m_print_progress; } @@ -65,8 +65,8 @@ protected: void print_test_results_as_json() const; virtual Vector<String> get_test_paths() const = 0; - virtual void do_run_single_test(const String&, size_t current_test_index, size_t num_tests) = 0; - virtual const Vector<String>* get_failed_test_names() const { return nullptr; } + virtual void do_run_single_test(String const&, size_t current_test_index, size_t num_tests) = 0; + virtual Vector<String> const* get_failed_test_names() const { return nullptr; } String m_test_root; bool m_print_times; @@ -101,7 +101,7 @@ inline double get_time_in_ms() } template<typename Callback> -inline void iterate_directory_recursively(const String& directory_path, Callback callback) +inline void iterate_directory_recursively(String const& directory_path, Callback callback) { Core::DirIterator directory_iterator(directory_path, Core::DirIterator::Flags::SkipDots); diff --git a/Userland/Libraries/LibTest/TestSuite.cpp b/Userland/Libraries/LibTest/TestSuite.cpp index e6923040ea..1eca37492d 100644 --- a/Userland/Libraries/LibTest/TestSuite.cpp +++ b/Userland/Libraries/LibTest/TestSuite.cpp @@ -45,7 +45,7 @@ void current_test_case_did_fail() } // Declared in TestCase.h -void add_test_case_to_suite(const NonnullRefPtr<TestCase>& test_case) +void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case) { TestSuite::the().add_case(test_case); } @@ -56,7 +56,7 @@ void set_suite_setup_function(Function<void()> setup) TestSuite::the().set_suite_setup(move(setup)); } -int TestSuite::main(const String& suite_name, int argc, char** argv) +int TestSuite::main(String const& suite_name, int argc, char** argv) { m_suite_name = suite_name; @@ -65,7 +65,7 @@ int TestSuite::main(const String& suite_name, int argc, char** argv) bool do_tests_only = getenv("TESTS_ONLY") != nullptr; bool do_benchmarks_only = false; bool do_list_cases = false; - const char* search_string = "*"; + char const* search_string = "*"; args_parser.add_option(do_tests_only, "Only run tests.", "tests", 0); args_parser.add_option(do_benchmarks_only, "Only run benchmarks.", "bench", 0); @@ -76,11 +76,11 @@ int TestSuite::main(const String& suite_name, int argc, char** argv) if (m_setup) m_setup(); - const auto& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only); + auto const& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only); if (do_list_cases) { outln("Available cases for {}:", suite_name); - for (const auto& test : matching_tests) { + for (auto const& test : matching_tests) { outln(" {}", test.name()); } return 0; @@ -91,10 +91,10 @@ int TestSuite::main(const String& suite_name, int argc, char** argv) return run(matching_tests); } -NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool find_tests, bool find_benchmarks) +NonnullRefPtrVector<TestCase> TestSuite::find_cases(String const& search, bool find_tests, bool find_benchmarks) { NonnullRefPtrVector<TestCase> matches; - for (const auto& t : m_cases) { + for (auto const& t : m_cases) { if (!search.is_empty() && !t.name().matches(search, CaseSensitivity::CaseInsensitive)) { continue; } @@ -111,22 +111,22 @@ NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool f return matches; } -int TestSuite::run(const NonnullRefPtrVector<TestCase>& tests) +int TestSuite::run(NonnullRefPtrVector<TestCase> const& tests) { size_t test_count = 0; size_t test_failed_count = 0; size_t benchmark_count = 0; TestElapsedTimer global_timer; - for (const auto& t : tests) { - const auto test_type = t.is_benchmark() ? "benchmark" : "test"; + for (auto const& t : tests) { + auto const test_type = t.is_benchmark() ? "benchmark" : "test"; warnln("Running {} '{}'.", test_type, t.name()); m_current_test_case_passed = true; TestElapsedTimer timer; t.func()(); - const auto time = timer.elapsed_milliseconds(); + auto const time = timer.elapsed_milliseconds(); dbgln("{} {} '{}' in {}ms", m_current_test_case_passed ? "Completed" : "Failed", test_type, t.name(), time); diff --git a/Userland/Libraries/LibTest/TestSuite.h b/Userland/Libraries/LibTest/TestSuite.h index 4cc1142514..4863329b63 100644 --- a/Userland/Libraries/LibTest/TestSuite.h +++ b/Userland/Libraries/LibTest/TestSuite.h @@ -33,10 +33,10 @@ public: s_global = nullptr; } - int run(const NonnullRefPtrVector<TestCase>&); - int main(const String& suite_name, int argc, char** argv); - NonnullRefPtrVector<TestCase> find_cases(const String& search, bool find_tests, bool find_benchmarks); - void add_case(const NonnullRefPtr<TestCase>& test_case) + int run(NonnullRefPtrVector<TestCase> const&); + int main(String const& suite_name, int argc, char** argv); + NonnullRefPtrVector<TestCase> find_cases(String const& search, bool find_tests, bool find_benchmarks); + void add_case(NonnullRefPtr<TestCase> const& test_case) { m_cases.append(test_case); } diff --git a/Userland/Libraries/LibTextCodec/Decoder.cpp b/Userland/Libraries/LibTextCodec/Decoder.cpp index 57695ec847..e312107f9e 100644 --- a/Userland/Libraries/LibTextCodec/Decoder.cpp +++ b/Userland/Libraries/LibTextCodec/Decoder.cpp @@ -26,7 +26,7 @@ TurkishDecoder s_turkish_decoder; XUserDefinedDecoder s_x_user_defined_decoder; } -Decoder* decoder_for(const String& a_encoding) +Decoder* decoder_for(String const& a_encoding) { auto encoding = get_standardized_encoding(a_encoding); if (encoding.has_value()) { diff --git a/Userland/Libraries/LibUSBDB/Database.cpp b/Userland/Libraries/LibUSBDB/Database.cpp index 140ca5bb65..2be7c04ad2 100644 --- a/Userland/Libraries/LibUSBDB/Database.cpp +++ b/Userland/Libraries/LibUSBDB/Database.cpp @@ -12,7 +12,7 @@ namespace USBDB { -RefPtr<Database> Database::open(const String& filename) +RefPtr<Database> Database::open(String const& filename) { auto file_or_error = Core::MappedFile::map(filename); if (file_or_error.is_error()) @@ -25,7 +25,7 @@ RefPtr<Database> Database::open(const String& filename) const StringView Database::get_vendor(u16 vendor_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) return ""; return vendor.value()->name; @@ -33,11 +33,11 @@ const StringView Database::get_vendor(u16 vendor_id) const const StringView Database::get_device(u16 vendor_id, u16 device_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) { return ""; } - const auto& device = vendor.value()->devices.get(device_id); + auto const& device = vendor.value()->devices.get(device_id); if (!device.has_value()) return ""; return device.value()->name; @@ -45,13 +45,13 @@ const StringView Database::get_device(u16 vendor_id, u16 device_id) const const StringView Database::get_interface(u16 vendor_id, u16 device_id, u16 interface_id) const { - const auto& vendor = m_vendors.get(vendor_id); + auto const& vendor = m_vendors.get(vendor_id); if (!vendor.has_value()) return ""; - const auto& device = vendor.value()->devices.get(device_id); + auto const& device = vendor.value()->devices.get(device_id); if (!device.has_value()) return ""; - const auto& interface = device.value()->interfaces.get(interface_id); + auto const& interface = device.value()->interfaces.get(interface_id); if (!interface.has_value()) return ""; return interface.value()->name; @@ -59,7 +59,7 @@ const StringView Database::get_interface(u16 vendor_id, u16 device_id, u16 inter const StringView Database::get_class(u8 class_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; return xclass.value()->name; @@ -67,10 +67,10 @@ const StringView Database::get_class(u8 class_id) const const StringView Database::get_subclass(u8 class_id, u8 subclass_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; - const auto& subclass = xclass.value()->subclasses.get(subclass_id); + auto const& subclass = xclass.value()->subclasses.get(subclass_id); if (!subclass.has_value()) return ""; return subclass.value()->name; @@ -78,13 +78,13 @@ const StringView Database::get_subclass(u8 class_id, u8 subclass_id) const const StringView Database::get_protocol(u8 class_id, u8 subclass_id, u8 protocol_id) const { - const auto& xclass = m_classes.get(class_id); + auto const& xclass = m_classes.get(class_id); if (!xclass.has_value()) return ""; - const auto& subclass = xclass.value()->subclasses.get(subclass_id); + auto const& subclass = xclass.value()->subclasses.get(subclass_id); if (!subclass.has_value()) return ""; - const auto& protocol = subclass.value()->protocols.get(protocol_id); + auto const& protocol = subclass.value()->protocols.get(protocol_id); if (!protocol.has_value()) return ""; return protocol.value()->name; diff --git a/Userland/Libraries/LibUSBDB/Database.h b/Userland/Libraries/LibUSBDB/Database.h index 207fedcc1e..d9f77e284c 100644 --- a/Userland/Libraries/LibUSBDB/Database.h +++ b/Userland/Libraries/LibUSBDB/Database.h @@ -52,7 +52,7 @@ struct Class { class Database : public RefCounted<Database> { public: - static RefPtr<Database> open(const String& filename); + static RefPtr<Database> open(String const& filename); static RefPtr<Database> open() { return open("/res/usb.ids"); }; const StringView get_vendor(u16 vendor_id) const; diff --git a/Userland/Libraries/LibVT/Attribute.h b/Userland/Libraries/LibVT/Attribute.h index 9b6a9ea897..a9c60ee80d 100644 --- a/Userland/Libraries/LibVT/Attribute.h +++ b/Userland/Libraries/LibVT/Attribute.h @@ -59,11 +59,11 @@ struct Attribute { Flags flags { Flags::NoAttributes }; - constexpr bool operator==(const Attribute& other) const + constexpr bool operator==(Attribute const& other) const { return foreground_color == other.foreground_color && background_color == other.background_color && flags == other.flags; } - constexpr bool operator!=(const Attribute& other) const + constexpr bool operator!=(Attribute const& other) const { return !(*this == other); } diff --git a/Userland/Libraries/LibVT/Color.h b/Userland/Libraries/LibVT/Color.h index 5e8a6b4b94..0144f55ea7 100644 --- a/Userland/Libraries/LibVT/Color.h +++ b/Userland/Libraries/LibVT/Color.h @@ -95,7 +95,7 @@ public: } } - constexpr bool operator==(const Color& other) const + constexpr bool operator==(Color const& other) const { if (m_kind != other.kind()) return false; diff --git a/Userland/Libraries/LibVT/EscapeSequenceParser.h b/Userland/Libraries/LibVT/EscapeSequenceParser.h index 5f4b5ad87d..6fec1ce6a9 100644 --- a/Userland/Libraries/LibVT/EscapeSequenceParser.h +++ b/Userland/Libraries/LibVT/EscapeSequenceParser.h @@ -19,7 +19,7 @@ class EscapeSequenceExecutor { public: virtual ~EscapeSequenceExecutor() = default; - using Parameters = Span<const unsigned>; + using Parameters = Span<unsigned const>; using Intermediates = Span<const u8>; using OscParameter = Span<const u8>; using OscParameters = Span<const OscParameter>; diff --git a/Userland/Libraries/LibVT/Line.cpp b/Userland/Libraries/LibVT/Line.cpp index bf348d4371..6c09c0056b 100644 --- a/Userland/Libraries/LibVT/Line.cpp +++ b/Userland/Libraries/LibVT/Line.cpp @@ -117,7 +117,7 @@ void Line::take_cells_from_next_line(size_t new_length, Line* next_line, bool cu next_line->m_cells.clear(); } -void Line::clear_range(size_t first_column, size_t last_column, const Attribute& attribute) +void Line::clear_range(size_t first_column, size_t last_column, Attribute const& attribute) { VERIFY(first_column <= last_column); VERIFY(last_column < m_cells.size()); diff --git a/Userland/Libraries/LibVT/Line.h b/Userland/Libraries/LibVT/Line.h index 09f9989868..fd920b593c 100644 --- a/Userland/Libraries/LibVT/Line.h +++ b/Userland/Libraries/LibVT/Line.h @@ -31,18 +31,18 @@ public: bool operator!=(Cell const& other) const { return code_point != other.code_point || attribute != other.attribute; } }; - const Attribute& attribute_at(size_t index) const { return m_cells[index].attribute; } + Attribute const& attribute_at(size_t index) const { return m_cells[index].attribute; } Attribute& attribute_at(size_t index) { return m_cells[index].attribute; } Cell& cell_at(size_t index) { return m_cells[index]; } - const Cell& cell_at(size_t index) const { return m_cells[index]; } + Cell const& cell_at(size_t index) const { return m_cells[index]; } - void clear(const Attribute& attribute = Attribute()) + void clear(Attribute const& attribute = Attribute()) { m_terminated_at.clear(); clear_range(0, m_cells.size() - 1, attribute); } - void clear_range(size_t first_column, size_t last_column, const Attribute& attribute = Attribute()); + void clear_range(size_t first_column, size_t last_column, Attribute const& attribute = Attribute()); bool has_only_one_background_color() const; bool is_empty() const diff --git a/Userland/Libraries/LibVT/Position.h b/Userland/Libraries/LibVT/Position.h index c880a4c005..b24e6e6a8f 100644 --- a/Userland/Libraries/LibVT/Position.h +++ b/Userland/Libraries/LibVT/Position.h @@ -23,27 +23,27 @@ public: int row() const { return m_row; } int column() const { return m_column; } - bool operator<(const Position& other) const + bool operator<(Position const& other) const { return m_row < other.m_row || (m_row == other.m_row && m_column < other.m_column); } - bool operator<=(const Position& other) const + bool operator<=(Position const& other) const { return *this < other || *this == other; } - bool operator>=(const Position& other) const + bool operator>=(Position const& other) const { return !(*this < other); } - bool operator==(const Position& other) const + bool operator==(Position const& other) const { return m_row == other.m_row && m_column == other.m_column; } - bool operator!=(const Position& other) const + bool operator!=(Position const& other) const { return !(*this == other); } diff --git a/Userland/Libraries/LibVT/Range.h b/Userland/Libraries/LibVT/Range.h index db3cb9015c..bc7566d923 100644 --- a/Userland/Libraries/LibVT/Range.h +++ b/Userland/Libraries/LibVT/Range.h @@ -48,7 +48,7 @@ public: m_end = Position(m_end.row() + delta, m_end.column()); } - bool operator==(const Range& other) const + bool operator==(Range const& other) const { return m_start == other.m_start && m_end == other.m_end; } diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 7e669a5f40..5eaacb682e 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -1347,7 +1347,7 @@ void Terminal::inject_string(StringView str) void Terminal::emit_string(StringView string) { - m_client.emit((const u8*)string.characters_without_null_termination(), string.length()); + m_client.emit((u8 const*)string.characters_without_null_termination(), string.length()); } void Terminal::handle_key_press(KeyCode key, u32 code_point, u8 flags) @@ -1657,7 +1657,7 @@ void Terminal::invalidate_cursor() active_buffer()[cursor_row()].set_dirty(true); } -Attribute Terminal::attribute_at(const Position& position) const +Attribute Terminal::attribute_at(Position const& position) const { if (!position.is_valid()) return {}; diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h index 6e8828f717..b3760b0106 100644 --- a/Userland/Libraries/LibVT/Terminal.h +++ b/Userland/Libraries/LibVT/Terminal.h @@ -53,7 +53,7 @@ public: virtual void set_window_progress(int value, int max) = 0; virtual void terminal_did_resize(u16 columns, u16 rows) = 0; virtual void terminal_history_changed(int delta) = 0; - virtual void emit(const u8*, size_t) = 0; + virtual void emit(u8 const*, size_t) = 0; virtual void set_cursor_style(CursorStyle) = 0; }; @@ -129,7 +129,7 @@ public: return m_normal_screen_buffer[index - m_history.size()]; } } - const Line& line(size_t index) const + Line const& line(size_t index) const { return const_cast<Terminal*>(this)->line(index); } @@ -139,7 +139,7 @@ public: return active_buffer()[index]; } - const Line& visible_line(size_t index) const + Line const& visible_line(size_t index) const { return active_buffer()[index]; } @@ -177,7 +177,7 @@ public: void handle_key_press(KeyCode, u32, u8 flags); #ifndef KERNEL - Attribute attribute_at(const Position&) const; + Attribute attribute_at(Position const&) const; #endif bool needs_bracketed_paste() const @@ -404,7 +404,7 @@ protected: } NonnullOwnPtrVector<Line>& active_buffer() { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; }; - const NonnullOwnPtrVector<Line>& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; }; + NonnullOwnPtrVector<Line> const& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; }; NonnullOwnPtrVector<Line> m_normal_screen_buffer; NonnullOwnPtrVector<Line> m_alternate_screen_buffer; #endif diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 5c9b70121c..c1d0d59344 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -492,7 +492,7 @@ void TerminalWidget::resize_event(GUI::ResizeEvent& event) relayout(event.size()); } -void TerminalWidget::relayout(const Gfx::IntSize& size) +void TerminalWidget::relayout(Gfx::IntSize const& size) { if (!m_scrollbar) return; @@ -580,7 +580,7 @@ bool TerminalWidget::selection_contains(const VT::Position& position) const return position >= normalized_selection.start() && position <= normalized_selection.end(); } -VT::Position TerminalWidget::buffer_position_at(const Gfx::IntPoint& position) const +VT::Position TerminalWidget::buffer_position_at(Gfx::IntPoint const& position) const { auto adjusted_position = position.translated(-(frame_thickness() + m_inset), -(frame_thickness() + m_inset)); int row = adjusted_position.y() / m_line_height; @@ -1030,7 +1030,7 @@ void TerminalWidget::beep() update(); } -void TerminalWidget::emit(const u8* data, size_t size) +void TerminalWidget::emit(u8 const* data, size_t size) { if (write(m_ptm_fd, data, size) < 0) { perror("TerminalWidget::emit: write"); @@ -1229,7 +1229,7 @@ void TerminalWidget::set_color_scheme(StringView name) update(); } -Gfx::IntSize TerminalWidget::widget_size_for_font(const Gfx::Font& font) const +Gfx::IntSize TerminalWidget::widget_size_for_font(Gfx::Font const& font) const { return { (frame_thickness() * 2) + (m_inset * 2) + (m_terminal.columns() * font.glyph_width('x')) + m_scrollbar->width(), @@ -1260,7 +1260,7 @@ constexpr Gfx::Color TerminalWidget::terminal_color_to_rgb(VT::Color color) cons } }; -void TerminalWidget::set_font_and_resize_to_fit(const Gfx::Font& font) +void TerminalWidget::set_font_and_resize_to_fit(Gfx::Font const& font) { set_font(font); resize(widget_size_for_font(font)); diff --git a/Userland/Libraries/LibVT/TerminalWidget.h b/Userland/Libraries/LibVT/TerminalWidget.h index aeadd8b00c..99f3a85226 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.h +++ b/Userland/Libraries/LibVT/TerminalWidget.h @@ -60,7 +60,7 @@ public: String selected_text() const; VT::Range normalized_selection() const { return m_selection.normalized(); } void set_selection(const VT::Range& selection); - VT::Position buffer_position_at(const Gfx::IntPoint&) const; + VT::Position buffer_position_at(Gfx::IntPoint const&) const; VT::Range find_next(StringView, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); VT::Range find_previous(StringView, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); @@ -85,14 +85,14 @@ public: const StringView color_scheme_name() const { return m_color_scheme_name; } Function<void(StringView)> on_title_change; - Function<void(const Gfx::IntSize&)> on_terminal_size_change; + Function<void(Gfx::IntSize const&)> on_terminal_size_change; Function<void()> on_command_exit; GUI::Menu& context_menu() { return *m_context_menu; } constexpr Gfx::Color terminal_color_to_rgb(VT::Color) const; - void set_font_and_resize_to_fit(const Gfx::Font&); + void set_font_and_resize_to_fit(Gfx::Font const&); void set_color_scheme(StringView); @@ -123,11 +123,11 @@ private: virtual void set_window_progress(int value, int max) override; virtual void terminal_did_resize(u16 columns, u16 rows) override; virtual void terminal_history_changed(int delta) override; - virtual void emit(const u8*, size_t) override; + virtual void emit(u8 const*, size_t) override; virtual void set_cursor_style(CursorStyle) override; // ^GUI::Clipboard::ClipboardClient - virtual void clipboard_content_did_change(const String&) override { update_paste_action(); } + virtual void clipboard_content_did_change(String const&) override { update_paste_action(); } void set_logical_focus(bool); @@ -136,12 +136,12 @@ private: Gfx::IntRect glyph_rect(u16 row, u16 column); Gfx::IntRect row_rect(u16 row); - Gfx::IntSize widget_size_for_font(const Gfx::Font&) const; + Gfx::IntSize widget_size_for_font(Gfx::Font const&) const; void update_cursor(); void invalidate_cursor(); - void relayout(const Gfx::IntSize&); + void relayout(Gfx::IntSize const&); void update_copy_action(); void update_paste_action(); diff --git a/Userland/Libraries/LibVideo/VP9/Decoder.cpp b/Userland/Libraries/LibVideo/VP9/Decoder.cpp index 725d9ac29b..9d9e739dc9 100644 --- a/Userland/Libraries/LibVideo/VP9/Decoder.cpp +++ b/Userland/Libraries/LibVideo/VP9/Decoder.cpp @@ -39,7 +39,7 @@ u8 Decoder::merge_prob(u8 pre_prob, u8 count_0, u8 count_1, u8 count_sat, u8 max return round_2(pre_prob * (256 - factor) + (prob * factor), 8); } -u8 Decoder::merge_probs(const int* tree, int index, u8* probs, u8* counts, u8 count_sat, u8 max_update_factor) +u8 Decoder::merge_probs(int const* tree, int index, u8* probs, u8* counts, u8 count_sat, u8 max_update_factor) { auto s = tree[index]; auto left_count = (s <= 0) ? counts[-s] : merge_probs(tree, s, probs, counts, count_sat, max_update_factor); diff --git a/Userland/Libraries/LibVideo/VP9/TreeParser.cpp b/Userland/Libraries/LibVideo/VP9/TreeParser.cpp index bd702c251c..1a218044d4 100644 --- a/Userland/Libraries/LibVideo/VP9/TreeParser.cpp +++ b/Userland/Libraries/LibVideo/VP9/TreeParser.cpp @@ -560,8 +560,8 @@ u8 TreeParser::calculate_tx_size_probability(u8 node) u8 TreeParser::calculate_inter_mode_probability(u8 node) { - //FIXME: Implement when ModeContext is implemented - // m_ctx = m_decoder.m_mode_context[m_decoder.m_ref_frame[0]] + // FIXME: Implement when ModeContext is implemented + // m_ctx = m_decoder.m_mode_context[m_decoder.m_ref_frame[0]] return m_decoder.m_probability_tables->inter_mode_probs()[m_ctx][node]; } diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp b/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp index f3dee8492d..0bb260ee5b 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp @@ -84,8 +84,7 @@ Result Configuration::execute(Interpreter& interpreter) void Configuration::dump_stack() { - auto print_value = []<typename... Ts>(CheckedFormatString<Ts...> format, Ts... vs) - { + auto print_value = []<typename... Ts>(CheckedFormatString<Ts...> format, Ts... vs) { DuplexMemoryStream memory_stream; Printer { memory_stream }.print(vs...); ByteBuffer buffer = memory_stream.copy_into_contiguous_buffer(); diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Validator.cpp b/Userland/Libraries/LibWasm/AbstractMachine/Validator.cpp index c5ba30fcb7..18e8eb95c1 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/Validator.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/Validator.cpp @@ -2155,7 +2155,7 @@ VALIDATE_INSTRUCTION(call_indirect) return {}; } -ErrorOr<void, ValidationError> Validator::validate(const Instruction& instruction, Stack& stack, bool& is_constant) +ErrorOr<void, ValidationError> Validator::validate(Instruction const& instruction, Stack& stack, bool& is_constant) { switch (instruction.opcode().value()) { #define M(name, integer_value) \ @@ -2194,7 +2194,7 @@ ErrorOr<Validator::ExpressionTypeResult, ValidationError> Validator::validate(Ex return ExpressionTypeResult { stack.release_vector(), is_constant_expression }; } -bool Validator::Stack::operator==(const Stack& other) const +bool Validator::Stack::operator==(Stack const& other) const { if (!m_did_insert_unknown_entry && !other.m_did_insert_unknown_entry) return static_cast<Vector<StackEntry> const&>(*this) == static_cast<Vector<StackEntry> const&>(other); diff --git a/Userland/Libraries/LibWasm/Printer/Printer.cpp b/Userland/Libraries/LibWasm/Printer/Printer.cpp index ed310f3629..7650720047 100644 --- a/Userland/Libraries/LibWasm/Printer/Printer.cpp +++ b/Userland/Libraries/LibWasm/Printer/Printer.cpp @@ -416,14 +416,15 @@ void Printer::print(Wasm::ImportSection::Import const& import) { TemporaryChange change { m_indent, m_indent + 1 }; import.description().visit( - [this](auto const& type) { print(type); }, + [this](auto const& type) { print(type); + }, [this](TypeIndex const& index) { - print_indent(); - print("(type index {})\n", index.value()); + print_indent(); + print("(type index {})\n", index.value()); }); - } - print_indent(); - print(")\n"); +} +print_indent(); +print(")\n"); } void Printer::print(Wasm::Instruction const& instruction) @@ -671,7 +672,6 @@ void Printer::print(Wasm::Reference const& value) [](Wasm::Reference::Null const&) { return String("null"); }, [](auto const& ref) { return String::number(ref.address.value()); })); } - } HashMap<Wasm::OpCode, String> Wasm::Names::instruction_names { diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h index 7b579f2805..04a662b5b0 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h @@ -42,11 +42,11 @@ public: LocationObject* location_object() { return m_location_object; } LocationObject const* location_object() const { return m_location_object; } - JS::Object* web_prototype(const String& class_name) { return m_prototypes.get(class_name).value_or(nullptr); } - JS::NativeFunction* web_constructor(const String& class_name) { return m_constructors.get(class_name).value_or(nullptr); } + JS::Object* web_prototype(String const& class_name) { return m_prototypes.get(class_name).value_or(nullptr); } + JS::NativeFunction* web_constructor(String const& class_name) { return m_constructors.get(class_name).value_or(nullptr); } template<typename T> - JS::Object& ensure_web_prototype(const String& class_name) + JS::Object& ensure_web_prototype(String const& class_name) { auto it = m_prototypes.find(class_name); if (it != m_prototypes.end()) @@ -57,7 +57,7 @@ public: } template<typename T> - JS::NativeFunction& ensure_web_constructor(const String& class_name) + JS::NativeFunction& ensure_web_constructor(String const& class_name) { auto it = m_constructors.find(class_name); if (it != m_constructors.end()) diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.h b/Userland/Libraries/LibWeb/Bindings/Wrappable.h index 36a581f399..26d2fbcc1d 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.h +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.h @@ -19,7 +19,7 @@ public: void set_wrapper(Wrapper&); Wrapper* wrapper() { return m_wrapper; } - const Wrapper* wrapper() const { return m_wrapper; } + Wrapper const* wrapper() const { return m_wrapper; } private: WeakPtr<Wrapper> m_wrapper; diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h index 37c219005e..667887d697 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h @@ -32,8 +32,8 @@ public: bool has_import_result() const { return !m_style_sheet.is_null(); } RefPtr<CSSStyleSheet> loaded_style_sheet() { return m_style_sheet; } - const RefPtr<CSSStyleSheet> loaded_style_sheet() const { return m_style_sheet; } - void set_style_sheet(const RefPtr<CSSStyleSheet>& style_sheet) { m_style_sheet = style_sheet; } + RefPtr<CSSStyleSheet> const loaded_style_sheet() const { return m_style_sheet; } + void set_style_sheet(RefPtr<CSSStyleSheet> const& style_sheet) { m_style_sheet = style_sheet; } virtual StringView class_name() const override { return "CSSImportRule"; }; virtual Type type() const override { return Type::Import; }; diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h index fcf5ff116a..31897d477d 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.h @@ -69,9 +69,9 @@ public: virtual Optional<StyleProperty> property(PropertyID) const override; virtual bool set_property(PropertyID, StringView css_text) override; - const Vector<StyleProperty>& properties() const { return m_properties; } - const HashMap<String, StyleProperty>& custom_properties() const { return m_custom_properties; } - Optional<StyleProperty> custom_property(const String& custom_property_name) const { return m_custom_properties.get(custom_property_name); } + Vector<StyleProperty> const& properties() const { return m_properties; } + HashMap<String, StyleProperty> const& custom_properties() const { return m_custom_properties; } + Optional<StyleProperty> custom_property(String const& custom_property_name) const { return m_custom_properties.get(custom_property_name); } size_t custom_property_count() const { return m_custom_properties.size(); } virtual String serialized() const final override; diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h index 23f8c1564c..5f61504a57 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.h @@ -29,8 +29,8 @@ public: virtual ~CSSStyleRule() override = default; - const NonnullRefPtrVector<Selector>& selectors() const { return m_selectors; } - const CSSStyleDeclaration& declaration() const { return m_declaration; } + NonnullRefPtrVector<Selector> const& selectors() const { return m_selectors; } + CSSStyleDeclaration const& declaration() const { return m_declaration; } virtual StringView class_name() const override { return "CSSStyleRule"; }; virtual Type type() const override { return Type::Style; }; diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 88779b1626..3462c152bd 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -152,10 +152,10 @@ public: const CSS::LengthBox& margin() const { return m_noninherited.margin; } const CSS::LengthBox& padding() const { return m_noninherited.padding; } - const BorderData& border_left() const { return m_noninherited.border_left; } - const BorderData& border_top() const { return m_noninherited.border_top; } - const BorderData& border_right() const { return m_noninherited.border_right; } - const BorderData& border_bottom() const { return m_noninherited.border_bottom; } + BorderData const& border_left() const { return m_noninherited.border_left; } + BorderData const& border_top() const { return m_noninherited.border_top; } + BorderData const& border_right() const { return m_noninherited.border_right; } + BorderData const& border_bottom() const { return m_noninherited.border_bottom; } const CSS::LengthPercentage& border_bottom_left_radius() const { return m_noninherited.border_bottom_left_radius; } const CSS::LengthPercentage& border_bottom_right_radius() const { return m_noninherited.border_bottom_right_radius; } @@ -267,12 +267,12 @@ public: void set_font_size(float font_size) { m_inherited.font_size = font_size; } void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; } void set_font_variant(CSS::FontVariant font_variant) { m_inherited.font_variant = font_variant; } - void set_color(const Color& color) { m_inherited.color = color; } + void set_color(Color const& color) { m_inherited.color = color; } void set_content(ContentData const& content) { m_noninherited.content = content; } void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; } void set_image_rendering(CSS::ImageRendering value) { m_inherited.image_rendering = value; } void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; } - void set_background_color(const Color& color) { m_noninherited.background_color = color; } + void set_background_color(Color const& color) { m_noninherited.background_color = color; } void set_background_layers(Vector<BackgroundLayerData>&& layers) { m_noninherited.background_layers = move(layers); } void set_float(CSS::Float value) { m_noninherited.float_ = value; } void set_clear(CSS::Clear value) { m_noninherited.clear = value; } diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 237fd4d4d9..724315c55e 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -118,7 +118,7 @@ String Length::to_string() const return String::formatted("{}{}", m_value, unit_name()); } -const char* Length::unit_name() const +char const* Length::unit_name() const { switch (m_type) { case Type::Cm: diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index 57ae881f76..97663b95fd 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -116,14 +116,14 @@ public: String to_string() const; - bool operator==(const Length& other) const + bool operator==(Length const& other) const { if (is_calculated()) return m_calculated_style == other.m_calculated_style; return m_type == other.m_type && m_value == other.m_value; } - bool operator!=(const Length& other) const + bool operator!=(Length const& other) const { return !(*this == other); } @@ -131,7 +131,7 @@ public: float relative_length_to_px(Gfx::IntRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, float font_size, float root_font_size) const; private: - const char* unit_name() const; + char const* unit_name() const; Type m_type; float m_value { 0 }; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 5e2a33d63b..0ae1e192b6 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -28,7 +28,7 @@ #include <LibWeb/DOM/Document.h> #include <LibWeb/Dump.h> -static void log_parse_error(const SourceLocation& location = SourceLocation::current()) +static void log_parse_error(SourceLocation const& location = SourceLocation::current()) { dbgln_if(CSS_PARSER_DEBUG, "Parse error (CSS) {}", location); } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp index b4d1d3d6ca..45cfb6f077 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp @@ -17,7 +17,7 @@ #define REPLACEMENT_CHARACTER 0xFFFD static constexpr u32 TOKENIZER_EOF = 0xFFFFFFFF; -static inline void log_parse_error(const SourceLocation& location = SourceLocation::current()) +static inline void log_parse_error(SourceLocation const& location = SourceLocation::current()) { dbgln_if(CSS_TOKENIZER_DEBUG, "Parse error (css tokenization) {} ", location); } @@ -192,7 +192,7 @@ static inline bool is_E(u32 code_point) namespace Web::CSS { -Tokenizer::Tokenizer(StringView input, const String& encoding) +Tokenizer::Tokenizer(StringView input, String const& encoding) { auto* decoder = TextCodec::decoder_for(encoding); VERIFY(decoder); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h index 6521e74eb2..39eb09d923 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h @@ -60,7 +60,7 @@ public: class Tokenizer { public: - explicit Tokenizer(StringView input, const String& encoding); + explicit Tokenizer(StringView input, String const& encoding); [[nodiscard]] Vector<Token> parse(); diff --git a/Userland/Libraries/LibWeb/CSS/Ratio.cpp b/Userland/Libraries/LibWeb/CSS/Ratio.cpp index f6285dfa45..b2a46b766a 100644 --- a/Userland/Libraries/LibWeb/CSS/Ratio.cpp +++ b/Userland/Libraries/LibWeb/CSS/Ratio.cpp @@ -27,7 +27,7 @@ String Ratio::to_string() const return String::formatted("{} / {}", m_first_value, m_second_value); } -auto Ratio::operator<=>(const Ratio& other) const +auto Ratio::operator<=>(Ratio const& other) const { return value() - other.value(); } diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 4bfc3562d3..43794e2f6b 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -114,7 +114,7 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co return !attribute.value.is_empty() && element.attribute(attribute.name).contains(attribute.value, case_sensitivity); case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: { - const auto element_attr_value = element.attribute(attribute.name); + auto const element_attr_value = element.attribute(attribute.name); if (element_attr_value.is_empty()) { // If the attribute value on element is empty, the selector is true // if the match value is also empty and false otherwise. diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index bf1a4cbb4d..4ae796ec1a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -862,7 +862,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele float font_size_in_px = 10; if (font_size->is_identifier()) { - switch (static_cast<const IdentifierStyleValue&>(*font_size).id()) { + switch (static_cast<IdentifierStyleValue const&>(*font_size).id()) { case CSS::ValueID::XxSmall: case CSS::ValueID::XSmall: case CSS::ValueID::Small: diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index b320bc1dfe..9856396e74 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -15,7 +15,7 @@ namespace Web::CSS { -StyleProperties::StyleProperties(const StyleProperties& other) +StyleProperties::StyleProperties(StyleProperties const& other) : m_property_values(other.m_property_values) { if (other.m_font) { @@ -412,7 +412,7 @@ Optional<CSS::Position> StyleProperties::position() const } } -bool StyleProperties::operator==(const StyleProperties& other) const +bool StyleProperties::operator==(StyleProperties const& other) const { if (m_property_values.size() != other.m_property_values.size()) return false; diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 82c0f1f932..ef34a95e1b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -20,7 +20,7 @@ class StyleProperties : public RefCounted<StyleProperties> { public: StyleProperties() = default; - explicit StyleProperties(const StyleProperties&); + explicit StyleProperties(StyleProperties const&); static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); } @@ -92,10 +92,10 @@ public: m_font = move(font); } - float line_height(const Layout::Node&) const; + float line_height(Layout::Node const&) const; - bool operator==(const StyleProperties&) const; - bool operator!=(const StyleProperties& other) const { return !(*this == other); } + bool operator==(StyleProperties const&) const; + bool operator!=(StyleProperties const& other) const { return !(*this == other); } Optional<CSS::Position> position() const; Optional<int> z_index() const; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index b90fe67ba0..970c9b74a3 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -941,7 +941,7 @@ public: { if (type() != other.type()) return false; - return m_color == static_cast<const ColorStyleValue&>(other).m_color; + return m_color == static_cast<ColorStyleValue const&>(other).m_color; } private: @@ -1151,7 +1151,7 @@ public: { if (type() != other.type()) return false; - return m_id == static_cast<const IdentifierStyleValue&>(other).m_id; + return m_id == static_cast<IdentifierStyleValue const&>(other).m_id; } private: diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp index 7044d67d6d..fd06e2949b 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp @@ -27,7 +27,7 @@ static void on_secure_attribute(ParsedCookie& parsed_cookie); static void on_http_only_attribute(ParsedCookie& parsed_cookie); static Optional<Core::DateTime> parse_date_time(StringView date_string); -Optional<ParsedCookie> parse_cookie(const String& cookie_string) +Optional<ParsedCookie> parse_cookie(String const& cookie_string) { // https://tools.ietf.org/html/rfc6265#section-5.2 @@ -293,7 +293,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string) bool found_month = false; bool found_year = false; - for (const auto& date_token : date_tokens) { + for (auto const& date_token : date_tokens) { if (!found_time && parse_time(date_token)) { found_time = true; } else if (!found_day_of_month && parse_day_of_month(date_token)) { @@ -333,7 +333,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string) } -bool IPC::encode(IPC::Encoder& encoder, const Web::Cookie::ParsedCookie& cookie) +bool IPC::encode(IPC::Encoder& encoder, Web::Cookie::ParsedCookie const& cookie) { encoder << cookie.name; encoder << cookie.value; diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.h b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.h index 6a8bb72551..2d293c3fa2 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.h +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.h @@ -24,13 +24,13 @@ struct ParsedCookie { bool http_only_attribute_present { false }; }; -Optional<ParsedCookie> parse_cookie(const String& cookie_string); +Optional<ParsedCookie> parse_cookie(String const& cookie_string); } namespace IPC { -bool encode(IPC::Encoder&, const Web::Cookie::ParsedCookie&); +bool encode(IPC::Encoder&, Web::Cookie::ParsedCookie const&); ErrorOr<void> decode(IPC::Decoder&, Web::Cookie::ParsedCookie&); } diff --git a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp index 277fec25b5..b6008f9aca 100644 --- a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp @@ -62,27 +62,27 @@ String Crypto::random_uuid() const bytes[8] |= 1 << 7; bytes[8] &= ~(1 << 6); - /* 5. Return the string concatenation of - « + /* 5. Return the string concatenation of + « hexadecimal representation of bytes[0], - hexadecimal representation of bytes[1], + hexadecimal representation of bytes[1], hexadecimal representation of bytes[2], hexadecimal representation of bytes[3], - "-", - hexadecimal representation of bytes[4], + "-", + hexadecimal representation of bytes[4], hexadecimal representation of bytes[5], "-", - hexadecimal representation of bytes[6], + hexadecimal representation of bytes[6], hexadecimal representation of bytes[7], "-", - hexadecimal representation of bytes[8], + hexadecimal representation of bytes[8], hexadecimal representation of bytes[9], "-", - hexadecimal representation of bytes[10], - hexadecimal representation of bytes[11], - hexadecimal representation of bytes[12], - hexadecimal representation of bytes[13], - hexadecimal representation of bytes[14], + hexadecimal representation of bytes[10], + hexadecimal representation of bytes[11], + hexadecimal representation of bytes[12], + hexadecimal representation of bytes[13], + hexadecimal representation of bytes[14], hexadecimal representation of bytes[15] ». */ diff --git a/Userland/Libraries/LibWeb/DOM/AbstractRange.h b/Userland/Libraries/LibWeb/DOM/AbstractRange.h index 0547879aa8..0407de68f2 100644 --- a/Userland/Libraries/LibWeb/DOM/AbstractRange.h +++ b/Userland/Libraries/LibWeb/DOM/AbstractRange.h @@ -20,11 +20,11 @@ public: virtual ~AbstractRange() override = default; Node* start_container() { return m_start_container; } - const Node* start_container() const { return m_start_container; } + Node const* start_container() const { return m_start_container; } unsigned start_offset() const { return m_start_offset; } Node* end_container() { return m_end_container; } - const Node* end_container() const { return m_end_container; } + Node const* end_container() const { return m_end_container; } unsigned end_offset() const { return m_end_offset; } // https://dom.spec.whatwg.org/#range-collapsed diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp index dec8901baf..2b17e0955e 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp @@ -10,7 +10,7 @@ namespace Web::DOM { -CharacterData::CharacterData(Document& document, NodeType type, const String& data) +CharacterData::CharacterData(Document& document, NodeType type, String const& data) : Node(document, type) , m_data(data) { diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.h b/Userland/Libraries/LibWeb/DOM/CharacterData.h index 0b38ec92a0..d72d5bdfc4 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.h +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.h @@ -22,7 +22,7 @@ public: virtual ~CharacterData() override = default; - const String& data() const { return m_data; } + String const& data() const { return m_data; } void set_data(String); unsigned length() const { return m_data.length(); } @@ -31,7 +31,7 @@ public: ExceptionOr<void> replace_data(size_t offset, size_t count, String const&); protected: - explicit CharacterData(Document&, NodeType, const String&); + explicit CharacterData(Document&, NodeType, String const&); private: String m_data; diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp index 8b70cf501b..9e79dd5869 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.cpp +++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp @@ -10,7 +10,7 @@ namespace Web::DOM { -Comment::Comment(Document& document, const String& data) +Comment::Comment(Document& document, String const& data) : CharacterData(document, NodeType::COMMENT_NODE, data) { } diff --git a/Userland/Libraries/LibWeb/DOM/Comment.h b/Userland/Libraries/LibWeb/DOM/Comment.h index 7f34f43a13..9696a31137 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.h +++ b/Userland/Libraries/LibWeb/DOM/Comment.h @@ -15,7 +15,7 @@ class Comment final : public CharacterData { public: using WrapperType = Bindings::CommentWrapper; - explicit Comment(Document&, const String&); + explicit Comment(Document&, String const&); virtual ~Comment() override = default; virtual FlyString node_name() const override { return "#comment"; } diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.h b/Userland/Libraries/LibWeb/DOM/CustomEvent.h index ed549d87d7..6ecbd83950 100644 --- a/Userland/Libraries/LibWeb/DOM/CustomEvent.h +++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.h @@ -23,7 +23,7 @@ public: { return adopt_ref(*new CustomEvent(event_name, event_init)); } - static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, CustomEventInit const& event_init) + static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, CustomEventInit const& event_init) { return CustomEvent::create(event_name, event_init); } diff --git a/Userland/Libraries/LibWeb/DOM/DOMException.h b/Userland/Libraries/LibWeb/DOM/DOMException.h index 6e555536bf..95475e2829 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMException.h +++ b/Userland/Libraries/LibWeb/DOM/DOMException.h @@ -78,7 +78,7 @@ namespace Web::DOM { __ENUMERATE(OperationError) \ __ENUMERATE(NotAllowedError) -static u16 get_legacy_code_for_name(const FlyString& name) +static u16 get_legacy_code_for_name(FlyString const& name) { #define __ENUMERATE(ErrorName, code) \ if (name == #ErrorName) \ @@ -95,23 +95,23 @@ class DOMException final public: using WrapperType = Bindings::DOMExceptionWrapper; - static NonnullRefPtr<DOMException> create(const FlyString& name, const FlyString& message) + static NonnullRefPtr<DOMException> create(FlyString const& name, FlyString const& message) { return adopt_ref(*new DOMException(name, message)); } // JS constructor has message first, name second - static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, const FlyString& message, const FlyString& name) + static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, FlyString const& message, FlyString const& name) { return adopt_ref(*new DOMException(name, message)); } - const FlyString& name() const { return m_name; } - const FlyString& message() const { return m_message; } + FlyString const& name() const { return m_name; } + FlyString const& message() const { return m_message; } u16 code() const { return get_legacy_code_for_name(m_name); } protected: - DOMException(const FlyString& name, const FlyString& message) + DOMException(FlyString const& name, FlyString const& message) : m_name(name) , m_message(message) { @@ -125,7 +125,7 @@ private: #define __ENUMERATE(ErrorName) \ class ErrorName final { \ public: \ - static NonnullRefPtr<DOMException> create(const FlyString& message) \ + static NonnullRefPtr<DOMException> create(FlyString const& message) \ { \ return DOMException::create(#ErrorName, message); \ } \ diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp index 08ae8d5de2..3da0c63c1a 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp @@ -20,7 +20,7 @@ DOMImplementation::DOMImplementation(Document& document) } // https://dom.spec.whatwg.org/#dom-domimplementation-createdocument -ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const String& namespace_, const String& qualified_name, RefPtr<DocumentType> doctype) const +ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(String const& namespace_, String const& qualified_name, RefPtr<DocumentType> doctype) const { // FIXME: This should specifically be an XML document. auto xml_document = Document::create(); @@ -51,7 +51,7 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St } // https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument -NonnullRefPtr<Document> DOMImplementation::create_html_document(const String& title) const +NonnullRefPtr<Document> DOMImplementation::create_html_document(String const& title) const { // FIXME: This should specifically be a HTML document. auto html_document = Document::create(); diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.h b/Userland/Libraries/LibWeb/DOM/DOMImplementation.h index 74948243be..1c8d828696 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.h +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.h @@ -28,7 +28,7 @@ public: } ExceptionOr<NonnullRefPtr<Document>> create_document(String const&, String const&, RefPtr<DocumentType>) const; - NonnullRefPtr<Document> create_html_document(const String& title) const; + NonnullRefPtr<Document> create_html_document(String const& title) const; ExceptionOr<NonnullRefPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id); // https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 929042dc74..d91d6c1e44 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -307,7 +307,7 @@ Origin Document::origin() const return { m_url.protocol(), m_url.host(), m_url.port_or_default() }; } -void Document::set_origin(const Origin& origin) +void Document::set_origin(Origin const& origin) { m_url.set_protocol(origin.protocol()); m_url.set_host(origin.host()); @@ -328,7 +328,7 @@ void Document::schedule_layout_update() m_layout_update_timer->start(); } -bool Document::is_child_allowed(const Node& node) const +bool Document::is_child_allowed(Node const& node) const { switch (node.type()) { case NodeType::DOCUMENT_NODE: @@ -350,7 +350,7 @@ Element* Document::document_element() return first_child_of_type<Element>(); } -const Element* Document::document_element() const +Element const* Document::document_element() const { return first_child_of_type<Element>(); } @@ -432,7 +432,7 @@ String Document::title() const return builder.to_string(); } -void Document::set_title(const String& title) +void Document::set_title(String const& title) { auto* head_element = const_cast<HTML::HTMLHeadElement*>(head()); if (!head_element) @@ -651,9 +651,9 @@ void Document::set_visited_link_color(Color color) m_visited_link_color = color; } -const Layout::InitialContainingBlock* Document::layout_node() const +Layout::InitialContainingBlock const* Document::layout_node() const { - return static_cast<const Layout::InitialContainingBlock*>(Node::layout_node()); + return static_cast<Layout::InitialContainingBlock const*>(Node::layout_node()); } Layout::InitialContainingBlock* Document::layout_node() @@ -935,12 +935,12 @@ NonnullRefPtr<DocumentFragment> Document::create_document_fragment() return adopt_ref(*new DocumentFragment(*this)); } -NonnullRefPtr<Text> Document::create_text_node(const String& data) +NonnullRefPtr<Text> Document::create_text_node(String const& data) { return adopt_ref(*new Text(*this, data)); } -NonnullRefPtr<Comment> Document::create_comment(const String& data) +NonnullRefPtr<Comment> Document::create_comment(String const& data) { return adopt_ref(*new Comment(*this, data)); } @@ -951,7 +951,7 @@ NonnullRefPtr<Range> Document::create_range() } // https://dom.spec.whatwg.org/#dom-document-createevent -NonnullRefPtr<Event> Document::create_event(const String& interface) +NonnullRefPtr<Event> Document::create_event(String const& interface) { auto interface_lowercase = interface.to_lowercase(); RefPtr<Event> event; @@ -1101,12 +1101,12 @@ ExceptionOr<NonnullRefPtr<Node>> Document::adopt_node_binding(NonnullRefPtr<Node return node; } -const DocumentType* Document::doctype() const +DocumentType const* Document::doctype() const { return first_child_of_type<DocumentType>(); } -const String& Document::compat_mode() const +String const& Document::compat_mode() const { static String back_compat = "BackCompat"; static String css1_compat = "CSS1Compat"; @@ -1192,12 +1192,12 @@ Page* Document::page() return m_browsing_context ? m_browsing_context->page() : nullptr; } -const Page* Document::page() const +Page const* Document::page() const { return m_browsing_context ? m_browsing_context->page() : nullptr; } -EventTarget* Document::get_parent(const Event& event) +EventTarget* Document::get_parent(Event const& event) { if (event.type() == HTML::EventNames::load) return nullptr; diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 7b1ca335c7..4412efd5e9 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -68,7 +68,7 @@ public: AK::URL url() const { return m_url; } Origin origin() const; - void set_origin(const Origin& origin); + void set_origin(Origin const& origin); AK::URL parse_url(String const&) const; @@ -84,14 +84,14 @@ public: void set_hovered_node(Node*); Node* hovered_node() { return m_hovered_node; } - const Node* hovered_node() const { return m_hovered_node; } + Node const* hovered_node() const { return m_hovered_node; } void set_inspected_node(Node*); Node* inspected_node() { return m_inspected_node; } - const Node* inspected_node() const { return m_inspected_node; } + Node const* inspected_node() const { return m_inspected_node; } Element* document_element(); - const Element* document_element() const; + Element const* document_element() const; HTML::HTMLHtmlElement* html_element(); HTML::HTMLHeadElement* head(); @@ -115,7 +115,7 @@ public: ExceptionOr<void> set_body(HTML::HTMLElement* new_body); String title() const; - void set_title(const String&); + void set_title(String const&); void attach_to_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&); void detach_from_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&); @@ -124,9 +124,9 @@ public: HTML::BrowsingContext const* browsing_context() const { return m_browsing_context.ptr(); } Page* page(); - const Page* page() const; + Page const* page() const; - Color background_color(const Gfx::Palette&) const; + Color background_color(Gfx::Palette const&) const; Vector<CSS::BackgroundLayerData> const* background_layers() const; Color link_color() const; @@ -148,9 +148,9 @@ public: void invalidate_layout(); void invalidate_stacking_context_tree(); - virtual bool is_child_allowed(const Node&) const override; + virtual bool is_child_allowed(Node const&) const override; - const Layout::InitialContainingBlock* layout_node() const; + Layout::InitialContainingBlock const* layout_node() const; Layout::InitialContainingBlock* layout_node(); void schedule_style_update(); @@ -168,8 +168,8 @@ public: NonnullRefPtr<HTMLCollection> forms(); NonnullRefPtr<HTMLCollection> scripts(); - const String& source() const { return m_source; } - void set_source(const String& source) { m_source = source; } + String const& source() const { return m_source; } + void set_source(String const& source) { m_source = source; } HTML::EnvironmentSettingsObject& relevant_settings_object(); JS::Realm& realm(); @@ -177,13 +177,13 @@ public: JS::Value run_javascript(StringView source, StringView filename = "(unknown)"); - ExceptionOr<NonnullRefPtr<Element>> create_element(const String& tag_name); - ExceptionOr<NonnullRefPtr<Element>> create_element_ns(const String& namespace_, const String& qualified_name); + ExceptionOr<NonnullRefPtr<Element>> create_element(String const& tag_name); + ExceptionOr<NonnullRefPtr<Element>> create_element_ns(String const& namespace_, String const& qualified_name); NonnullRefPtr<DocumentFragment> create_document_fragment(); - NonnullRefPtr<Text> create_text_node(const String& data); - NonnullRefPtr<Comment> create_comment(const String& data); + NonnullRefPtr<Text> create_text_node(String const& data); + NonnullRefPtr<Comment> create_comment(String const& data); NonnullRefPtr<Range> create_range(); - NonnullRefPtr<Event> create_event(const String& interface); + NonnullRefPtr<Event> create_event(String const& interface); void set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement*); HTML::HTMLScriptElement* pending_parsing_blocking_script() { return m_pending_parsing_blocking_script; } @@ -205,18 +205,18 @@ public: void adopt_node(Node&); ExceptionOr<NonnullRefPtr<Node>> adopt_node_binding(NonnullRefPtr<Node>); - const DocumentType* doctype() const; - const String& compat_mode() const; + DocumentType const* doctype() const; + String const& compat_mode() const; void set_editable(bool editable) { m_editable = editable; } virtual bool is_editable() const final; Element* focused_element() { return m_focused_element; } - const Element* focused_element() const { return m_focused_element; } + Element const* focused_element() const { return m_focused_element; } void set_focused_element(Element*); - const Element* active_element() const { return m_active_element; } + Element const* active_element() const { return m_active_element; } void set_active_element(Element*); @@ -224,7 +224,7 @@ public: void set_created_for_appropriate_template_contents(bool value) { m_created_for_appropriate_template_contents = value; } Document* associated_inert_template_document() { return m_associated_inert_template_document; } - const Document* associated_inert_template_document() const { return m_associated_inert_template_document; } + Document const* associated_inert_template_document() const { return m_associated_inert_template_document; } void set_associated_inert_template_document(Document& document) { m_associated_inert_template_document = document; } String ready_state() const; @@ -253,13 +253,13 @@ public: HTML::Window* default_view() { return m_window; } - const String& content_type() const { return m_content_type; } - void set_content_type(const String& content_type) { m_content_type = content_type; } + String const& content_type() const { return m_content_type; } + void set_content_type(String const& content_type) { m_content_type = content_type; } bool has_encoding() const { return m_encoding.has_value(); } - const Optional<String>& encoding() const { return m_encoding; } + Optional<String> const& encoding() const { return m_encoding; } String encoding_or_default() const { return m_encoding.value_or("UTF-8"); } - void set_encoding(const Optional<String>& encoding) { m_encoding = encoding; } + void set_encoding(Optional<String> const& encoding) { m_encoding = encoding; } // NOTE: These are intended for the JS bindings String character_set() const { return encoding_or_default(); } @@ -280,7 +280,7 @@ public: void increment_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter++; } void decrement_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter--; } - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; String dump_dom_tree_as_json() const; diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.h b/Userland/Libraries/LibWeb/DOM/DocumentType.h index 0e8a9eedd0..89816ef0ea 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.h @@ -28,14 +28,14 @@ public: virtual FlyString node_name() const override { return "#doctype"; } - const String& name() const { return m_name; } - void set_name(const String& name) { m_name = name; } + String const& name() const { return m_name; } + void set_name(String const& name) { m_name = name; } - const String& public_id() const { return m_public_id; } - void set_public_id(const String& public_id) { m_public_id = public_id; } + String const& public_id() const { return m_public_id; } + void set_public_id(String const& public_id) { m_public_id = public_id; } - const String& system_id() const { return m_system_id; } - void set_system_id(const String& system_id) { m_system_id = system_id; } + String const& system_id() const { return m_system_id; } + void set_system_id(String const& system_id) { m_system_id = system_id; } private: String m_name; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 4068fa5160..6bce81f358 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -51,7 +51,7 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name) Element::~Element() = default; // https://dom.spec.whatwg.org/#dom-element-getattribute -String Element::get_attribute(const FlyString& name) const +String Element::get_attribute(FlyString const& name) const { // 1. Let attr be the result of getting an attribute given qualifiedName and this. auto const* attribute = m_attributes->get_attribute(name); @@ -65,7 +65,7 @@ String Element::get_attribute(const FlyString& name) const } // https://dom.spec.whatwg.org/#dom-element-setattribute -ExceptionOr<void> Element::set_attribute(const FlyString& name, const String& value) +ExceptionOr<void> Element::set_attribute(FlyString const& name, String const& value) { // 1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException. // FIXME: Proper name validation @@ -156,7 +156,7 @@ ExceptionOr<void> Element::set_attribute_ns(FlyString const& namespace_, FlyStri } // https://dom.spec.whatwg.org/#dom-element-removeattribute -void Element::remove_attribute(const FlyString& name) +void Element::remove_attribute(FlyString const& name) { m_attributes->remove_attribute(name); @@ -167,7 +167,7 @@ void Element::remove_attribute(const FlyString& name) } // https://dom.spec.whatwg.org/#dom-element-hasattribute -bool Element::has_attribute(const FlyString& name) const +bool Element::has_attribute(FlyString const& name) const { return m_attributes->get_attribute(name) != nullptr; } @@ -232,7 +232,7 @@ Vector<String> Element::get_attribute_names() const return names; } -bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensitivity) const +bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const { return any_of(m_classes, [&](auto& it) { return case_sensitivity == CaseSensitivity::CaseSensitive @@ -291,7 +291,7 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document& TODO(); } -void Element::parse_attribute(const FlyString& name, const String& value) +void Element::parse_attribute(FlyString const& name, String const& value) { if (name == HTML::AttributeNames::class_) { auto new_classes = value.split_view(is_ascii_space); diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 8746a69f6f..5608534806 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -36,27 +36,27 @@ public: Element(Document&, DOM::QualifiedName); virtual ~Element() override; - const String& qualified_name() const { return m_qualified_name.as_string(); } - const String& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; } + String const& qualified_name() const { return m_qualified_name.as_string(); } + String const& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; } virtual FlyString node_name() const final { return html_uppercased_qualified_name(); } - const FlyString& local_name() const { return m_qualified_name.local_name(); } + FlyString const& local_name() const { return m_qualified_name.local_name(); } // NOTE: This is for the JS bindings - const String& tag_name() const { return html_uppercased_qualified_name(); } + String const& tag_name() const { return html_uppercased_qualified_name(); } - const FlyString& prefix() const { return m_qualified_name.prefix(); } - const FlyString& namespace_() const { return m_qualified_name.namespace_(); } + FlyString const& prefix() const { return m_qualified_name.prefix(); } + FlyString const& namespace_() const { return m_qualified_name.namespace_(); } // NOTE: This is for the JS bindings - const FlyString& namespace_uri() const { return namespace_(); } + FlyString const& namespace_uri() const { return namespace_(); } - bool has_attribute(const FlyString& name) const; + bool has_attribute(FlyString const& name) const; bool has_attributes() const { return !m_attributes->is_empty(); } - String attribute(const FlyString& name) const { return get_attribute(name); } - String get_attribute(const FlyString& name) const; - ExceptionOr<void> set_attribute(const FlyString& name, const String& value); + String attribute(FlyString const& name) const { return get_attribute(name); } + String get_attribute(FlyString const& name) const; + ExceptionOr<void> set_attribute(FlyString const& name, String const& value); ExceptionOr<void> set_attribute_ns(FlyString const& namespace_, FlyString const& qualified_name, String const& value); - void remove_attribute(const FlyString& name); + void remove_attribute(FlyString const& name); DOM::ExceptionOr<bool> toggle_attribute(FlyString const& name, Optional<bool> force); size_t attribute_list_size() const { return m_attributes->length(); } NonnullRefPtr<NamedNodeMap> const& attributes() const { return m_attributes; } @@ -81,11 +81,11 @@ public: } } - bool has_class(const FlyString&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - const Vector<FlyString>& class_names() const { return m_classes; } + bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + Vector<FlyString> const& class_names() const { return m_classes; } virtual void apply_presentational_hints(CSS::StyleProperties&) const { } - virtual void parse_attribute(const FlyString& name, const String& value); + virtual void parse_attribute(FlyString const& name, String const& value); virtual void did_remove_attribute(FlyString const&); enum class NeedsRelayout { @@ -95,7 +95,7 @@ public: NeedsRelayout recompute_style(); Layout::NodeWithStyle* layout_node() { return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); } - const Layout::NodeWithStyle* layout_node() const { return static_cast<const Layout::NodeWithStyle*>(Node::layout_node()); } + Layout::NodeWithStyle const* layout_node() const { return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); } String name() const { return attribute(HTML::AttributeNames::name); } @@ -116,7 +116,7 @@ public: NonnullRefPtr<HTMLCollection> get_elements_by_class_name(FlyString const&); ShadowRoot* shadow_root() { return m_shadow_root; } - const ShadowRoot* shadow_root() const { return m_shadow_root; } + ShadowRoot const* shadow_root() const { return m_shadow_root; } void set_shadow_root(RefPtr<ShadowRoot>); void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); } diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp index 16ef6055f3..dc16bad15b 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.cpp +++ b/Userland/Libraries/LibWeb/DOM/Event.cpp @@ -37,7 +37,7 @@ void Event::set_cancelled_flag() } // https://dom.spec.whatwg.org/#concept-event-initialize -void Event::initialize(const String& type, bool bubbles, bool cancelable) +void Event::initialize(String const& type, bool bubbles, bool cancelable) { m_initialized = true; m_stop_propagation = false; @@ -51,7 +51,7 @@ void Event::initialize(const String& type, bool bubbles, bool cancelable) } // https://dom.spec.whatwg.org/#dom-event-initevent -void Event::init_event(const String& type, bool bubbles, bool cancelable) +void Event::init_event(String const& type, bool bubbles, bool cancelable) { if (m_dispatch) return; diff --git a/Userland/Libraries/LibWeb/DOM/Event.h b/Userland/Libraries/LibWeb/DOM/Event.h index 23d25f040e..698b65250b 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.h +++ b/Userland/Libraries/LibWeb/DOM/Event.h @@ -47,11 +47,11 @@ public: using Path = Vector<PathEntry>; - static NonnullRefPtr<Event> create(const FlyString& event_name, EventInit const& event_init = {}) + static NonnullRefPtr<Event> create(FlyString const& event_name, EventInit const& event_init = {}) { return adopt_ref(*new Event(event_name, event_init)); } - static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, EventInit const& event_init) + static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, EventInit const& event_init) { return Event::create(event_name, event_init); } @@ -60,7 +60,7 @@ public: double time_stamp() const; - const FlyString& type() const { return m_type; } + FlyString const& type() const { return m_type; } void set_type(StringView type) { m_type = type; } RefPtr<EventTarget> target() const { return m_target; } @@ -111,7 +111,7 @@ public: void append_to_path(EventTarget&, RefPtr<EventTarget>, RefPtr<EventTarget>, TouchTargetList&, bool); Path& path() { return m_path; } - const Path& path() const { return m_path; } + Path const& path() const { return m_path; } void clear_path() { m_path.clear(); } void set_touch_target_list(TouchTargetList& touch_target_list) { m_touch_target_list = touch_target_list; } @@ -142,7 +142,7 @@ public: m_stop_immediate_propagation = true; } - void init_event(const String&, bool, bool); + void init_event(String const&, bool, bool); void set_time_stamp(double time_stamp) { m_time_stamp = time_stamp; } @@ -163,7 +163,7 @@ protected: { } - void initialize(const String&, bool, bool); + void initialize(String const&, bool, bool); private: FlyString m_type; diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.h b/Userland/Libraries/LibWeb/DOM/EventTarget.h index 75586c3d36..c0098efc47 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.h +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.h @@ -41,7 +41,7 @@ public: virtual JS::Object* create_wrapper(JS::GlobalObject&) = 0; - virtual EventTarget* get_parent(const Event&) { return nullptr; } + virtual EventTarget* get_parent(Event const&) { return nullptr; } void add_an_event_listener(NonnullRefPtr<DOMEventListener>); void remove_an_event_listener(DOMEventListener&); @@ -50,7 +50,7 @@ public: auto& event_listener_list() { return m_event_listener_list; } auto const& event_listener_list() const { return m_event_listener_list; } - Function<void(const Event&)> activation_behavior; + Function<void(Event const&)> activation_behavior; // NOTE: These only exist for checkbox and radio input elements. virtual void legacy_pre_activation_behavior() { } diff --git a/Userland/Libraries/LibWeb/DOM/ExceptionOr.h b/Userland/Libraries/LibWeb/DOM/ExceptionOr.h index e741cbceba..bef730ff68 100644 --- a/Userland/Libraries/LibWeb/DOM/ExceptionOr.h +++ b/Userland/Libraries/LibWeb/DOM/ExceptionOr.h @@ -39,7 +39,7 @@ public: { } - ExceptionOr(const ValueType& result) + ExceptionOr(ValueType const& result) : m_result(result) { } @@ -65,7 +65,7 @@ public: } ExceptionOr(ExceptionOr&& other) = default; - ExceptionOr(const ExceptionOr& other) = default; + ExceptionOr(ExceptionOr const& other) = default; ~ExceptionOr() = default; ValueType& value() requires(!IsSame<ValueType, Empty>) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index ad6773e4e3..c12ed76f78 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -95,7 +95,7 @@ const HTML::HTMLElement* Node::enclosing_html_element() const return first_ancestor_of_type<HTML::HTMLElement>(); } -const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(const FlyString& attribute) const +const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(FlyString const& attribute) const { for (auto* node = this; node; node = node->parent()) { if (is<HTML::HTMLElement>(*node) && verify_cast<HTML::HTMLElement>(*node).has_attribute(attribute)) @@ -162,7 +162,7 @@ String Node::node_value() const } // https://dom.spec.whatwg.org/#ref-for-dom-node-nodevalue%E2%91%A0 -void Node::set_node_value(const String& value) +void Node::set_node_value(String const& value) { if (is<Attribute>(this)) { @@ -249,7 +249,7 @@ Element* Node::parent_element() return verify_cast<Element>(parent()); } -const Element* Node::parent_element() const +Element const* Node::parent_element() const { if (!parent() || !is<Element>(parent())) return nullptr; @@ -650,7 +650,7 @@ void Node::set_layout_node(Badge<Layout::Node>, Layout::Node* layout_node) const m_layout_node = nullptr; } -EventTarget* Node::get_parent(const Event&) +EventTarget* Node::get_parent(Event const&) { // FIXME: returns the node’s assigned slot, if node is assigned, and node’s parent otherwise. return parent(); @@ -746,7 +746,7 @@ u16 Node::compare_document_position(RefPtr<Node> other) } // https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor -bool Node::is_host_including_inclusive_ancestor_of(const Node& other) const +bool Node::is_host_including_inclusive_ancestor_of(Node const& other) const { if (is_inclusive_ancestor_of(other)) return true; diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 44d63efb96..ffc513642b 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -50,7 +50,7 @@ public: using TreeNode<Node>::unref; ParentNode* parent_or_shadow_host(); - const ParentNode* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); } + ParentNode const* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); } // ^EventTarget virtual void ref_event_target() final { ref(); } @@ -121,24 +121,24 @@ public: void set_node_value(String const&); Document& document() { return *m_document; } - const Document& document() const { return *m_document; } + Document const& document() const { return *m_document; } RefPtr<Document> owner_document() const; const HTML::HTMLAnchorElement* enclosing_link_element() const; const HTML::HTMLElement* enclosing_html_element() const; - const HTML::HTMLElement* enclosing_html_element_with_attribute(const FlyString&) const; + const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const; String child_text_content() const; Node& root(); - const Node& root() const + Node const& root() const { return const_cast<Node*>(this)->root(); } Node& shadow_including_root(); - const Node& shadow_including_root() const + Node const& shadow_including_root() const { return const_cast<Node*>(this)->shadow_including_root(); } @@ -146,10 +146,10 @@ public: bool is_connected() const; Node* parent_node() { return parent(); } - const Node* parent_node() const { return parent(); } + Node const* parent_node() const { return parent(); } Element* parent_element(); - const Element* parent_element() const; + Element const* parent_element() const; virtual void inserted(); virtual void removed_from(Node*) { } @@ -157,7 +157,7 @@ public: virtual void adopted_from(Document&) { } virtual void cloned(Node&, bool) {}; - const Layout::Node* layout_node() const { return m_layout_node; } + Layout::Node const* layout_node() const { return m_layout_node; } Layout::Node* layout_node() { return m_layout_node; } Painting::PaintableBox const* paint_box() const; @@ -165,7 +165,7 @@ public: void set_layout_node(Badge<Layout::Node>, Layout::Node*) const; - virtual bool is_child_allowed(const Node&) const { return true; } + virtual bool is_child_allowed(Node const&) const { return true; } bool needs_style_update() const { return m_needs_style_update; } void set_needs_style_update(bool); @@ -179,14 +179,14 @@ public: void set_document(Badge<Document>, Document&); - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; template<typename T> bool fast_is() const = delete; ExceptionOr<void> ensure_pre_insertion_validity(NonnullRefPtr<Node> node, RefPtr<Node> child) const; - bool is_host_including_inclusive_ancestor_of(const Node&) const; + bool is_host_including_inclusive_ancestor_of(Node const&) const; bool is_scripting_enabled() const; bool is_scripting_disabled() const; diff --git a/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h b/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h index 3929382b7c..37a4fde5bd 100644 --- a/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h +++ b/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h @@ -51,10 +51,10 @@ public: return nullptr; } - const Element* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); } - const Element* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); } - const Element* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); } - const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); } + Element const* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); } + Element const* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); } + Element const* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); } + Element const* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); } protected: NonDocumentTypeChildNode() = default; diff --git a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h index 4b8605d4bd..59c1ef65cb 100644 --- a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h +++ b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h @@ -16,10 +16,10 @@ namespace Web::DOM { template<typename NodeType> class NonElementParentNode { public: - RefPtr<Element> get_element_by_id(const FlyString& id) const + RefPtr<Element> get_element_by_id(FlyString const& id) const { RefPtr<Element> found_element; - static_cast<const NodeType*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) { + static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) { if (element.attribute(HTML::AttributeNames::id) == id) { found_element = &element; return IterationDecision::Break; @@ -28,9 +28,9 @@ public: }); return found_element; } - RefPtr<Element> get_element_by_id(const FlyString& id) + RefPtr<Element> get_element_by_id(FlyString const& id) { - return const_cast<const NonElementParentNode*>(this)->get_element_by_id(id); + return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id); } protected: diff --git a/Userland/Libraries/LibWeb/DOM/Position.h b/Userland/Libraries/LibWeb/DOM/Position.h index a4fe55a57e..45ef6768a7 100644 --- a/Userland/Libraries/LibWeb/DOM/Position.h +++ b/Userland/Libraries/LibWeb/DOM/Position.h @@ -21,7 +21,7 @@ public: bool is_valid() const { return m_node; } Node* node() { return m_node; } - const Node* node() const { return m_node; } + Node const* node() const { return m_node; } unsigned offset() const { return m_offset; } bool offset_is_at_end_of_node() const; @@ -29,12 +29,12 @@ public: bool increment_offset(); bool decrement_offset(); - bool operator==(const Position& other) const + bool operator==(Position const& other) const { return m_node == other.m_node && m_offset == other.m_offset; } - bool operator!=(const Position& other) const + bool operator!=(Position const& other) const { return !(*this == other); } diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp index c1cc2f2dce..66cb7a56bc 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp @@ -9,7 +9,7 @@ namespace Web::DOM { -ProcessingInstruction::ProcessingInstruction(Document& document, const String& data, const String& target) +ProcessingInstruction::ProcessingInstruction(Document& document, String const& data, String const& target) : CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data) , m_target(target) { diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h index 087960ca3c..5bc6706daf 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h @@ -15,12 +15,12 @@ class ProcessingInstruction final : public CharacterData { public: using WrapperType = Bindings::ProcessingInstructionWrapper; - ProcessingInstruction(Document&, const String& data, const String& target); + ProcessingInstruction(Document&, String const& data, String const& target); virtual ~ProcessingInstruction() override = default; virtual FlyString node_name() const override { return m_target; } - const String& target() const { return m_target; } + String const& target() const { return m_target; } private: String m_target; diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp index 98965b475d..01a312ee65 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp @@ -19,7 +19,7 @@ ShadowRoot::ShadowRoot(Document& document, Element& host) } // https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6 -EventTarget* ShadowRoot::get_parent(const Event& event) +EventTarget* ShadowRoot::get_parent(Event const& event) { if (!event.composed()) { auto& events_first_invocation_target = verify_cast<Node>(*event.path().first().invocation_target); diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h index f550c0e5cb..b4306c4461 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h @@ -23,7 +23,7 @@ public: void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; } // ^EventTarget - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; // NOTE: This is intended for the JS bindings. String mode() const { return m_closed ? "closed" : "open"; } diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 83b21fcdd7..d2ea61a2bb 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -12,7 +12,7 @@ namespace Web::DOM { -Text::Text(Document& document, const String& data) +Text::Text(Document& document, String const& data) : CharacterData(document, NodeType::TEXT_NODE, data) { } diff --git a/Userland/Libraries/LibWeb/DOM/Text.h b/Userland/Libraries/LibWeb/DOM/Text.h index 2d839cb63a..bccfc2024e 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.h +++ b/Userland/Libraries/LibWeb/DOM/Text.h @@ -16,7 +16,7 @@ class Text final : public CharacterData { public: using WrapperType = Bindings::TextWrapper; - explicit Text(Document&, const String&); + explicit Text(Document&, String const&); virtual ~Text() override = default; static NonnullRefPtr<Text> create_with_global_object(Bindings::WindowObject& window, String const& data); diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.h b/Userland/Libraries/LibWeb/DOMTreeModel.h index 94b7606a62..2d971a1384 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.h +++ b/Userland/Libraries/LibWeb/DOMTreeModel.h @@ -36,14 +36,14 @@ public: private: DOMTreeModel(JsonObject, GUI::TreeView&); - ALWAYS_INLINE JsonObject const* get_parent(const JsonObject& o) const + ALWAYS_INLINE JsonObject const* get_parent(JsonObject const& o) const { auto parent_node = m_dom_node_to_parent_map.get(&o); VERIFY(parent_node.has_value()); return *parent_node; } - ALWAYS_INLINE static JsonArray const* get_children(const JsonObject& o) + ALWAYS_INLINE static JsonArray const* get_children(JsonObject const& o) { if (auto const* maybe_children = o.get_ptr("children"); maybe_children) return &maybe_children->as_array(); diff --git a/Userland/Libraries/LibWeb/FontCache.cpp b/Userland/Libraries/LibWeb/FontCache.cpp index 12edddc2d4..7350049dd3 100644 --- a/Userland/Libraries/LibWeb/FontCache.cpp +++ b/Userland/Libraries/LibWeb/FontCache.cpp @@ -13,7 +13,7 @@ FontCache& FontCache::the() return cache; } -RefPtr<Gfx::Font> FontCache::get(const FontSelector& font_selector) const +RefPtr<Gfx::Font> FontCache::get(FontSelector const& font_selector) const { auto cached_font = m_fonts.get(font_selector); if (cached_font.has_value()) @@ -21,7 +21,7 @@ RefPtr<Gfx::Font> FontCache::get(const FontSelector& font_selector) const return nullptr; } -void FontCache::set(const FontSelector& font_selector, NonnullRefPtr<Gfx::Font> font) +void FontCache::set(FontSelector const& font_selector, NonnullRefPtr<Gfx::Font> font) { m_fonts.set(font_selector, move(font)); } diff --git a/Userland/Libraries/LibWeb/FontCache.h b/Userland/Libraries/LibWeb/FontCache.h index f36411570f..647e6b6813 100644 --- a/Userland/Libraries/LibWeb/FontCache.h +++ b/Userland/Libraries/LibWeb/FontCache.h @@ -18,7 +18,7 @@ struct FontSelector { int weight { 0 }; int slope { 0 }; - bool operator==(const FontSelector& other) const + bool operator==(FontSelector const& other) const { return family == other.family && point_size == other.point_size && weight == other.weight && slope == other.slope; } @@ -27,15 +27,15 @@ struct FontSelector { namespace AK { template<> struct Traits<FontSelector> : public GenericTraits<FontSelector> { - static unsigned hash(const FontSelector& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); } + static unsigned hash(FontSelector const& key) { return pair_int_hash(pair_int_hash(key.family.hash(), key.weight), key.point_size); } }; } class FontCache { public: static FontCache& the(); - RefPtr<Gfx::Font> get(const FontSelector&) const; - void set(const FontSelector&, NonnullRefPtr<Gfx::Font>); + RefPtr<Gfx::Font> get(FontSelector const&) const; + void set(FontSelector const&, NonnullRefPtr<Gfx::Font>); private: FontCache() = default; diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h index 8d44b124c6..78b6071d9c 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h @@ -16,7 +16,7 @@ public: virtual ~BrowsingContextContainer() override; BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; } - const BrowsingContext* nested_browsing_context() const { return m_nested_browsing_context; } + BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; } const DOM::Document* content_document() const; DOM::Document const* content_document_without_origin_check() const; diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 806cae33cc..d3994da800 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -207,7 +207,7 @@ void CanvasRenderingContext2D::rotate(float radians) m_drawing_state.transform.rotate_radians(radians); } -void CanvasRenderingContext2D::did_draw(const Gfx::FloatRect&) +void CanvasRenderingContext2D::did_draw(Gfx::FloatRect const&) { // FIXME: Make use of the rect to reduce the invalidated area when possible. if (!m_element) @@ -230,7 +230,7 @@ OwnPtr<Gfx::Painter> CanvasRenderingContext2D::painter() return make<Gfx::Painter>(*m_element->bitmap()); } -void CanvasRenderingContext2D::fill_text(const String& text, float x, float y, Optional<double> max_width) +void CanvasRenderingContext2D::fill_text(String const& text, float x, float y, Optional<double> max_width) { if (max_width.has_value() && max_width.value() <= 0) return; @@ -383,7 +383,7 @@ void CanvasRenderingContext2D::fill(Gfx::Painter::WindingRule winding) did_draw(m_path.bounding_box()); } -void CanvasRenderingContext2D::fill(const String& fill_rule) +void CanvasRenderingContext2D::fill(String const& fill_rule) { if (fill_rule == "evenodd") return fill(Gfx::Painter::WindingRule::EvenOdd); @@ -439,7 +439,7 @@ DOM::ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int return image_data; } -void CanvasRenderingContext2D::put_image_data(const ImageData& image_data, float x, float y) +void CanvasRenderingContext2D::put_image_data(ImageData const& image_data, float x, float y) { auto painter = this->painter(); if (!painter) diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index ceacd1b5c8..f7465670b0 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -72,16 +72,16 @@ public: void rect(float x, float y, float width, float height); void stroke(); - void fill_text(const String&, float x, float y, Optional<double> max_width); + void fill_text(String const&, float x, float y, Optional<double> max_width); void stroke_text(String const&, float x, float y, Optional<double> max_width); // FIXME: We should only have one fill(), really. Fix the wrapper generator! void fill(Gfx::Painter::WindingRule); - void fill(const String& fill_rule); + void fill(String const& fill_rule); RefPtr<ImageData> create_image_data(int width, int height) const; DOM::ExceptionOr<RefPtr<ImageData>> get_image_data(int x, int y, int width, int height) const; - void put_image_data(const ImageData&, float x, float y); + void put_image_data(ImageData const&, float x, float y); void save(); void restore(); @@ -112,7 +112,7 @@ private: Gfx::IntRect bounding_box; }; - void did_draw(const Gfx::FloatRect&); + void did_draw(Gfx::FloatRect const&); PreparedText prepare_text(String const& text, float max_width = INFINITY); OwnPtr<Gfx::Painter> painter(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 5d75290daa..ad0d688c6f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -37,7 +37,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co }); } -void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value) +void HTMLBodyElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); if (name.equals_ignoring_case("link")) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 9bbb48ec2f..2aef6df4d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -17,7 +17,7 @@ public: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLBodyElement() override; - virtual void parse_attribute(const FlyString&, const String&) override; + virtual void parse_attribute(FlyString const&, String const&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; private: diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 2f132faff9..1244c3dfc0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -59,7 +59,7 @@ CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) return m_context; } -static Gfx::IntSize bitmap_size_for_canvas(const HTMLCanvasElement& canvas) +static Gfx::IntSize bitmap_size_for_canvas(HTMLCanvasElement const& canvas) { auto width = canvas.width(); auto height = canvas.height(); @@ -94,7 +94,7 @@ bool HTMLCanvasElement::create_bitmap() return m_bitmap; } -String HTMLCanvasElement::to_data_url(const String& type, [[maybe_unused]] Optional<double> quality) const +String HTMLCanvasElement::to_data_url(String const& type, [[maybe_unused]] Optional<double> quality) const { if (!m_bitmap) return {}; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h index d242c12adf..b6bda5884c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -19,7 +19,7 @@ public: HTMLCanvasElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLCanvasElement() override; - const Gfx::Bitmap* bitmap() const { return m_bitmap; } + Gfx::Bitmap const* bitmap() const { return m_bitmap; } Gfx::Bitmap* bitmap() { return m_bitmap; } bool create_bitmap(); @@ -31,7 +31,7 @@ public: void set_width(unsigned); void set_height(unsigned); - String to_data_url(const String& type, Optional<double> quality) const; + String to_data_url(String const& type, Optional<double> quality) const; private: virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index b9523d51cf..748d85fc5e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -78,7 +78,7 @@ String HTMLElement::content_editable() const } // https://html.spec.whatwg.org/multipage/interaction.html#contenteditable -DOM::ExceptionOr<void> HTMLElement::set_content_editable(const String& content_editable) +DOM::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable) { if (content_editable.equals_ignoring_case("inherit")) { remove_attribute(HTML::AttributeNames::contenteditable); @@ -112,7 +112,7 @@ String HTMLElement::inner_text() if (!layout_node()) return text_content(); - Function<void(const Layout::Node&)> recurse = [&](auto& node) { + Function<void(Layout::Node const&)> recurse = [&](auto& node) { for (auto* child = node.first_child(); child; child = child->next_sibling()) { if (is<Layout::TextNode>(child)) builder.append(verify_cast<Layout::TextNode>(*child).text_for_rendering()); @@ -168,7 +168,7 @@ bool HTMLElement::cannot_navigate() const return !is<HTML::HTMLAnchorElement>(this) && !is_connected(); } -void HTMLElement::parse_attribute(const FlyString& name, const String& value) +void HTMLElement::parse_attribute(FlyString const& name, String const& value) { Element::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index 6e6239c56e..c4f0ba8bfc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -26,7 +26,7 @@ public: virtual bool is_editable() const final; String content_editable() const; - DOM::ExceptionOr<void> set_content_editable(const String&); + DOM::ExceptionOr<void> set_content_editable(String const&); String inner_text(); void set_inner_text(StringView); @@ -50,7 +50,7 @@ public: virtual bool is_labelable() const { return false; } protected: - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; private: // ^HTML::GlobalEventHandlers diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index cb3427e697..1cb3a6c06c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -22,7 +22,7 @@ public: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLFieldSetElement() override; - const String& type() const + String const& type() const { static String fieldset = "fieldset"; return fieldset; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 5879b7b4cf..163a457553 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -25,7 +25,7 @@ RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::St return adopt_ref(*new Layout::FrameBox(document(), *this, move(style))); } -void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value) +void HTMLIFrameElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); if (name == HTML::AttributeNames::src) @@ -56,7 +56,7 @@ void HTMLIFrameElement::removed_from(DOM::Node* node) discard_nested_browsing_context(); } -void HTMLIFrameElement::load_src(const String& value) +void HTMLIFrameElement::load_src(String const& value) { if (!m_nested_browsing_context) return; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index 1276480fc9..34149e50ed 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -22,9 +22,9 @@ public: private: virtual void inserted() override; virtual void removed_from(Node*) override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; - void load_src(const String&); + void load_src(String const&); }; void run_iframe_load_event_steps(HTML::HTMLIFrameElement&); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index bf05d8983e..17fdca1b91 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -70,7 +70,7 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c }); } -void HTMLImageElement::parse_attribute(const FlyString& name, const String& value) +void HTMLImageElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); @@ -83,7 +83,7 @@ RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::Sty return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); } -const Gfx::Bitmap* HTMLImageElement::bitmap() const +Gfx::Bitmap const* HTMLImageElement::bitmap() const { return m_image_loader.bitmap(m_image_loader.current_frame_index()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index e488e96f58..c7b46db958 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -26,12 +26,12 @@ public: HTMLImageElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLImageElement() override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; String alt() const { return attribute(HTML::AttributeNames::alt); } String src() const { return attribute(HTML::AttributeNames::src); } - const Gfx::Bitmap* bitmap() const; + Gfx::Bitmap const* bitmap() const; unsigned width() const; void set_width(unsigned); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index b1f835e43b..acebc098f8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -53,7 +53,7 @@ void HTMLLinkElement::inserted() } } -void HTMLLinkElement::parse_attribute(const FlyString& name, const String& value) +void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value) { if (name == HTML::AttributeNames::rel) { m_relationship = 0; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index 9a5153f9db..f033b27d0a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -29,7 +29,7 @@ public: String href() const { return attribute(HTML::AttributeNames::href); } private: - void parse_attribute(const FlyString&, const String&) override; + void parse_attribute(FlyString const&, String const&) override; // ^ResourceClient virtual void resource_did_fail() override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 0b324c3f05..8c59e43d23 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -23,7 +23,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName HTMLObjectElement::~HTMLObjectElement() = default; -void HTMLObjectElement::parse_attribute(const FlyString& name, const String& value) +void HTMLObjectElement::parse_attribute(FlyString const& name, String const& value) { BrowsingContextContainer::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index 34cb9c4a3a..9b8b7aa558 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -34,7 +34,7 @@ public: HTMLObjectElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLObjectElement() override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; String data() const; void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index 3e38612e8e..fb3ad802d0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -23,7 +23,7 @@ public: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLOutputElement() override; - const String& type() const + String const& type() const { static String output = "output"; return output; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 71ab5b1eb9..32fa015405 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -99,7 +99,7 @@ void HTMLScriptElement::execute_script() } // https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match -static bool is_javascript_mime_type_essence_match(const String& string) +static bool is_javascript_mime_type_essence_match(String const& string) { auto lowercase_string = string.to_lowercase(); return lowercase_string.is_one_of("application/ecmascript", "application/javascript", "application/x-ecmascript", "application/x-javascript", "text/ecmascript", "text/javascript", "text/javascript1.0", "text/javascript1.1", "text/javascript1.2", "text/javascript1.3", "text/javascript1.4", "text/javascript1.5", "text/jscript", "text/livescript", "text/x-ecmascript", "text/x-javascript"); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h index d2eb8509cd..b00dc90bf7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h @@ -19,7 +19,7 @@ public: virtual ~HTMLTemplateElement() override; NonnullRefPtr<DOM::DocumentFragment> content() { return *m_content; } - const NonnullRefPtr<DOM::DocumentFragment> content() const { return *m_content; } + NonnullRefPtr<DOM::DocumentFragment> const content() const { return *m_content; } virtual void adopted_from(DOM::Document&) override; virtual void cloned(Node& copy, bool clone_children) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 23c3148b7e..f8705b2551 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -23,7 +23,7 @@ public: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLTextAreaElement() override; - const String& type() const + String const& type() const { static String textarea = "textarea"; return textarea; diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h index ed14a5852e..9f5c14d7c0 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.h +++ b/Userland/Libraries/LibWeb/HTML/ImageData.h @@ -26,7 +26,7 @@ public: unsigned height() const; Gfx::Bitmap& bitmap() { return m_bitmap; } - const Gfx::Bitmap& bitmap() const { return m_bitmap; } + Gfx::Bitmap const& bitmap() const { return m_bitmap; } JS::Uint8ClampedArray* data(); const JS::Uint8ClampedArray* data() const; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index 2a9b622df5..f492a4170f 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -16,17 +16,17 @@ namespace Web::HTML { -bool prescan_should_abort(const ByteBuffer& input, const size_t& position) +bool prescan_should_abort(ByteBuffer const& input, size_t const& position) { return position >= input.size() || position >= 1024; } -bool prescan_is_whitespace_or_slash(const u8& byte) +bool prescan_is_whitespace_or_slash(u8 const& byte) { return byte == '\t' || byte == '\n' || byte == '\f' || byte == '\r' || byte == ' ' || byte == '/'; } -bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position) +bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position) { while (!prescan_should_abort(input, position) && (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '/')) ++position; @@ -96,7 +96,7 @@ Optional<StringView> extract_character_encoding_from_meta_element(String const& return TextCodec::get_standardized_encoding(encoding); } -RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, const ByteBuffer& input, size_t& position) +RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position) { if (!prescan_skip_whitespace_and_slashes(input, position)) return {}; @@ -160,7 +160,7 @@ value: } // https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding -Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, const ByteBuffer& input) +Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input) { // https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding @@ -249,7 +249,7 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, cons } // https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding -String run_encoding_sniffing_algorithm(DOM::Document& document, const ByteBuffer& input) +String run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input) { if (input.size() >= 2) { if (input[0] == 0xFE && input[1] == 0xFF) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h index e388b68d99..6cb9fc7e31 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h @@ -12,12 +12,12 @@ namespace Web::HTML { -bool prescan_should_abort(const ByteBuffer& input, const size_t& position); -bool prescan_is_whitespace_or_slash(const u8& byte); -bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position); +bool prescan_should_abort(ByteBuffer const& input, size_t const& position); +bool prescan_is_whitespace_or_slash(u8 const& byte); +bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position); Optional<StringView> extract_character_encoding_from_meta_element(String const&); -RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, const ByteBuffer& input, size_t& position); -Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, const ByteBuffer& input); -String run_encoding_sniffing_algorithm(DOM::Document&, const ByteBuffer& input); +RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position); +Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input); +String run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index ba5e00dc13..7e59679b08 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -32,7 +32,7 @@ namespace Web::HTML { -static inline void log_parse_error(const SourceLocation& location = SourceLocation::current()) +static inline void log_parse_error(SourceLocation const& location = SourceLocation::current()) { dbgln("Parse error! {}", location); } @@ -118,7 +118,7 @@ static bool is_html_integration_point(DOM::Element const& element) return false; } -RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, const String& encoding) +RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, String const& encoding) { auto document = DOM::Document::create(url); auto parser = HTMLParser::create(document, data, encoding); @@ -126,7 +126,7 @@ RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, c return document; } -HTMLParser::HTMLParser(DOM::Document& document, StringView input, const String& encoding) +HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const& encoding) : m_tokenizer(input, encoding) , m_document(document) { @@ -389,7 +389,7 @@ void HTMLParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& toke } } -DOM::QuirksMode HTMLParser::which_quirks_mode(const HTMLToken& doctype_token) const +DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) const { if (doctype_token.doctype_data().force_quirks) return DOM::QuirksMode::Yes; @@ -651,7 +651,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::create_element_for(HTMLToken const& toke } // https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element -NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_) +NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(HTMLToken const& token, FlyString const& namespace_) { auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(); @@ -677,7 +677,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& return element; } -NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(const HTMLToken& token) +NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(HTMLToken const& token) { return insert_foreign_element(token, Namespace::HTML); } @@ -1011,7 +1011,7 @@ AnythingElse: process_using_the_rules_for(m_insertion_mode, token); } -void HTMLParser::generate_implied_end_tags(const FlyString& exception) +void HTMLParser::generate_implied_end_tags(FlyString const& exception) { while (current_node().local_name() != exception && current_node().local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc)) (void)m_stack_of_open_elements.pop(); @@ -1335,7 +1335,7 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a } } -bool HTMLParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_) +bool HTMLParser::is_special_tag(FlyString const& tag_name, FlyString const& namespace_) { if (namespace_ == Namespace::HTML) { return tag_name.is_one_of( @@ -3357,7 +3357,7 @@ void HTMLParser::reset_the_insertion_mode_appropriately() m_insertion_mode = InsertionMode::InBody; } -const char* HTMLParser::insertion_mode_name() const +char const* HTMLParser::insertion_mode_name() const { switch (m_insertion_mode) { #define __ENUMERATE_INSERTION_MODE(mode) \ @@ -3430,7 +3430,7 @@ NonnullRefPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& docume return adopt_ref(*new HTMLParser(document)); } -NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, const ByteBuffer& input) +NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input) { if (document.has_encoding()) return adopt_ref(*new HTMLParser(document, input, document.encoding().value())); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h index 7fbfb363d6..81d0e46dd3 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h @@ -39,7 +39,7 @@ namespace Web::HTML { __ENUMERATE_INSERTION_MODE(AfterAfterBody) \ __ENUMERATE_INSERTION_MODE(AfterAfterFrameset) -RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, const String& encoding); +RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, String const& encoding); class HTMLParser : public RefCounted<HTMLParser> { friend class HTMLTokenizer; @@ -67,7 +67,7 @@ public: InsertionMode insertion_mode() const { return m_insertion_mode; } - static bool is_special_tag(const FlyString& tag_name, const FlyString& namespace_); + static bool is_special_tag(FlyString const& tag_name, FlyString const& namespace_); HTMLTokenizer& tokenizer() { return m_tokenizer; } @@ -76,12 +76,12 @@ public: size_t script_nesting_level() const { return m_script_nesting_level; } private: - HTMLParser(DOM::Document&, StringView input, const String& encoding); + HTMLParser(DOM::Document&, StringView input, String const& encoding); HTMLParser(DOM::Document&); - const char* insertion_mode_name() const; + char const* insertion_mode_name() const; - DOM::QuirksMode which_quirks_mode(const HTMLToken&) const; + DOM::QuirksMode which_quirks_mode(HTMLToken const&) const; void handle_initial(HTMLToken&); void handle_before_html(HTMLToken&); @@ -111,7 +111,7 @@ private: void stop_parsing() { m_stop_parsing = true; } - void generate_implied_end_tags(const FlyString& exception = {}); + void generate_implied_end_tags(FlyString const& exception = {}); void generate_all_implied_end_tags_thoroughly(); NonnullRefPtr<DOM::Element> create_element_for(HTMLToken const&, FlyString const& namespace_, DOM::Node const& intended_parent); @@ -124,8 +124,8 @@ private: DOM::Text* find_character_insertion_node(); void flush_character_insertions(); - NonnullRefPtr<DOM::Element> insert_foreign_element(const HTMLToken&, const FlyString&); - NonnullRefPtr<DOM::Element> insert_html_element(const HTMLToken&); + NonnullRefPtr<DOM::Element> insert_foreign_element(HTMLToken const&, FlyString const&); + NonnullRefPtr<DOM::Element> insert_html_element(HTMLToken const&); DOM::Element& current_node(); DOM::Element& adjusted_current_node(); DOM::Element& node_before_current_node(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp index 838f147df6..1d2453aad6 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp @@ -31,7 +31,7 @@ bool ListOfActiveFormattingElements::contains(const DOM::Element& element) const return false; } -DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(const FlyString& tag_name) +DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(FlyString const& tag_name) { for (ssize_t i = m_entries.size() - 1; i >= 0; --i) { auto& entry = m_entries[i]; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h index 9476e28497..bf8293d1f5 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h @@ -34,10 +34,10 @@ public: void remove(DOM::Element&); - const Vector<Entry>& entries() const { return m_entries; } + Vector<Entry> const& entries() const { return m_entries; } Vector<Entry>& entries() { return m_entries; } - DOM::Element* last_element_with_tag_name_before_marker(const FlyString& tag_name); + DOM::Element* last_element_with_tag_name_before_marker(FlyString const& tag_name); void clear_up_to_the_last_marker(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index f71b35cdaf..f67c64305d 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -14,7 +14,7 @@ static Vector<FlyString> s_base_list { "applet", "caption", "html", "table", "td StackOfOpenElements::~StackOfOpenElements() = default; -bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>& list) const +bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const& list) const { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& node = m_elements.at(i); @@ -26,12 +26,12 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec VERIFY_NOT_REACHED(); } -bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_scope(FlyString const& tag_name) const { return has_in_scope_impl(tag_name, s_base_list); } -bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>& list) const +bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const& list) const { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& node = m_elements.at(i); @@ -48,19 +48,19 @@ bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const return has_in_scope_impl(target_node, s_base_list); } -bool StackOfOpenElements::has_in_button_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_button_scope(FlyString const& tag_name) const { auto list = s_base_list; list.append("button"); return has_in_scope_impl(tag_name, list); } -bool StackOfOpenElements::has_in_table_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_table_scope(FlyString const& tag_name) const { return has_in_scope_impl(tag_name, { "html", "table", "template" }); } -bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_list_item_scope(FlyString const& tag_name) const { auto list = s_base_list; list.append("ol"); @@ -74,7 +74,7 @@ bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) cons // - optgroup in the HTML namespace // - option in the HTML namespace // NOTE: In this case it's "all element types _except_" -bool StackOfOpenElements::has_in_select_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_select_scope(FlyString const& tag_name) const { // https://html.spec.whatwg.org/multipage/parsing.html#has-an-element-in-the-specific-scope for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { @@ -103,7 +103,7 @@ bool StackOfOpenElements::contains(const DOM::Element& element) const return false; } -bool StackOfOpenElements::contains(const FlyString& tag_name) const +bool StackOfOpenElements::contains(FlyString const& tag_name) const { for (auto& element_on_stack : m_elements) { if (element_on_stack.local_name() == tag_name) @@ -112,7 +112,7 @@ bool StackOfOpenElements::contains(const FlyString& tag_name) const return false; } -void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(const FlyString& tag_name) +void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(FlyString const& tag_name) { while (m_elements.last().local_name() != tag_name) (void)pop(); @@ -132,7 +132,7 @@ DOM::Element* StackOfOpenElements::topmost_special_node_below(const DOM::Element return found_element; } -StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(const FlyString& tag_name) +StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(FlyString const& tag_name) { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& element = m_elements[i]; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h index 8c6baae04a..726d7018de 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h @@ -36,21 +36,21 @@ public: const DOM::Element& current_node() const { return m_elements.last(); } DOM::Element& current_node() { return m_elements.last(); } - bool has_in_scope(const FlyString& tag_name) const; - bool has_in_button_scope(const FlyString& tag_name) const; - bool has_in_table_scope(const FlyString& tag_name) const; - bool has_in_list_item_scope(const FlyString& tag_name) const; - bool has_in_select_scope(const FlyString& tag_name) const; + bool has_in_scope(FlyString const& tag_name) const; + bool has_in_button_scope(FlyString const& tag_name) const; + bool has_in_table_scope(FlyString const& tag_name) const; + bool has_in_list_item_scope(FlyString const& tag_name) const; + bool has_in_select_scope(FlyString const& tag_name) const; bool has_in_scope(const DOM::Element&) const; bool contains(const DOM::Element&) const; - bool contains(const FlyString& tag_name) const; + bool contains(FlyString const& tag_name) const; - const NonnullRefPtrVector<DOM::Element>& elements() const { return m_elements; } + NonnullRefPtrVector<DOM::Element> const& elements() const { return m_elements; } NonnullRefPtrVector<DOM::Element>& elements() { return m_elements; } - void pop_until_an_element_with_tag_name_has_been_popped(const FlyString&); + void pop_until_an_element_with_tag_name_has_been_popped(FlyString const&); DOM::Element* topmost_special_node_below(const DOM::Element&); @@ -58,12 +58,12 @@ public: DOM::Element* element; ssize_t index; }; - LastElementResult last_element_with_tag_name(const FlyString&); + LastElementResult last_element_with_tag_name(FlyString const&); DOM::Element* element_immediately_above(DOM::Element const&); private: - bool has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>&) const; - bool has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>&) const; + bool has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const&) const; + bool has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const&) const; NonnullRefPtrVector<DOM::Element> m_elements; }; diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index 688b0994cb..3ecd087454 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -64,7 +64,7 @@ void InProcessWebView::page_did_layout() set_content_size(layout_root()->paint_box()->content_size().to_type<int>()); } -void InProcessWebView::page_did_change_title(const String& title) +void InProcessWebView::page_did_change_title(String const& title) { if (on_title_change) on_title_change(title); @@ -101,19 +101,19 @@ void InProcessWebView::page_did_request_cursor_change(Gfx::StandardCursor cursor set_override_cursor(cursor); } -void InProcessWebView::page_did_request_context_menu(const Gfx::IntPoint& content_position) +void InProcessWebView::page_did_request_context_menu(Gfx::IntPoint const& content_position) { if (on_context_menu_request) on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position))); } -void InProcessWebView::page_did_request_link_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) +void InProcessWebView::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const AK::URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers) { if (on_link_context_menu_request) on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position))); } -void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& content_position, const AK::URL& url, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap* bitmap) +void InProcessWebView::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const AK::URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers, Gfx::Bitmap const* bitmap) { if (!on_image_context_menu_request) return; @@ -123,19 +123,19 @@ void InProcessWebView::page_did_request_image_context_menu(const Gfx::IntPoint& on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), move(shareable_bitmap)); } -void InProcessWebView::page_did_click_link(const AK::URL& url, const String& target, unsigned modifiers) +void InProcessWebView::page_did_click_link(const AK::URL& url, String const& target, unsigned modifiers) { if (on_link_click) on_link_click(url, target, modifiers); } -void InProcessWebView::page_did_middle_click_link(const AK::URL& url, const String& target, unsigned modifiers) +void InProcessWebView::page_did_middle_click_link(const AK::URL& url, String const& target, unsigned modifiers) { if (on_link_middle_click) on_link_middle_click(url, target, modifiers); } -void InProcessWebView::page_did_enter_tooltip_area([[maybe_unused]] const Gfx::IntPoint& content_position, const String& title) +void InProcessWebView::page_did_enter_tooltip_area([[maybe_unused]] Gfx::IntPoint const& content_position, String const& title) { GUI::Application::the()->show_tooltip(title, nullptr); } @@ -157,12 +157,12 @@ void InProcessWebView::page_did_unhover_link() on_link_hover({}); } -void InProcessWebView::page_did_invalidate(const Gfx::IntRect&) +void InProcessWebView::page_did_invalidate(Gfx::IntRect const&) { update(); } -void InProcessWebView::page_did_change_favicon(const Gfx::Bitmap& bitmap) +void InProcessWebView::page_did_change_favicon(Gfx::Bitmap const& bitmap) { if (on_favicon_change) on_favicon_change(bitmap); @@ -306,7 +306,7 @@ bool InProcessWebView::load(const AK::URL& url) return page().top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation); } -const Layout::InitialContainingBlock* InProcessWebView::layout_root() const +Layout::InitialContainingBlock const* InProcessWebView::layout_root() const { return document() ? document()->layout_node() : nullptr; } @@ -318,7 +318,7 @@ Layout::InitialContainingBlock* InProcessWebView::layout_root() return const_cast<Layout::InitialContainingBlock*>(document()->layout_node()); } -void InProcessWebView::page_did_request_scroll_into_view(const Gfx::IntRect& rect) +void InProcessWebView::page_did_request_scroll_into_view(Gfx::IntRect const& rect) { scroll_into_view(rect, true, true); set_override_cursor(Gfx::StandardCursor::None); @@ -360,18 +360,18 @@ void InProcessWebView::drop_event(GUI::DropEvent& event) AbstractScrollableWidget::drop_event(event); } -void InProcessWebView::page_did_request_alert(const String& message) +void InProcessWebView::page_did_request_alert(String const& message) { GUI::MessageBox::show(window(), message, "Alert", GUI::MessageBox::Type::Information); } -bool InProcessWebView::page_did_request_confirm(const String& message) +bool InProcessWebView::page_did_request_confirm(String const& message) { auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); return confirm_result == GUI::Dialog::ExecResult::ExecOK; } -String InProcessWebView::page_did_request_prompt(const String& message, const String& default_) +String InProcessWebView::page_did_request_prompt(String const& message, String const& default_) { String value { default_ }; if (GUI::InputBox::show(window(), value, message, "Prompt") == GUI::InputBox::ExecOK) @@ -386,7 +386,7 @@ String InProcessWebView::page_did_request_cookie(const AK::URL& url, Cookie::Sou return {}; } -void InProcessWebView::page_did_set_cookie(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source) +void InProcessWebView::page_did_set_cookie(const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source) { if (on_set_cookie) on_set_cookie(url, cookie, source); diff --git a/Userland/Libraries/LibWeb/InProcessWebView.h b/Userland/Libraries/LibWeb/InProcessWebView.h index b51a384e2c..c62cd6fbdc 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.h +++ b/Userland/Libraries/LibWeb/InProcessWebView.h @@ -32,7 +32,7 @@ public: void set_document(DOM::Document*); - const Layout::InitialContainingBlock* layout_root() const; + Layout::InitialContainingBlock const* layout_root() const; Layout::InitialContainingBlock* layout_root(); void reload(); @@ -50,7 +50,7 @@ private: InProcessWebView(); Page& page() { return *m_page; } - const Page& page() const { return *m_page; } + Page const& page() const { return *m_page; } virtual void resize_event(GUI::ResizeEvent&) override; virtual void paint_event(GUI::PaintEvent&) override; @@ -67,30 +67,30 @@ private: virtual Gfx::Palette palette() const override { return GUI::AbstractScrollableWidget::palette(); } virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); } virtual CSS::PreferredColorScheme preferred_color_scheme() const override { return m_preferred_color_scheme; } - virtual void page_did_change_title(const String&) override; + virtual void page_did_change_title(String const&) override; virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) override; virtual void page_did_start_loading(const AK::URL&) override; virtual void page_did_finish_loading(const AK::URL&) override; virtual void page_did_change_selection() override; virtual void page_did_request_cursor_change(Gfx::StandardCursor) override; - virtual void page_did_request_context_menu(const Gfx::IntPoint&) override; - virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers) override; - virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::Bitmap*) override; - virtual void page_did_click_link(const AK::URL&, const String& target, unsigned modifiers) override; - virtual void page_did_middle_click_link(const AK::URL&, const String& target, unsigned modifiers) override; - virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override; + virtual void page_did_request_context_menu(Gfx::IntPoint const&) override; + virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers) override; + virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::Bitmap const*) override; + virtual void page_did_click_link(const AK::URL&, String const& target, unsigned modifiers) override; + virtual void page_did_middle_click_link(const AK::URL&, String const& target, unsigned modifiers) override; + virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override; virtual void page_did_leave_tooltip_area() override; virtual void page_did_hover_link(const AK::URL&) override; virtual void page_did_unhover_link() override; - virtual void page_did_invalidate(const Gfx::IntRect&) override; - virtual void page_did_change_favicon(const Gfx::Bitmap&) override; + virtual void page_did_invalidate(Gfx::IntRect const&) override; + virtual void page_did_change_favicon(Gfx::Bitmap const&) override; virtual void page_did_layout() override; - virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) override; - virtual void page_did_request_alert(const String&) override; - virtual bool page_did_request_confirm(const String&) override; - virtual String page_did_request_prompt(const String&, const String&) override; + virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) override; + virtual void page_did_request_alert(String const&) override; + virtual bool page_did_request_confirm(String const&) override; + virtual String page_did_request_prompt(String const&, String const&) override; virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) override; - virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) override; + virtual void page_did_set_cookie(const AK::URL&, Cookie::ParsedCookie const&, Cookie::Source) override; void layout_and_sync_size(); diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp index d958c55d3b..e46bbda70d 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp @@ -27,7 +27,7 @@ bool BlockContainer::is_scrollable() const return computed_values().overflow_y() == CSS::Overflow::Scroll; } -void BlockContainer::set_scroll_offset(const Gfx::FloatPoint& offset) +void BlockContainer::set_scroll_offset(Gfx::FloatPoint const& offset) { // FIXME: If there is horizontal and vertical scroll ignore only part of the new offset if (offset.y() < 0 || m_scroll_offset == offset) diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.h b/Userland/Libraries/LibWeb/Layout/BlockContainer.h index fbff185595..0735a45553 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.h +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.h @@ -19,13 +19,13 @@ public: virtual ~BlockContainer() override; BlockContainer* previous_sibling() { return verify_cast<BlockContainer>(Node::previous_sibling()); } - const BlockContainer* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); } + BlockContainer const* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); } BlockContainer* next_sibling() { return verify_cast<BlockContainer>(Node::next_sibling()); } - const BlockContainer* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); } + BlockContainer const* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); } bool is_scrollable() const; - const Gfx::FloatPoint& scroll_offset() const { return m_scroll_offset; } - void set_scroll_offset(const Gfx::FloatPoint&); + Gfx::FloatPoint const& scroll_offset() const { return m_scroll_offset; } + void set_scroll_offset(Gfx::FloatPoint const&); Painting::PaintableWithLines const* paint_box() const; diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index e8e4cc63eb..995af034dc 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -115,10 +115,10 @@ void BlockFormattingContext::compute_width(Box const& box, LayoutMode layout_mod auto margin_left = CSS::Length::make_auto(); auto margin_right = CSS::Length::make_auto(); - const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box); - const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box); + auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box); + auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box); - auto try_compute_width = [&](const auto& a_width) { + auto try_compute_width = [&](auto const& a_width) { CSS::Length width = a_width; margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box); margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box); @@ -253,8 +253,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Layo auto margin_left = computed_values.margin().left.resolved(box, width_of_containing_block_as_length).resolved(box); auto margin_right = computed_values.margin().right.resolved(box, width_of_containing_block_as_length).resolved(box); - const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box); - const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box); + auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block_as_length).resolved(box); + auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block_as_length).resolved(box); // If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'. if (margin_left.is_auto()) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 5dcd1dcfde..603aa176eb 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -29,7 +29,7 @@ FormattingContext::FormattingContext(Type type, FormattingState& state, Box cons FormattingContext::~FormattingContext() = default; -bool FormattingContext::creates_block_formatting_context(const Box& box) +bool FormattingContext::creates_block_formatting_context(Box const& box) { if (box.is_root_element()) return true; @@ -472,12 +472,12 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele auto margin_left = CSS::Length::make_auto(); auto margin_right = CSS::Length::make_auto(); - const auto border_left = computed_values.border_left().width; - const auto border_right = computed_values.border_right().width; - const auto padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box); - const auto padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box); + auto const border_left = computed_values.border_left().width; + auto const border_right = computed_values.border_right().width; + auto const padding_left = computed_values.padding().left.resolved(box, width_of_containing_block).to_px(box); + auto const padding_right = computed_values.padding().right.resolved(box, width_of_containing_block).to_px(box); - auto try_compute_width = [&](const auto& a_width) { + auto try_compute_width = [&](auto const& a_width) { margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box); margin_right = computed_values.margin().right.resolved(box, width_of_containing_block).resolved(box); diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.h b/Userland/Libraries/LibWeb/Layout/FormattingContext.h index da0a787241..fff8e18f28 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.h @@ -29,14 +29,14 @@ public: Box const& context_box() const { return m_context_box; } FormattingContext* parent() { return m_parent; } - const FormattingContext* parent() const { return m_parent; } + FormattingContext const* parent() const { return m_parent; } Type type() const { return m_type; } bool is_block_formatting_context() const { return type() == Type::Block; } virtual bool inhibits_floating() const { return false; } - static bool creates_block_formatting_context(const Box&); + static bool creates_block_formatting_context(Box const&); static float compute_width_for_replaced_element(FormattingState const&, ReplacedBox const&); static float compute_height_for_replaced_element(FormattingState const&, ReplacedBox const&); diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp index ebf27336a7..6063949272 100644 --- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp @@ -12,7 +12,7 @@ namespace Web::Layout { -ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, const ImageLoader& image_loader) +ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, ImageLoader const& image_loader) : ReplacedBox(document, element, move(style)) , m_image_loader(image_loader) { diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.h b/Userland/Libraries/LibWeb/Layout/ImageBox.h index 44a493da48..f03ea9c723 100644 --- a/Userland/Libraries/LibWeb/Layout/ImageBox.h +++ b/Userland/Libraries/LibWeb/Layout/ImageBox.h @@ -16,7 +16,7 @@ class ImageBox : public ReplacedBox , public HTML::BrowsingContext::ViewportClient { public: - ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&); + ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, ImageLoader const&); virtual ~ImageBox() override; virtual void prepare_for_replaced_layout() override; @@ -36,7 +36,7 @@ private: int preferred_width() const; int preferred_height() const; - const ImageLoader& m_image_loader; + ImageLoader const& m_image_loader; }; } diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp index 8bb8b3582f..c76424dffe 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp @@ -78,13 +78,13 @@ void InitialContainingBlock::recompute_selection_states() }); } -void InitialContainingBlock::set_selection(const LayoutRange& selection) +void InitialContainingBlock::set_selection(LayoutRange const& selection) { m_selection = selection; recompute_selection_states(); } -void InitialContainingBlock::set_selection_end(const LayoutPosition& position) +void InitialContainingBlock::set_selection_end(LayoutPosition const& position) { m_selection.set_end(position); recompute_selection_states(); diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h index 2c35b82f1c..5d54ada9c0 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h @@ -20,9 +20,9 @@ public: void paint_all_phases(PaintContext&); - const LayoutRange& selection() const { return m_selection; } - void set_selection(const LayoutRange&); - void set_selection_end(const LayoutPosition&); + LayoutRange const& selection() const { return m_selection; } + void set_selection(LayoutRange const&); + void set_selection_end(LayoutPosition const&); void build_stacking_context_tree_if_needed(); void recompute_selection_states(); diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp index ece03ad1a1..fc8ef56649 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.cpp +++ b/Userland/Libraries/LibWeb/Layout/Label.cpp @@ -65,7 +65,7 @@ void Label::handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPo } } -bool Label::is_inside_associated_label(LabelableNode const& control, const Gfx::IntPoint& position) +bool Label::is_inside_associated_label(LabelableNode const& control, Gfx::IntPoint const& position) { if (auto* label = label_for_control_node(control); label) return enclosing_int_rect(label->paint_box()->absolute_rect()).contains(position); diff --git a/Userland/Libraries/LibWeb/Layout/Label.h b/Userland/Libraries/LibWeb/Layout/Label.h index 1cd942306a..5cee1a986c 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.h +++ b/Userland/Libraries/LibWeb/Layout/Label.h @@ -22,9 +22,9 @@ public: const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); } HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); } - void handle_mousedown_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button); - void handle_mouseup_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button); - void handle_mousemove_on_label(Badge<Painting::TextPaintable>, const Gfx::IntPoint&, unsigned button); + void handle_mousedown_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button); + void handle_mouseup_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button); + void handle_mousemove_on_label(Badge<Painting::TextPaintable>, Gfx::IntPoint const&, unsigned button); LabelableNode* labeled_control(); diff --git a/Userland/Libraries/LibWeb/Layout/LayoutPosition.h b/Userland/Libraries/LibWeb/Layout/LayoutPosition.h index 7f5d221139..f924e75ebb 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutPosition.h +++ b/Userland/Libraries/LibWeb/Layout/LayoutPosition.h @@ -24,7 +24,7 @@ struct LayoutPosition { class LayoutRange { public: LayoutRange() = default; - LayoutRange(const LayoutPosition& start, const LayoutPosition& end) + LayoutRange(LayoutPosition const& start, LayoutPosition const& end) : m_start(start) , m_end(end) { @@ -32,18 +32,18 @@ public: bool is_valid() const { return m_start.layout_node && m_end.layout_node; } - void set(const LayoutPosition& start, const LayoutPosition& end) + void set(LayoutPosition const& start, LayoutPosition const& end) { m_start = start; m_end = end; } - void set_start(const LayoutPosition& start) { m_start = start; } - void set_end(const LayoutPosition& end) { m_end = end; } + void set_start(LayoutPosition const& start) { m_start = start; } + void set_end(LayoutPosition const& end) { m_end = end; } - const LayoutPosition& start() const { return m_start; } + LayoutPosition const& start() const { return m_start; } LayoutPosition& start() { return m_start; } - const LayoutPosition& end() const { return m_end; } + LayoutPosition const& end() const { return m_end; } LayoutPosition& end() { return m_end; } LayoutRange normalized() const; diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp index 795c4dad41..6945417dc3 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp @@ -65,7 +65,7 @@ int LineBoxFragment::text_index_at(float x) const return m_start + m_length; } -Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const +Gfx::FloatRect LineBoxFragment::selection_rect(Gfx::Font const& font) const { if (layout_node().selection_state() == Node::SelectionState::None) return {}; @@ -79,8 +79,8 @@ Gfx::FloatRect LineBoxFragment::selection_rect(const Gfx::Font& font) const if (!is<TextNode>(layout_node())) return {}; - const auto start_index = m_start; - const auto end_index = m_start + m_length; + auto const start_index = m_start; + auto const end_index = m_start + m_length; auto text = this->text(); if (layout_node().selection_state() == Node::SelectionState::StartAndEnd) { diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h index 5338b36bee..2a34112309 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h +++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h @@ -40,14 +40,14 @@ public: const Gfx::FloatRect absolute_rect() const; Type type() const { return m_type; } - const Gfx::FloatPoint& offset() const { return m_offset; } - void set_offset(const Gfx::FloatPoint& offset) { m_offset = offset; } + Gfx::FloatPoint const& offset() const { return m_offset; } + void set_offset(Gfx::FloatPoint const& offset) { m_offset = offset; } // The baseline of a fragment is the number of pixels from the top to the text baseline. void set_baseline(float y) { m_baseline = y; } float baseline() const { return m_baseline; } - const Gfx::FloatSize& size() const { return m_size; } + Gfx::FloatSize const& size() const { return m_size; } void set_width(float width) { m_size.set_width(width); } void set_height(float height) { m_size.set_height(height); } float width() const { return m_size.width(); } @@ -65,7 +65,7 @@ public: int text_index_at(float x) const; - Gfx::FloatRect selection_rect(const Gfx::Font&) const; + Gfx::FloatRect selection_rect(Gfx::Font const&) const; float height_of_inline_level_box(FormattingState const&) const; float top_of_inline_level_box(FormattingState const&) const; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 242275d5df..99803a25b0 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -54,7 +54,7 @@ bool Node::can_contain_boxes_with_position_absolute() const return computed_values().position() != CSS::Position::Static || is<InitialContainingBlock>(*this); } -const BlockContainer* Node::containing_block() const +BlockContainer const* Node::containing_block() const { if (is<TextNode>(*this)) return first_ancestor_of_type<BlockContainer>(); @@ -67,7 +67,7 @@ const BlockContainer* Node::containing_block() const ancestor = ancestor->parent(); while (ancestor && (!is<BlockContainer>(*ancestor) || ancestor->is_anonymous())) ancestor = ancestor->containing_block(); - return static_cast<const BlockContainer*>(ancestor); + return static_cast<BlockContainer const*>(ancestor); } if (position == CSS::Position::Fixed) @@ -102,7 +102,7 @@ HTML::BrowsingContext& Node::browsing_context() return *document().browsing_context(); } -const InitialContainingBlock& Node::root() const +InitialContainingBlock const& Node::root() const { VERIFY(document().layout_node()); return *document().layout_node(); diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 0c7bccfbab..e562348cfd 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -57,7 +57,7 @@ public: HTML::BrowsingContext const& browsing_context() const; HTML::BrowsingContext& browsing_context(); - const InitialContainingBlock& root() const; + InitialContainingBlock const& root() const; InitialContainingBlock& root(); bool is_root_element() const; @@ -99,19 +99,19 @@ public: bool is_flex_item() const { return m_is_flex_item; } void set_flex_item(bool b) { m_is_flex_item = b; } - const BlockContainer* containing_block() const; - BlockContainer* containing_block() { return const_cast<BlockContainer*>(const_cast<const Node*>(this)->containing_block()); } + BlockContainer const* containing_block() const; + BlockContainer* containing_block() { return const_cast<BlockContainer*>(const_cast<Node const*>(this)->containing_block()); } bool establishes_stacking_context() const; bool can_contain_boxes_with_position_absolute() const; - const Gfx::Font& font() const; + Gfx::Font const& font() const; const CSS::ImmutableComputedValues& computed_values() const; float line_height() const; NodeWithStyle* parent(); - const NodeWithStyle* parent() const; + NodeWithStyle const* parent() const; void inserted_into(Node&) { } void removed_from(Node&) { } @@ -165,7 +165,7 @@ public: void apply_style(const CSS::StyleProperties&); - const Gfx::Font& font() const { return *m_font; } + Gfx::Font const& font() const { return *m_font; } float line_height() const { return m_line_height; } Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); } const CSS::ImageStyleValue* list_style_image() const { return m_list_style_image; } @@ -197,7 +197,7 @@ private: class NodeWithStyleAndBoxModelMetrics : public NodeWithStyle { public: BoxModelMetrics& box_model() { return m_box_model; } - const BoxModelMetrics& box_model() const { return m_box_model; } + BoxModelMetrics const& box_model() const { return m_box_model; } protected: NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style) @@ -214,17 +214,17 @@ private: BoxModelMetrics m_box_model; }; -inline const Gfx::Font& Node::font() const +inline Gfx::Font const& Node::font() const { if (m_has_style) - return static_cast<const NodeWithStyle*>(this)->font(); + return static_cast<NodeWithStyle const*>(this)->font(); return parent()->font(); } inline const CSS::ImmutableComputedValues& Node::computed_values() const { if (m_has_style) - return static_cast<const NodeWithStyle*>(this)->computed_values(); + return static_cast<NodeWithStyle const*>(this)->computed_values(); return parent()->computed_values(); } @@ -235,9 +235,9 @@ inline float Node::line_height() const return parent()->line_height(); } -inline const NodeWithStyle* Node::parent() const +inline NodeWithStyle const* Node::parent() const { - return static_cast<const NodeWithStyle*>(TreeNode<Node>::parent()); + return static_cast<NodeWithStyle const*>(TreeNode<Node>::parent()); } inline NodeWithStyle* Node::parent() diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.h b/Userland/Libraries/LibWeb/Layout/TableCellBox.h index ab78c133f4..3662c62fa0 100644 --- a/Userland/Libraries/LibWeb/Layout/TableCellBox.h +++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.h @@ -17,7 +17,7 @@ public: virtual ~TableCellBox() override; TableCellBox* next_cell() { return next_sibling_of_type<TableCellBox>(); } - const TableCellBox* next_cell() const { return next_sibling_of_type<TableCellBox>(); } + TableCellBox const* next_cell() const { return next_sibling_of_type<TableCellBox>(); } size_t colspan() const; diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.h b/Userland/Libraries/LibWeb/Layout/TextNode.h index f468b87089..18e604edb4 100644 --- a/Userland/Libraries/LibWeb/Layout/TextNode.h +++ b/Userland/Libraries/LibWeb/Layout/TextNode.h @@ -21,7 +21,7 @@ public: const DOM::Text& dom_node() const { return static_cast<const DOM::Text&>(*Node::dom_node()); } - const String& text_for_rendering() const { return m_text_for_rendering; } + String const& text_for_rendering() const { return m_text_for_rendering; } struct Chunk { Utf8View view; @@ -40,8 +40,8 @@ public: Optional<Chunk> try_commit_chunk(Utf8View::Iterator const& start, Utf8View::Iterator const& end, bool has_breaking_newline, bool must_commit = false) const; const LayoutMode m_layout_mode; - const bool m_wrap_lines; - const bool m_respect_linebreaks; + bool const m_wrap_lines; + bool const m_respect_linebreaks; Utf8View m_utf8_view; Utf8View::Iterator m_iterator; }; diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 38c60284f2..6795a1e3af 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -343,7 +343,7 @@ static bool is_table_track_group(CSS::Display display) || display.is_table_column_group(); } -static bool is_not_proper_table_child(const Node& node) +static bool is_not_proper_table_child(Node const& node) { if (!node.has_style()) return true; @@ -351,7 +351,7 @@ static bool is_not_proper_table_child(const Node& node) return !is_table_track_group(display) && !is_table_track(display) && !display.is_table_caption(); } -static bool is_not_table_row(const Node& node) +static bool is_not_table_row(Node const& node) { if (!node.has_style()) return true; @@ -359,7 +359,7 @@ static bool is_not_table_row(const Node& node) return !display.is_table_row(); } -static bool is_not_table_cell(const Node& node) +static bool is_not_table_cell(Node const& node) { if (!node.has_style()) return true; diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp index 8c3941d4e9..adce6815a4 100644 --- a/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp +++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.cpp @@ -33,7 +33,7 @@ bool ContentFilter::is_filtered(const AK::URL& url) const return false; } -void ContentFilter::add_pattern(const String& pattern) +void ContentFilter::add_pattern(String const& pattern) { StringBuilder builder; if (!pattern.starts_with('*')) diff --git a/Userland/Libraries/LibWeb/Loader/ContentFilter.h b/Userland/Libraries/LibWeb/Loader/ContentFilter.h index ac7c45d66b..6295364e31 100644 --- a/Userland/Libraries/LibWeb/Loader/ContentFilter.h +++ b/Userland/Libraries/LibWeb/Loader/ContentFilter.h @@ -16,7 +16,7 @@ public: static ContentFilter& the(); bool is_filtered(const AK::URL&) const; - void add_pattern(const String&); + void add_pattern(String const&); private: ContentFilter(); diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 648fbb179a..e690c83155 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -39,7 +39,7 @@ FrameLoader::FrameLoader(HTML::BrowsingContext& browsing_context) FrameLoader::~FrameLoader() = default; -static bool build_markdown_document(DOM::Document& document, const ByteBuffer& data) +static bool build_markdown_document(DOM::Document& document, ByteBuffer const& data) { auto markdown_document = Markdown::Document::parse(data); if (!markdown_document) @@ -50,7 +50,7 @@ static bool build_markdown_document(DOM::Document& document, const ByteBuffer& d return true; } -static bool build_text_document(DOM::Document& document, const ByteBuffer& data) +static bool build_text_document(DOM::Document& document, ByteBuffer const& data) { auto html_element = document.create_element("html").release_value(); document.append_child(html_element); @@ -106,7 +106,7 @@ static bool build_image_document(DOM::Document& document, ByteBuffer const& data return true; } -static bool build_gemini_document(DOM::Document& document, const ByteBuffer& data) +static bool build_gemini_document(DOM::Document& document, ByteBuffer const& data) { StringView gemini_data { data }; auto gemini_document = Gemini::Document::parse(gemini_data, document.url()); @@ -120,7 +120,7 @@ static bool build_gemini_document(DOM::Document& document, const ByteBuffer& dat return true; } -static bool build_xml_document(DOM::Document& document, const ByteBuffer& data) +static bool build_xml_document(DOM::Document& document, ByteBuffer const& data) { XML::Parser parser(data, { .resolve_external_resource = resolve_xml_resource }); @@ -129,7 +129,7 @@ static bool build_xml_document(DOM::Document& document, const ByteBuffer& data) return !result.is_error() && !builder.has_error(); } -bool FrameLoader::parse_document(DOM::Document& document, const ByteBuffer& data) +bool FrameLoader::parse_document(DOM::Document& document, ByteBuffer const& data) { auto& mime_type = document.content_type(); if (mime_type == "text/html" || mime_type == "image/svg+xml") { @@ -244,7 +244,7 @@ void FrameLoader::load_html(StringView html, const AK::URL& url) // FIXME: Use an actual templating engine (our own one when it's built, preferably // with a way to check these usages at compile time) -void FrameLoader::load_error_page(const AK::URL& failed_url, const String& error) +void FrameLoader::load_error_page(const AK::URL& failed_url, String const& error) { auto error_page_url = "file:///res/html/error.html"; ResourceLoader::the().load( @@ -285,7 +285,7 @@ void FrameLoader::store_response_cookies(AK::URL const& url, String const& cooki auto set_cookie_json_value = MUST(JsonValue::from_string(cookies)); VERIFY(set_cookie_json_value.type() == JsonValue::Type::Array); - for (const auto& set_cookie_entry : set_cookie_json_value.as_array().values()) { + for (auto const& set_cookie_entry : set_cookie_json_value.as_array().values()) { VERIFY(set_cookie_entry.type() == JsonValue::Type::String); auto cookie = Cookie::parse_cookie(set_cookie_entry.as_string()); diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.h b/Userland/Libraries/LibWeb/Loader/FrameLoader.h index 5fecbce26c..5a0eece55c 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.h +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.h @@ -39,9 +39,9 @@ private: virtual void resource_did_load() override; virtual void resource_did_fail() override; - void load_error_page(const AK::URL& failed_url, const String& error_message); + void load_error_page(const AK::URL& failed_url, String const& error_message); void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr); - bool parse_document(DOM::Document&, const ByteBuffer& data); + bool parse_document(DOM::Document&, ByteBuffer const& data); void store_response_cookies(AK::URL const& url, String const& cookies); diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp index 3b1cd1d48f..b6d00ef408 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -155,7 +155,7 @@ unsigned ImageLoader::height() const return bitmap(0) ? bitmap(0)->height() : 0; } -const Gfx::Bitmap* ImageLoader::bitmap(size_t frame_index) const +Gfx::Bitmap const* ImageLoader::bitmap(size_t frame_index) const { if (!resource()) return nullptr; diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.h b/Userland/Libraries/LibWeb/Loader/ImageLoader.h index ad6ece9c71..23c5344b1f 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.h +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.h @@ -20,7 +20,7 @@ public: void load(const AK::URL&); - const Gfx::Bitmap* bitmap(size_t index) const; + Gfx::Bitmap const* bitmap(size_t index) const; size_t current_frame_index() const { return m_current_frame_index; } bool has_image() const; diff --git a/Userland/Libraries/LibWeb/Loader/ImageResource.cpp b/Userland/Libraries/LibWeb/Loader/ImageResource.cpp index 76769c7828..874f4d4ee4 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageResource.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageResource.cpp @@ -15,7 +15,7 @@ NonnullRefPtr<ImageResource> ImageResource::convert_from_resource(Resource& reso return adopt_ref(*new ImageResource(resource)); } -ImageResource::ImageResource(const LoadRequest& request) +ImageResource::ImageResource(LoadRequest const& request) : Resource(Type::Image, request) { } @@ -63,7 +63,7 @@ void ImageResource::decode_if_needed() const m_has_attempted_decode = true; } -const Gfx::Bitmap* ImageResource::bitmap(size_t frame_index) const +Gfx::Bitmap const* ImageResource::bitmap(size_t frame_index) const { decode_if_needed(); if (frame_index >= m_decoded_frames.size()) diff --git a/Userland/Libraries/LibWeb/Loader/ImageResource.h b/Userland/Libraries/LibWeb/Loader/ImageResource.h index c740010a87..0823a19a74 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageResource.h +++ b/Userland/Libraries/LibWeb/Loader/ImageResource.h @@ -23,7 +23,7 @@ public: size_t duration { 0 }; }; - const Gfx::Bitmap* bitmap(size_t frame_index = 0) const; + Gfx::Bitmap const* bitmap(size_t frame_index = 0) const; int frame_duration(size_t frame_index) const; size_t frame_count() const { @@ -44,7 +44,7 @@ public: void update_volatility(); private: - explicit ImageResource(const LoadRequest&); + explicit ImageResource(LoadRequest const&); explicit ImageResource(Resource&); void decode_if_needed() const; @@ -63,7 +63,7 @@ public: protected: ImageResource* resource() { return static_cast<ImageResource*>(ResourceClient::resource()); } - const ImageResource* resource() const { return static_cast<const ImageResource*>(ResourceClient::resource()); } + ImageResource const* resource() const { return static_cast<ImageResource const*>(ResourceClient::resource()); } private: virtual Resource::Type client_type() const override { return Resource::Type::Image; } diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.h b/Userland/Libraries/LibWeb/Loader/LoadRequest.h index d220fddac9..43e9bd3db7 100644 --- a/Userland/Libraries/LibWeb/Loader/LoadRequest.h +++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.h @@ -28,24 +28,24 @@ public: const AK::URL& url() const { return m_url; } void set_url(const AK::URL& url) { m_url = url; } - const String& method() const { return m_method; } - void set_method(const String& method) { m_method = method; } + String const& method() const { return m_method; } + void set_method(String const& method) { m_method = method; } - const ByteBuffer& body() const { return m_body; } - void set_body(const ByteBuffer& body) { m_body = body; } + ByteBuffer const& body() const { return m_body; } + void set_body(ByteBuffer const& body) { m_body = body; } void start_timer() { m_load_timer.start(); }; Time load_time() const { return m_load_timer.elapsed_time(); } unsigned hash() const { - auto body_hash = string_hash((const char*)m_body.data(), m_body.size()); + auto body_hash = string_hash((char const*)m_body.data(), m_body.size()); auto body_and_headers_hash = pair_int_hash(body_hash, m_headers.hash()); auto url_and_method_hash = pair_int_hash(m_url.to_string().hash(), m_method.hash()); return pair_int_hash(body_and_headers_hash, url_and_method_hash); } - bool operator==(const LoadRequest& other) const + bool operator==(LoadRequest const& other) const { if (m_headers.size() != other.m_headers.size()) return false; @@ -59,10 +59,10 @@ public: return m_url == other.m_url && m_method == other.m_method && m_body == other.m_body; } - void set_header(const String& name, const String& value) { m_headers.set(name, value); } - String header(const String& name) const { return m_headers.get(name).value_or({}); } + void set_header(String const& name, String const& value) { m_headers.set(name, value); } + String header(String const& name) const { return m_headers.get(name).value_or({}); } - const HashMap<String, String>& headers() const { return m_headers; } + HashMap<String, String> const& headers() const { return m_headers; } private: AK::URL m_url; @@ -78,7 +78,7 @@ namespace AK { template<> struct Traits<Web::LoadRequest> : public GenericTraits<Web::LoadRequest> { - static unsigned hash(const Web::LoadRequest& request) { return request.hash(); } + static unsigned hash(Web::LoadRequest const& request) { return request.hash(); } }; } diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 6682756480..525992697a 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -15,14 +15,14 @@ namespace Web { -NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, Type type, const LoadRequest& request) +NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, Type type, LoadRequest const& request) { if (type == Type::Image) return adopt_ref(*new ImageResource(request)); return adopt_ref(*new Resource(type, request)); } -Resource::Resource(Type type, const LoadRequest& request) +Resource::Resource(Type type, LoadRequest const& request) : m_request(request) , m_type(type) { @@ -57,7 +57,7 @@ void Resource::for_each_client(Function<void(ResourceClient&)> callback) } } -static Optional<String> encoding_from_content_type(const String& content_type) +static Optional<String> encoding_from_content_type(String const& content_type) { auto offset = content_type.find("charset="sv); if (offset.has_value()) { @@ -72,7 +72,7 @@ static Optional<String> encoding_from_content_type(const String& content_type) return {}; } -static String mime_type_from_content_type(const String& content_type) +static String mime_type_from_content_type(String const& content_type) { auto offset = content_type.find(';'); if (offset.has_value()) @@ -86,7 +86,7 @@ static bool is_valid_encoding(String const& encoding) return TextCodec::decoder_for(encoding); } -void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers, Optional<u32> status_code) +void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<String, String, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code) { VERIFY(!m_loaded); // FIXME: Handle OOM failure. @@ -131,7 +131,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap }); } -void Resource::did_fail(Badge<ResourceLoader>, const String& error, Optional<u32> status_code) +void Resource::did_fail(Badge<ResourceLoader>, String const& error, Optional<u32> status_code) { m_error = error; m_status_code = move(status_code); diff --git a/Userland/Libraries/LibWeb/Loader/Resource.h b/Userland/Libraries/LibWeb/Loader/Resource.h index ad77e9e611..40edf5e41a 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.h +++ b/Userland/Libraries/LibWeb/Loader/Resource.h @@ -32,7 +32,7 @@ public: Image, }; - static NonnullRefPtr<Resource> create(Badge<ResourceLoader>, Type, const LoadRequest&); + static NonnullRefPtr<Resource> create(Badge<ResourceLoader>, Type, LoadRequest const&); virtual ~Resource(); Type type() const { return m_type; } @@ -40,14 +40,14 @@ public: bool is_loaded() const { return m_loaded; } bool is_failed() const { return m_failed; } - const String& error() const { return m_error; } + String const& error() const { return m_error; } bool has_encoded_data() const { return !m_encoded_data.is_empty(); } const AK::URL& url() const { return m_request.url(); } - const ByteBuffer& encoded_data() const { return m_encoded_data; } + ByteBuffer const& encoded_data() const { return m_encoded_data; } - const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers() const { return m_response_headers; } + HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; } [[nodiscard]] Optional<u32> status_code() const { return m_status_code; } @@ -55,16 +55,16 @@ public: void unregister_client(Badge<ResourceClient>, ResourceClient&); bool has_encoding() const { return m_encoding.has_value(); } - const Optional<String>& encoding() const { return m_encoding; } - const String& mime_type() const { return m_mime_type; } + Optional<String> const& encoding() const { return m_encoding; } + String const& mime_type() const { return m_mime_type; } void for_each_client(Function<void(ResourceClient&)>); - void did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers, Optional<u32> status_code); - void did_fail(Badge<ResourceLoader>, const String& error, Optional<u32> status_code); + void did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<String, String, CaseInsensitiveStringTraits> const& headers, Optional<u32> status_code); + void did_fail(Badge<ResourceLoader>, String const& error, Optional<u32> status_code); protected: - explicit Resource(Type, const LoadRequest&); + explicit Resource(Type, LoadRequest const&); Resource(Type, Resource&); private: @@ -93,7 +93,7 @@ protected: virtual Resource::Type client_type() const { return Resource::Type::Generic; } Resource* resource() { return m_resource; } - const Resource* resource() const { return m_resource; } + Resource const* resource() const { return m_resource; } void set_resource(Resource*); private: diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp index 327eed13a4..737598cc3d 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp @@ -41,7 +41,7 @@ ResourceLoader::ResourceLoader(NonnullRefPtr<Protocol::RequestClient> protocol_c { } -void ResourceLoader::load_sync(LoadRequest& request, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback) +void ResourceLoader::load_sync(LoadRequest& request, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback) { Core::EventLoop loop; @@ -123,7 +123,7 @@ static void emit_signpost(String const& message, int id) static size_t resource_id = 0; -void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback) +void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback) { auto& url = request.url(); request.start_timer(); @@ -133,13 +133,13 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, con emit_signpost(String::formatted("Starting load: {}", url_for_logging), id); dbgln("ResourceLoader: Starting load of: \"{}\"", url_for_logging); - const auto log_success = [url_for_logging, id](const auto& request) { + auto const log_success = [url_for_logging, id](auto const& request) { auto load_time_ms = request.load_time().to_milliseconds(); emit_signpost(String::formatted("Finished load: {}", url_for_logging), id); dbgln("ResourceLoader: Finished load of: \"{}\", Duration: {}ms", url_for_logging, load_time_ms); }; - const auto log_failure = [url_for_logging, id](const auto& request, const auto error_message) { + auto const log_failure = [url_for_logging, id](auto const& request, auto const error_message) { auto load_time_ms = request.load_time().to_milliseconds(); emit_signpost(String::formatted("Failed load: {}", url_for_logging), id); dbgln("ResourceLoader: Failed load of: \"{}\", \033[31;1mError: {}\033[0m, Duration: {}ms", url_for_logging, error_message, load_time_ms); @@ -267,7 +267,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, con error_callback(not_implemented_error, {}); } -void ResourceLoader::load(const AK::URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback) +void ResourceLoader::load(const AK::URL& url, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback) { LoadRequest request; request.set_url(url); diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h index 4d31d9f9f3..0f3f7f592c 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h @@ -33,9 +33,9 @@ public: RefPtr<Resource> load_resource(Resource::Type, LoadRequest&); - void load(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr); - void load(const AK::URL&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr); - void load_sync(LoadRequest&, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback = nullptr); + void load(LoadRequest&, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback = nullptr); + void load(const AK::URL&, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback = nullptr); + void load_sync(LoadRequest&, Function<void(ReadonlyBytes, HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> status_code)> success_callback, Function<void(String const&, Optional<u32> status_code)> error_callback = nullptr); void prefetch_dns(AK::URL const&); void preconnect(AK::URL const&); @@ -46,8 +46,8 @@ public: Protocol::RequestClient& protocol_client() { return *m_protocol_client; } - const String& user_agent() const { return m_user_agent; } - void set_user_agent(const String& user_agent) { m_user_agent = user_agent; } + String const& user_agent() const { return m_user_agent; } + void set_user_agent(String const& user_agent) { m_user_agent = user_agent; } void clear_cache(); void evict_from_cache(LoadRequest const&); diff --git a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp index ae13e676de..7d36522b53 100644 --- a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp +++ b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp @@ -56,7 +56,7 @@ Optional<MimeType> MimeType::from_string(StringView string) // https://fetch.spec.whatwg.org/#http-whitespace // HTTP whitespace is U+000A LF, U+000D CR, or an HTTP tab or space. // An HTTP tab or space is U+0009 TAB or U+0020 SPACE. - constexpr const char* http_whitespace = "\n\r\t "; + constexpr char const* http_whitespace = "\n\r\t "; // 1. Remove any leading and trailing HTTP whitespace from input. auto trimmed_string = string.trim(http_whitespace, TrimMode::Both); diff --git a/Userland/Libraries/LibWeb/Origin.h b/Userland/Libraries/LibWeb/Origin.h index e89be3f9a2..115203ebff 100644 --- a/Userland/Libraries/LibWeb/Origin.h +++ b/Userland/Libraries/LibWeb/Origin.h @@ -14,7 +14,7 @@ namespace Web { class Origin { public: Origin() = default; - Origin(const String& protocol, const String& host, u16 port) + Origin(String const& protocol, String const& host, u16 port) : m_protocol(protocol) , m_host(host) , m_port(port) @@ -24,8 +24,8 @@ public: // https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque bool is_opaque() const { return m_protocol.is_null() && m_host.is_null() && m_port == 0; } - const String& protocol() const { return m_protocol; } - const String& host() const { return m_host; } + String const& protocol() const { return m_protocol; } + String const& host() const { return m_host; } u16 port() const { return m_port; } // https://html.spec.whatwg.org/multipage/origin.html#same-origin diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 1b838b3691..e3dd13ac99 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -213,7 +213,7 @@ void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 b } } -void OutOfProcessWebView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] const Gfx::IntRect& content_rect) +void OutOfProcessWebView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] Gfx::IntRect const& content_rect) { request_repaint(); } @@ -228,12 +228,12 @@ void OutOfProcessWebView::notify_server_did_request_cursor_change(Badge<WebConte set_override_cursor(cursor); } -void OutOfProcessWebView::notify_server_did_layout(Badge<WebContentClient>, const Gfx::IntSize& content_size) +void OutOfProcessWebView::notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize const& content_size) { set_content_size(content_size); } -void OutOfProcessWebView::notify_server_did_change_title(Badge<WebContentClient>, const String& title) +void OutOfProcessWebView::notify_server_did_change_title(Badge<WebContentClient>, String const& title) { if (on_title_change) on_title_change(title); @@ -251,12 +251,12 @@ void OutOfProcessWebView::notify_server_did_request_scroll_to(Badge<WebContentCl vertical_scrollbar().set_value(scroll_position.y()); } -void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect& rect) +void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const& rect) { scroll_into_view(rect, true, true); } -void OutOfProcessWebView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String& title) +void OutOfProcessWebView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const&, String const& title) { GUI::Application::the()->show_tooltip(title, nullptr); } @@ -279,13 +279,13 @@ void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient> on_link_hover({}); } -void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers) +void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const AK::URL& url, String const& target, unsigned int modifiers) { if (on_link_click) on_link_click(url, target, modifiers); } -void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL& url, const String& target, unsigned int modifiers) +void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL& url, String const& target, unsigned int modifiers) { if (on_link_middle_click) on_link_middle_click(url, target, modifiers); @@ -303,36 +303,36 @@ void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClien on_load_finish(url); } -void OutOfProcessWebView::notify_server_did_request_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position) +void OutOfProcessWebView::notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position) { if (on_context_menu_request) on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position))); } -void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned) +void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, const AK::URL& url, String const&, unsigned) { if (on_link_context_menu_request) on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position))); } -void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint& content_position, const AK::URL& url, const String&, unsigned, const Gfx::ShareableBitmap& bitmap) +void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, const AK::URL& url, String const&, unsigned, Gfx::ShareableBitmap const& bitmap) { if (on_image_context_menu_request) on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap); } -void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, const String& message) +void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message) { GUI::MessageBox::show(window(), message, "Alert", GUI::MessageBox::Type::Information); } -bool OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, const String& message) +bool OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) { auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); return confirm_result == GUI::Dialog::ExecResult::ExecOK; } -String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, const String& message, const String& default_) +String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) { String response { default_ }; if (GUI::InputBox::show(window(), response, message, "Prompt") == GUI::InputBox::ExecOK) @@ -340,13 +340,13 @@ String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentCli return {}; } -void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, const String& source) +void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, String const& source) { if (on_get_source) on_get_source(url, source); } -void OutOfProcessWebView::notify_server_did_get_dom_tree(const String& dom_tree) +void OutOfProcessWebView::notify_server_did_get_dom_tree(String const& dom_tree) { if (on_get_dom_tree) on_get_dom_tree(dom_tree); @@ -364,13 +364,13 @@ void OutOfProcessWebView::notify_server_did_output_js_console_message(i32 messag on_js_console_new_message(message_index); } -void OutOfProcessWebView::notify_server_did_get_js_console_messages(i32 start_index, const Vector<String>& message_types, const Vector<String>& messages) +void OutOfProcessWebView::notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) { if (on_get_js_console_messages) on_get_js_console_messages(start_index, message_types, messages); } -void OutOfProcessWebView::notify_server_did_change_favicon(const Gfx::Bitmap& favicon) +void OutOfProcessWebView::notify_server_did_change_favicon(Gfx::Bitmap const& favicon) { if (on_favicon_change) on_favicon_change(favicon); @@ -383,7 +383,7 @@ String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentCli return {}; } -void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source) +void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source) { if (on_set_cookie) on_set_cookie(url, cookie, source); @@ -422,7 +422,7 @@ WebContentClient& OutOfProcessWebView::client() return *m_client_state.client; } -void OutOfProcessWebView::debug_request(const String& request, const String& argument) +void OutOfProcessWebView::debug_request(String const& request, String const& argument) { client().async_debug_request(request, argument); } @@ -460,7 +460,7 @@ i32 OutOfProcessWebView::get_hovered_node_id() return client().get_hovered_node_id(); } -void OutOfProcessWebView::js_console_input(const String& js_source) +void OutOfProcessWebView::js_console_input(String const& js_source) { client().async_js_console_input(js_source); } diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index a80c757e3c..f996ae2116 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -31,7 +31,7 @@ public: void load_html(StringView, const AK::URL&); void load_empty_document(); - void debug_request(const String& request, const String& argument = {}); + void debug_request(String const& request, String const& argument = {}); void get_source(); void inspect_dom_tree(); @@ -45,7 +45,7 @@ public: void clear_inspected_dom_node(); i32 get_hovered_node_id(); - void js_console_input(const String& js_source); + void js_console_input(String const& js_source); void js_console_request_messages(i32 start_index); void run_javascript(StringView); @@ -58,37 +58,37 @@ public: void set_content_filters(Vector<String>); void set_preferred_color_scheme(Web::CSS::PreferredColorScheme); - void notify_server_did_layout(Badge<WebContentClient>, const Gfx::IntSize& content_size); + void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize const& content_size); void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id); - void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, const Gfx::IntRect&); + void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&); void notify_server_did_change_selection(Badge<WebContentClient>); void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor); - void notify_server_did_change_title(Badge<WebContentClient>, const String&); + void notify_server_did_change_title(Badge<WebContentClient>, String const&); void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32); void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint const&); - void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&); - void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String&); + void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&); + void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const&, String const&); void notify_server_did_leave_tooltip_area(Badge<WebContentClient>); void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&); void notify_server_did_unhover_link(Badge<WebContentClient>); - void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers); - void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, const String& target, unsigned modifiers); + void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers); + void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers); void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&); void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&); - void notify_server_did_request_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&); - void notify_server_did_request_link_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers); - void notify_server_did_request_image_context_menu(Badge<WebContentClient>, const Gfx::IntPoint&, const AK::URL&, const String& target, unsigned modifiers, const Gfx::ShareableBitmap&); - void notify_server_did_request_alert(Badge<WebContentClient>, const String& message); - bool notify_server_did_request_confirm(Badge<WebContentClient>, const String& message); - String notify_server_did_request_prompt(Badge<WebContentClient>, const String& message, const String& default_); - void notify_server_did_get_source(const AK::URL& url, const String& source); - void notify_server_did_get_dom_tree(const String& dom_tree); + void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&); + void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers); + void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::ShareableBitmap const&); + void notify_server_did_request_alert(Badge<WebContentClient>, String const& message); + bool notify_server_did_request_confirm(Badge<WebContentClient>, String const& message); + String notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_); + void notify_server_did_get_source(const AK::URL& url, String const& source); + void notify_server_did_get_dom_tree(String const& dom_tree); void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing); void notify_server_did_output_js_console_message(i32 message_index); void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages); - void notify_server_did_change_favicon(const Gfx::Bitmap& favicon); + void notify_server_did_change_favicon(Gfx::Bitmap const& favicon); String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source); - void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source); + void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source); void notify_server_did_update_resource_count(i32 count_waiting); private: diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 8ac8a32fed..4f92731e6e 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -80,7 +80,7 @@ static Gfx::StandardCursor cursor_css_to_gfx(Optional<CSS::Cursor> cursor) } } -static Gfx::IntPoint compute_mouse_event_offset(const Gfx::IntPoint& position, const Layout::Node& layout_node) +static Gfx::IntPoint compute_mouse_event_offset(Gfx::IntPoint const& position, Layout::Node const& layout_node) { auto top_left_of_layout_node = layout_node.box_type_agnostic_position(); return { @@ -97,7 +97,7 @@ EventHandler::EventHandler(Badge<HTML::BrowsingContext>, HTML::BrowsingContext& EventHandler::~EventHandler() = default; -const Layout::InitialContainingBlock* EventHandler::layout_root() const +Layout::InitialContainingBlock const* EventHandler::layout_root() const { if (!m_browsing_context.active_document()) return nullptr; @@ -125,7 +125,7 @@ Painting::PaintableBox const* EventHandler::paint_root() const return const_cast<Painting::PaintableBox*>(m_browsing_context.active_document()->paint_box()); } -bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y) +bool EventHandler::handle_mousewheel(Gfx::IntPoint const& position, unsigned int buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y) { if (m_browsing_context.active_document()) m_browsing_context.active_document()->update_layout(); @@ -150,7 +150,7 @@ bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int return false; } -bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers) +bool EventHandler::handle_mouseup(Gfx::IntPoint const& position, unsigned button, unsigned modifiers) { if (m_browsing_context.active_document()) m_browsing_context.active_document()->update_layout(); @@ -247,7 +247,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button return handled_event; } -bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned button, unsigned modifiers) +bool EventHandler::handle_mousedown(Gfx::IntPoint const& position, unsigned button, unsigned modifiers) { if (m_browsing_context.active_document()) m_browsing_context.active_document()->update_layout(); @@ -341,7 +341,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt return true; } -bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned buttons, unsigned modifiers) +bool EventHandler::handle_mousemove(Gfx::IntPoint const& position, unsigned buttons, unsigned modifiers) { if (m_browsing_context.active_document()) m_browsing_context.active_document()->update_layout(); diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.h b/Userland/Libraries/LibWeb/Page/EventHandler.h index c2244f9b46..255d2503ae 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.h +++ b/Userland/Libraries/LibWeb/Page/EventHandler.h @@ -22,10 +22,10 @@ public: explicit EventHandler(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&); ~EventHandler(); - bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); - bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); - bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); + bool handle_mouseup(Gfx::IntPoint const&, unsigned button, unsigned modifiers); + bool handle_mousedown(Gfx::IntPoint const&, unsigned button, unsigned modifiers); + bool handle_mousemove(Gfx::IntPoint const&, unsigned buttons, unsigned modifiers); + bool handle_mousewheel(Gfx::IntPoint const&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point); bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point); @@ -39,7 +39,7 @@ private: bool focus_previous_element(); Layout::InitialContainingBlock* layout_root(); - const Layout::InitialContainingBlock* layout_root() const; + Layout::InitialContainingBlock const* layout_root() const; Painting::PaintableBox* paint_root(); Painting::PaintableBox const* paint_root() const; diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index 70e8f90c6c..98f748d40a 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -59,22 +59,22 @@ CSS::PreferredColorScheme Page::preferred_color_scheme() const return m_client.preferred_color_scheme(); } -bool Page::handle_mousewheel(const Gfx::IntPoint& position, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) +bool Page::handle_mousewheel(Gfx::IntPoint const& position, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) { return top_level_browsing_context().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta_x, wheel_delta_y); } -bool Page::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers) +bool Page::handle_mouseup(Gfx::IntPoint const& position, unsigned button, unsigned modifiers) { return top_level_browsing_context().event_handler().handle_mouseup(position, button, modifiers); } -bool Page::handle_mousedown(const Gfx::IntPoint& position, unsigned button, unsigned modifiers) +bool Page::handle_mousedown(Gfx::IntPoint const& position, unsigned button, unsigned modifiers) { return top_level_browsing_context().event_handler().handle_mousedown(position, button, modifiers); } -bool Page::handle_mousemove(const Gfx::IntPoint& position, unsigned buttons, unsigned modifiers) +bool Page::handle_mousemove(Gfx::IntPoint const& position, unsigned buttons, unsigned modifiers) { return top_level_browsing_context().event_handler().handle_mousemove(position, buttons, modifiers); } diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 3bfe12b0b7..cbf6b1e35b 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -32,7 +32,7 @@ public: ~Page(); PageClient& client() { return m_client; } - const PageClient& client() const { return m_client; } + PageClient const& client() const { return m_client; } HTML::BrowsingContext& top_level_browsing_context() { return *m_top_level_browsing_context; } HTML::BrowsingContext const& top_level_browsing_context() const { return *m_top_level_browsing_context; } @@ -47,10 +47,10 @@ public: void load_html(StringView, const AK::URL&); - bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); - bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); - bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - bool handle_mousewheel(const Gfx::IntPoint&, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); + bool handle_mouseup(Gfx::IntPoint const&, unsigned button, unsigned modifiers); + bool handle_mousedown(Gfx::IntPoint const&, unsigned button, unsigned modifiers); + bool handle_mousemove(Gfx::IntPoint const&, unsigned buttons, unsigned modifiers); + bool handle_mousewheel(Gfx::IntPoint const&, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point); bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point); @@ -83,31 +83,31 @@ public: virtual Gfx::IntRect screen_rect() const = 0; virtual CSS::PreferredColorScheme preferred_color_scheme() const = 0; virtual void page_did_set_document_in_top_level_browsing_context(DOM::Document*) { } - virtual void page_did_change_title(const String&) { } + virtual void page_did_change_title(String const&) { } virtual void page_did_start_loading(const AK::URL&) { } virtual void page_did_finish_loading(const AK::URL&) { } virtual void page_did_change_selection() { } virtual void page_did_request_cursor_change(Gfx::StandardCursor) { } - virtual void page_did_request_context_menu(const Gfx::IntPoint&) { } - virtual void page_did_request_link_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { } - virtual void page_did_request_image_context_menu(const Gfx::IntPoint&, const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers, const Gfx::Bitmap*) { } - virtual void page_did_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { } - virtual void page_did_middle_click_link(const AK::URL&, [[maybe_unused]] const String& target, [[maybe_unused]] unsigned modifiers) { } - virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) { } + virtual void page_did_request_context_menu(Gfx::IntPoint const&) { } + virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const AK::URL&, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers) { } + virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const AK::URL&, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers, Gfx::Bitmap const*) { } + virtual void page_did_click_link(const AK::URL&, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers) { } + virtual void page_did_middle_click_link(const AK::URL&, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers) { } + virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) { } virtual void page_did_leave_tooltip_area() { } virtual void page_did_hover_link(const AK::URL&) { } virtual void page_did_unhover_link() { } - virtual void page_did_invalidate(const Gfx::IntRect&) { } - virtual void page_did_change_favicon(const Gfx::Bitmap&) { } + virtual void page_did_invalidate(Gfx::IntRect const&) { } + virtual void page_did_change_favicon(Gfx::Bitmap const&) { } virtual void page_did_layout() { } virtual void page_did_request_scroll(i32, i32) { } virtual void page_did_request_scroll_to(Gfx::IntPoint const&) { } - virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) { } - virtual void page_did_request_alert(const String&) { } - virtual bool page_did_request_confirm(const String&) { return false; } - virtual String page_did_request_prompt(const String&, const String&) { return {}; } + virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) { } + virtual void page_did_request_alert(String const&) { } + virtual bool page_did_request_confirm(String const&) { return false; } + virtual String page_did_request_prompt(String const&, String const&) { return {}; } virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; } - virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) { } + virtual void page_did_set_cookie(const AK::URL&, Cookie::ParsedCookie const&, Cookie::Source) { } virtual void page_did_update_resource_count(i32) { } protected: diff --git a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp index b8397438f2..91dabcc73f 100644 --- a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp @@ -45,7 +45,7 @@ void paint_border(PaintContext& context, BorderEdge edge, Gfx::FloatRect const& { auto rect = a_rect.to_rounded<float>(); - const auto& border_data = [&] { + auto const& border_data = [&] { switch (edge) { case BorderEdge::Top: return borders_data.top; @@ -71,7 +71,7 @@ void paint_border(PaintContext& context, BorderEdge edge, Gfx::FloatRect const& Gfx::FloatPoint p2; }; - auto points_for_edge = [](BorderEdge edge, const Gfx::FloatRect& rect) -> Points { + auto points_for_edge = [](BorderEdge edge, Gfx::FloatRect const& rect) -> Points { switch (edge) { case BorderEdge::Top: return { rect.top_left(), rect.top_right() }; diff --git a/Userland/Libraries/LibWeb/Painting/LabelablePaintable.cpp b/Userland/Libraries/LibWeb/Painting/LabelablePaintable.cpp index 9afcff46da..74ce00c66d 100644 --- a/Userland/Libraries/LibWeb/Painting/LabelablePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/LabelablePaintable.cpp @@ -35,7 +35,7 @@ Layout::FormAssociatedLabelableNode& LabelablePaintable::layout_box() return static_cast<Layout::FormAssociatedLabelableNode&>(PaintableBox::layout_box()); } -LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned) +LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mousedown(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned) { if (button != GUI::MouseButton::Primary || !layout_box().dom_node().enabled()) return DispatchEventOfSameName::No; @@ -46,7 +46,7 @@ LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mousedown return DispatchEventOfSameName::Yes; } -LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) +LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mouseup(Badge<EventHandler>, Gfx::IntPoint const& position, unsigned button, unsigned) { if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !layout_box().dom_node().enabled()) return DispatchEventOfSameName::No; @@ -61,7 +61,7 @@ LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mouseup(B return DispatchEventOfSameName::Yes; } -LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned, unsigned) +LabelablePaintable::DispatchEventOfSameName LabelablePaintable::handle_mousemove(Badge<EventHandler>, Gfx::IntPoint const& position, unsigned, unsigned) { if (!m_tracking_mouse || !layout_box().dom_node().enabled()) return DispatchEventOfSameName::No; diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.h b/Userland/Libraries/LibWeb/Painting/Paintable.h index d272fa185d..2a8b13866a 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.h +++ b/Userland/Libraries/LibWeb/Painting/Paintable.h @@ -64,12 +64,12 @@ public: // When these methods return true, the DOM event with the same name will be // dispatch at the mouse_event_target if it returns a valid DOM::Node, or // the layout node's associated DOM node if it doesn't. - virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers); - virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers); - virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); + virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers); + virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers); + virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, Gfx::IntPoint const&, unsigned buttons, unsigned modifiers); virtual DOM::Node* mouse_event_target() const { return nullptr; } - virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); + virtual bool handle_mousewheel(Badge<EventHandler>, Gfx::IntPoint const&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); Layout::Node const& layout_node() const { return m_layout_node; } Layout::Node& layout_node() { return const_cast<Layout::Node&>(m_layout_node); } diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 12bfabb273..86f8f5bee4 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -43,7 +43,7 @@ PaintableWithLines::~PaintableWithLines() { } -void PaintableBox::set_offset(const Gfx::FloatPoint& offset) +void PaintableBox::set_offset(Gfx::FloatPoint const& offset) { m_offset = offset; // FIXME: This const_cast is gross. @@ -527,7 +527,7 @@ Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint const& position, return {}; } -Optional<HitTestResult> PaintableWithLines::hit_test(const Gfx::FloatPoint& position, HitTestType type) const +Optional<HitTestResult> PaintableWithLines::hit_test(Gfx::FloatPoint const& position, HitTestType type) const { if (!layout_box().children_are_inline()) return PaintableBox::hit_test(position, type); diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.h b/Userland/Libraries/LibWeb/Painting/PaintableBox.h index 028a619fec..7077e814e2 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.h +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.h @@ -163,7 +163,7 @@ public: virtual void paint(PaintContext&, PaintPhase) const override; virtual bool wants_mouse_events() const override { return false; } - virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) override; + virtual bool handle_mousewheel(Badge<EventHandler>, Gfx::IntPoint const&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) override; virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const override; diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.h b/Userland/Libraries/LibWeb/Painting/StackingContext.h index 9ea3e8ca71..3d0a9df1bc 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.h +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.h @@ -18,7 +18,7 @@ public: StackingContext(Layout::Box&, StackingContext* parent); StackingContext* parent() { return m_parent; } - const StackingContext* parent() const { return m_parent; } + StackingContext const* parent() const { return m_parent; } enum class StackingContextPaintPhase { BackgroundAndBorders, diff --git a/Userland/Libraries/LibWeb/Painting/TextPaintable.cpp b/Userland/Libraries/LibWeb/Painting/TextPaintable.cpp index 37c02f842a..a209e8e481 100644 --- a/Userland/Libraries/LibWeb/Painting/TextPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/TextPaintable.cpp @@ -36,7 +36,7 @@ DOM::Node* TextPaintable::mouse_event_target() const return nullptr; } -TextPaintable::DispatchEventOfSameName TextPaintable::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) +TextPaintable::DispatchEventOfSameName TextPaintable::handle_mousedown(Badge<EventHandler>, Gfx::IntPoint const& position, unsigned button, unsigned) { auto* label = layout_node().first_ancestor_of_type<Layout::Label>(); if (!label) @@ -46,7 +46,7 @@ TextPaintable::DispatchEventOfSameName TextPaintable::handle_mousedown(Badge<Eve return DispatchEventOfSameName::Yes; } -TextPaintable::DispatchEventOfSameName TextPaintable::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) +TextPaintable::DispatchEventOfSameName TextPaintable::handle_mouseup(Badge<EventHandler>, Gfx::IntPoint const& position, unsigned button, unsigned) { auto* label = layout_node().first_ancestor_of_type<Layout::Label>(); if (!label) @@ -57,7 +57,7 @@ TextPaintable::DispatchEventOfSameName TextPaintable::handle_mouseup(Badge<Event return DispatchEventOfSameName::Yes; } -TextPaintable::DispatchEventOfSameName TextPaintable::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned) +TextPaintable::DispatchEventOfSameName TextPaintable::handle_mousemove(Badge<EventHandler>, Gfx::IntPoint const& position, unsigned button, unsigned) { auto* label = layout_node().first_ancestor_of_type<Layout::Label>(); if (!label) diff --git a/Userland/Libraries/LibWeb/Painting/TextPaintable.h b/Userland/Libraries/LibWeb/Painting/TextPaintable.h index 2b61032a1f..5c029062bb 100644 --- a/Userland/Libraries/LibWeb/Painting/TextPaintable.h +++ b/Userland/Libraries/LibWeb/Painting/TextPaintable.h @@ -18,9 +18,9 @@ public: virtual bool wants_mouse_events() const override; virtual DOM::Node* mouse_event_target() const override; - virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override; - virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override; - virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override; + virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override; + virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override; + virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override; private: explicit TextPaintable(Layout::TextNode const&); diff --git a/Userland/Libraries/LibWeb/SVG/SVGContext.h b/Userland/Libraries/LibWeb/SVG/SVGContext.h index 2e073a5cce..1073620137 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGContext.h +++ b/Userland/Libraries/LibWeb/SVG/SVGContext.h @@ -20,8 +20,8 @@ public: m_states.append(State()); } - const Gfx::Color& fill_color() const { return state().fill_color; } - const Gfx::Color& stroke_color() const { return state().stroke_color; } + Gfx::Color const& fill_color() const { return state().fill_color; } + Gfx::Color const& stroke_color() const { return state().stroke_color; } float stroke_width() const { return state().stroke_width; } void set_fill_color(Gfx::Color color) { state().fill_color = color; } @@ -40,7 +40,7 @@ private: float stroke_width { 1.0 }; }; - const State& state() const { return m_states.last(); } + State const& state() const { return m_states.last(); } State& state() { return m_states.last(); } Gfx::FloatRect m_svg_element_bounds; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index b7a8effc18..0419dbf527 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -15,7 +15,7 @@ namespace Web::SVG { -[[maybe_unused]] static void print_instruction(const PathInstruction& instruction) +[[maybe_unused]] static void print_instruction(PathInstruction const& instruction) { VERIFY(PATH_DEBUG); diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h index 1f1dbfa060..1b3ff0a2aa 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h @@ -20,7 +20,7 @@ public: SVGPathElement(DOM::Document&, DOM::QualifiedName); virtual ~SVGPathElement() override = default; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; virtual Gfx::Path& get_path() override; diff --git a/Userland/Libraries/LibWeb/TreeNode.h b/Userland/Libraries/LibWeb/TreeNode.h index 8b5adb9557..1972c4fd05 100644 --- a/Userland/Libraries/LibWeb/TreeNode.h +++ b/Userland/Libraries/LibWeb/TreeNode.h @@ -123,10 +123,10 @@ public: return {}; } - bool is_ancestor_of(const TreeNode&) const; - bool is_inclusive_ancestor_of(const TreeNode&) const; - bool is_descendant_of(const TreeNode&) const; - bool is_inclusive_descendant_of(const TreeNode&) const; + bool is_ancestor_of(TreeNode const&) const; + bool is_inclusive_ancestor_of(TreeNode const&) const; + bool is_descendant_of(TreeNode const&) const; + bool is_inclusive_descendant_of(TreeNode const&) const; bool is_following(TreeNode const&) const; @@ -556,7 +556,7 @@ inline void TreeNode<T>::prepend_child(NonnullRefPtr<T> node) } template<typename T> -inline bool TreeNode<T>::is_ancestor_of(const TreeNode<T>& other) const +inline bool TreeNode<T>::is_ancestor_of(TreeNode<T> const& other) const { for (auto* ancestor = other.parent(); ancestor; ancestor = ancestor->parent()) { if (ancestor == this) @@ -566,19 +566,19 @@ inline bool TreeNode<T>::is_ancestor_of(const TreeNode<T>& other) const } template<typename T> -inline bool TreeNode<T>::is_inclusive_ancestor_of(const TreeNode<T>& other) const +inline bool TreeNode<T>::is_inclusive_ancestor_of(TreeNode<T> const& other) const { return &other == this || is_ancestor_of(other); } template<typename T> -inline bool TreeNode<T>::is_descendant_of(const TreeNode<T>& other) const +inline bool TreeNode<T>::is_descendant_of(TreeNode<T> const& other) const { return other.is_ancestor_of(*this); } template<typename T> -inline bool TreeNode<T>::is_inclusive_descendant_of(const TreeNode<T>& other) const +inline bool TreeNode<T>::is_inclusive_descendant_of(TreeNode<T> const& other) const { return other.is_inclusive_ancestor_of(*this); } diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp index 8355e9811e..96bad7de8f 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp @@ -10,7 +10,7 @@ namespace Web::UIEvents { -MouseEvent::MouseEvent(const FlyString& event_name, double offset_x, double offset_y, double client_x, double client_y) +MouseEvent::MouseEvent(FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y) : UIEvent(event_name) , m_offset_x(offset_x) , m_offset_y(offset_y) diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h index 2f3cd652fb..99c2df94f2 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -16,7 +16,7 @@ class MouseEvent final : public UIEvent { public: using WrapperType = Bindings::MouseEventWrapper; - static NonnullRefPtr<MouseEvent> create(const FlyString& event_name, double offset_x, double offset_y, double client_x, double client_y) + static NonnullRefPtr<MouseEvent> create(FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y) { return adopt_ref(*new MouseEvent(event_name, offset_x, offset_y, client_x, client_y)); } @@ -33,7 +33,7 @@ public: double y() const { return client_y(); } protected: - MouseEvent(const FlyString& event_name, double offset_x, double offset_y, double client_x, double client_y); + MouseEvent(FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y); private: void set_event_characteristics(); diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp index 61ba8c3d06..0470e86f1c 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/URL/URL.cpp @@ -101,7 +101,7 @@ String URL::username() const return m_url.username(); } -void URL::set_username(const String& username) +void URL::set_username(String const& username) { // 1. If this’s URL cannot have a username/password/port, then return. if (m_url.cannot_have_a_username_or_password_or_port()) @@ -139,7 +139,7 @@ String URL::host() const return String::formatted("{}:{}", url.host(), *url.port()); } -void URL::set_host(const String& host) +void URL::set_host(String const& host) { // 1. If this’s URL’s cannot-be-a-base-URL is true, then return. if (m_url.cannot_be_a_base_url()) diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/URL/URL.h index 0f17dc1c62..15bea032cb 100644 --- a/Userland/Libraries/LibWeb/URL/URL.h +++ b/Userland/Libraries/LibWeb/URL/URL.h @@ -26,7 +26,7 @@ public: return adopt_ref(*new URL(move(url), move(query))); } - static DOM::ExceptionOr<NonnullRefPtr<URL>> create_with_global_object(Bindings::WindowObject&, const String& url, const String& base); + static DOM::ExceptionOr<NonnullRefPtr<URL>> create_with_global_object(Bindings::WindowObject&, String const& url, String const& base); String href() const; DOM::ExceptionOr<void> set_href(String const&); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp index 34ca58a0e9..b4ff650856 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp @@ -12,7 +12,7 @@ namespace Web::URL { -String url_encode(const Vector<QueryParam>& pairs, AK::URL::PercentEncodeSet percent_encode_set) +String url_encode(Vector<QueryParam> const& pairs, AK::URL::PercentEncodeSet percent_encode_set) { StringBuilder builder; for (size_t i = 0; i < pairs.size(); ++i) { @@ -185,7 +185,7 @@ bool URLSearchParams::has(String const& name) .is_end(); } -void URLSearchParams::set(const String& name, const String& value) +void URLSearchParams::set(String const& name, String const& value) { // 1. If this’s list contains any name-value pairs whose name is name, then set the value of the first such name-value pair to value and remove the others. auto existing = m_list.find_if([&name](auto& entry) { diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.h b/Userland/Libraries/LibWeb/URL/URLSearchParams.h index 7fe3ea8114..a2cfe8c7e5 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.h @@ -17,7 +17,7 @@ struct QueryParam { String name; String value; }; -String url_encode(const Vector<QueryParam>&, AK::URL::PercentEncodeSet); +String url_encode(Vector<QueryParam> const&, AK::URL::PercentEncodeSet); Vector<QueryParam> url_decode(StringView); class URLSearchParams : public Bindings::Wrappable diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp index a6e083f6f9..d90c092eec 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp @@ -33,7 +33,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object) auto& cache = this->cache(); for (auto& export_ : instance.exports()) { export_.value().visit( - [&](const Wasm::FunctionAddress& address) { + [&](Wasm::FunctionAddress const& address) { auto object = cache.function_instances.get(address); if (!object.has_value()) { object = create_native_function(global_object, address, export_.name()); @@ -41,7 +41,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object) } m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes); }, - [&](const Wasm::MemoryAddress& address) { + [&](Wasm::MemoryAddress const& address) { auto object = cache.memory_instances.get(address); if (!object.has_value()) { object = heap().allocate<Web::Bindings::WebAssemblyMemoryObject>(global_object, global_object, address); @@ -49,7 +49,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object) } m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes); }, - [&](const auto&) { + [&](auto const&) { // FIXME: Implement other exports! }); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h index b865fab521..38911c36bf 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h @@ -22,7 +22,7 @@ public: virtual ~WebAssemblyModuleObject() override = default; size_t index() const { return m_index; } - const Wasm::Module& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; } + Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; } private: size_t m_index { 0 }; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index de27ae907c..b0f6e6e330 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -184,7 +184,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module if (!import_argument.is_undefined()) { auto* import_object = TRY(import_argument.to_object(global_object)); dbgln("Trying to resolve stuff because import object was specified"); - for (const Wasm::Linker::Name& import_name : linker.unresolved_imports()) { + for (Wasm::Linker::Name const& import_name : linker.unresolved_imports()) { dbgln("Trying to resolve {}::{}", import_name.module, import_name.name); auto value_or_error = import_object->get(import_name.module); if (value_or_error.is_error()) @@ -286,7 +286,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module resolved_imports.set(import_name, Wasm::ExternValue { address }); return {}; }, - [&](const auto&) -> JS::ThrowCompletionOr<void> { + [&](auto const&) -> JS::ThrowCompletionOr<void> { // FIXME: Implement these. dbgln("Unimplemented import of non-function attempted"); return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Not Implemented"); @@ -328,7 +328,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate) } auto* buffer = buffer_or_error.release_value(); - const Wasm::Module* module { nullptr }; + Wasm::Module const* module { nullptr }; if (is<JS::ArrayBuffer>(buffer) || is<JS::TypedArrayBase>(buffer)) { auto result = parse_module(global_object, buffer); if (result.is_error()) { @@ -386,7 +386,7 @@ JS::Value to_js_value(JS::GlobalObject& global_object, Wasm::Value& wasm_value) VERIFY_NOT_REACHED(); } -JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, const Wasm::ValueType& type) +JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, Wasm::ValueType const& type) { static ::Crypto::SignedBigInteger two_64 = "1"_sbigint.shift_left(64); auto& vm = global_object.vm(); @@ -439,7 +439,7 @@ JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global JS::NativeFunction* create_native_function(JS::GlobalObject& global_object, Wasm::FunctionAddress address, String const& name) { Optional<Wasm::FunctionType> type; - WebAssemblyObject::s_abstract_machine.store().get(address)->visit([&](const auto& value) { type = value.type(); }); + WebAssemblyObject::s_abstract_machine.store().get(address)->visit([&](auto const& value) { type = value.type(); }); if (auto entry = WebAssemblyObject::s_global_cache.function_instances.get(address); entry.has_value()) return *entry; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h index 834c2cc826..481138dd22 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h @@ -17,7 +17,7 @@ class WebAssemblyMemoryObject; JS::ThrowCompletionOr<size_t> parse_module(JS::GlobalObject& global_object, JS::Object* buffer); JS::NativeFunction* create_native_function(JS::GlobalObject& global_object, Wasm::FunctionAddress address, String const& name); JS::Value to_js_value(JS::GlobalObject& global_object, Wasm::Value& wasm_value); -JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, const Wasm::ValueType& type); +JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, Wasm::ValueType const& type); class WebAssemblyObject final : public JS::Object { JS_OBJECT(WebAssemblyObject, JS::Object); diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 531cf0cda3..ae75861d6c 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -23,7 +23,7 @@ void WebContentClient::die() on_web_content_process_crash(); } -void WebContentClient::did_paint(const Gfx::IntRect&, i32 bitmap_id) +void WebContentClient::did_paint(Gfx::IntRect const&, i32 bitmap_id) { m_view.notify_server_did_paint({}, bitmap_id); } diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index ff3bdeba68..c351b95501 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -53,7 +53,7 @@ RefPtr<Protocol::WebSocket> WebSocketClientManager::connect(const AK::URL& url, } // https://websockets.spec.whatwg.org/#dom-websocket-websocket -DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(Bindings::WindowObject& window, const String& url) +DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(Bindings::WindowObject& window, String const& url) { AK::URL url_record(url); if (!url_record.is_valid()) @@ -169,7 +169,7 @@ DOM::ExceptionOr<void> WebSocket::close(Optional<u16> code, Optional<String> rea } // https://websockets.spec.whatwg.org/#dom-websocket-send -DOM::ExceptionOr<void> WebSocket::send(const String& data) +DOM::ExceptionOr<void> WebSocket::send(String const& data) { auto state = ready_state(); if (state == WebSocket::ReadyState::Connecting) diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h index cf9c02795c..7d2b292592 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h @@ -64,7 +64,7 @@ public: return adopt_ref(*new WebSocket(window, url)); } - static DOM::ExceptionOr<NonnullRefPtr<WebSocket>> create_with_global_object(Bindings::WindowObject& window, const String& url); + static DOM::ExceptionOr<NonnullRefPtr<WebSocket>> create_with_global_object(Bindings::WindowObject& window, String const& url); virtual ~WebSocket() override; @@ -84,11 +84,11 @@ public: String extensions() const; String protocol() const; - const String& binary_type() { return m_binary_type; }; - void set_binary_type(const String& type) { m_binary_type = type; }; + String const& binary_type() { return m_binary_type; }; + void set_binary_type(String const& type) { m_binary_type = type; }; DOM::ExceptionOr<void> close(Optional<u16> code, Optional<String> reason); - DOM::ExceptionOr<void> send(const String& data); + DOM::ExceptionOr<void> send(String const& data); private: virtual void ref_event_target() override { ref(); } diff --git a/Userland/Libraries/LibWeb/WebViewHooks.h b/Userland/Libraries/LibWeb/WebViewHooks.h index 88f728695f..483255748b 100644 --- a/Userland/Libraries/LibWeb/WebViewHooks.h +++ b/Userland/Libraries/LibWeb/WebViewHooks.h @@ -15,25 +15,25 @@ namespace Web { class WebViewHooks { public: - Function<void(const Gfx::IntPoint& screen_position)> on_context_menu_request; - Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_click; - Function<void(const AK::URL&, const Gfx::IntPoint& screen_position)> on_link_context_menu_request; - Function<void(const AK::URL&, const Gfx::IntPoint& screen_position, const Gfx::ShareableBitmap&)> on_image_context_menu_request; - Function<void(const AK::URL&, const String& target, unsigned modifiers)> on_link_middle_click; + Function<void(Gfx::IntPoint const& screen_position)> on_context_menu_request; + Function<void(const AK::URL&, String const& target, unsigned modifiers)> on_link_click; + Function<void(const AK::URL&, Gfx::IntPoint const& screen_position)> on_link_context_menu_request; + Function<void(const AK::URL&, Gfx::IntPoint const& screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request; + Function<void(const AK::URL&, String const& target, unsigned modifiers)> on_link_middle_click; Function<void(const AK::URL&)> on_link_hover; - Function<void(const String&)> on_title_change; + Function<void(String const&)> on_title_change; Function<void(const AK::URL&)> on_load_start; Function<void(const AK::URL&)> on_load_finish; - Function<void(const Gfx::Bitmap&)> on_favicon_change; + Function<void(Gfx::Bitmap const&)> on_favicon_change; Function<void(const AK::URL&)> on_url_drop; Function<void(DOM::Document*)> on_set_document; - Function<void(const AK::URL&, const String&)> on_get_source; - Function<void(const String&)> on_get_dom_tree; + Function<void(const AK::URL&, String const&)> on_get_source; + Function<void(String const&)> on_get_dom_tree; Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties; Function<void(i32 message_id)> on_js_console_new_message; Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages; Function<String(const AK::URL& url, Cookie::Source source)> on_get_cookie; - Function<void(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie; + Function<void(const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source)> on_set_cookie; Function<void(i32 count_waiting)> on_resource_status_change; }; diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 3a3acad6ae..3b7a42204c 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -50,7 +50,7 @@ void XMLHttpRequest::set_ready_state(ReadyState ready_state) dispatch_event(DOM::Event::create(EventNames::readystatechange)); } -void XMLHttpRequest::fire_progress_event(const String& event_name, u64 transmitted, u64 length) +void XMLHttpRequest::fire_progress_event(String const& event_name, u64 transmitted, u64 length) { ProgressEventInit event_init {}; event_init.length_computable = true; @@ -371,7 +371,7 @@ Optional<MimeSniff::MimeType> XMLHttpRequest::extract_mime_type(HashMap<String, } // https://fetch.spec.whatwg.org/#forbidden-header-name -static bool is_forbidden_header_name(const String& header_name) +static bool is_forbidden_header_name(String const& header_name) { if (header_name.starts_with("Proxy-", CaseSensitivity::CaseInsensitive) || header_name.starts_with("Sec-", CaseSensitivity::CaseInsensitive)) return true; @@ -381,14 +381,14 @@ static bool is_forbidden_header_name(const String& header_name) } // https://fetch.spec.whatwg.org/#forbidden-method -static bool is_forbidden_method(const String& method) +static bool is_forbidden_method(String const& method) { auto lowercase_method = method.to_lowercase(); return lowercase_method.is_one_of("connect", "trace", "track"); } // https://fetch.spec.whatwg.org/#concept-method-normalize -static String normalize_method(const String& method) +static String normalize_method(String const& method) { auto lowercase_method = method.to_lowercase(); if (lowercase_method.is_one_of("delete", "get", "head", "options", "post", "put")) @@ -397,14 +397,14 @@ static String normalize_method(const String& method) } // https://fetch.spec.whatwg.org/#concept-header-value-normalize -static String normalize_header_value(const String& header_value) +static String normalize_header_value(String const& header_value) { // FIXME: I'm not sure if this is the right trim, it should only be HTML whitespace bytes. return header_value.trim_whitespace(); } // https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader -DOM::ExceptionOr<void> XMLHttpRequest::set_request_header(const String& header, const String& value) +DOM::ExceptionOr<void> XMLHttpRequest::set_request_header(String const& header, String const& value) { if (m_ready_state != ReadyState::Opened) return DOM::InvalidStateError::create("XHR readyState is not OPENED"); @@ -424,7 +424,7 @@ DOM::ExceptionOr<void> XMLHttpRequest::set_request_header(const String& header, } // https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open -DOM::ExceptionOr<void> XMLHttpRequest::open(const String& method, const String& url) +DOM::ExceptionOr<void> XMLHttpRequest::open(String const& method, String const& url) { // FIXME: Let settingsObject be this’s relevant settings object. diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 543b35e81f..268a5d8639 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -54,13 +54,13 @@ public: DOM::ExceptionOr<JS::Value> response(); Bindings::XMLHttpRequestResponseType response_type() const { return m_response_type; } - DOM::ExceptionOr<void> open(const String& method, const String& url); + DOM::ExceptionOr<void> open(String const& method, String const& url); DOM::ExceptionOr<void> send(String body); - DOM::ExceptionOr<void> set_request_header(const String& header, const String& value); + DOM::ExceptionOr<void> set_request_header(String const& header, String const& value); void set_response_type(Bindings::XMLHttpRequestResponseType type) { m_response_type = type; } - String get_response_header(const String& name) { return m_response_headers.get(name).value_or({}); } + String get_response_header(String const& name) { return m_response_headers.get(name).value_or({}); } String get_all_response_headers() const; Bindings::CallbackType* onreadystatechange(); @@ -75,7 +75,7 @@ private: void set_ready_state(ReadyState); void set_status(unsigned status) { m_status = status; } - void fire_progress_event(const String&, u64, u64); + void fire_progress_event(String const&, u64, u64); MimeSniff::MimeType get_response_mime_type() const; Optional<StringView> get_final_encoding() const; diff --git a/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp b/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp index 532d0f695f..7f594c2719 100644 --- a/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp +++ b/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp @@ -9,7 +9,7 @@ #include <LibWeb/XML/XMLDocumentBuilder.h> inline namespace { -extern const char* s_xhtml_unified_dtd; +extern char const* s_xhtml_unified_dtd; } static FlyString s_html_namespace = "http://www.w3.org/1999/xhtml"; @@ -44,7 +44,7 @@ XMLDocumentBuilder::XMLDocumentBuilder(DOM::Document& document, XMLScriptingSupp { } -void XMLDocumentBuilder::element_start(const XML::Name& name, const HashMap<XML::Name, String>& attributes) +void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name, String> const& attributes) { if (m_has_error) return; @@ -116,7 +116,7 @@ void XMLDocumentBuilder::element_end(const XML::Name& name) m_current_node = m_current_node->parent_node(); } -void XMLDocumentBuilder::text(const String& data) +void XMLDocumentBuilder::text(String const& data) { if (m_has_error) return; @@ -133,7 +133,7 @@ void XMLDocumentBuilder::text(const String& data) } } -void XMLDocumentBuilder::comment(const String& data) +void XMLDocumentBuilder::comment(String const& data) { if (m_has_error) return; @@ -244,7 +244,7 @@ void XMLDocumentBuilder::document_end() } inline namespace { -const char* s_xhtml_unified_dtd = R"xmlxmlxml( +char const* s_xhtml_unified_dtd = R"xmlxmlxml( <!ENTITY Tab "	"><!ENTITY NewLine "
"><!ENTITY excl "!"><!ENTITY quot """><!ENTITY QUOT """><!ENTITY num "#"><!ENTITY dollar "$"><!ENTITY percnt "%"><!ENTITY amp "&#x26;"><!ENTITY AMP "&#x26;"><!ENTITY apos "'"><!ENTITY lpar "("><!ENTITY rpar ")"><!ENTITY ast "*"><!ENTITY midast "*"><!ENTITY plus "+"><!ENTITY comma ","><!ENTITY period "."><!ENTITY sol "/"><!ENTITY colon ":"><!ENTITY semi ";"><!ENTITY lt "&#x3C;"><!ENTITY LT "&#x3C;"><!ENTITY nvlt "&#x3C;⃒"><!ENTITY equals "="><!ENTITY bne "=⃥"><!ENTITY gt ">"><!ENTITY GT ">"><!ENTITY nvgt ">⃒"><!ENTITY quest "?"><!ENTITY commat "@"><!ENTITY lsqb "["><!ENTITY lbrack "["><!ENTITY bsol "\"><!ENTITY rsqb "]"><!ENTITY rbrack "]"><!ENTITY Hat "^"><!ENTITY lowbar "_"><!ENTITY UnderBar "_"><!ENTITY grave "`"><!ENTITY DiacriticalGrave "`"><!ENTITY fjlig "fj"><!ENTITY lcub "{"><!ENTITY lbrace "{"><!ENTITY verbar "|"><!ENTITY vert "|"><!ENTITY VerticalLine "|"><!ENTITY rcub "}"><!ENTITY rbrace "}"><!ENTITY nbsp " "><!ENTITY NonBreakingSpace " "><!ENTITY iexcl "¡"><!ENTITY cent "¢"><!ENTITY pound "£"><!ENTITY curren "¤"><!ENTITY yen "¥"><!ENTITY brvbar "¦"><!ENTITY sect "§"><!ENTITY Dot "¨"><!ENTITY die "¨"><!ENTITY DoubleDot "¨"><!ENTITY uml "¨"><!ENTITY copy "©"><!ENTITY COPY "©"><!ENTITY ordf "ª"><!ENTITY laquo "«"><!ENTITY not "¬"><!ENTITY shy "­"><!ENTITY reg "®"><!ENTITY circledR "®"><!ENTITY REG "®"><!ENTITY macr "¯"><!ENTITY strns "¯"><!ENTITY deg "°"><!ENTITY plusmn "±"><!ENTITY pm "±"><!ENTITY PlusMinus "±"><!ENTITY sup2 "²"><!ENTITY sup3 "³"><!ENTITY acute "´"><!ENTITY DiacriticalAcute "´"><!ENTITY micro "µ"><!ENTITY para "¶"><!ENTITY middot "·"><!ENTITY centerdot "·"><!ENTITY CenterDot "·"><!ENTITY cedil "¸"><!ENTITY Cedilla "¸"><!ENTITY sup1 "¹"><!ENTITY ordm "º"><!ENTITY raquo "»"><!ENTITY frac14 "¼"><!ENTITY frac12 "½"><!ENTITY half "½"><!ENTITY frac34 "¾"><!ENTITY iquest "¿"><!ENTITY Agrave "À"><!ENTITY Aacute "Á"><!ENTITY Acirc "Â"><!ENTITY Atilde "Ã"><!ENTITY Auml "Ä"><!ENTITY Aring "Å"><!ENTITY angst "Å"><!ENTITY AElig "Æ"><!ENTITY Ccedil "Ç"><!ENTITY Egrave "È"><!ENTITY Eacute "É"><!ENTITY Ecirc "Ê"><!ENTITY Euml "Ë"><!ENTITY Igrave "Ì"><!ENTITY Iacute "Í"><!ENTITY Icirc "Î"><!ENTITY Iuml "Ï"><!ENTITY ETH "Ð"><!ENTITY Ntilde "Ñ"><!ENTITY Ograve "Ò"><!ENTITY Oacute "Ó"><!ENTITY Ocirc "Ô"><!ENTITY Otilde "Õ"><!ENTITY Ouml "Ö"><!ENTITY times "×"><!ENTITY Oslash "Ø"><!ENTITY Ugrave "Ù"><!ENTITY Uacute "Ú"><!ENTITY Ucirc "Û"><!ENTITY Uuml "Ü"><!ENTITY Yacute "Ý"><!ENTITY THORN "Þ"><!ENTITY szlig "ß"><!ENTITY agrave "à"><!ENTITY aacute "á"><!ENTITY acirc "â"><!ENTITY atilde "ã"><!ENTITY auml "ä"><!ENTITY aring "å"><!ENTITY aelig "æ"><!ENTITY ccedil "ç"><!ENTITY egrave "è"><!ENTITY eacute "é"><!ENTITY ecirc "ê"><!ENTITY euml "ë"><!ENTITY igrave "ì"><!ENTITY iacute "í"><!ENTITY icirc "î"><!ENTITY iuml "ï"><!ENTITY eth "ð"><!ENTITY ntilde "ñ"><!ENTITY ograve "ò"><!ENTITY oacute "ó"><!ENTITY ocirc "ô"><!ENTITY otilde "õ"><!ENTITY ouml "ö"><!ENTITY divide "÷"><!ENTITY div "÷"><!ENTITY oslash "ø"><!ENTITY ugrave "ù"><!ENTITY uacute "ú"><!ENTITY ucirc "û"><!ENTITY uuml "ü"><!ENTITY yacute "ý"><!ENTITY thorn "þ"><!ENTITY yuml "ÿ"><!ENTITY Amacr "Ā"><!ENTITY amacr "ā"><!ENTITY Abreve "Ă"><!ENTITY abreve "ă"><!ENTITY Aogon "Ą"><!ENTITY aogon "ą"><!ENTITY Cacute "Ć"><!ENTITY cacute "ć"><!ENTITY Ccirc "Ĉ"><!ENTITY ccirc "ĉ"><!ENTITY Cdot "Ċ"><!ENTITY cdot "ċ"><!ENTITY Ccaron "Č"><!ENTITY ccaron "č"><!ENTITY Dcaron "Ď"><!ENTITY dcaron "ď"><!ENTITY Dstrok "Đ"><!ENTITY dstrok "đ"><!ENTITY Emacr "Ē"><!ENTITY emacr "ē"><!ENTITY Edot "Ė"><!ENTITY edot "ė"><!ENTITY Eogon "Ę"><!ENTITY eogon "ę"><!ENTITY Ecaron "Ě"><!ENTITY ecaron "ě"><!ENTITY Gcirc "Ĝ"><!ENTITY gcirc "ĝ"><!ENTITY Gbreve "Ğ"><!ENTITY gbreve "ğ"><!ENTITY Gdot "Ġ"><!ENTITY gdot "ġ"><!ENTITY Gcedil "Ģ"><!ENTITY Hcirc "Ĥ"><!ENTITY hcirc "ĥ"><!ENTITY Hstrok "Ħ"><!ENTITY hstrok "ħ"><!ENTITY Itilde "Ĩ"><!ENTITY itilde "ĩ"><!ENTITY Imacr "Ī"><!ENTITY imacr "ī"><!ENTITY Iogon "Į"><!ENTITY iogon "į"><!ENTITY Idot "İ"><!ENTITY imath "ı"><!ENTITY inodot "ı"><!ENTITY IJlig "IJ"><!ENTITY ijlig "ij"><!ENTITY Jcirc "Ĵ"><!ENTITY jcirc "ĵ"><!ENTITY Kcedil "Ķ"><!ENTITY kcedil "ķ"><!ENTITY kgreen "ĸ"><!ENTITY Lacute "Ĺ"><!ENTITY lacute "ĺ"><!ENTITY Lcedil "Ļ"><!ENTITY lcedil "ļ"><!ENTITY Lcaron "Ľ"><!ENTITY lcaron "ľ"><!ENTITY Lmidot "Ŀ"><!ENTITY lmidot "ŀ"><!ENTITY Lstrok "Ł"><!ENTITY lstrok "ł"><!ENTITY Nacute "Ń"><!ENTITY nacute "ń"><!ENTITY Ncedil "Ņ"><!ENTITY ncedil "ņ"><!ENTITY Ncaron "Ň"><!ENTITY ncaron "ň"><!ENTITY napos "ʼn"><!ENTITY ENG "Ŋ"><!ENTITY eng "ŋ"><!ENTITY Omacr "Ō"><!ENTITY omacr "ō"><!ENTITY Odblac "Ő"><!ENTITY odblac "ő"><!ENTITY OElig "Œ"><!ENTITY oelig "œ"><!ENTITY Racute "Ŕ"><!ENTITY racute "ŕ"><!ENTITY Rcedil "Ŗ"><!ENTITY rcedil "ŗ"><!ENTITY Rcaron "Ř"><!ENTITY rcaron "ř"><!ENTITY Sacute "Ś"><!ENTITY sacute "ś"><!ENTITY Scirc "Ŝ"><!ENTITY scirc "ŝ"><!ENTITY Scedil "Ş"><!ENTITY scedil "ş"><!ENTITY Scaron "Š"><!ENTITY scaron "š"><!ENTITY Tcedil "Ţ"><!ENTITY tcedil "ţ"><!ENTITY Tcaron "Ť"><!ENTITY tcaron "ť"><!ENTITY Tstrok "Ŧ"><!ENTITY tstrok "ŧ"><!ENTITY Utilde "Ũ"><!ENTITY utilde "ũ"><!ENTITY Umacr "Ū"><!ENTITY umacr "ū"><!ENTITY Ubreve "Ŭ"><!ENTITY ubreve "ŭ"><!ENTITY Uring "Ů"><!ENTITY uring "ů"><!ENTITY Udblac "Ű"><!ENTITY udblac "ű"><!ENTITY Uogon "Ų"><!ENTITY uogon "ų"><!ENTITY Wcirc "Ŵ"><!ENTITY wcirc "ŵ"><!ENTITY Ycirc "Ŷ"><!ENTITY ycirc "ŷ"><!ENTITY Yuml "Ÿ"><!ENTITY Zacute "Ź"><!ENTITY zacute "ź"><!ENTITY Zdot "Ż"><!ENTITY zdot "ż"><!ENTITY Zcaron "Ž"><!ENTITY zcaron "ž"><!ENTITY fnof "ƒ"><!ENTITY imped "Ƶ"><!ENTITY gacute "ǵ"><!ENTITY jmath "ȷ"><!ENTITY circ "ˆ"><!ENTITY caron "ˇ"><!ENTITY Hacek "ˇ"><!ENTITY breve "˘"><!ENTITY Breve "˘"><!ENTITY dot "˙"><!ENTITY DiacriticalDot "˙"><!ENTITY ring "˚"><!ENTITY ogon "˛"><!ENTITY tilde "˜"><!ENTITY DiacriticalTilde "˜"><!ENTITY dblac "˝"><!ENTITY DiacriticalDoubleAcute "˝"><!ENTITY DownBreve "̑"><!ENTITY Alpha "Α"><!ENTITY Beta "Β"><!ENTITY Gamma "Γ"><!ENTITY Delta "Δ"><!ENTITY Epsilon "Ε"><!ENTITY Zeta "Ζ"><!ENTITY Eta "Η"><!ENTITY Theta "Θ"><!ENTITY Iota "Ι"><!ENTITY Kappa "Κ"><!ENTITY Lambda "Λ"><!ENTITY Mu "Μ"><!ENTITY Nu "Ν"><!ENTITY Xi "Ξ"><!ENTITY Omicron "Ο"><!ENTITY Pi "Π"><!ENTITY Rho "Ρ"><!ENTITY Sigma "Σ"><!ENTITY Tau "Τ"><!ENTITY Upsilon "Υ"><!ENTITY Phi "Φ"><!ENTITY Chi "Χ"><!ENTITY Psi "Ψ"><!ENTITY Omega "Ω"><!ENTITY ohm "Ω"><!ENTITY alpha "α"><!ENTITY beta "β"><!ENTITY gamma "γ"><!ENTITY delta "δ"><!ENTITY epsi "ε"><!ENTITY epsilon "ε"><!ENTITY zeta "ζ"><!ENTITY eta "η"><!ENTITY theta "θ"><!ENTITY iota "ι"><!ENTITY kappa "κ"><!ENTITY lambda "λ"><!ENTITY mu "μ"><!ENTITY nu "ν"><!ENTITY xi "ξ"><!ENTITY omicron "ο"><!ENTITY pi "π"><!ENTITY rho "ρ"><!ENTITY sigmav "ς"><!ENTITY varsigma "ς"><!ENTITY sigmaf "ς"><!ENTITY sigma "σ"><!ENTITY tau "τ"><!ENTITY upsi "υ"><!ENTITY upsilon "υ"><!ENTITY phi "φ"><!ENTITY chi "χ"><!ENTITY psi "ψ"><!ENTITY omega "ω"><!ENTITY thetav "ϑ"><!ENTITY vartheta "ϑ"><!ENTITY thetasym "ϑ"><!ENTITY Upsi "ϒ"><!ENTITY upsih "ϒ"><!ENTITY straightphi "ϕ"><!ENTITY phiv "ϕ"><!ENTITY varphi "ϕ"><!ENTITY piv "ϖ"><!ENTITY varpi "ϖ"><!ENTITY Gammad "Ϝ"><!ENTITY gammad "ϝ"><!ENTITY digamma "ϝ"><!ENTITY kappav "ϰ"><!ENTITY varkappa "ϰ"><!ENTITY rhov "ϱ"><!ENTITY varrho "ϱ"><!ENTITY epsiv "ϵ"><!ENTITY straightepsilon "ϵ"><!ENTITY varepsilon "ϵ"><!ENTITY bepsi "϶"><!ENTITY backepsilon "϶"><!ENTITY IOcy "Ё"><!ENTITY DJcy "Ђ"><!ENTITY GJcy "Ѓ"><!ENTITY Jukcy "Є"><!ENTITY DScy "Ѕ"><!ENTITY Iukcy "І"><!ENTITY YIcy "Ї"><!ENTITY Jsercy "Ј"><!ENTITY LJcy "Љ"><!ENTITY NJcy "Њ"><!ENTITY TSHcy "Ћ"><!ENTITY KJcy "Ќ"><!ENTITY Ubrcy "Ў"><!ENTITY DZcy "Џ"><!ENTITY Acy "А"><!ENTITY Bcy "Б"><!ENTITY Vcy "В"><!ENTITY Gcy "Г"><!ENTITY Dcy "Д"><!ENTITY IEcy "Е"><!ENTITY ZHcy "Ж"><!ENTITY Zcy "З"><!ENTITY Icy "И"><!ENTITY Jcy "Й"><!ENTITY Kcy "К"><!ENTITY Lcy "Л"><!ENTITY Mcy "М"><!ENTITY Ncy "Н"><!ENTITY Ocy "О"><!ENTITY Pcy "П"><!ENTITY Rcy "Р"><!ENTITY Scy "С"><!ENTITY Tcy "Т"><!ENTITY Ucy "У"><!ENTITY Fcy "Ф"><!ENTITY KHcy "Х"><!ENTITY TScy "Ц"><!ENTITY CHcy "Ч"><!ENTITY SHcy "Ш"><!ENTITY SHCHcy "Щ"><!ENTITY HARDcy "Ъ"><!ENTITY Ycy "Ы"><!ENTITY SOFTcy "Ь"><!ENTITY Ecy "Э"><!ENTITY YUcy "Ю"><!ENTITY YAcy "Я"><!ENTITY acy "а"><!ENTITY bcy "б"><!ENTITY vcy "в"><!ENTITY gcy "г"><!ENTITY dcy "д"><!ENTITY iecy "е"><!ENTITY zhcy "ж"><!ENTITY zcy "з"><!ENTITY icy "и"><!ENTITY jcy "й"><!ENTITY kcy "к"><!ENTITY lcy "л"><!ENTITY mcy "м"><!ENTITY ncy "н"><!ENTITY ocy "о"><!ENTITY pcy "п"><!ENTITY rcy "р"><!ENTITY scy "с"><!ENTITY tcy "т"><!ENTITY ucy "у"><!ENTITY fcy "ф"><!ENTITY khcy "х"><!ENTITY tscy "ц"><!ENTITY chcy "ч"><!ENTITY shcy "ш"><!ENTITY shchcy "щ"><!ENTITY hardcy "ъ"><!ENTITY ycy "ы"><!ENTITY softcy "ь"><!ENTITY ecy "э"><!ENTITY yucy "ю"><!ENTITY yacy "я"><!ENTITY iocy "ё"><!ENTITY djcy "ђ"><!ENTITY gjcy "ѓ"><!ENTITY jukcy "є"><!ENTITY dscy "ѕ"><!ENTITY iukcy "і"><!ENTITY yicy "ї"><!ENTITY jsercy "ј"><!ENTITY ljcy "љ"><!ENTITY njcy "њ"><!ENTITY tshcy "ћ"><!ENTITY kjcy "ќ"><!ENTITY ubrcy "ў"><!ENTITY dzcy "џ"><!ENTITY ensp " "><!ENTITY emsp " "><!ENTITY emsp13 " "><!ENTITY emsp14 " "><!ENTITY numsp " "><!ENTITY puncsp " "><!ENTITY thinsp " "><!ENTITY ThinSpace " "><!ENTITY hairsp " "><!ENTITY VeryThinSpace " "><!ENTITY ZeroWidthSpace "​"><!ENTITY NegativeVeryThinSpace "​"><!ENTITY NegativeThinSpace "​"><!ENTITY NegativeMediumSpace "​"><!ENTITY NegativeThickSpace "​"><!ENTITY zwnj "‌"><!ENTITY zwj "‍"><!ENTITY lrm "‎"><!ENTITY rlm "‏"><!ENTITY hyphen "‐"><!ENTITY dash "‐"><!ENTITY ndash "–"><!ENTITY mdash "—"><!ENTITY horbar "―"><!ENTITY Verbar "‖"><!ENTITY Vert "‖"><!ENTITY lsquo "‘"><!ENTITY OpenCurlyQuote "‘"><!ENTITY rsquo "’"><!ENTITY rsquor "’"><!ENTITY CloseCurlyQuote "’"><!ENTITY lsquor "‚"><!ENTITY sbquo "‚"><!ENTITY ldquo "“"><!ENTITY OpenCurlyDoubleQuote "“"><!ENTITY rdquo "”"><!ENTITY rdquor "”"><!ENTITY CloseCurlyDoubleQuote "”"><!ENTITY ldquor "„"><!ENTITY bdquo "„"><!ENTITY dagger "†"><!ENTITY Dagger "‡"><!ENTITY ddagger "‡"><!ENTITY bull "•"><!ENTITY bullet "•"><!ENTITY nldr "‥"><!ENTITY hellip "…"><!ENTITY mldr "…"><!ENTITY permil "‰"><!ENTITY pertenk "‱"><!ENTITY prime "′"><!ENTITY Prime "″"><!ENTITY tprime "‴"><!ENTITY bprime "‵"><!ENTITY backprime "‵"><!ENTITY lsaquo "‹"><!ENTITY rsaquo "›"><!ENTITY oline "‾"><!ENTITY OverBar "‾"><!ENTITY caret "⁁"><!ENTITY hybull "⁃"><!ENTITY frasl "⁄"><!ENTITY bsemi "⁏"><!ENTITY qprime "⁗"><!ENTITY MediumSpace " "><!ENTITY ThickSpace "  "><!ENTITY NoBreak "⁠"><!ENTITY ApplyFunction "⁡"><!ENTITY af "⁡"><!ENTITY InvisibleTimes "⁢"><!ENTITY it "⁢"><!ENTITY InvisibleComma "⁣"><!ENTITY ic "⁣"><!ENTITY euro "€"><!ENTITY tdot "⃛"><!ENTITY TripleDot "⃛"><!ENTITY DotDot "⃜"><!ENTITY Copf "ℂ"><!ENTITY complexes "ℂ"><!ENTITY incare "℅"><!ENTITY gscr "ℊ"><!ENTITY hamilt "ℋ"><!ENTITY HilbertSpace "ℋ"><!ENTITY Hscr "ℋ"><!ENTITY Hfr "ℌ"><!ENTITY Poincareplane "ℌ"><!ENTITY quaternions "ℍ"><!ENTITY Hopf "ℍ"><!ENTITY planckh "ℎ"><!ENTITY planck "ℏ"><!ENTITY hbar "ℏ"><!ENTITY plankv "ℏ"><!ENTITY hslash "ℏ"><!ENTITY Iscr "ℐ"><!ENTITY imagline "ℐ"><!ENTITY image "ℑ"><!ENTITY Im "ℑ"><!ENTITY imagpart "ℑ"><!ENTITY Ifr "ℑ"><!ENTITY Lscr "ℒ"><!ENTITY lagran "ℒ"><!ENTITY Laplacetrf "ℒ"><!ENTITY ell "ℓ"><!ENTITY Nopf "ℕ"><!ENTITY naturals "ℕ"><!ENTITY numero "№"><!ENTITY copysr "℗"><!ENTITY weierp "℘"><!ENTITY wp "℘"><!ENTITY Popf "ℙ"><!ENTITY primes "ℙ"><!ENTITY rationals "ℚ"><!ENTITY Qopf "ℚ"><!ENTITY Rscr "ℛ"><!ENTITY realine "ℛ"><!ENTITY real "ℜ"><!ENTITY Re "ℜ"><!ENTITY realpart "ℜ"><!ENTITY Rfr "ℜ"><!ENTITY reals "ℝ"><!ENTITY Ropf "ℝ"><!ENTITY rx "℞"><!ENTITY trade "™"><!ENTITY TRADE "™"><!ENTITY integers "ℤ"><!ENTITY Zopf "ℤ"><!ENTITY mho "℧"><!ENTITY Zfr "ℨ"><!ENTITY zeetrf "ℨ"><!ENTITY iiota "℩"><!ENTITY bernou "ℬ"><!ENTITY Bernoullis "ℬ"><!ENTITY Bscr "ℬ"><!ENTITY Cfr "ℭ"><!ENTITY Cayleys "ℭ"><!ENTITY escr "ℯ"><!ENTITY Escr "ℰ"><!ENTITY expectation "ℰ"><!ENTITY Fscr "ℱ"><!ENTITY Fouriertrf "ℱ"><!ENTITY phmmat "ℳ"><!ENTITY Mellintrf "ℳ"><!ENTITY Mscr "ℳ"><!ENTITY order "ℴ"><!ENTITY orderof "ℴ"><!ENTITY oscr "ℴ"><!ENTITY alefsym "ℵ"><!ENTITY aleph "ℵ"><!ENTITY beth "ℶ"><!ENTITY gimel "ℷ"><!ENTITY daleth "ℸ"><!ENTITY CapitalDifferentialD "ⅅ"><!ENTITY DD "ⅅ"><!ENTITY DifferentialD "ⅆ"><!ENTITY dd "ⅆ"><!ENTITY ExponentialE "ⅇ"><!ENTITY exponentiale "ⅇ"><!ENTITY ee "ⅇ"><!ENTITY ImaginaryI "ⅈ"><!ENTITY ii "ⅈ"><!ENTITY frac13 "⅓"><!ENTITY frac23 "⅔"><!ENTITY frac15 "⅕"><!ENTITY frac25 "⅖"><!ENTITY frac35 "⅗"><!ENTITY frac45 "⅘"><!ENTITY frac16 "⅙"><!ENTITY frac56 "⅚"><!ENTITY frac18 "⅛"><!ENTITY frac38 "⅜"><!ENTITY frac58 "⅝"><!ENTITY frac78 "⅞"><!ENTITY larr "←"><!ENTITY leftarrow "←"><!ENTITY LeftArrow "←"><!ENTITY slarr "←"><!ENTITY ShortLeftArrow "←"><!ENTITY uarr "↑"><!ENTITY uparrow "↑"><!ENTITY UpArrow "↑"><!ENTITY ShortUpArrow "↑"><!ENTITY rarr "→"><!ENTITY rightarrow "→"><!ENTITY RightArrow "→"><!ENTITY srarr "→"><!ENTITY ShortRightArrow "→"><!ENTITY darr "↓"><!ENTITY downarrow "↓"><!ENTITY DownArrow "↓"><!ENTITY ShortDownArrow "↓"><!ENTITY harr "↔"><!ENTITY leftrightarrow "↔"><!ENTITY LeftRightArrow "↔"><!ENTITY varr "↕"><!ENTITY updownarrow "↕"><!ENTITY UpDownArrow "↕"><!ENTITY nwarr "↖"><!ENTITY UpperLeftArrow "↖"><!ENTITY nwarrow "↖"><!ENTITY nearr "↗"><!ENTITY UpperRightArrow "↗"><!ENTITY nearrow "↗"><!ENTITY searr "↘"><!ENTITY searrow "↘"><!ENTITY LowerRightArrow "↘"><!ENTITY swarr "↙"><!ENTITY swarrow "↙"><!ENTITY LowerLeftArrow "↙"><!ENTITY nlarr "↚"><!ENTITY nleftarrow "↚"><!ENTITY nrarr "↛"><!ENTITY nrightarrow "↛"><!ENTITY rarrw "↝"><!ENTITY rightsquigarrow "↝"><!ENTITY nrarrw "↝̸"><!ENTITY Larr "↞"><!ENTITY twoheadleftarrow "↞"><!ENTITY Uarr "↟"><!ENTITY Rarr "↠"><!ENTITY twoheadrightarrow "↠"><!ENTITY Darr "↡"><!ENTITY larrtl "↢"><!ENTITY leftarrowtail "↢"><!ENTITY rarrtl "↣"><!ENTITY rightarrowtail "↣"><!ENTITY LeftTeeArrow "↤"><!ENTITY mapstoleft "↤"><!ENTITY UpTeeArrow "↥"><!ENTITY mapstoup "↥"><!ENTITY map "↦"><!ENTITY RightTeeArrow "↦"><!ENTITY mapsto "↦"><!ENTITY DownTeeArrow "↧"><!ENTITY mapstodown "↧"><!ENTITY larrhk "↩"><!ENTITY hookleftarrow "↩"><!ENTITY rarrhk "↪"><!ENTITY hookrightarrow "↪"><!ENTITY larrlp "↫"><!ENTITY looparrowleft "↫"><!ENTITY rarrlp "↬"><!ENTITY looparrowright "↬"><!ENTITY harrw "↭"><!ENTITY leftrightsquigarrow "↭"><!ENTITY nharr "↮"><!ENTITY nleftrightarrow "↮"><!ENTITY lsh "↰"><!ENTITY Lsh "↰"><!ENTITY rsh "↱"><!ENTITY Rsh "↱"><!ENTITY ldsh "↲"><!ENTITY rdsh "↳"><!ENTITY crarr "↵"><!ENTITY cularr "↶"><!ENTITY curvearrowleft "↶"><!ENTITY curarr "↷"><!ENTITY curvearrowright "↷"><!ENTITY olarr "↺"><!ENTITY circlearrowleft "↺"><!ENTITY orarr "↻"><!ENTITY circlearrowright "↻"><!ENTITY lharu "↼"><!ENTITY LeftVector "↼"><!ENTITY leftharpoonup "↼"><!ENTITY lhard "↽"><!ENTITY leftharpoondown "↽"><!ENTITY DownLeftVector "↽"><!ENTITY uharr "↾"><!ENTITY upharpoonright "↾"><!ENTITY RightUpVector "↾"><!ENTITY uharl "↿"><!ENTITY upharpoonleft "↿"><!ENTITY LeftUpVector "↿"><!ENTITY rharu "⇀"><!ENTITY RightVector "⇀"><!ENTITY rightharpoonup "⇀"><!ENTITY rhard "⇁"><!ENTITY rightharpoondown "⇁"><!ENTITY DownRightVector "⇁"><!ENTITY dharr "⇂"><!ENTITY RightDownVector "⇂"><!ENTITY downharpoonright "⇂"><!ENTITY dharl "⇃"><!ENTITY LeftDownVector "⇃"><!ENTITY downharpoonleft "⇃"><!ENTITY rlarr "⇄"><!ENTITY rightleftarrows "⇄"><!ENTITY RightArrowLeftArrow "⇄"><!ENTITY udarr "⇅"><!ENTITY UpArrowDownArrow "⇅"><!ENTITY lrarr "⇆"><!ENTITY leftrightarrows "⇆"><!ENTITY LeftArrowRightArrow "⇆"><!ENTITY llarr "⇇"><!ENTITY leftleftarrows "⇇"><!ENTITY uuarr "⇈"><!ENTITY upuparrows "⇈"><!ENTITY rrarr "⇉"><!ENTITY rightrightarrows "⇉"><!ENTITY ddarr "⇊"><!ENTITY downdownarrows "⇊"><!ENTITY lrhar "⇋"><!ENTITY ReverseEquilibrium "⇋"><!ENTITY leftrightharpoons "⇋"><!ENTITY rlhar "⇌"><!ENTITY rightleftharpoons "⇌"><!ENTITY Equilibrium "⇌"><!ENTITY nlArr "⇍"><!ENTITY nLeftarrow "⇍"><!ENTITY nhArr "⇎"><!ENTITY nLeftrightarrow "⇎"><!ENTITY nrArr "⇏"><!ENTITY nRightarrow "⇏"><!ENTITY lArr "⇐"><!ENTITY Leftarrow "⇐"><!ENTITY DoubleLeftArrow "⇐"><!ENTITY uArr "⇑"><!ENTITY Uparrow "⇑"><!ENTITY DoubleUpArrow "⇑"><!ENTITY rArr "⇒"><!ENTITY Rightarrow "⇒"><!ENTITY Implies "⇒"><!ENTITY DoubleRightArrow "⇒"><!ENTITY dArr "⇓"><!ENTITY Downarrow "⇓"><!ENTITY DoubleDownArrow "⇓"><!ENTITY hArr "⇔"><!ENTITY Leftrightarrow "⇔"><!ENTITY DoubleLeftRightArrow "⇔"><!ENTITY iff "⇔"><!ENTITY vArr "⇕"><!ENTITY Updownarrow "⇕"><!ENTITY DoubleUpDownArrow "⇕"><!ENTITY nwArr "⇖"><!ENTITY neArr "⇗"><!ENTITY seArr "⇘"><!ENTITY swArr "⇙"><!ENTITY lAarr "⇚"><!ENTITY Lleftarrow "⇚"><!ENTITY rAarr "⇛"><!ENTITY Rrightarrow "⇛"><!ENTITY zigrarr "⇝"><!ENTITY larrb "⇤"><!ENTITY LeftArrowBar "⇤"><!ENTITY rarrb "⇥"><!ENTITY RightArrowBar "⇥"><!ENTITY duarr "⇵"><!ENTITY DownArrowUpArrow "⇵"><!ENTITY loarr "⇽"><!ENTITY roarr "⇾"><!ENTITY hoarr "⇿"><!ENTITY forall "∀"><!ENTITY ForAll "∀"><!ENTITY comp "∁"><!ENTITY complement "∁"><!ENTITY part "∂"><!ENTITY PartialD "∂"><!ENTITY npart "∂̸"><!ENTITY exist "∃"><!ENTITY Exists "∃"><!ENTITY nexist "∄"><!ENTITY NotExists "∄"><!ENTITY nexists "∄"><!ENTITY empty "∅"><!ENTITY emptyset "∅"><!ENTITY emptyv "∅"><!ENTITY varnothing "∅"><!ENTITY nabla "∇"><!ENTITY Del "∇"><!ENTITY isin "∈"><!ENTITY isinv "∈"><!ENTITY Element "∈"><!ENTITY in "∈"><!ENTITY notin "∉"><!ENTITY NotElement "∉"><!ENTITY notinva "∉"><!ENTITY niv "∋"><!ENTITY ReverseElement "∋"><!ENTITY ni "∋"><!ENTITY SuchThat "∋"><!ENTITY notni "∌"><!ENTITY notniva "∌"><!ENTITY NotReverseElement "∌"><!ENTITY prod "∏"><!ENTITY Product "∏"><!ENTITY coprod "∐"><!ENTITY Coproduct "∐"><!ENTITY sum "∑"><!ENTITY Sum "∑"><!ENTITY minus "−"><!ENTITY mnplus "∓"><!ENTITY mp "∓"><!ENTITY MinusPlus "∓"><!ENTITY plusdo "∔"><!ENTITY dotplus "∔"><!ENTITY setmn "∖"><!ENTITY setminus "∖"><!ENTITY Backslash "∖"><!ENTITY ssetmn "∖"><!ENTITY smallsetminus "∖"><!ENTITY lowast "∗"><!ENTITY compfn "∘"><!ENTITY SmallCircle "∘"><!ENTITY radic "√"><!ENTITY Sqrt "√"><!ENTITY prop "∝"><!ENTITY propto "∝"><!ENTITY Proportional "∝"><!ENTITY vprop "∝"><!ENTITY varpropto "∝"><!ENTITY infin "∞"><!ENTITY angrt "∟"><!ENTITY ang "∠"><!ENTITY angle "∠"><!ENTITY nang "∠⃒"><!ENTITY angmsd "∡"><!ENTITY measuredangle "∡"><!ENTITY angsph "∢"><!ENTITY mid "∣"><!ENTITY VerticalBar "∣"><!ENTITY smid "∣"><!ENTITY shortmid "∣"><!ENTITY nmid "∤"><!ENTITY NotVerticalBar "∤"><!ENTITY nsmid "∤"><!ENTITY nshortmid "∤"><!ENTITY par "∥"><!ENTITY parallel "∥"><!ENTITY DoubleVerticalBar "∥"><!ENTITY spar "∥"><!ENTITY shortparallel "∥"><!ENTITY npar "∦"><!ENTITY nparallel "∦"><!ENTITY NotDoubleVerticalBar "∦"><!ENTITY nspar "∦"><!ENTITY nshortparallel "∦"><!ENTITY and "∧"><!ENTITY wedge "∧"><!ENTITY or "∨"><!ENTITY vee "∨"><!ENTITY cap "∩"><!ENTITY caps "∩︀"><!ENTITY cup "∪"><!ENTITY cups "∪︀"><!ENTITY int "∫"><!ENTITY Integral "∫"><!ENTITY Int "∬"><!ENTITY tint "∭"><!ENTITY iiint "∭"><!ENTITY conint "∮"><!ENTITY oint "∮"><!ENTITY ContourIntegral "∮"><!ENTITY Conint "∯"><!ENTITY DoubleContourIntegral "∯"><!ENTITY Cconint "∰"><!ENTITY cwint "∱"><!ENTITY cwconint "∲"><!ENTITY ClockwiseContourIntegral "∲"><!ENTITY awconint "∳"><!ENTITY CounterClockwiseContourIntegral "∳"><!ENTITY there4 "∴"><!ENTITY therefore "∴"><!ENTITY Therefore "∴"><!ENTITY becaus "∵"><!ENTITY because "∵"><!ENTITY Because "∵"><!ENTITY ratio "∶"><!ENTITY Colon "∷"><!ENTITY Proportion "∷"><!ENTITY minusd "∸"><!ENTITY dotminus "∸"><!ENTITY mDDot "∺"><!ENTITY homtht "∻"><!ENTITY sim "∼"><!ENTITY Tilde "∼"><!ENTITY thksim "∼"><!ENTITY thicksim "∼"><!ENTITY nvsim "∼⃒"><!ENTITY bsim "∽"><!ENTITY backsim "∽"><!ENTITY race "∽̱"><!ENTITY ac "∾"><!ENTITY mstpos "∾"><!ENTITY acE "∾̳"><!ENTITY acd "∿"><!ENTITY wreath "≀"><!ENTITY VerticalTilde "≀"><!ENTITY wr "≀"><!ENTITY nsim "≁"><!ENTITY NotTilde "≁"><!ENTITY esim "≂"><!ENTITY EqualTilde "≂"><!ENTITY eqsim "≂"><!ENTITY NotEqualTilde "≂̸"><!ENTITY nesim "≂̸"><!ENTITY sime "≃"><!ENTITY TildeEqual "≃"><!ENTITY simeq "≃"><!ENTITY nsime "≄"><!ENTITY nsimeq "≄"><!ENTITY NotTildeEqual "≄"><!ENTITY cong "≅"><!ENTITY TildeFullEqual "≅"><!ENTITY simne "≆"><!ENTITY ncong "≇"><!ENTITY NotTildeFullEqual "≇"><!ENTITY asymp "≈"><!ENTITY ap "≈"><!ENTITY TildeTilde "≈"><!ENTITY approx "≈"><!ENTITY thkap "≈"><!ENTITY thickapprox "≈"><!ENTITY nap "≉"><!ENTITY NotTildeTilde "≉"><!ENTITY napprox "≉"><!ENTITY ape "≊"><!ENTITY approxeq "≊"><!ENTITY apid "≋"><!ENTITY napid "≋̸"><!ENTITY bcong "≌"><!ENTITY backcong "≌"><!ENTITY asympeq "≍"><!ENTITY CupCap "≍"><!ENTITY nvap "≍⃒"><!ENTITY bump "≎"><!ENTITY HumpDownHump "≎"><!ENTITY Bumpeq "≎"><!ENTITY NotHumpDownHump "≎̸"><!ENTITY nbump "≎̸"><!ENTITY bumpe "≏"><!ENTITY HumpEqual "≏"><!ENTITY bumpeq "≏"><!ENTITY nbumpe "≏̸"><!ENTITY NotHumpEqual "≏̸"><!ENTITY esdot "≐"><!ENTITY DotEqual "≐"><!ENTITY doteq "≐"><!ENTITY nedot "≐̸"><!ENTITY eDot "≑"><!ENTITY doteqdot "≑"><!ENTITY efDot "≒"><!ENTITY fallingdotseq "≒"><!ENTITY erDot "≓"><!ENTITY risingdotseq "≓"><!ENTITY colone "≔"><!ENTITY coloneq "≔"><!ENTITY Assign "≔"><!ENTITY ecolon "≕"><!ENTITY eqcolon "≕"><!ENTITY ecir "≖"><!ENTITY eqcirc "≖"><!ENTITY cire "≗"><!ENTITY circeq "≗"><!ENTITY wedgeq "≙"><!ENTITY veeeq "≚"><!ENTITY trie "≜"><!ENTITY triangleq "≜"><!ENTITY equest "≟"><!ENTITY questeq "≟"><!ENTITY ne "≠"><!ENTITY NotEqual "≠"><!ENTITY equiv "≡"><!ENTITY Congruent "≡"><!ENTITY bnequiv "≡⃥"><!ENTITY nequiv "≢"><!ENTITY NotCongruent "≢"><!ENTITY le "≤"><!ENTITY leq "≤"><!ENTITY nvle "≤⃒"><!ENTITY ge "≥"><!ENTITY GreaterEqual "≥"><!ENTITY geq "≥"><!ENTITY nvge "≥⃒"><!ENTITY lE "≦"><!ENTITY LessFullEqual "≦"><!ENTITY leqq "≦"><!ENTITY nlE "≦̸"><!ENTITY nleqq "≦̸"><!ENTITY gE "≧"><!ENTITY GreaterFullEqual "≧"><!ENTITY geqq "≧"><!ENTITY ngE "≧̸"><!ENTITY ngeqq "≧̸"><!ENTITY NotGreaterFullEqual "≧̸"><!ENTITY lnE "≨"><!ENTITY lneqq "≨"><!ENTITY lvnE "≨︀"><!ENTITY lvertneqq "≨︀"><!ENTITY gnE "≩"><!ENTITY gneqq "≩"><!ENTITY gvnE "≩︀"><!ENTITY gvertneqq "≩︀"><!ENTITY Lt "≪"><!ENTITY NestedLessLess "≪"><!ENTITY ll "≪"><!ENTITY nLtv "≪̸"><!ENTITY NotLessLess "≪̸"><!ENTITY nLt "≪⃒"><!ENTITY Gt "≫"><!ENTITY NestedGreaterGreater "≫"><!ENTITY gg "≫"><!ENTITY nGtv "≫̸"><!ENTITY NotGreaterGreater "≫̸"><!ENTITY nGt "≫⃒"><!ENTITY twixt "≬"><!ENTITY between "≬"><!ENTITY NotCupCap "≭"><!ENTITY nlt "≮"><!ENTITY NotLess "≮"><!ENTITY nless "≮"><!ENTITY ngt "≯"><!ENTITY NotGreater "≯"><!ENTITY ngtr "≯"><!ENTITY nle "≰"><!ENTITY NotLessEqual "≰"><!ENTITY nleq "≰"><!ENTITY nge "≱"><!ENTITY NotGreaterEqual "≱"><!ENTITY ngeq "≱"><!ENTITY lsim "≲"><!ENTITY LessTilde "≲"><!ENTITY lesssim "≲"><!ENTITY gsim "≳"><!ENTITY gtrsim "≳"><!ENTITY GreaterTilde "≳"><!ENTITY nlsim "≴"><!ENTITY NotLessTilde "≴"><!ENTITY ngsim "≵"><!ENTITY NotGreaterTilde "≵"><!ENTITY lg "≶"><!ENTITY lessgtr "≶"><!ENTITY LessGreater "≶"><!ENTITY gl "≷"><!ENTITY gtrless "≷"><!ENTITY GreaterLess "≷"><!ENTITY ntlg "≸"><!ENTITY NotLessGreater "≸"><!ENTITY ntgl "≹"><!ENTITY NotGreaterLess "≹"><!ENTITY pr "≺"><!ENTITY Precedes "≺"><!ENTITY prec "≺"><!ENTITY sc "≻"><!ENTITY Succeeds "≻"><!ENTITY succ "≻"><!ENTITY prcue "≼"><!ENTITY PrecedesSlantEqual "≼"><!ENTITY preccurlyeq "≼"><!ENTITY sccue "≽"><!ENTITY SucceedsSlantEqual "≽"><!ENTITY succcurlyeq "≽"><!ENTITY prsim "≾"><!ENTITY precsim "≾"><!ENTITY PrecedesTilde "≾"><!ENTITY scsim "≿"><!ENTITY succsim "≿"><!ENTITY SucceedsTilde "≿"><!ENTITY NotSucceedsTilde "≿̸"><!ENTITY npr "⊀"><!ENTITY nprec "⊀"><!ENTITY NotPrecedes "⊀"><!ENTITY nsc "⊁"><!ENTITY nsucc "⊁"><!ENTITY NotSucceeds "⊁"><!ENTITY sub "⊂"><!ENTITY subset "⊂"><!ENTITY vnsub "⊂⃒"><!ENTITY nsubset "⊂⃒"><!ENTITY NotSubset "⊂⃒"><!ENTITY sup "⊃"><!ENTITY supset "⊃"><!ENTITY Superset "⊃"><!ENTITY vnsup "⊃⃒"><!ENTITY nsupset "⊃⃒"><!ENTITY NotSuperset "⊃⃒"><!ENTITY nsub "⊄"><!ENTITY nsup "⊅"><!ENTITY sube "⊆"><!ENTITY SubsetEqual "⊆"><!ENTITY subseteq "⊆"><!ENTITY supe "⊇"><!ENTITY supseteq "⊇"><!ENTITY SupersetEqual "⊇"><!ENTITY nsube "⊈"><!ENTITY nsubseteq "⊈"><!ENTITY NotSubsetEqual "⊈"><!ENTITY nsupe "⊉"><!ENTITY nsupseteq "⊉"><!ENTITY NotSupersetEqual "⊉"><!ENTITY subne "⊊"><!ENTITY subsetneq "⊊"><!ENTITY vsubne "⊊︀"><!ENTITY varsubsetneq "⊊︀"><!ENTITY supne "⊋"><!ENTITY supsetneq "⊋"><!ENTITY vsupne "⊋︀"><!ENTITY varsupsetneq "⊋︀"><!ENTITY cupdot "⊍"><!ENTITY uplus "⊎"><!ENTITY UnionPlus "⊎"><!ENTITY sqsub "⊏"><!ENTITY SquareSubset "⊏"><!ENTITY sqsubset "⊏"><!ENTITY NotSquareSubset "⊏̸"><!ENTITY sqsup "⊐"><!ENTITY SquareSuperset "⊐"><!ENTITY sqsupset "⊐"><!ENTITY NotSquareSuperset "⊐̸"><!ENTITY sqsube "⊑"><!ENTITY SquareSubsetEqual "⊑"><!ENTITY sqsubseteq "⊑"><!ENTITY sqsupe "⊒"><!ENTITY SquareSupersetEqual "⊒"><!ENTITY sqsupseteq "⊒"><!ENTITY sqcap "⊓"><!ENTITY SquareIntersection "⊓"><!ENTITY sqcaps "⊓︀"><!ENTITY sqcup "⊔"><!ENTITY SquareUnion "⊔"><!ENTITY sqcups "⊔︀"><!ENTITY oplus "⊕"><!ENTITY CirclePlus "⊕"><!ENTITY ominus "⊖"><!ENTITY CircleMinus "⊖"><!ENTITY otimes "⊗"><!ENTITY CircleTimes "⊗"><!ENTITY osol "⊘"><!ENTITY odot "⊙"><!ENTITY CircleDot "⊙"><!ENTITY ocir "⊚"><!ENTITY circledcirc "⊚"><!ENTITY oast "⊛"><!ENTITY circledast "⊛"><!ENTITY odash "⊝"><!ENTITY circleddash "⊝"><!ENTITY plusb "⊞"><!ENTITY boxplus "⊞"><!ENTITY minusb "⊟"><!ENTITY boxminus "⊟"><!ENTITY timesb "⊠"><!ENTITY boxtimes "⊠"><!ENTITY sdotb "⊡"><!ENTITY dotsquare "⊡"><!ENTITY vdash "⊢"><!ENTITY RightTee "⊢"><!ENTITY dashv "⊣"><!ENTITY LeftTee "⊣"><!ENTITY top "⊤"><!ENTITY DownTee "⊤"><!ENTITY bottom "⊥"><!ENTITY bot "⊥"><!ENTITY perp "⊥"><!ENTITY UpTee "⊥"><!ENTITY models "⊧"><!ENTITY vDash "⊨"><!ENTITY DoubleRightTee "⊨"><!ENTITY Vdash "⊩"><!ENTITY Vvdash "⊪"><!ENTITY VDash "⊫"><!ENTITY nvdash "⊬"><!ENTITY nvDash "⊭"><!ENTITY nVdash "⊮"><!ENTITY nVDash "⊯"><!ENTITY prurel "⊰"><!ENTITY vltri "⊲"><!ENTITY vartriangleleft "⊲"><!ENTITY LeftTriangle "⊲"><!ENTITY vrtri "⊳"><!ENTITY vartriangleright "⊳"><!ENTITY RightTriangle "⊳"><!ENTITY ltrie "⊴"><!ENTITY trianglelefteq "⊴"><!ENTITY LeftTriangleEqual "⊴"><!ENTITY nvltrie "⊴⃒"><!ENTITY rtrie "⊵"><!ENTITY trianglerighteq "⊵"><!ENTITY RightTriangleEqual "⊵"><!ENTITY nvrtrie "⊵⃒"><!ENTITY origof "⊶"><!ENTITY imof "⊷"><!ENTITY mumap "⊸"><!ENTITY multimap "⊸"><!ENTITY hercon "⊹"><!ENTITY intcal "⊺"><!ENTITY intercal "⊺"><!ENTITY veebar "⊻"><!ENTITY barvee "⊽"><!ENTITY angrtvb "⊾"><!ENTITY lrtri "⊿"><!ENTITY xwedge "⋀"><!ENTITY Wedge "⋀"><!ENTITY bigwedge "⋀"><!ENTITY xvee "⋁"><!ENTITY Vee "⋁"><!ENTITY bigvee "⋁"><!ENTITY xcap "⋂"><!ENTITY Intersection "⋂"><!ENTITY bigcap "⋂"><!ENTITY xcup "⋃"><!ENTITY Union "⋃"><!ENTITY bigcup "⋃"><!ENTITY diam "⋄"><!ENTITY diamond "⋄"><!ENTITY Diamond "⋄"><!ENTITY sdot "⋅"><!ENTITY sstarf "⋆"><!ENTITY Star "⋆"><!ENTITY divonx "⋇"><!ENTITY divideontimes "⋇"><!ENTITY bowtie "⋈"><!ENTITY ltimes "⋉"><!ENTITY rtimes "⋊"><!ENTITY lthree "⋋"><!ENTITY leftthreetimes "⋋"><!ENTITY rthree "⋌"><!ENTITY rightthreetimes "⋌"><!ENTITY bsime "⋍"><!ENTITY backsimeq "⋍"><!ENTITY cuvee "⋎"><!ENTITY curlyvee "⋎"><!ENTITY cuwed "⋏"><!ENTITY curlywedge "⋏"><!ENTITY Sub "⋐"><!ENTITY Subset "⋐"><!ENTITY Sup "⋑"><!ENTITY Supset "⋑"><!ENTITY Cap "⋒"><!ENTITY Cup "⋓"><!ENTITY fork "⋔"><!ENTITY pitchfork "⋔"><!ENTITY epar "⋕"><!ENTITY ltdot "⋖"><!ENTITY lessdot "⋖"><!ENTITY gtdot "⋗"><!ENTITY gtrdot "⋗"><!ENTITY Ll "⋘"><!ENTITY nLl "⋘̸"><!ENTITY Gg "⋙"><!ENTITY ggg "⋙"><!ENTITY nGg "⋙̸"><!ENTITY leg "⋚"><!ENTITY LessEqualGreater "⋚"><!ENTITY lesseqgtr "⋚"><!ENTITY lesg "⋚︀"><!ENTITY gel "⋛"><!ENTITY gtreqless "⋛"><!ENTITY GreaterEqualLess "⋛"><!ENTITY gesl "⋛︀"><!ENTITY cuepr "⋞"><!ENTITY curlyeqprec "⋞"><!ENTITY cuesc "⋟"><!ENTITY curlyeqsucc "⋟"><!ENTITY nprcue "⋠"><!ENTITY NotPrecedesSlantEqual "⋠"><!ENTITY nsccue "⋡"><!ENTITY NotSucceedsSlantEqual "⋡"><!ENTITY nsqsube "⋢"><!ENTITY NotSquareSubsetEqual "⋢"><!ENTITY nsqsupe "⋣"><!ENTITY NotSquareSupersetEqual "⋣"><!ENTITY lnsim "⋦"><!ENTITY gnsim "⋧"><!ENTITY prnsim "⋨"><!ENTITY precnsim "⋨"><!ENTITY scnsim "⋩"><!ENTITY succnsim "⋩"><!ENTITY nltri "⋪"><!ENTITY ntriangleleft "⋪"><!ENTITY NotLeftTriangle "⋪"><!ENTITY nrtri "⋫"><!ENTITY ntriangleright "⋫"><!ENTITY NotRightTriangle "⋫"><!ENTITY nltrie "⋬"><!ENTITY ntrianglelefteq "⋬"><!ENTITY NotLeftTriangleEqual "⋬"><!ENTITY nrtrie "⋭"><!ENTITY ntrianglerighteq "⋭"><!ENTITY NotRightTriangleEqual "⋭"><!ENTITY vellip "⋮"><!ENTITY ctdot "⋯"><!ENTITY utdot "⋰"><!ENTITY dtdot "⋱"><!ENTITY disin "⋲"><!ENTITY isinsv "⋳"><!ENTITY isins "⋴"><!ENTITY isindot "⋵"><!ENTITY notindot "⋵̸"><!ENTITY notinvc "⋶"><!ENTITY notinvb "⋷"><!ENTITY isinE "⋹"><!ENTITY notinE "⋹̸"><!ENTITY nisd "⋺"><!ENTITY xnis "⋻"><!ENTITY nis "⋼"><!ENTITY notnivc "⋽"><!ENTITY notnivb "⋾"><!ENTITY barwed "⌅"><!ENTITY barwedge "⌅"><!ENTITY Barwed "⌆"><!ENTITY doublebarwedge "⌆"><!ENTITY lceil "⌈"><!ENTITY LeftCeiling "⌈"><!ENTITY rceil "⌉"><!ENTITY RightCeiling "⌉"><!ENTITY lfloor "⌊"><!ENTITY LeftFloor "⌊"><!ENTITY rfloor "⌋"><!ENTITY RightFloor "⌋"><!ENTITY drcrop "⌌"><!ENTITY dlcrop "⌍"><!ENTITY urcrop "⌎"><!ENTITY ulcrop "⌏"><!ENTITY bnot "⌐"><!ENTITY profline "⌒"><!ENTITY profsurf "⌓"><!ENTITY telrec "⌕"><!ENTITY target "⌖"><!ENTITY ulcorn "⌜"><!ENTITY ulcorner "⌜"><!ENTITY urcorn "⌝"><!ENTITY urcorner "⌝"><!ENTITY dlcorn "⌞"><!ENTITY llcorner "⌞"><!ENTITY drcorn "⌟"><!ENTITY lrcorner "⌟"><!ENTITY frown "⌢"><!ENTITY sfrown "⌢"><!ENTITY smile "⌣"><!ENTITY ssmile "⌣"><!ENTITY cylcty "⌭"><!ENTITY profalar "⌮"><!ENTITY topbot "⌶"><!ENTITY ovbar "⌽"><!ENTITY solbar "⌿"><!ENTITY angzarr "⍼"><!ENTITY lmoust "⎰"><!ENTITY lmoustache "⎰"><!ENTITY rmoust "⎱"><!ENTITY rmoustache "⎱"><!ENTITY tbrk "⎴"><!ENTITY OverBracket "⎴"><!ENTITY bbrk "⎵"><!ENTITY UnderBracket "⎵"><!ENTITY bbrktbrk "⎶"><!ENTITY OverParenthesis "⏜"><!ENTITY UnderParenthesis "⏝"><!ENTITY OverBrace "⏞"><!ENTITY UnderBrace "⏟"><!ENTITY trpezium "⏢"><!ENTITY elinters "⏧"><!ENTITY blank "␣"><!ENTITY oS "Ⓢ"><!ENTITY circledS "Ⓢ"><!ENTITY boxh "─"><!ENTITY HorizontalLine "─"><!ENTITY boxv "│"><!ENTITY boxdr "┌"><!ENTITY boxdl "┐"><!ENTITY boxur "└"><!ENTITY boxul "┘"><!ENTITY boxvr "├"><!ENTITY boxvl "┤"><!ENTITY boxhd "┬"><!ENTITY boxhu "┴"><!ENTITY boxvh "┼"><!ENTITY boxH "═"><!ENTITY boxV "║"><!ENTITY boxdR "╒"><!ENTITY boxDr "╓"><!ENTITY boxDR "╔"><!ENTITY boxdL "╕"><!ENTITY boxDl "╖"><!ENTITY boxDL "╗"><!ENTITY boxuR "╘"><!ENTITY boxUr "╙"><!ENTITY boxUR "╚"><!ENTITY boxuL "╛"><!ENTITY boxUl "╜"><!ENTITY boxUL "╝"><!ENTITY boxvR "╞"><!ENTITY boxVr "╟"><!ENTITY boxVR "╠"><!ENTITY boxvL "╡"><!ENTITY boxVl "╢"><!ENTITY boxVL "╣"><!ENTITY boxHd "╤"><!ENTITY boxhD "╥"><!ENTITY boxHD "╦"><!ENTITY boxHu "╧"><!ENTITY boxhU "╨"><!ENTITY boxHU "╩"><!ENTITY boxvH "╪"><!ENTITY boxVh "╫"><!ENTITY boxVH "╬"><!ENTITY uhblk "▀"><!ENTITY lhblk "▄"><!ENTITY block "█"><!ENTITY blk14 "░"><!ENTITY blk12 "▒"><!ENTITY blk34 "▓"><!ENTITY squ "□"><!ENTITY square "□"><!ENTITY Square "□"><!ENTITY squf "▪"><!ENTITY squarf "▪"><!ENTITY blacksquare "▪"><!ENTITY FilledVerySmallSquare "▪"><!ENTITY EmptyVerySmallSquare "▫"><!ENTITY rect "▭"><!ENTITY marker "▮"><!ENTITY fltns "▱"><!ENTITY xutri "△"><!ENTITY bigtriangleup "△"><!ENTITY utrif "▴"><!ENTITY blacktriangle "▴"><!ENTITY utri "▵"><!ENTITY triangle "▵"><!ENTITY rtrif "▸"><!ENTITY blacktriangleright "▸"><!ENTITY rtri "▹"><!ENTITY triangleright "▹"><!ENTITY xdtri "▽"><!ENTITY bigtriangledown "▽"><!ENTITY dtrif "▾"><!ENTITY blacktriangledown "▾"><!ENTITY dtri "▿"><!ENTITY triangledown "▿"><!ENTITY ltrif "◂"><!ENTITY blacktriangleleft "◂"><!ENTITY ltri "◃"><!ENTITY triangleleft "◃"><!ENTITY loz "◊"><!ENTITY lozenge "◊"><!ENTITY cir "○"><!ENTITY tridot "◬"><!ENTITY xcirc "◯"><!ENTITY bigcirc "◯"><!ENTITY ultri "◸"><!ENTITY urtri "◹"><!ENTITY lltri "◺"><!ENTITY EmptySmallSquare "◻"><!ENTITY FilledSmallSquare "◼"><!ENTITY starf "★"><!ENTITY bigstar "★"><!ENTITY star "☆"><!ENTITY phone "☎"><!ENTITY female "♀"><!ENTITY male "♂"><!ENTITY spades "♠"><!ENTITY spadesuit "♠"><!ENTITY clubs "♣"><!ENTITY clubsuit "♣"><!ENTITY hearts "♥"><!ENTITY heartsuit "♥"><!ENTITY diams "♦"><!ENTITY diamondsuit "♦"><!ENTITY sung "♪"><!ENTITY flat "♭"><!ENTITY natur "♮"><!ENTITY natural "♮"><!ENTITY sharp "♯"><!ENTITY check "✓"><!ENTITY checkmark "✓"><!ENTITY cross "✗"><!ENTITY malt "✠"><!ENTITY maltese "✠"><!ENTITY sext "✶"><!ENTITY VerticalSeparator "❘"><!ENTITY lbbrk "❲"><!ENTITY rbbrk "❳"><!ENTITY bsolhsub "⟈"><!ENTITY suphsol "⟉"><!ENTITY lobrk "⟦"><!ENTITY LeftDoubleBracket "⟦"><!ENTITY robrk "⟧"><!ENTITY RightDoubleBracket "⟧"><!ENTITY lang "⟨"><!ENTITY LeftAngleBracket "⟨"><!ENTITY langle "⟨"><!ENTITY rang "⟩"><!ENTITY RightAngleBracket "⟩"><!ENTITY rangle "⟩"><!ENTITY Lang "⟪"><!ENTITY Rang "⟫"><!ENTITY loang "⟬"><!ENTITY roang "⟭"><!ENTITY xlarr "⟵"><!ENTITY longleftarrow "⟵"><!ENTITY LongLeftArrow "⟵"><!ENTITY xrarr "⟶"><!ENTITY longrightarrow "⟶"><!ENTITY LongRightArrow "⟶"><!ENTITY xharr "⟷"><!ENTITY longleftrightarrow "⟷"><!ENTITY LongLeftRightArrow "⟷"><!ENTITY xlArr "⟸"><!ENTITY Longleftarrow "⟸"><!ENTITY DoubleLongLeftArrow "⟸"><!ENTITY xrArr "⟹"><!ENTITY Longrightarrow "⟹"><!ENTITY DoubleLongRightArrow "⟹"><!ENTITY xhArr "⟺"><!ENTITY Longleftrightarrow "⟺"><!ENTITY DoubleLongLeftRightArrow "⟺"><!ENTITY xmap "⟼"><!ENTITY longmapsto "⟼"><!ENTITY dzigrarr "⟿"><!ENTITY nvlArr "⤂"><!ENTITY nvrArr "⤃"><!ENTITY nvHarr "⤄"><!ENTITY Map "⤅"><!ENTITY lbarr "⤌"><!ENTITY rbarr "⤍"><!ENTITY bkarow "⤍"><!ENTITY lBarr "⤎"><!ENTITY rBarr "⤏"><!ENTITY dbkarow "⤏"><!ENTITY RBarr "⤐"><!ENTITY drbkarow "⤐"><!ENTITY DDotrahd "⤑"><!ENTITY UpArrowBar "⤒"><!ENTITY DownArrowBar "⤓"><!ENTITY Rarrtl "⤖"><!ENTITY latail "⤙"><!ENTITY ratail "⤚"><!ENTITY lAtail "⤛"><!ENTITY rAtail "⤜"><!ENTITY larrfs "⤝"><!ENTITY rarrfs "⤞"><!ENTITY larrbfs "⤟"><!ENTITY rarrbfs "⤠"><!ENTITY nwarhk "⤣"><!ENTITY nearhk "⤤"><!ENTITY searhk "⤥"><!ENTITY hksearow "⤥"><!ENTITY swarhk "⤦"><!ENTITY hkswarow "⤦"><!ENTITY nwnear "⤧"><!ENTITY nesear "⤨"><!ENTITY toea "⤨"><!ENTITY seswar "⤩"><!ENTITY tosa "⤩"><!ENTITY swnwar "⤪"><!ENTITY rarrc "⤳"><!ENTITY nrarrc "⤳̸"><!ENTITY cudarrr "⤵"><!ENTITY ldca "⤶"><!ENTITY rdca "⤷"><!ENTITY cudarrl "⤸"><!ENTITY larrpl "⤹"><!ENTITY curarrm "⤼"><!ENTITY cularrp "⤽"><!ENTITY rarrpl "⥅"><!ENTITY harrcir "⥈"><!ENTITY Uarrocir "⥉"><!ENTITY lurdshar "⥊"><!ENTITY ldrushar "⥋"><!ENTITY LeftRightVector "⥎"><!ENTITY RightUpDownVector "⥏"><!ENTITY DownLeftRightVector "⥐"><!ENTITY LeftUpDownVector "⥑"><!ENTITY LeftVectorBar "⥒"><!ENTITY RightVectorBar "⥓"><!ENTITY RightUpVectorBar "⥔"><!ENTITY RightDownVectorBar "⥕"><!ENTITY DownLeftVectorBar "⥖"><!ENTITY DownRightVectorBar "⥗"><!ENTITY LeftUpVectorBar "⥘"><!ENTITY LeftDownVectorBar "⥙"><!ENTITY LeftTeeVector "⥚"><!ENTITY RightTeeVector "⥛"><!ENTITY RightUpTeeVector "⥜"><!ENTITY RightDownTeeVector "⥝"><!ENTITY DownLeftTeeVector "⥞"><!ENTITY DownRightTeeVector "⥟"><!ENTITY LeftUpTeeVector "⥠"><!ENTITY LeftDownTeeVector "⥡"><!ENTITY lHar "⥢"><!ENTITY uHar "⥣"><!ENTITY rHar "⥤"><!ENTITY dHar "⥥"><!ENTITY luruhar "⥦"><!ENTITY ldrdhar "⥧"><!ENTITY ruluhar "⥨"><!ENTITY rdldhar "⥩"><!ENTITY lharul "⥪"><!ENTITY llhard "⥫"><!ENTITY rharul "⥬"><!ENTITY lrhard "⥭"><!ENTITY udhar "⥮"><!ENTITY UpEquilibrium "⥮"><!ENTITY duhar "⥯"><!ENTITY ReverseUpEquilibrium "⥯"><!ENTITY RoundImplies "⥰"><!ENTITY erarr "⥱"><!ENTITY simrarr "⥲"><!ENTITY larrsim "⥳"><!ENTITY rarrsim "⥴"><!ENTITY rarrap "⥵"><!ENTITY ltlarr "⥶"><!ENTITY gtrarr "⥸"><!ENTITY subrarr "⥹"><!ENTITY suplarr "⥻"><!ENTITY lfisht "⥼"><!ENTITY rfisht "⥽"><!ENTITY ufisht "⥾"><!ENTITY dfisht "⥿"><!ENTITY lopar "⦅"><!ENTITY ropar "⦆"><!ENTITY lbrke "⦋"><!ENTITY rbrke "⦌"><!ENTITY lbrkslu "⦍"><!ENTITY rbrksld "⦎"><!ENTITY lbrksld "⦏"><!ENTITY rbrkslu "⦐"><!ENTITY langd "⦑"><!ENTITY rangd "⦒"><!ENTITY lparlt "⦓"><!ENTITY rpargt "⦔"><!ENTITY gtlPar "⦕"><!ENTITY ltrPar "⦖"><!ENTITY vzigzag "⦚"><!ENTITY vangrt "⦜"><!ENTITY angrtvbd "⦝"><!ENTITY ange "⦤"><!ENTITY range "⦥"><!ENTITY dwangle "⦦"><!ENTITY uwangle "⦧"><!ENTITY angmsdaa "⦨"><!ENTITY angmsdab "⦩"><!ENTITY angmsdac "⦪"><!ENTITY angmsdad "⦫"><!ENTITY angmsdae "⦬"><!ENTITY angmsdaf "⦭"><!ENTITY angmsdag "⦮"><!ENTITY angmsdah "⦯"><!ENTITY bemptyv "⦰"><!ENTITY demptyv "⦱"><!ENTITY cemptyv "⦲"><!ENTITY raemptyv "⦳"><!ENTITY laemptyv "⦴"><!ENTITY ohbar "⦵"><!ENTITY omid "⦶"><!ENTITY opar "⦷"><!ENTITY operp "⦹"><!ENTITY olcross "⦻"><!ENTITY odsold "⦼"><!ENTITY olcir "⦾"><!ENTITY ofcir "⦿"><!ENTITY olt "⧀"><!ENTITY ogt "⧁"><!ENTITY cirscir "⧂"><!ENTITY cirE "⧃"><!ENTITY solb "⧄"><!ENTITY bsolb "⧅"><!ENTITY boxbox "⧉"><!ENTITY trisb "⧍"><!ENTITY rtriltri "⧎"><!ENTITY LeftTriangleBar "⧏"><!ENTITY NotLeftTriangleBar "⧏̸"><!ENTITY RightTriangleBar "⧐"><!ENTITY NotRightTriangleBar "⧐̸"><!ENTITY iinfin "⧜"><!ENTITY infintie "⧝"><!ENTITY nvinfin "⧞"><!ENTITY eparsl "⧣"><!ENTITY smeparsl "⧤"><!ENTITY eqvparsl "⧥"><!ENTITY lozf "⧫"><!ENTITY blacklozenge "⧫"><!ENTITY RuleDelayed "⧴"><!ENTITY dsol "⧶"><!ENTITY xodot "⨀"><!ENTITY bigodot "⨀"><!ENTITY xoplus "⨁"><!ENTITY bigoplus "⨁"><!ENTITY xotime "⨂"><!ENTITY bigotimes "⨂"><!ENTITY xuplus "⨄"><!ENTITY biguplus "⨄"><!ENTITY xsqcup "⨆"><!ENTITY bigsqcup "⨆"><!ENTITY qint "⨌"><!ENTITY iiiint "⨌"><!ENTITY fpartint "⨍"><!ENTITY cirfnint "⨐"><!ENTITY awint "⨑"><!ENTITY rppolint "⨒"><!ENTITY scpolint "⨓"><!ENTITY npolint "⨔"><!ENTITY pointint "⨕"><!ENTITY quatint "⨖"><!ENTITY intlarhk "⨗"><!ENTITY pluscir "⨢"><!ENTITY plusacir "⨣"><!ENTITY simplus "⨤"><!ENTITY plusdu "⨥"><!ENTITY plussim "⨦"><!ENTITY plustwo "⨧"><!ENTITY mcomma "⨩"><!ENTITY minusdu "⨪"><!ENTITY loplus "⨭"><!ENTITY roplus "⨮"><!ENTITY Cross "⨯"><!ENTITY timesd "⨰"><!ENTITY timesbar "⨱"><!ENTITY smashp "⨳"><!ENTITY lotimes "⨴"><!ENTITY rotimes "⨵"><!ENTITY otimesas "⨶"><!ENTITY Otimes "⨷"><!ENTITY odiv "⨸"><!ENTITY triplus "⨹"><!ENTITY triminus "⨺"><!ENTITY tritime "⨻"><!ENTITY iprod "⨼"><!ENTITY intprod "⨼"><!ENTITY amalg "⨿"><!ENTITY capdot "⩀"><!ENTITY ncup "⩂"><!ENTITY ncap "⩃"><!ENTITY capand "⩄"><!ENTITY cupor "⩅"><!ENTITY cupcap "⩆"><!ENTITY capcup "⩇"><!ENTITY cupbrcap "⩈"><!ENTITY capbrcup "⩉"><!ENTITY cupcup "⩊"><!ENTITY capcap "⩋"><!ENTITY ccups "⩌"><!ENTITY ccaps "⩍"><!ENTITY ccupssm "⩐"><!ENTITY And "⩓"><!ENTITY Or "⩔"><!ENTITY andand "⩕"><!ENTITY oror "⩖"><!ENTITY orslope "⩗"><!ENTITY andslope "⩘"><!ENTITY andv "⩚"><!ENTITY orv "⩛"><!ENTITY andd "⩜"><!ENTITY ord "⩝"><!ENTITY wedbar "⩟"><!ENTITY sdote "⩦"><!ENTITY simdot "⩪"><!ENTITY congdot "⩭"><!ENTITY ncongdot "⩭̸"><!ENTITY easter "⩮"><!ENTITY apacir "⩯"><!ENTITY apE "⩰"><!ENTITY napE "⩰̸"><!ENTITY eplus "⩱"><!ENTITY pluse "⩲"><!ENTITY Esim "⩳"><!ENTITY Colone "⩴"><!ENTITY Equal "⩵"><!ENTITY eDDot "⩷"><!ENTITY ddotseq "⩷"><!ENTITY equivDD "⩸"><!ENTITY ltcir "⩹"><!ENTITY gtcir "⩺"><!ENTITY ltquest "⩻"><!ENTITY gtquest "⩼"><!ENTITY les "⩽"><!ENTITY LessSlantEqual "⩽"><!ENTITY leqslant "⩽"><!ENTITY nles "⩽̸"><!ENTITY NotLessSlantEqual "⩽̸"><!ENTITY nleqslant "⩽̸"><!ENTITY ges "⩾"><!ENTITY GreaterSlantEqual "⩾"><!ENTITY geqslant "⩾"><!ENTITY nges "⩾̸"><!ENTITY NotGreaterSlantEqual "⩾̸"><!ENTITY ngeqslant "⩾̸"><!ENTITY lesdot "⩿"><!ENTITY gesdot "⪀"><!ENTITY lesdoto "⪁"><!ENTITY gesdoto "⪂"><!ENTITY lesdotor "⪃"><!ENTITY gesdotol "⪄"><!ENTITY lap "⪅"><!ENTITY lessapprox "⪅"><!ENTITY gap "⪆"><!ENTITY gtrapprox "⪆"><!ENTITY lne "⪇"><!ENTITY lneq "⪇"><!ENTITY gne "⪈"><!ENTITY gneq "⪈"><!ENTITY lnap "⪉"><!ENTITY lnapprox "⪉"><!ENTITY gnap "⪊"><!ENTITY gnapprox "⪊"><!ENTITY lEg "⪋"><!ENTITY lesseqqgtr "⪋"><!ENTITY gEl "⪌"><!ENTITY gtreqqless "⪌"><!ENTITY lsime "⪍"><!ENTITY gsime "⪎"><!ENTITY lsimg "⪏"><!ENTITY gsiml "⪐"><!ENTITY lgE "⪑"><!ENTITY glE "⪒"><!ENTITY lesges "⪓"><!ENTITY gesles "⪔"><!ENTITY els "⪕"><!ENTITY eqslantless "⪕"><!ENTITY egs "⪖"><!ENTITY eqslantgtr "⪖"><!ENTITY elsdot "⪗"><!ENTITY egsdot "⪘"><!ENTITY el "⪙"><!ENTITY eg "⪚"><!ENTITY siml "⪝"><!ENTITY simg "⪞"><!ENTITY simlE "⪟"><!ENTITY simgE "⪠"><!ENTITY LessLess "⪡"><!ENTITY NotNestedLessLess "⪡̸"><!ENTITY GreaterGreater "⪢"><!ENTITY NotNestedGreaterGreater "⪢̸"><!ENTITY glj "⪤"><!ENTITY gla "⪥"><!ENTITY ltcc "⪦"><!ENTITY gtcc "⪧"><!ENTITY lescc "⪨"><!ENTITY gescc "⪩"><!ENTITY smt "⪪"><!ENTITY lat "⪫"><!ENTITY smte "⪬"><!ENTITY smtes "⪬︀"><!ENTITY late "⪭"><!ENTITY lates "⪭︀"><!ENTITY bumpE "⪮"><!ENTITY pre "⪯"><!ENTITY preceq "⪯"><!ENTITY PrecedesEqual "⪯"><!ENTITY npre "⪯̸"><!ENTITY npreceq "⪯̸"><!ENTITY NotPrecedesEqual "⪯̸"><!ENTITY sce "⪰"><!ENTITY succeq "⪰"><!ENTITY SucceedsEqual "⪰"><!ENTITY nsce "⪰̸"><!ENTITY nsucceq "⪰̸"><!ENTITY NotSucceedsEqual "⪰̸"><!ENTITY prE "⪳"><!ENTITY scE "⪴"><!ENTITY prnE "⪵"><!ENTITY precneqq "⪵"><!ENTITY scnE "⪶"><!ENTITY succneqq "⪶"><!ENTITY prap "⪷"><!ENTITY precapprox "⪷"><!ENTITY scap "⪸"><!ENTITY succapprox "⪸"><!ENTITY prnap "⪹"><!ENTITY precnapprox "⪹"><!ENTITY scnap "⪺"><!ENTITY succnapprox "⪺"><!ENTITY Pr "⪻"><!ENTITY Sc "⪼"><!ENTITY subdot "⪽"><!ENTITY supdot "⪾"><!ENTITY subplus "⪿"><!ENTITY supplus "⫀"><!ENTITY submult "⫁"><!ENTITY supmult "⫂"><!ENTITY subedot "⫃"><!ENTITY supedot "⫄"><!ENTITY subE "⫅"><!ENTITY subseteqq "⫅"><!ENTITY nsubE "⫅̸"><!ENTITY nsubseteqq "⫅̸"><!ENTITY supE "⫆"><!ENTITY supseteqq "⫆"><!ENTITY nsupE "⫆̸"><!ENTITY nsupseteqq "⫆̸"><!ENTITY subsim "⫇"><!ENTITY supsim "⫈"><!ENTITY subnE "⫋"><!ENTITY subsetneqq "⫋"><!ENTITY vsubnE "⫋︀"><!ENTITY varsubsetneqq "⫋︀"><!ENTITY supnE "⫌"><!ENTITY supsetneqq "⫌"><!ENTITY vsupnE "⫌︀"><!ENTITY varsupsetneqq "⫌︀"><!ENTITY csub "⫏"><!ENTITY csup "⫐"><!ENTITY csube "⫑"><!ENTITY csupe "⫒"><!ENTITY subsup "⫓"><!ENTITY supsub "⫔"><!ENTITY subsub "⫕"><!ENTITY supsup "⫖"><!ENTITY suphsub "⫗"><!ENTITY supdsub "⫘"><!ENTITY forkv "⫙"><!ENTITY topfork "⫚"><!ENTITY mlcp "⫛"><!ENTITY Dashv "⫤"><!ENTITY DoubleLeftTee "⫤"><!ENTITY Vdashl "⫦"><!ENTITY Barv "⫧"><!ENTITY vBar "⫨"><!ENTITY vBarv "⫩"><!ENTITY Vbar "⫫"><!ENTITY Not "⫬"><!ENTITY bNot "⫭"><!ENTITY rnmid "⫮"><!ENTITY cirmid "⫯"><!ENTITY midcir "⫰"><!ENTITY topcir "⫱"><!ENTITY nhpar "⫲"><!ENTITY parsim "⫳"><!ENTITY parsl "⫽"><!ENTITY nparsl "⫽⃥"><!ENTITY fflig "ff"><!ENTITY filig "fi"><!ENTITY fllig "fl"><!ENTITY ffilig "ffi"><!ENTITY ffllig "ffl"><!ENTITY Ascr "𝒜"><!ENTITY Cscr "𝒞"><!ENTITY Dscr "𝒟"><!ENTITY Gscr "𝒢"><!ENTITY Jscr "𝒥"><!ENTITY Kscr "𝒦"><!ENTITY Nscr "𝒩"><!ENTITY Oscr "𝒪"><!ENTITY Pscr "𝒫"><!ENTITY Qscr "𝒬"><!ENTITY Sscr "𝒮"><!ENTITY Tscr "𝒯"><!ENTITY Uscr "𝒰"><!ENTITY Vscr "𝒱"><!ENTITY Wscr "𝒲"><!ENTITY Xscr "𝒳"><!ENTITY Yscr "𝒴"><!ENTITY Zscr "𝒵"><!ENTITY ascr "𝒶"><!ENTITY bscr "𝒷"><!ENTITY cscr "𝒸"><!ENTITY dscr "𝒹"><!ENTITY fscr "𝒻"><!ENTITY hscr "𝒽"><!ENTITY iscr "𝒾"><!ENTITY jscr "𝒿"><!ENTITY kscr "𝓀"><!ENTITY lscr "𝓁"><!ENTITY mscr "𝓂"><!ENTITY nscr "𝓃"><!ENTITY pscr "𝓅"><!ENTITY qscr "𝓆"><!ENTITY rscr "𝓇"><!ENTITY sscr "𝓈"><!ENTITY tscr "𝓉"><!ENTITY uscr "𝓊"><!ENTITY vscr "𝓋"><!ENTITY wscr "𝓌"><!ENTITY xscr "𝓍"><!ENTITY yscr "𝓎"><!ENTITY zscr "𝓏"><!ENTITY Afr "𝔄"><!ENTITY Bfr "𝔅"><!ENTITY Dfr "𝔇"><!ENTITY Efr "𝔈"><!ENTITY Ffr "𝔉"><!ENTITY Gfr "𝔊"><!ENTITY Jfr "𝔍"><!ENTITY Kfr "𝔎"><!ENTITY Lfr "𝔏"><!ENTITY Mfr "𝔐"><!ENTITY Nfr "𝔑"><!ENTITY Ofr "𝔒"><!ENTITY Pfr "𝔓"><!ENTITY Qfr "𝔔"><!ENTITY Sfr "𝔖"><!ENTITY Tfr "𝔗"><!ENTITY Ufr "𝔘"><!ENTITY Vfr "𝔙"><!ENTITY Wfr "𝔚"><!ENTITY Xfr "𝔛"><!ENTITY Yfr "𝔜"><!ENTITY afr "𝔞"><!ENTITY bfr "𝔟"><!ENTITY cfr "𝔠"><!ENTITY dfr "𝔡"><!ENTITY efr "𝔢"><!ENTITY ffr "𝔣"><!ENTITY gfr "𝔤"><!ENTITY hfr "𝔥"><!ENTITY ifr "𝔦"><!ENTITY jfr "𝔧"><!ENTITY kfr "𝔨"><!ENTITY lfr "𝔩"><!ENTITY mfr "𝔪"><!ENTITY nfr "𝔫"><!ENTITY ofr "𝔬"><!ENTITY pfr "𝔭"><!ENTITY qfr "𝔮"><!ENTITY rfr "𝔯"><!ENTITY sfr "𝔰"><!ENTITY tfr "𝔱"><!ENTITY ufr "𝔲"><!ENTITY vfr "𝔳"><!ENTITY wfr "𝔴"><!ENTITY xfr "𝔵"><!ENTITY yfr "𝔶"><!ENTITY zfr "𝔷"><!ENTITY Aopf "𝔸"><!ENTITY Bopf "𝔹"><!ENTITY Dopf "𝔻"><!ENTITY Eopf "𝔼"><!ENTITY Fopf "𝔽"><!ENTITY Gopf "𝔾"><!ENTITY Iopf "𝕀"><!ENTITY Jopf "𝕁"><!ENTITY Kopf "𝕂"><!ENTITY Lopf "𝕃"><!ENTITY Mopf "𝕄"><!ENTITY Oopf "𝕆"><!ENTITY Sopf "𝕊"><!ENTITY Topf "𝕋"><!ENTITY Uopf "𝕌"><!ENTITY Vopf "𝕍"><!ENTITY Wopf "𝕎"><!ENTITY Xopf "𝕏"><!ENTITY Yopf "𝕐"><!ENTITY aopf "𝕒"><!ENTITY bopf "𝕓"><!ENTITY copf "𝕔"><!ENTITY dopf "𝕕"><!ENTITY eopf "𝕖"><!ENTITY fopf "𝕗"><!ENTITY gopf "𝕘"><!ENTITY hopf "𝕙"><!ENTITY iopf "𝕚"><!ENTITY jopf "𝕛"><!ENTITY kopf "𝕜"><!ENTITY lopf "𝕝"><!ENTITY mopf "𝕞"><!ENTITY nopf "𝕟"><!ENTITY oopf "𝕠"><!ENTITY popf "𝕡"><!ENTITY qopf "𝕢"><!ENTITY ropf "𝕣"><!ENTITY sopf "𝕤"><!ENTITY topf "𝕥"><!ENTITY uopf "𝕦"><!ENTITY vopf "𝕧"><!ENTITY wopf "𝕨"><!ENTITY xopf "𝕩"><!ENTITY yopf "𝕪"><!ENTITY zopf "𝕫"> )xmlxmlxml"; } diff --git a/Userland/Libraries/LibX86/Instruction.cpp b/Userland/Libraries/LibX86/Instruction.cpp index 4907fd72a0..acc82b06c1 100644 --- a/Userland/Libraries/LibX86/Instruction.cpp +++ b/Userland/Libraries/LibX86/Instruction.cpp @@ -33,7 +33,7 @@ static bool opcode_has_register_index(u8 op) return false; } -static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed) +static void build(InstructionDescriptor* table, u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed) { InstructionDescriptor& d = table[op]; @@ -111,7 +111,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins case OP_NEAR_imm: d.imm1_bytes = CurrentAddressSize; break; - //default: + // default: case InvalidFormat: case MultibyteWithSlash: case InstructionPrefix: @@ -202,7 +202,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins } } -static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { InstructionDescriptor& d = table[op]; VERIFY(d.handler == nullptr); @@ -214,7 +214,7 @@ static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const cha build(d.slashes, slash, mnemonic, format, handler, lock_prefix_allowed); } -static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler handler) +static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, char const* mnemonic, InstructionFormat format, InstructionHandler handler) { VERIFY((rm & 0xc0) == 0xc0); VERIFY(((rm >> 3) & 7) == slash); @@ -235,79 +235,79 @@ static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, build(d.slashes, rm & 7, mnemonic, format, handler, LockPrefixNotAllowed); } -static void build_0f(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_0f(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_0f_table16, op, mnemonic, format, impl, lock_prefix_allowed); build(s_0f_table32, op, mnemonic, format, impl, lock_prefix_allowed); } -static void build(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_table16, op, mnemonic, format, impl, lock_prefix_allowed); build(s_table32, op, mnemonic, format, impl, lock_prefix_allowed); } -static void build(u8 op, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build(u8 op, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_table16, op, mnemonic, format16, impl16, lock_prefix_allowed); build(s_table32, op, mnemonic, format32, impl32, lock_prefix_allowed); } -static void build_0f(u8 op, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_0f(u8 op, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_0f_table16, op, mnemonic, format16, impl16, lock_prefix_allowed); build(s_0f_table32, op, mnemonic, format32, impl32, lock_prefix_allowed); } -static void build(u8 op, const char* mnemonic16, InstructionFormat format16, InstructionHandler impl16, const char* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build(u8 op, char const* mnemonic16, InstructionFormat format16, InstructionHandler impl16, char const* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_table16, op, mnemonic16, format16, impl16, lock_prefix_allowed); build(s_table32, op, mnemonic32, format32, impl32, lock_prefix_allowed); } -static void build_0f(u8 op, const char* mnemonic16, InstructionFormat format16, InstructionHandler impl16, const char* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_0f(u8 op, char const* mnemonic16, InstructionFormat format16, InstructionHandler impl16, char const* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build(s_0f_table16, op, mnemonic16, format16, impl16, lock_prefix_allowed); build(s_0f_table32, op, mnemonic32, format32, impl32, lock_prefix_allowed); } -static void build_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build_slash(s_table16, op, slash, mnemonic, format, impl, lock_prefix_allowed); build_slash(s_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed); } -static void build_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build_slash(s_table16, op, slash, mnemonic, format16, impl16, lock_prefix_allowed); build_slash(s_table32, op, slash, mnemonic, format32, impl32, lock_prefix_allowed); } -static void build_0f_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_0f_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build_slash(s_0f_table16, op, slash, mnemonic, format16, impl16, lock_prefix_allowed); build_slash(s_0f_table32, op, slash, mnemonic, format32, impl32, lock_prefix_allowed); } -static void build_0f_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_0f_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { build_slash(s_0f_table16, op, slash, mnemonic, format, impl, lock_prefix_allowed); build_slash(s_0f_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed); } -static void build_slash_rm(u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler impl) +static void build_slash_rm(u8 op, u8 slash, u8 rm, char const* mnemonic, InstructionFormat format, InstructionHandler impl) { build_slash_rm(s_table16, op, slash, rm, mnemonic, format, impl); build_slash_rm(s_table32, op, slash, rm, mnemonic, format, impl); } -static void build_slash_reg(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl) +static void build_slash_reg(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl) { for (int i = 0; i < 8; ++i) build_slash_rm(op, slash, 0xc0 | (slash << 3) | i, mnemonic, format, impl); } -static void build_sse_np(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_sse_np(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { if (s_0f_table32[op].format == InvalidFormat) { build_0f(op, mnemonic, format, impl, lock_prefix_allowed); @@ -321,7 +321,7 @@ static void build_sse_np(u8 op, const char* mnemonic, InstructionFormat format, build(s_sse_table_np, op, mnemonic, format, impl, lock_prefix_allowed); } -static void build_sse_66(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_sse_66(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { if (s_0f_table32[op].format != __SSE) build_0f(op, "__SSE_temp", __SSE, nullptr, lock_prefix_allowed); @@ -329,7 +329,7 @@ static void build_sse_66(u8 op, const char* mnemonic, InstructionFormat format, build(s_sse_table_66, op, mnemonic, format, impl, lock_prefix_allowed); } -static void build_sse_f3(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) +static void build_sse_f3(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed) { if (s_0f_table32[op].format != __SSE) build_0f(op, "__SSE_temp", __SSE, nullptr, lock_prefix_allowed); @@ -1086,44 +1086,44 @@ static void build_sse_f3(u8 op, const char* mnemonic, InstructionFormat format, build_0f(0xFF, "UD0", OP, &Interpreter::UD0); } -static const char* register_name(RegisterIndex8); -static const char* register_name(RegisterIndex16); -static const char* register_name(RegisterIndex32); -static const char* register_name(FpuRegisterIndex); -static const char* register_name(SegmentRegister); -static const char* register_name(MMXRegisterIndex); -static const char* register_name(XMMRegisterIndex); +static char const* register_name(RegisterIndex8); +static char const* register_name(RegisterIndex16); +static char const* register_name(RegisterIndex32); +static char const* register_name(FpuRegisterIndex); +static char const* register_name(SegmentRegister); +static char const* register_name(MMXRegisterIndex); +static char const* register_name(XMMRegisterIndex); -const char* Instruction::reg8_name() const +char const* Instruction::reg8_name() const { return register_name(static_cast<RegisterIndex8>(register_index())); } -const char* Instruction::reg16_name() const +char const* Instruction::reg16_name() const { return register_name(static_cast<RegisterIndex16>(register_index())); } -const char* Instruction::reg32_name() const +char const* Instruction::reg32_name() const { return register_name(static_cast<RegisterIndex32>(register_index())); } -String MemoryOrRegisterReference::to_string_o8(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_o8(Instruction const& insn) const { if (is_register()) return register_name(reg8()); return String::formatted("[{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_o16(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_o16(Instruction const& insn) const { if (is_register()) return register_name(reg16()); return String::formatted("[{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_o32(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_o32(Instruction const& insn) const { if (is_register()) return register_name(reg32()); @@ -1136,7 +1136,7 @@ String MemoryOrRegisterReference::to_string_fpu_reg() const return register_name(reg_fpu()); } -String MemoryOrRegisterReference::to_string_fpu_mem(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_fpu_mem(Instruction const& insn) const { VERIFY(!is_register()); return String::formatted("[{}]", to_string(insn)); @@ -1148,46 +1148,46 @@ String MemoryOrRegisterReference::to_string_fpu_ax16() const return register_name(reg16()); } -String MemoryOrRegisterReference::to_string_fpu16(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_fpu16(Instruction const& insn) const { if (is_register()) return register_name(reg_fpu()); return String::formatted("word ptr [{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_fpu32(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_fpu32(Instruction const& insn) const { if (is_register()) return register_name(reg_fpu()); return String::formatted("dword ptr [{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_fpu64(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_fpu64(Instruction const& insn) const { if (is_register()) return register_name(reg_fpu()); return String::formatted("qword ptr [{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_fpu80(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_fpu80(Instruction const& insn) const { VERIFY(!is_register()); return String::formatted("tbyte ptr [{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_mm(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_mm(Instruction const& insn) const { if (is_register()) return register_name(static_cast<MMXRegisterIndex>(m_register_index)); return String::formatted("[{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string_xmm(const Instruction& insn) const +String MemoryOrRegisterReference::to_string_xmm(Instruction const& insn) const { if (is_register()) return register_name(static_cast<XMMRegisterIndex>(m_register_index)); return String::formatted("[{}]", to_string(insn)); } -String MemoryOrRegisterReference::to_string(const Instruction& insn) const +String MemoryOrRegisterReference::to_string(Instruction const& insn) const { if (insn.a32()) return to_string_a32(); @@ -1407,7 +1407,7 @@ static String relative_address(u32 origin, bool x32, i32 imm) return String::formatted("{:#04x}", w + si); } -String Instruction::to_string(u32 origin, const SymbolProvider* symbol_provider, bool x32) const +String Instruction::to_string(u32 origin, SymbolProvider const* symbol_provider, bool x32) const { StringBuilder builder; if (has_segment_prefix()) @@ -1424,7 +1424,7 @@ String Instruction::to_string(u32 origin, const SymbolProvider* symbol_provider, return builder.to_string(); } -void Instruction::to_string_internal(StringBuilder& builder, u32 origin, const SymbolProvider* symbol_provider, bool x32) const +void Instruction::to_string_internal(StringBuilder& builder, u32 origin, SymbolProvider const* symbol_provider, bool x32) const { if (!m_descriptor) { builder.appendff("db {:02x}", m_op); @@ -2215,45 +2215,45 @@ String Instruction::mnemonic() const return m_descriptor->mnemonic; } -const char* register_name(SegmentRegister index) +char const* register_name(SegmentRegister index) { - static constexpr const char* names[] = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" }; + static constexpr char const* names[] = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" }; return names[(int)index & 7]; } -const char* register_name(RegisterIndex8 register_index) +char const* register_name(RegisterIndex8 register_index) { - static constexpr const char* names[] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" }; + static constexpr char const* names[] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" }; return names[register_index & 7]; } -const char* register_name(RegisterIndex16 register_index) +char const* register_name(RegisterIndex16 register_index) { - static constexpr const char* names[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" }; + static constexpr char const* names[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" }; return names[register_index & 7]; } -const char* register_name(RegisterIndex32 register_index) +char const* register_name(RegisterIndex32 register_index) { - static constexpr const char* names[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" }; + static constexpr char const* names[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" }; return names[register_index & 7]; } -const char* register_name(FpuRegisterIndex register_index) +char const* register_name(FpuRegisterIndex register_index) { - static constexpr const char* names[] = { "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" }; + static constexpr char const* names[] = { "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" }; return names[register_index & 7]; } -const char* register_name(MMXRegisterIndex register_index) +char const* register_name(MMXRegisterIndex register_index) { - static constexpr const char* names[] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" }; + static constexpr char const* names[] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" }; return names[register_index & 7]; } -const char* register_name(XMMRegisterIndex register_index) +char const* register_name(XMMRegisterIndex register_index) { - static constexpr const char* names[] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" }; + static constexpr char const* names[] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" }; return names[register_index & 7]; } diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h index 60a797091e..b70287d925 100644 --- a/Userland/Libraries/LibX86/Instruction.h +++ b/Userland/Libraries/LibX86/Instruction.h @@ -17,7 +17,7 @@ namespace X86 { class Instruction; class Interpreter; -typedef void (Interpreter::*InstructionHandler)(const Instruction&); +typedef void (Interpreter::*InstructionHandler)(Instruction const&); class SymbolProvider { public: @@ -194,7 +194,7 @@ static constexpr unsigned CurrentAddressSize = 0xB33FBABE; struct InstructionDescriptor { InstructionHandler handler { nullptr }; bool opcode_has_register_index { false }; - const char* mnemonic { nullptr }; + char const* mnemonic { nullptr }; InstructionFormat format { InvalidFormat }; bool has_rm { false }; unsigned imm1_bytes { 0 }; @@ -352,7 +352,7 @@ protected: class SimpleInstructionStream final : public InstructionStream { public: - SimpleInstructionStream(const u8* data, size_t size) + SimpleInstructionStream(u8 const* data, size_t size) : m_data(data) , m_size(size) { @@ -389,7 +389,7 @@ public: size_t offset() const { return m_offset; } private: - const u8* m_data { nullptr }; + u8 const* m_data { nullptr }; size_t m_offset { 0 }; size_t m_size { 0 }; }; @@ -398,18 +398,18 @@ class MemoryOrRegisterReference { friend class Instruction; public: - String to_string_o8(const Instruction&) const; - String to_string_o16(const Instruction&) const; - String to_string_o32(const Instruction&) const; + String to_string_o8(Instruction const&) const; + String to_string_o16(Instruction const&) const; + String to_string_o32(Instruction const&) const; String to_string_fpu_reg() const; - String to_string_fpu_mem(const Instruction&) const; + String to_string_fpu_mem(Instruction const&) const; String to_string_fpu_ax16() const; - String to_string_fpu16(const Instruction&) const; - String to_string_fpu32(const Instruction&) const; - String to_string_fpu64(const Instruction&) const; - String to_string_fpu80(const Instruction&) const; - String to_string_mm(const Instruction&) const; - String to_string_xmm(const Instruction&) const; + String to_string_fpu16(Instruction const&) const; + String to_string_fpu32(Instruction const&) const; + String to_string_fpu64(Instruction const&) const; + String to_string_fpu80(Instruction const&) const; + String to_string_mm(Instruction const&) const; + String to_string_xmm(Instruction const&) const; bool is_register() const { return m_register_index != 0x7f; } @@ -425,38 +425,38 @@ public: u8 rm() const { return m_rm_byte & 0b111; } template<typename CPU, typename T> - void write8(CPU&, const Instruction&, T); + void write8(CPU&, Instruction const&, T); template<typename CPU, typename T> - void write16(CPU&, const Instruction&, T); + void write16(CPU&, Instruction const&, T); template<typename CPU, typename T> - void write32(CPU&, const Instruction&, T); + void write32(CPU&, Instruction const&, T); template<typename CPU, typename T> - void write64(CPU&, const Instruction&, T); + void write64(CPU&, Instruction const&, T); template<typename CPU, typename T> - void write128(CPU&, const Instruction&, T); + void write128(CPU&, Instruction const&, T); template<typename CPU, typename T> - void write256(CPU&, const Instruction&, T); + void write256(CPU&, Instruction const&, T); template<typename CPU> - typename CPU::ValueWithShadowType8 read8(CPU&, const Instruction&); + typename CPU::ValueWithShadowType8 read8(CPU&, Instruction const&); template<typename CPU> - typename CPU::ValueWithShadowType16 read16(CPU&, const Instruction&); + typename CPU::ValueWithShadowType16 read16(CPU&, Instruction const&); template<typename CPU> - typename CPU::ValueWithShadowType32 read32(CPU&, const Instruction&); + typename CPU::ValueWithShadowType32 read32(CPU&, Instruction const&); template<typename CPU> - typename CPU::ValueWithShadowType64 read64(CPU&, const Instruction&); + typename CPU::ValueWithShadowType64 read64(CPU&, Instruction const&); template<typename CPU> - typename CPU::ValueWithShadowType128 read128(CPU&, const Instruction&); + typename CPU::ValueWithShadowType128 read128(CPU&, Instruction const&); template<typename CPU> - typename CPU::ValueWithShadowType256 read256(CPU&, const Instruction&); + typename CPU::ValueWithShadowType256 read256(CPU&, Instruction const&); template<typename CPU> - LogicalAddress resolve(const CPU&, const Instruction&); + LogicalAddress resolve(const CPU&, Instruction const&); private: MemoryOrRegisterReference() = default; - String to_string(const Instruction&) const; + String to_string(Instruction const&) const; String to_string_a16() const; String to_string_a32() const; @@ -550,17 +550,17 @@ public: bool a32() const { return m_a32; } - String to_string(u32 origin, const SymbolProvider* = nullptr, bool x32 = true) const; + String to_string(u32 origin, SymbolProvider const* = nullptr, bool x32 = true) const; private: template<typename InstructionStreamType> Instruction(InstructionStreamType&, bool o32, bool a32); - void to_string_internal(StringBuilder&, u32 origin, const SymbolProvider*, bool x32) const; + void to_string_internal(StringBuilder&, u32 origin, SymbolProvider const*, bool x32) const; - const char* reg8_name() const; - const char* reg16_name() const; - const char* reg32_name() const; + char const* reg8_name() const; + char const* reg16_name() const; + char const* reg32_name() const; InstructionDescriptor* m_descriptor { nullptr }; mutable MemoryOrRegisterReference m_modrm; @@ -697,7 +697,7 @@ ALWAYS_INLINE u32 MemoryOrRegisterReference::evaluate_sib(const CPU& cpu, Segmen } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, Instruction const& insn, T value) { if (is_register()) { cpu.gpr8(reg8()) = value; @@ -709,7 +709,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, const Instruction } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, Instruction const& insn, T value) { if (is_register()) { cpu.gpr16(reg16()) = value; @@ -721,7 +721,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, const Instructio } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, Instruction const& insn, T value) { if (is_register()) { cpu.gpr32(reg32()) = value; @@ -733,7 +733,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instructio } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, Instruction const& insn, T value) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -741,7 +741,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instructio } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, Instruction const& insn, T value) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -749,7 +749,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, const Instructi } template<typename CPU, typename T> -ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, const Instruction& insn, T value) +ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, Instruction const& insn, T value) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -757,7 +757,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, const Instructi } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read8(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read8(CPU& cpu, Instruction const& insn) { if (is_register()) return cpu.const_gpr8(reg8()); @@ -767,7 +767,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::read16(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::read16(CPU& cpu, Instruction const& insn) { if (is_register()) return cpu.const_gpr16(reg16()); @@ -777,7 +777,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::rea } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::read32(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::read32(CPU& cpu, Instruction const& insn) { if (is_register()) return cpu.const_gpr32(reg32()); @@ -787,7 +787,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::rea } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, Instruction const& insn) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -795,7 +795,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::rea } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::read128(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::read128(CPU& cpu, Instruction const& insn) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -803,7 +803,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::re } template<typename CPU> -ALWAYS_INLINE typename CPU::ValueWithShadowType256 MemoryOrRegisterReference::read256(CPU& cpu, const Instruction& insn) +ALWAYS_INLINE typename CPU::ValueWithShadowType256 MemoryOrRegisterReference::read256(CPU& cpu, Instruction const& insn) { VERIFY(!is_register()); auto address = resolve(cpu, insn); @@ -1085,7 +1085,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode32(InstructionStreamType& st } template<typename CPU> -ALWAYS_INLINE LogicalAddress MemoryOrRegisterReference::resolve(const CPU& cpu, const Instruction& insn) +ALWAYS_INLINE LogicalAddress MemoryOrRegisterReference::resolve(const CPU& cpu, Instruction const& insn) { if (insn.a32()) return resolve32(cpu, insn.segment_prefix()); diff --git a/Userland/Libraries/LibX86/Interpreter.h b/Userland/Libraries/LibX86/Interpreter.h index aee9093500..d8fa0623a2 100644 --- a/Userland/Libraries/LibX86/Interpreter.h +++ b/Userland/Libraries/LibX86/Interpreter.h @@ -14,648 +14,648 @@ class Instruction; class Interpreter { public: - virtual void AAA(const Instruction&) = 0; - virtual void AAD(const Instruction&) = 0; - virtual void AAM(const Instruction&) = 0; - virtual void AAS(const Instruction&) = 0; - virtual void ADC_AL_imm8(const Instruction&) = 0; - virtual void ADC_AX_imm16(const Instruction&) = 0; - virtual void ADC_EAX_imm32(const Instruction&) = 0; - virtual void ADC_RM16_imm16(const Instruction&) = 0; - virtual void ADC_RM16_imm8(const Instruction&) = 0; - virtual void ADC_RM16_reg16(const Instruction&) = 0; - virtual void ADC_RM32_imm32(const Instruction&) = 0; - virtual void ADC_RM32_imm8(const Instruction&) = 0; - virtual void ADC_RM32_reg32(const Instruction&) = 0; - virtual void ADC_RM8_imm8(const Instruction&) = 0; - virtual void ADC_RM8_reg8(const Instruction&) = 0; - virtual void ADC_reg16_RM16(const Instruction&) = 0; - virtual void ADC_reg32_RM32(const Instruction&) = 0; - virtual void ADC_reg8_RM8(const Instruction&) = 0; - virtual void ADD_AL_imm8(const Instruction&) = 0; - virtual void ADD_AX_imm16(const Instruction&) = 0; - virtual void ADD_EAX_imm32(const Instruction&) = 0; - virtual void ADD_RM16_imm16(const Instruction&) = 0; - virtual void ADD_RM16_imm8(const Instruction&) = 0; - virtual void ADD_RM16_reg16(const Instruction&) = 0; - virtual void ADD_RM32_imm32(const Instruction&) = 0; - virtual void ADD_RM32_imm8(const Instruction&) = 0; - virtual void ADD_RM32_reg32(const Instruction&) = 0; - virtual void ADD_RM8_imm8(const Instruction&) = 0; - virtual void ADD_RM8_reg8(const Instruction&) = 0; - virtual void ADD_reg16_RM16(const Instruction&) = 0; - virtual void ADD_reg32_RM32(const Instruction&) = 0; - virtual void ADD_reg8_RM8(const Instruction&) = 0; - virtual void AND_AL_imm8(const Instruction&) = 0; - virtual void AND_AX_imm16(const Instruction&) = 0; - virtual void AND_EAX_imm32(const Instruction&) = 0; - virtual void AND_RM16_imm16(const Instruction&) = 0; - virtual void AND_RM16_imm8(const Instruction&) = 0; - virtual void AND_RM16_reg16(const Instruction&) = 0; - virtual void AND_RM32_imm32(const Instruction&) = 0; - virtual void AND_RM32_imm8(const Instruction&) = 0; - virtual void AND_RM32_reg32(const Instruction&) = 0; - virtual void AND_RM8_imm8(const Instruction&) = 0; - virtual void AND_RM8_reg8(const Instruction&) = 0; - virtual void AND_reg16_RM16(const Instruction&) = 0; - virtual void AND_reg32_RM32(const Instruction&) = 0; - virtual void AND_reg8_RM8(const Instruction&) = 0; - virtual void ARPL(const Instruction&) = 0; - virtual void BOUND(const Instruction&) = 0; - virtual void BSF_reg16_RM16(const Instruction&) = 0; - virtual void BSF_reg32_RM32(const Instruction&) = 0; - virtual void BSR_reg16_RM16(const Instruction&) = 0; - virtual void BSR_reg32_RM32(const Instruction&) = 0; - virtual void BSWAP_reg32(const Instruction&) = 0; - virtual void BTC_RM16_imm8(const Instruction&) = 0; - virtual void BTC_RM16_reg16(const Instruction&) = 0; - virtual void BTC_RM32_imm8(const Instruction&) = 0; - virtual void BTC_RM32_reg32(const Instruction&) = 0; - virtual void BTR_RM16_imm8(const Instruction&) = 0; - virtual void BTR_RM16_reg16(const Instruction&) = 0; - virtual void BTR_RM32_imm8(const Instruction&) = 0; - virtual void BTR_RM32_reg32(const Instruction&) = 0; - virtual void BTS_RM16_imm8(const Instruction&) = 0; - virtual void BTS_RM16_reg16(const Instruction&) = 0; - virtual void BTS_RM32_imm8(const Instruction&) = 0; - virtual void BTS_RM32_reg32(const Instruction&) = 0; - virtual void BT_RM16_imm8(const Instruction&) = 0; - virtual void BT_RM16_reg16(const Instruction&) = 0; - virtual void BT_RM32_imm8(const Instruction&) = 0; - virtual void BT_RM32_reg32(const Instruction&) = 0; - virtual void CALL_FAR_mem16(const Instruction&) = 0; - virtual void CALL_FAR_mem32(const Instruction&) = 0; - virtual void CALL_RM16(const Instruction&) = 0; - virtual void CALL_RM32(const Instruction&) = 0; - virtual void CALL_imm16(const Instruction&) = 0; - virtual void CALL_imm16_imm16(const Instruction&) = 0; - virtual void CALL_imm16_imm32(const Instruction&) = 0; - virtual void CALL_imm32(const Instruction&) = 0; - virtual void CBW(const Instruction&) = 0; - virtual void CDQ(const Instruction&) = 0; - virtual void CLC(const Instruction&) = 0; - virtual void CLD(const Instruction&) = 0; - virtual void CLI(const Instruction&) = 0; - virtual void CLTS(const Instruction&) = 0; - virtual void CMC(const Instruction&) = 0; - virtual void CMOVcc_reg16_RM16(const Instruction&) = 0; - virtual void CMOVcc_reg32_RM32(const Instruction&) = 0; - virtual void CMPSB(const Instruction&) = 0; - virtual void CMPSD(const Instruction&) = 0; - virtual void CMPSW(const Instruction&) = 0; - virtual void CMPXCHG_RM16_reg16(const Instruction&) = 0; - virtual void CMPXCHG_RM32_reg32(const Instruction&) = 0; - virtual void CMPXCHG_RM8_reg8(const Instruction&) = 0; - virtual void CMP_AL_imm8(const Instruction&) = 0; - virtual void CMP_AX_imm16(const Instruction&) = 0; - virtual void CMP_EAX_imm32(const Instruction&) = 0; - virtual void CMP_RM16_imm16(const Instruction&) = 0; - virtual void CMP_RM16_imm8(const Instruction&) = 0; - virtual void CMP_RM16_reg16(const Instruction&) = 0; - virtual void CMP_RM32_imm32(const Instruction&) = 0; - virtual void CMP_RM32_imm8(const Instruction&) = 0; - virtual void CMP_RM32_reg32(const Instruction&) = 0; - virtual void CMP_RM8_imm8(const Instruction&) = 0; - virtual void CMP_RM8_reg8(const Instruction&) = 0; - virtual void CMP_reg16_RM16(const Instruction&) = 0; - virtual void CMP_reg32_RM32(const Instruction&) = 0; - virtual void CMP_reg8_RM8(const Instruction&) = 0; - virtual void CPUID(const Instruction&) = 0; - virtual void CWD(const Instruction&) = 0; - virtual void CWDE(const Instruction&) = 0; - virtual void DAA(const Instruction&) = 0; - virtual void DAS(const Instruction&) = 0; - virtual void DEC_RM16(const Instruction&) = 0; - virtual void DEC_RM32(const Instruction&) = 0; - virtual void DEC_RM8(const Instruction&) = 0; - virtual void DEC_reg16(const Instruction&) = 0; - virtual void DEC_reg32(const Instruction&) = 0; - virtual void DIV_RM16(const Instruction&) = 0; - virtual void DIV_RM32(const Instruction&) = 0; - virtual void DIV_RM8(const Instruction&) = 0; - virtual void ENTER16(const Instruction&) = 0; - virtual void ENTER32(const Instruction&) = 0; - virtual void ESCAPE(const Instruction&) = 0; - virtual void FADD_RM32(const Instruction&) = 0; - virtual void FMUL_RM32(const Instruction&) = 0; - virtual void FCOM_RM32(const Instruction&) = 0; - virtual void FCOMP_RM32(const Instruction&) = 0; - virtual void FSUB_RM32(const Instruction&) = 0; - virtual void FSUBR_RM32(const Instruction&) = 0; - virtual void FDIV_RM32(const Instruction&) = 0; - virtual void FDIVR_RM32(const Instruction&) = 0; - virtual void FLD_RM32(const Instruction&) = 0; - virtual void FXCH(const Instruction&) = 0; - virtual void FST_RM32(const Instruction&) = 0; - virtual void FNOP(const Instruction&) = 0; - virtual void FSTP_RM32(const Instruction&) = 0; - virtual void FLDENV(const Instruction&) = 0; - virtual void FCHS(const Instruction&) = 0; - virtual void FABS(const Instruction&) = 0; - virtual void FTST(const Instruction&) = 0; - virtual void FXAM(const Instruction&) = 0; - virtual void FLDCW(const Instruction&) = 0; - virtual void FLD1(const Instruction&) = 0; - virtual void FLDL2T(const Instruction&) = 0; - virtual void FLDL2E(const Instruction&) = 0; - virtual void FLDPI(const Instruction&) = 0; - virtual void FLDLG2(const Instruction&) = 0; - virtual void FLDLN2(const Instruction&) = 0; - virtual void FLDZ(const Instruction&) = 0; - virtual void FNSTENV(const Instruction&) = 0; - virtual void F2XM1(const Instruction&) = 0; - virtual void FYL2X(const Instruction&) = 0; - virtual void FPTAN(const Instruction&) = 0; - virtual void FPATAN(const Instruction&) = 0; - virtual void FXTRACT(const Instruction&) = 0; - virtual void FPREM1(const Instruction&) = 0; - virtual void FDECSTP(const Instruction&) = 0; - virtual void FINCSTP(const Instruction&) = 0; - virtual void FNSTCW(const Instruction&) = 0; - virtual void FPREM(const Instruction&) = 0; - virtual void FYL2XP1(const Instruction&) = 0; - virtual void FSQRT(const Instruction&) = 0; - virtual void FSINCOS(const Instruction&) = 0; - virtual void FRNDINT(const Instruction&) = 0; - virtual void FSCALE(const Instruction&) = 0; - virtual void FSIN(const Instruction&) = 0; - virtual void FCOS(const Instruction&) = 0; - virtual void FIADD_RM32(const Instruction&) = 0; - virtual void FADDP(const Instruction&) = 0; - virtual void FIMUL_RM32(const Instruction&) = 0; - virtual void FCMOVE(const Instruction&) = 0; - virtual void FICOM_RM32(const Instruction&) = 0; - virtual void FCMOVBE(const Instruction&) = 0; - virtual void FICOMP_RM32(const Instruction&) = 0; - virtual void FCMOVU(const Instruction&) = 0; - virtual void FISUB_RM32(const Instruction&) = 0; - virtual void FISUBR_RM32(const Instruction&) = 0; - virtual void FUCOMPP(const Instruction&) = 0; - virtual void FIDIV_RM32(const Instruction&) = 0; - virtual void FIDIVR_RM32(const Instruction&) = 0; - virtual void FILD_RM32(const Instruction&) = 0; - virtual void FCMOVNB(const Instruction&) = 0; - virtual void FISTTP_RM32(const Instruction&) = 0; - virtual void FCMOVNE(const Instruction&) = 0; - virtual void FIST_RM32(const Instruction&) = 0; - virtual void FCMOVNBE(const Instruction&) = 0; - virtual void FISTP_RM32(const Instruction&) = 0; - virtual void FCMOVNU(const Instruction&) = 0; - virtual void FNENI(const Instruction&) = 0; - virtual void FNDISI(const Instruction&) = 0; - virtual void FNCLEX(const Instruction&) = 0; - virtual void FNINIT(const Instruction&) = 0; - virtual void FNSETPM(const Instruction&) = 0; - virtual void FLD_RM80(const Instruction&) = 0; - virtual void FUCOMI(const Instruction&) = 0; - virtual void FCOMI(const Instruction&) = 0; - virtual void FSTP_RM80(const Instruction&) = 0; - virtual void FADD_RM64(const Instruction&) = 0; - virtual void FMUL_RM64(const Instruction&) = 0; - virtual void FCOM_RM64(const Instruction&) = 0; - virtual void FCOMP_RM64(const Instruction&) = 0; - virtual void FSUB_RM64(const Instruction&) = 0; - virtual void FSUBR_RM64(const Instruction&) = 0; - virtual void FDIV_RM64(const Instruction&) = 0; - virtual void FDIVR_RM64(const Instruction&) = 0; - virtual void FLD_RM64(const Instruction&) = 0; - virtual void FFREE(const Instruction&) = 0; - virtual void FISTTP_RM64(const Instruction&) = 0; - virtual void FST_RM64(const Instruction&) = 0; - virtual void FSTP_RM64(const Instruction&) = 0; - virtual void FRSTOR(const Instruction&) = 0; - virtual void FUCOM(const Instruction&) = 0; - virtual void FUCOMP(const Instruction&) = 0; - virtual void FNSAVE(const Instruction&) = 0; - virtual void FNSTSW(const Instruction&) = 0; - virtual void FIADD_RM16(const Instruction&) = 0; - virtual void FCMOVB(const Instruction&) = 0; - virtual void FIMUL_RM16(const Instruction&) = 0; - virtual void FMULP(const Instruction&) = 0; - virtual void FICOM_RM16(const Instruction&) = 0; - virtual void FICOMP_RM16(const Instruction&) = 0; - virtual void FCOMPP(const Instruction&) = 0; - virtual void FISUB_RM16(const Instruction&) = 0; - virtual void FSUBRP(const Instruction&) = 0; - virtual void FISUBR_RM16(const Instruction&) = 0; - virtual void FSUBP(const Instruction&) = 0; - virtual void FIDIV_RM16(const Instruction&) = 0; - virtual void FDIVRP(const Instruction&) = 0; - virtual void FIDIVR_RM16(const Instruction&) = 0; - virtual void FDIVP(const Instruction&) = 0; - virtual void FILD_RM16(const Instruction&) = 0; - virtual void FFREEP(const Instruction&) = 0; - virtual void FISTTP_RM16(const Instruction&) = 0; - virtual void FIST_RM16(const Instruction&) = 0; - virtual void FISTP_RM16(const Instruction&) = 0; - virtual void FBLD_M80(const Instruction&) = 0; - virtual void FNSTSW_AX(const Instruction&) = 0; - virtual void FILD_RM64(const Instruction&) = 0; - virtual void FUCOMIP(const Instruction&) = 0; - virtual void FBSTP_M80(const Instruction&) = 0; - virtual void FCOMIP(const Instruction&) = 0; - virtual void FISTP_RM64(const Instruction&) = 0; - virtual void HLT(const Instruction&) = 0; - virtual void IDIV_RM16(const Instruction&) = 0; - virtual void IDIV_RM32(const Instruction&) = 0; - virtual void IDIV_RM8(const Instruction&) = 0; - virtual void IMUL_RM16(const Instruction&) = 0; - virtual void IMUL_RM32(const Instruction&) = 0; - virtual void IMUL_RM8(const Instruction&) = 0; - virtual void IMUL_reg16_RM16(const Instruction&) = 0; - virtual void IMUL_reg16_RM16_imm16(const Instruction&) = 0; - virtual void IMUL_reg16_RM16_imm8(const Instruction&) = 0; - virtual void IMUL_reg32_RM32(const Instruction&) = 0; - virtual void IMUL_reg32_RM32_imm32(const Instruction&) = 0; - virtual void IMUL_reg32_RM32_imm8(const Instruction&) = 0; - virtual void INC_RM16(const Instruction&) = 0; - virtual void INC_RM32(const Instruction&) = 0; - virtual void INC_RM8(const Instruction&) = 0; - virtual void INC_reg16(const Instruction&) = 0; - virtual void INC_reg32(const Instruction&) = 0; - virtual void INSB(const Instruction&) = 0; - virtual void INSD(const Instruction&) = 0; - virtual void INSW(const Instruction&) = 0; - virtual void INT1(const Instruction&) = 0; - virtual void INT3(const Instruction&) = 0; - virtual void INTO(const Instruction&) = 0; - virtual void INT_imm8(const Instruction&) = 0; - virtual void INVLPG(const Instruction&) = 0; - virtual void IN_AL_DX(const Instruction&) = 0; - virtual void IN_AL_imm8(const Instruction&) = 0; - virtual void IN_AX_DX(const Instruction&) = 0; - virtual void IN_AX_imm8(const Instruction&) = 0; - virtual void IN_EAX_DX(const Instruction&) = 0; - virtual void IN_EAX_imm8(const Instruction&) = 0; - virtual void IRET(const Instruction&) = 0; - virtual void JCXZ_imm8(const Instruction&) = 0; - virtual void JMP_FAR_mem16(const Instruction&) = 0; - virtual void JMP_FAR_mem32(const Instruction&) = 0; - virtual void JMP_RM16(const Instruction&) = 0; - virtual void JMP_RM32(const Instruction&) = 0; - virtual void JMP_imm16(const Instruction&) = 0; - virtual void JMP_imm16_imm16(const Instruction&) = 0; - virtual void JMP_imm16_imm32(const Instruction&) = 0; - virtual void JMP_imm32(const Instruction&) = 0; - virtual void JMP_short_imm8(const Instruction&) = 0; - virtual void Jcc_NEAR_imm(const Instruction&) = 0; - virtual void Jcc_imm8(const Instruction&) = 0; - virtual void LAHF(const Instruction&) = 0; - virtual void LAR_reg16_RM16(const Instruction&) = 0; - virtual void LAR_reg32_RM32(const Instruction&) = 0; - virtual void LDS_reg16_mem16(const Instruction&) = 0; - virtual void LDS_reg32_mem32(const Instruction&) = 0; - virtual void LEAVE16(const Instruction&) = 0; - virtual void LEAVE32(const Instruction&) = 0; - virtual void LEA_reg16_mem16(const Instruction&) = 0; - virtual void LEA_reg32_mem32(const Instruction&) = 0; - virtual void LES_reg16_mem16(const Instruction&) = 0; - virtual void LES_reg32_mem32(const Instruction&) = 0; - virtual void LFS_reg16_mem16(const Instruction&) = 0; - virtual void LFS_reg32_mem32(const Instruction&) = 0; - virtual void LGDT(const Instruction&) = 0; - virtual void LGS_reg16_mem16(const Instruction&) = 0; - virtual void LGS_reg32_mem32(const Instruction&) = 0; - virtual void LIDT(const Instruction&) = 0; - virtual void LLDT_RM16(const Instruction&) = 0; - virtual void LMSW_RM16(const Instruction&) = 0; - virtual void LODSB(const Instruction&) = 0; - virtual void LODSD(const Instruction&) = 0; - virtual void LODSW(const Instruction&) = 0; - virtual void LOOPNZ_imm8(const Instruction&) = 0; - virtual void LOOPZ_imm8(const Instruction&) = 0; - virtual void LOOP_imm8(const Instruction&) = 0; - virtual void LSL_reg16_RM16(const Instruction&) = 0; - virtual void LSL_reg32_RM32(const Instruction&) = 0; - virtual void LSS_reg16_mem16(const Instruction&) = 0; - virtual void LSS_reg32_mem32(const Instruction&) = 0; - virtual void LTR_RM16(const Instruction&) = 0; - virtual void MOVSB(const Instruction&) = 0; - virtual void MOVSD(const Instruction&) = 0; - virtual void MOVSW(const Instruction&) = 0; - virtual void MOVSX_reg16_RM8(const Instruction&) = 0; - virtual void MOVSX_reg32_RM16(const Instruction&) = 0; - virtual void MOVSX_reg32_RM8(const Instruction&) = 0; - virtual void MOVZX_reg16_RM8(const Instruction&) = 0; - virtual void MOVZX_reg32_RM16(const Instruction&) = 0; - virtual void MOVZX_reg32_RM8(const Instruction&) = 0; - virtual void MOV_AL_moff8(const Instruction&) = 0; - virtual void MOV_AX_moff16(const Instruction&) = 0; - virtual void MOV_CR_reg32(const Instruction&) = 0; - virtual void MOV_DR_reg32(const Instruction&) = 0; - virtual void MOV_EAX_moff32(const Instruction&) = 0; - virtual void MOV_RM16_imm16(const Instruction&) = 0; - virtual void MOV_RM16_reg16(const Instruction&) = 0; - virtual void MOV_RM16_seg(const Instruction&) = 0; - virtual void MOV_RM32_imm32(const Instruction&) = 0; - virtual void MOV_RM32_reg32(const Instruction&) = 0; - virtual void MOV_RM8_imm8(const Instruction&) = 0; - virtual void MOV_RM8_reg8(const Instruction&) = 0; - virtual void MOV_moff16_AX(const Instruction&) = 0; - virtual void MOV_moff32_EAX(const Instruction&) = 0; - virtual void MOV_moff8_AL(const Instruction&) = 0; - virtual void MOV_reg16_RM16(const Instruction&) = 0; - virtual void MOV_reg16_imm16(const Instruction&) = 0; - virtual void MOV_reg32_CR(const Instruction&) = 0; - virtual void MOV_reg32_DR(const Instruction&) = 0; - virtual void MOV_reg32_RM32(const Instruction&) = 0; - virtual void MOV_reg32_imm32(const Instruction&) = 0; - virtual void MOV_reg8_RM8(const Instruction&) = 0; - virtual void MOV_reg8_imm8(const Instruction&) = 0; - virtual void MOV_seg_RM16(const Instruction&) = 0; - virtual void MOV_seg_RM32(const Instruction&) = 0; - virtual void MUL_RM16(const Instruction&) = 0; - virtual void MUL_RM32(const Instruction&) = 0; - virtual void MUL_RM8(const Instruction&) = 0; - virtual void NEG_RM16(const Instruction&) = 0; - virtual void NEG_RM32(const Instruction&) = 0; - virtual void NEG_RM8(const Instruction&) = 0; - virtual void NOP(const Instruction&) = 0; - virtual void NOT_RM16(const Instruction&) = 0; - virtual void NOT_RM32(const Instruction&) = 0; - virtual void NOT_RM8(const Instruction&) = 0; - virtual void OR_AL_imm8(const Instruction&) = 0; - virtual void OR_AX_imm16(const Instruction&) = 0; - virtual void OR_EAX_imm32(const Instruction&) = 0; - virtual void OR_RM16_imm16(const Instruction&) = 0; - virtual void OR_RM16_imm8(const Instruction&) = 0; - virtual void OR_RM16_reg16(const Instruction&) = 0; - virtual void OR_RM32_imm32(const Instruction&) = 0; - virtual void OR_RM32_imm8(const Instruction&) = 0; - virtual void OR_RM32_reg32(const Instruction&) = 0; - virtual void OR_RM8_imm8(const Instruction&) = 0; - virtual void OR_RM8_reg8(const Instruction&) = 0; - virtual void OR_reg16_RM16(const Instruction&) = 0; - virtual void OR_reg32_RM32(const Instruction&) = 0; - virtual void OR_reg8_RM8(const Instruction&) = 0; - virtual void OUTSB(const Instruction&) = 0; - virtual void OUTSD(const Instruction&) = 0; - virtual void OUTSW(const Instruction&) = 0; - virtual void OUT_DX_AL(const Instruction&) = 0; - virtual void OUT_DX_AX(const Instruction&) = 0; - virtual void OUT_DX_EAX(const Instruction&) = 0; - virtual void OUT_imm8_AL(const Instruction&) = 0; - virtual void OUT_imm8_AX(const Instruction&) = 0; - virtual void OUT_imm8_EAX(const Instruction&) = 0; - virtual void PACKSSDW_mm1_mm2m64(const Instruction&) = 0; - virtual void PACKSSWB_mm1_mm2m64(const Instruction&) = 0; - virtual void PACKUSWB_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDB_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDW_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDD_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDSB_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDSW_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDUSB_mm1_mm2m64(const Instruction&) = 0; - virtual void PADDUSW_mm1_mm2m64(const Instruction&) = 0; - virtual void PAND_mm1_mm2m64(const Instruction&) = 0; - virtual void PANDN_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPEQB_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPEQW_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPEQD_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPGTB_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPGTW_mm1_mm2m64(const Instruction&) = 0; - virtual void PCMPGTD_mm1_mm2m64(const Instruction&) = 0; - virtual void PMADDWD_mm1_mm2m64(const Instruction&) = 0; - virtual void PMULHW_mm1_mm2m64(const Instruction&) = 0; - virtual void PMULLW_mm1_mm2m64(const Instruction&) = 0; - virtual void POPA(const Instruction&) = 0; - virtual void POPAD(const Instruction&) = 0; - virtual void POPF(const Instruction&) = 0; - virtual void POPFD(const Instruction&) = 0; - virtual void POP_DS(const Instruction&) = 0; - virtual void POP_ES(const Instruction&) = 0; - virtual void POP_FS(const Instruction&) = 0; - virtual void POP_GS(const Instruction&) = 0; - virtual void POP_RM16(const Instruction&) = 0; - virtual void POP_RM32(const Instruction&) = 0; - virtual void POP_SS(const Instruction&) = 0; - virtual void POP_reg16(const Instruction&) = 0; - virtual void POP_reg32(const Instruction&) = 0; - virtual void POR_mm1_mm2m64(const Instruction&) = 0; - virtual void PSLLW_mm1_mm2m64(const Instruction&) = 0; - virtual void PSLLW_mm1_imm8(const Instruction&) = 0; - virtual void PSLLD_mm1_mm2m64(const Instruction&) = 0; - virtual void PSLLD_mm1_imm8(const Instruction&) = 0; - virtual void PSLLQ_mm1_mm2m64(const Instruction&) = 0; - virtual void PSLLQ_mm1_imm8(const Instruction&) = 0; - virtual void PSRAW_mm1_mm2m64(const Instruction&) = 0; - virtual void PSRAW_mm1_imm8(const Instruction&) = 0; - virtual void PSRAD_mm1_mm2m64(const Instruction&) = 0; - virtual void PSRAD_mm1_imm8(const Instruction&) = 0; - virtual void PSRLW_mm1_mm2m64(const Instruction&) = 0; - virtual void PSRLW_mm1_imm8(const Instruction&) = 0; - virtual void PSRLD_mm1_mm2m64(const Instruction&) = 0; - virtual void PSRLD_mm1_imm8(const Instruction&) = 0; - virtual void PSRLQ_mm1_mm2m64(const Instruction&) = 0; - virtual void PSRLQ_mm1_imm8(const Instruction&) = 0; - virtual void PSUBB_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBW_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBD_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBSB_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBSW_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBUSB_mm1_mm2m64(const Instruction&) = 0; - virtual void PSUBUSW_mm1_mm2m64(const Instruction&) = 0; - virtual void PUNPCKHBW_mm1_mm2m64(const Instruction&) = 0; - virtual void PUNPCKHWD_mm1_mm2m64(const Instruction&) = 0; - virtual void PUNPCKHDQ_mm1_mm2m64(const Instruction&) = 0; - virtual void PUNPCKLBW_mm1_mm2m32(const Instruction&) = 0; - virtual void PUNPCKLWD_mm1_mm2m32(const Instruction&) = 0; - virtual void PUNPCKLDQ_mm1_mm2m32(const Instruction&) = 0; - virtual void PUSHA(const Instruction&) = 0; - virtual void PUSHAD(const Instruction&) = 0; - virtual void PUSHF(const Instruction&) = 0; - virtual void PUSHFD(const Instruction&) = 0; - virtual void PUSH_CS(const Instruction&) = 0; - virtual void PUSH_DS(const Instruction&) = 0; - virtual void PUSH_ES(const Instruction&) = 0; - virtual void PUSH_FS(const Instruction&) = 0; - virtual void PUSH_GS(const Instruction&) = 0; - virtual void PUSH_RM16(const Instruction&) = 0; - virtual void PUSH_RM32(const Instruction&) = 0; - virtual void PUSH_SP_8086_80186(const Instruction&) = 0; - virtual void PUSH_SS(const Instruction&) = 0; - virtual void PUSH_imm16(const Instruction&) = 0; - virtual void PUSH_imm32(const Instruction&) = 0; - virtual void PUSH_imm8(const Instruction&) = 0; - virtual void PUSH_reg16(const Instruction&) = 0; - virtual void PUSH_reg32(const Instruction&) = 0; - virtual void PXOR_mm1_mm2m64(const Instruction&) = 0; - virtual void RCL_RM16_1(const Instruction&) = 0; - virtual void RCL_RM16_CL(const Instruction&) = 0; - virtual void RCL_RM16_imm8(const Instruction&) = 0; - virtual void RCL_RM32_1(const Instruction&) = 0; - virtual void RCL_RM32_CL(const Instruction&) = 0; - virtual void RCL_RM32_imm8(const Instruction&) = 0; - virtual void RCL_RM8_1(const Instruction&) = 0; - virtual void RCL_RM8_CL(const Instruction&) = 0; - virtual void RCL_RM8_imm8(const Instruction&) = 0; - virtual void RCR_RM16_1(const Instruction&) = 0; - virtual void RCR_RM16_CL(const Instruction&) = 0; - virtual void RCR_RM16_imm8(const Instruction&) = 0; - virtual void RCR_RM32_1(const Instruction&) = 0; - virtual void RCR_RM32_CL(const Instruction&) = 0; - virtual void RCR_RM32_imm8(const Instruction&) = 0; - virtual void RCR_RM8_1(const Instruction&) = 0; - virtual void RCR_RM8_CL(const Instruction&) = 0; - virtual void RCR_RM8_imm8(const Instruction&) = 0; - virtual void RDTSC(const Instruction&) = 0; - virtual void RET(const Instruction&) = 0; - virtual void RETF(const Instruction&) = 0; - virtual void RETF_imm16(const Instruction&) = 0; - virtual void RET_imm16(const Instruction&) = 0; - virtual void ROL_RM16_1(const Instruction&) = 0; - virtual void ROL_RM16_CL(const Instruction&) = 0; - virtual void ROL_RM16_imm8(const Instruction&) = 0; - virtual void ROL_RM32_1(const Instruction&) = 0; - virtual void ROL_RM32_CL(const Instruction&) = 0; - virtual void ROL_RM32_imm8(const Instruction&) = 0; - virtual void ROL_RM8_1(const Instruction&) = 0; - virtual void ROL_RM8_CL(const Instruction&) = 0; - virtual void ROL_RM8_imm8(const Instruction&) = 0; - virtual void ROR_RM16_1(const Instruction&) = 0; - virtual void ROR_RM16_CL(const Instruction&) = 0; - virtual void ROR_RM16_imm8(const Instruction&) = 0; - virtual void ROR_RM32_1(const Instruction&) = 0; - virtual void ROR_RM32_CL(const Instruction&) = 0; - virtual void ROR_RM32_imm8(const Instruction&) = 0; - virtual void ROR_RM8_1(const Instruction&) = 0; - virtual void ROR_RM8_CL(const Instruction&) = 0; - virtual void ROR_RM8_imm8(const Instruction&) = 0; - virtual void SAHF(const Instruction&) = 0; - virtual void SALC(const Instruction&) = 0; - virtual void SAR_RM16_1(const Instruction&) = 0; - virtual void SAR_RM16_CL(const Instruction&) = 0; - virtual void SAR_RM16_imm8(const Instruction&) = 0; - virtual void SAR_RM32_1(const Instruction&) = 0; - virtual void SAR_RM32_CL(const Instruction&) = 0; - virtual void SAR_RM32_imm8(const Instruction&) = 0; - virtual void SAR_RM8_1(const Instruction&) = 0; - virtual void SAR_RM8_CL(const Instruction&) = 0; - virtual void SAR_RM8_imm8(const Instruction&) = 0; - virtual void SBB_AL_imm8(const Instruction&) = 0; - virtual void SBB_AX_imm16(const Instruction&) = 0; - virtual void SBB_EAX_imm32(const Instruction&) = 0; - virtual void SBB_RM16_imm16(const Instruction&) = 0; - virtual void SBB_RM16_imm8(const Instruction&) = 0; - virtual void SBB_RM16_reg16(const Instruction&) = 0; - virtual void SBB_RM32_imm32(const Instruction&) = 0; - virtual void SBB_RM32_imm8(const Instruction&) = 0; - virtual void SBB_RM32_reg32(const Instruction&) = 0; - virtual void SBB_RM8_imm8(const Instruction&) = 0; - virtual void SBB_RM8_reg8(const Instruction&) = 0; - virtual void SBB_reg16_RM16(const Instruction&) = 0; - virtual void SBB_reg32_RM32(const Instruction&) = 0; - virtual void SBB_reg8_RM8(const Instruction&) = 0; - virtual void SCASB(const Instruction&) = 0; - virtual void SCASD(const Instruction&) = 0; - virtual void SCASW(const Instruction&) = 0; - virtual void SETcc_RM8(const Instruction&) = 0; - virtual void SGDT(const Instruction&) = 0; - virtual void SHLD_RM16_reg16_CL(const Instruction&) = 0; - virtual void SHLD_RM16_reg16_imm8(const Instruction&) = 0; - virtual void SHLD_RM32_reg32_CL(const Instruction&) = 0; - virtual void SHLD_RM32_reg32_imm8(const Instruction&) = 0; - virtual void SHL_RM16_1(const Instruction&) = 0; - virtual void SHL_RM16_CL(const Instruction&) = 0; - virtual void SHL_RM16_imm8(const Instruction&) = 0; - virtual void SHL_RM32_1(const Instruction&) = 0; - virtual void SHL_RM32_CL(const Instruction&) = 0; - virtual void SHL_RM32_imm8(const Instruction&) = 0; - virtual void SHL_RM8_1(const Instruction&) = 0; - virtual void SHL_RM8_CL(const Instruction&) = 0; - virtual void SHL_RM8_imm8(const Instruction&) = 0; - virtual void SHRD_RM16_reg16_CL(const Instruction&) = 0; - virtual void SHRD_RM16_reg16_imm8(const Instruction&) = 0; - virtual void SHRD_RM32_reg32_CL(const Instruction&) = 0; - virtual void SHRD_RM32_reg32_imm8(const Instruction&) = 0; - virtual void SHR_RM16_1(const Instruction&) = 0; - virtual void SHR_RM16_CL(const Instruction&) = 0; - virtual void SHR_RM16_imm8(const Instruction&) = 0; - virtual void SHR_RM32_1(const Instruction&) = 0; - virtual void SHR_RM32_CL(const Instruction&) = 0; - virtual void SHR_RM32_imm8(const Instruction&) = 0; - virtual void SHR_RM8_1(const Instruction&) = 0; - virtual void SHR_RM8_CL(const Instruction&) = 0; - virtual void SHR_RM8_imm8(const Instruction&) = 0; - virtual void SIDT(const Instruction&) = 0; - virtual void SLDT_RM16(const Instruction&) = 0; - virtual void SMSW_RM16(const Instruction&) = 0; - virtual void STC(const Instruction&) = 0; - virtual void STD(const Instruction&) = 0; - virtual void STI(const Instruction&) = 0; - virtual void STOSB(const Instruction&) = 0; - virtual void STOSD(const Instruction&) = 0; - virtual void STOSW(const Instruction&) = 0; - virtual void STR_RM16(const Instruction&) = 0; - virtual void SUB_AL_imm8(const Instruction&) = 0; - virtual void SUB_AX_imm16(const Instruction&) = 0; - virtual void SUB_EAX_imm32(const Instruction&) = 0; - virtual void SUB_RM16_imm16(const Instruction&) = 0; - virtual void SUB_RM16_imm8(const Instruction&) = 0; - virtual void SUB_RM16_reg16(const Instruction&) = 0; - virtual void SUB_RM32_imm32(const Instruction&) = 0; - virtual void SUB_RM32_imm8(const Instruction&) = 0; - virtual void SUB_RM32_reg32(const Instruction&) = 0; - virtual void SUB_RM8_imm8(const Instruction&) = 0; - virtual void SUB_RM8_reg8(const Instruction&) = 0; - virtual void SUB_reg16_RM16(const Instruction&) = 0; - virtual void SUB_reg32_RM32(const Instruction&) = 0; - virtual void SUB_reg8_RM8(const Instruction&) = 0; - virtual void TEST_AL_imm8(const Instruction&) = 0; - virtual void TEST_AX_imm16(const Instruction&) = 0; - virtual void TEST_EAX_imm32(const Instruction&) = 0; - virtual void TEST_RM16_imm16(const Instruction&) = 0; - virtual void TEST_RM16_reg16(const Instruction&) = 0; - virtual void TEST_RM32_imm32(const Instruction&) = 0; - virtual void TEST_RM32_reg32(const Instruction&) = 0; - virtual void TEST_RM8_imm8(const Instruction&) = 0; - virtual void TEST_RM8_reg8(const Instruction&) = 0; - virtual void UD0(const Instruction&) = 0; - virtual void UD1(const Instruction&) = 0; - virtual void UD2(const Instruction&) = 0; - virtual void VERR_RM16(const Instruction&) = 0; - virtual void VERW_RM16(const Instruction&) = 0; - virtual void WAIT(const Instruction&) = 0; - virtual void WBINVD(const Instruction&) = 0; - virtual void XADD_RM16_reg16(const Instruction&) = 0; - virtual void XADD_RM32_reg32(const Instruction&) = 0; - virtual void XADD_RM8_reg8(const Instruction&) = 0; - virtual void XCHG_AX_reg16(const Instruction&) = 0; - virtual void XCHG_EAX_reg32(const Instruction&) = 0; - virtual void XCHG_reg16_RM16(const Instruction&) = 0; - virtual void XCHG_reg32_RM32(const Instruction&) = 0; - virtual void XCHG_reg8_RM8(const Instruction&) = 0; - virtual void XLAT(const Instruction&) = 0; - virtual void XOR_AL_imm8(const Instruction&) = 0; - virtual void XOR_AX_imm16(const Instruction&) = 0; - virtual void XOR_EAX_imm32(const Instruction&) = 0; - virtual void XOR_RM16_imm16(const Instruction&) = 0; - virtual void XOR_RM16_imm8(const Instruction&) = 0; - virtual void XOR_RM16_reg16(const Instruction&) = 0; - virtual void XOR_RM32_imm32(const Instruction&) = 0; - virtual void XOR_RM32_imm8(const Instruction&) = 0; - virtual void XOR_RM32_reg32(const Instruction&) = 0; - virtual void XOR_RM8_imm8(const Instruction&) = 0; - virtual void XOR_RM8_reg8(const Instruction&) = 0; - virtual void XOR_reg16_RM16(const Instruction&) = 0; - virtual void XOR_reg32_RM32(const Instruction&) = 0; - virtual void XOR_reg8_RM8(const Instruction&) = 0; - virtual void MOVQ_mm1_mm2m64(const Instruction&) = 0; - virtual void MOVQ_mm1m64_mm2(const Instruction&) = 0; - virtual void MOVD_mm1_rm32(const Instruction&) = 0; - virtual void MOVQ_mm1_rm64(const Instruction&) = 0; // long mode - virtual void MOVD_rm32_mm2(const Instruction&) = 0; - virtual void MOVQ_rm64_mm2(const Instruction&) = 0; // long mode - virtual void EMMS(const Instruction&) = 0; - virtual void wrap_0xC0(const Instruction&) = 0; - virtual void wrap_0xC1_16(const Instruction&) = 0; - virtual void wrap_0xC1_32(const Instruction&) = 0; - virtual void wrap_0xD0(const Instruction&) = 0; - virtual void wrap_0xD1_16(const Instruction&) = 0; - virtual void wrap_0xD1_32(const Instruction&) = 0; - virtual void wrap_0xD2(const Instruction&) = 0; - virtual void wrap_0xD3_16(const Instruction&) = 0; - virtual void wrap_0xD3_32(const Instruction&) = 0; + virtual void AAA(Instruction const&) = 0; + virtual void AAD(Instruction const&) = 0; + virtual void AAM(Instruction const&) = 0; + virtual void AAS(Instruction const&) = 0; + virtual void ADC_AL_imm8(Instruction const&) = 0; + virtual void ADC_AX_imm16(Instruction const&) = 0; + virtual void ADC_EAX_imm32(Instruction const&) = 0; + virtual void ADC_RM16_imm16(Instruction const&) = 0; + virtual void ADC_RM16_imm8(Instruction const&) = 0; + virtual void ADC_RM16_reg16(Instruction const&) = 0; + virtual void ADC_RM32_imm32(Instruction const&) = 0; + virtual void ADC_RM32_imm8(Instruction const&) = 0; + virtual void ADC_RM32_reg32(Instruction const&) = 0; + virtual void ADC_RM8_imm8(Instruction const&) = 0; + virtual void ADC_RM8_reg8(Instruction const&) = 0; + virtual void ADC_reg16_RM16(Instruction const&) = 0; + virtual void ADC_reg32_RM32(Instruction const&) = 0; + virtual void ADC_reg8_RM8(Instruction const&) = 0; + virtual void ADD_AL_imm8(Instruction const&) = 0; + virtual void ADD_AX_imm16(Instruction const&) = 0; + virtual void ADD_EAX_imm32(Instruction const&) = 0; + virtual void ADD_RM16_imm16(Instruction const&) = 0; + virtual void ADD_RM16_imm8(Instruction const&) = 0; + virtual void ADD_RM16_reg16(Instruction const&) = 0; + virtual void ADD_RM32_imm32(Instruction const&) = 0; + virtual void ADD_RM32_imm8(Instruction const&) = 0; + virtual void ADD_RM32_reg32(Instruction const&) = 0; + virtual void ADD_RM8_imm8(Instruction const&) = 0; + virtual void ADD_RM8_reg8(Instruction const&) = 0; + virtual void ADD_reg16_RM16(Instruction const&) = 0; + virtual void ADD_reg32_RM32(Instruction const&) = 0; + virtual void ADD_reg8_RM8(Instruction const&) = 0; + virtual void AND_AL_imm8(Instruction const&) = 0; + virtual void AND_AX_imm16(Instruction const&) = 0; + virtual void AND_EAX_imm32(Instruction const&) = 0; + virtual void AND_RM16_imm16(Instruction const&) = 0; + virtual void AND_RM16_imm8(Instruction const&) = 0; + virtual void AND_RM16_reg16(Instruction const&) = 0; + virtual void AND_RM32_imm32(Instruction const&) = 0; + virtual void AND_RM32_imm8(Instruction const&) = 0; + virtual void AND_RM32_reg32(Instruction const&) = 0; + virtual void AND_RM8_imm8(Instruction const&) = 0; + virtual void AND_RM8_reg8(Instruction const&) = 0; + virtual void AND_reg16_RM16(Instruction const&) = 0; + virtual void AND_reg32_RM32(Instruction const&) = 0; + virtual void AND_reg8_RM8(Instruction const&) = 0; + virtual void ARPL(Instruction const&) = 0; + virtual void BOUND(Instruction const&) = 0; + virtual void BSF_reg16_RM16(Instruction const&) = 0; + virtual void BSF_reg32_RM32(Instruction const&) = 0; + virtual void BSR_reg16_RM16(Instruction const&) = 0; + virtual void BSR_reg32_RM32(Instruction const&) = 0; + virtual void BSWAP_reg32(Instruction const&) = 0; + virtual void BTC_RM16_imm8(Instruction const&) = 0; + virtual void BTC_RM16_reg16(Instruction const&) = 0; + virtual void BTC_RM32_imm8(Instruction const&) = 0; + virtual void BTC_RM32_reg32(Instruction const&) = 0; + virtual void BTR_RM16_imm8(Instruction const&) = 0; + virtual void BTR_RM16_reg16(Instruction const&) = 0; + virtual void BTR_RM32_imm8(Instruction const&) = 0; + virtual void BTR_RM32_reg32(Instruction const&) = 0; + virtual void BTS_RM16_imm8(Instruction const&) = 0; + virtual void BTS_RM16_reg16(Instruction const&) = 0; + virtual void BTS_RM32_imm8(Instruction const&) = 0; + virtual void BTS_RM32_reg32(Instruction const&) = 0; + virtual void BT_RM16_imm8(Instruction const&) = 0; + virtual void BT_RM16_reg16(Instruction const&) = 0; + virtual void BT_RM32_imm8(Instruction const&) = 0; + virtual void BT_RM32_reg32(Instruction const&) = 0; + virtual void CALL_FAR_mem16(Instruction const&) = 0; + virtual void CALL_FAR_mem32(Instruction const&) = 0; + virtual void CALL_RM16(Instruction const&) = 0; + virtual void CALL_RM32(Instruction const&) = 0; + virtual void CALL_imm16(Instruction const&) = 0; + virtual void CALL_imm16_imm16(Instruction const&) = 0; + virtual void CALL_imm16_imm32(Instruction const&) = 0; + virtual void CALL_imm32(Instruction const&) = 0; + virtual void CBW(Instruction const&) = 0; + virtual void CDQ(Instruction const&) = 0; + virtual void CLC(Instruction const&) = 0; + virtual void CLD(Instruction const&) = 0; + virtual void CLI(Instruction const&) = 0; + virtual void CLTS(Instruction const&) = 0; + virtual void CMC(Instruction const&) = 0; + virtual void CMOVcc_reg16_RM16(Instruction const&) = 0; + virtual void CMOVcc_reg32_RM32(Instruction const&) = 0; + virtual void CMPSB(Instruction const&) = 0; + virtual void CMPSD(Instruction const&) = 0; + virtual void CMPSW(Instruction const&) = 0; + virtual void CMPXCHG_RM16_reg16(Instruction const&) = 0; + virtual void CMPXCHG_RM32_reg32(Instruction const&) = 0; + virtual void CMPXCHG_RM8_reg8(Instruction const&) = 0; + virtual void CMP_AL_imm8(Instruction const&) = 0; + virtual void CMP_AX_imm16(Instruction const&) = 0; + virtual void CMP_EAX_imm32(Instruction const&) = 0; + virtual void CMP_RM16_imm16(Instruction const&) = 0; + virtual void CMP_RM16_imm8(Instruction const&) = 0; + virtual void CMP_RM16_reg16(Instruction const&) = 0; + virtual void CMP_RM32_imm32(Instruction const&) = 0; + virtual void CMP_RM32_imm8(Instruction const&) = 0; + virtual void CMP_RM32_reg32(Instruction const&) = 0; + virtual void CMP_RM8_imm8(Instruction const&) = 0; + virtual void CMP_RM8_reg8(Instruction const&) = 0; + virtual void CMP_reg16_RM16(Instruction const&) = 0; + virtual void CMP_reg32_RM32(Instruction const&) = 0; + virtual void CMP_reg8_RM8(Instruction const&) = 0; + virtual void CPUID(Instruction const&) = 0; + virtual void CWD(Instruction const&) = 0; + virtual void CWDE(Instruction const&) = 0; + virtual void DAA(Instruction const&) = 0; + virtual void DAS(Instruction const&) = 0; + virtual void DEC_RM16(Instruction const&) = 0; + virtual void DEC_RM32(Instruction const&) = 0; + virtual void DEC_RM8(Instruction const&) = 0; + virtual void DEC_reg16(Instruction const&) = 0; + virtual void DEC_reg32(Instruction const&) = 0; + virtual void DIV_RM16(Instruction const&) = 0; + virtual void DIV_RM32(Instruction const&) = 0; + virtual void DIV_RM8(Instruction const&) = 0; + virtual void ENTER16(Instruction const&) = 0; + virtual void ENTER32(Instruction const&) = 0; + virtual void ESCAPE(Instruction const&) = 0; + virtual void FADD_RM32(Instruction const&) = 0; + virtual void FMUL_RM32(Instruction const&) = 0; + virtual void FCOM_RM32(Instruction const&) = 0; + virtual void FCOMP_RM32(Instruction const&) = 0; + virtual void FSUB_RM32(Instruction const&) = 0; + virtual void FSUBR_RM32(Instruction const&) = 0; + virtual void FDIV_RM32(Instruction const&) = 0; + virtual void FDIVR_RM32(Instruction const&) = 0; + virtual void FLD_RM32(Instruction const&) = 0; + virtual void FXCH(Instruction const&) = 0; + virtual void FST_RM32(Instruction const&) = 0; + virtual void FNOP(Instruction const&) = 0; + virtual void FSTP_RM32(Instruction const&) = 0; + virtual void FLDENV(Instruction const&) = 0; + virtual void FCHS(Instruction const&) = 0; + virtual void FABS(Instruction const&) = 0; + virtual void FTST(Instruction const&) = 0; + virtual void FXAM(Instruction const&) = 0; + virtual void FLDCW(Instruction const&) = 0; + virtual void FLD1(Instruction const&) = 0; + virtual void FLDL2T(Instruction const&) = 0; + virtual void FLDL2E(Instruction const&) = 0; + virtual void FLDPI(Instruction const&) = 0; + virtual void FLDLG2(Instruction const&) = 0; + virtual void FLDLN2(Instruction const&) = 0; + virtual void FLDZ(Instruction const&) = 0; + virtual void FNSTENV(Instruction const&) = 0; + virtual void F2XM1(Instruction const&) = 0; + virtual void FYL2X(Instruction const&) = 0; + virtual void FPTAN(Instruction const&) = 0; + virtual void FPATAN(Instruction const&) = 0; + virtual void FXTRACT(Instruction const&) = 0; + virtual void FPREM1(Instruction const&) = 0; + virtual void FDECSTP(Instruction const&) = 0; + virtual void FINCSTP(Instruction const&) = 0; + virtual void FNSTCW(Instruction const&) = 0; + virtual void FPREM(Instruction const&) = 0; + virtual void FYL2XP1(Instruction const&) = 0; + virtual void FSQRT(Instruction const&) = 0; + virtual void FSINCOS(Instruction const&) = 0; + virtual void FRNDINT(Instruction const&) = 0; + virtual void FSCALE(Instruction const&) = 0; + virtual void FSIN(Instruction const&) = 0; + virtual void FCOS(Instruction const&) = 0; + virtual void FIADD_RM32(Instruction const&) = 0; + virtual void FADDP(Instruction const&) = 0; + virtual void FIMUL_RM32(Instruction const&) = 0; + virtual void FCMOVE(Instruction const&) = 0; + virtual void FICOM_RM32(Instruction const&) = 0; + virtual void FCMOVBE(Instruction const&) = 0; + virtual void FICOMP_RM32(Instruction const&) = 0; + virtual void FCMOVU(Instruction const&) = 0; + virtual void FISUB_RM32(Instruction const&) = 0; + virtual void FISUBR_RM32(Instruction const&) = 0; + virtual void FUCOMPP(Instruction const&) = 0; + virtual void FIDIV_RM32(Instruction const&) = 0; + virtual void FIDIVR_RM32(Instruction const&) = 0; + virtual void FILD_RM32(Instruction const&) = 0; + virtual void FCMOVNB(Instruction const&) = 0; + virtual void FISTTP_RM32(Instruction const&) = 0; + virtual void FCMOVNE(Instruction const&) = 0; + virtual void FIST_RM32(Instruction const&) = 0; + virtual void FCMOVNBE(Instruction const&) = 0; + virtual void FISTP_RM32(Instruction const&) = 0; + virtual void FCMOVNU(Instruction const&) = 0; + virtual void FNENI(Instruction const&) = 0; + virtual void FNDISI(Instruction const&) = 0; + virtual void FNCLEX(Instruction const&) = 0; + virtual void FNINIT(Instruction const&) = 0; + virtual void FNSETPM(Instruction const&) = 0; + virtual void FLD_RM80(Instruction const&) = 0; + virtual void FUCOMI(Instruction const&) = 0; + virtual void FCOMI(Instruction const&) = 0; + virtual void FSTP_RM80(Instruction const&) = 0; + virtual void FADD_RM64(Instruction const&) = 0; + virtual void FMUL_RM64(Instruction const&) = 0; + virtual void FCOM_RM64(Instruction const&) = 0; + virtual void FCOMP_RM64(Instruction const&) = 0; + virtual void FSUB_RM64(Instruction const&) = 0; + virtual void FSUBR_RM64(Instruction const&) = 0; + virtual void FDIV_RM64(Instruction const&) = 0; + virtual void FDIVR_RM64(Instruction const&) = 0; + virtual void FLD_RM64(Instruction const&) = 0; + virtual void FFREE(Instruction const&) = 0; + virtual void FISTTP_RM64(Instruction const&) = 0; + virtual void FST_RM64(Instruction const&) = 0; + virtual void FSTP_RM64(Instruction const&) = 0; + virtual void FRSTOR(Instruction const&) = 0; + virtual void FUCOM(Instruction const&) = 0; + virtual void FUCOMP(Instruction const&) = 0; + virtual void FNSAVE(Instruction const&) = 0; + virtual void FNSTSW(Instruction const&) = 0; + virtual void FIADD_RM16(Instruction const&) = 0; + virtual void FCMOVB(Instruction const&) = 0; + virtual void FIMUL_RM16(Instruction const&) = 0; + virtual void FMULP(Instruction const&) = 0; + virtual void FICOM_RM16(Instruction const&) = 0; + virtual void FICOMP_RM16(Instruction const&) = 0; + virtual void FCOMPP(Instruction const&) = 0; + virtual void FISUB_RM16(Instruction const&) = 0; + virtual void FSUBRP(Instruction const&) = 0; + virtual void FISUBR_RM16(Instruction const&) = 0; + virtual void FSUBP(Instruction const&) = 0; + virtual void FIDIV_RM16(Instruction const&) = 0; + virtual void FDIVRP(Instruction const&) = 0; + virtual void FIDIVR_RM16(Instruction const&) = 0; + virtual void FDIVP(Instruction const&) = 0; + virtual void FILD_RM16(Instruction const&) = 0; + virtual void FFREEP(Instruction const&) = 0; + virtual void FISTTP_RM16(Instruction const&) = 0; + virtual void FIST_RM16(Instruction const&) = 0; + virtual void FISTP_RM16(Instruction const&) = 0; + virtual void FBLD_M80(Instruction const&) = 0; + virtual void FNSTSW_AX(Instruction const&) = 0; + virtual void FILD_RM64(Instruction const&) = 0; + virtual void FUCOMIP(Instruction const&) = 0; + virtual void FBSTP_M80(Instruction const&) = 0; + virtual void FCOMIP(Instruction const&) = 0; + virtual void FISTP_RM64(Instruction const&) = 0; + virtual void HLT(Instruction const&) = 0; + virtual void IDIV_RM16(Instruction const&) = 0; + virtual void IDIV_RM32(Instruction const&) = 0; + virtual void IDIV_RM8(Instruction const&) = 0; + virtual void IMUL_RM16(Instruction const&) = 0; + virtual void IMUL_RM32(Instruction const&) = 0; + virtual void IMUL_RM8(Instruction const&) = 0; + virtual void IMUL_reg16_RM16(Instruction const&) = 0; + virtual void IMUL_reg16_RM16_imm16(Instruction const&) = 0; + virtual void IMUL_reg16_RM16_imm8(Instruction const&) = 0; + virtual void IMUL_reg32_RM32(Instruction const&) = 0; + virtual void IMUL_reg32_RM32_imm32(Instruction const&) = 0; + virtual void IMUL_reg32_RM32_imm8(Instruction const&) = 0; + virtual void INC_RM16(Instruction const&) = 0; + virtual void INC_RM32(Instruction const&) = 0; + virtual void INC_RM8(Instruction const&) = 0; + virtual void INC_reg16(Instruction const&) = 0; + virtual void INC_reg32(Instruction const&) = 0; + virtual void INSB(Instruction const&) = 0; + virtual void INSD(Instruction const&) = 0; + virtual void INSW(Instruction const&) = 0; + virtual void INT1(Instruction const&) = 0; + virtual void INT3(Instruction const&) = 0; + virtual void INTO(Instruction const&) = 0; + virtual void INT_imm8(Instruction const&) = 0; + virtual void INVLPG(Instruction const&) = 0; + virtual void IN_AL_DX(Instruction const&) = 0; + virtual void IN_AL_imm8(Instruction const&) = 0; + virtual void IN_AX_DX(Instruction const&) = 0; + virtual void IN_AX_imm8(Instruction const&) = 0; + virtual void IN_EAX_DX(Instruction const&) = 0; + virtual void IN_EAX_imm8(Instruction const&) = 0; + virtual void IRET(Instruction const&) = 0; + virtual void JCXZ_imm8(Instruction const&) = 0; + virtual void JMP_FAR_mem16(Instruction const&) = 0; + virtual void JMP_FAR_mem32(Instruction const&) = 0; + virtual void JMP_RM16(Instruction const&) = 0; + virtual void JMP_RM32(Instruction const&) = 0; + virtual void JMP_imm16(Instruction const&) = 0; + virtual void JMP_imm16_imm16(Instruction const&) = 0; + virtual void JMP_imm16_imm32(Instruction const&) = 0; + virtual void JMP_imm32(Instruction const&) = 0; + virtual void JMP_short_imm8(Instruction const&) = 0; + virtual void Jcc_NEAR_imm(Instruction const&) = 0; + virtual void Jcc_imm8(Instruction const&) = 0; + virtual void LAHF(Instruction const&) = 0; + virtual void LAR_reg16_RM16(Instruction const&) = 0; + virtual void LAR_reg32_RM32(Instruction const&) = 0; + virtual void LDS_reg16_mem16(Instruction const&) = 0; + virtual void LDS_reg32_mem32(Instruction const&) = 0; + virtual void LEAVE16(Instruction const&) = 0; + virtual void LEAVE32(Instruction const&) = 0; + virtual void LEA_reg16_mem16(Instruction const&) = 0; + virtual void LEA_reg32_mem32(Instruction const&) = 0; + virtual void LES_reg16_mem16(Instruction const&) = 0; + virtual void LES_reg32_mem32(Instruction const&) = 0; + virtual void LFS_reg16_mem16(Instruction const&) = 0; + virtual void LFS_reg32_mem32(Instruction const&) = 0; + virtual void LGDT(Instruction const&) = 0; + virtual void LGS_reg16_mem16(Instruction const&) = 0; + virtual void LGS_reg32_mem32(Instruction const&) = 0; + virtual void LIDT(Instruction const&) = 0; + virtual void LLDT_RM16(Instruction const&) = 0; + virtual void LMSW_RM16(Instruction const&) = 0; + virtual void LODSB(Instruction const&) = 0; + virtual void LODSD(Instruction const&) = 0; + virtual void LODSW(Instruction const&) = 0; + virtual void LOOPNZ_imm8(Instruction const&) = 0; + virtual void LOOPZ_imm8(Instruction const&) = 0; + virtual void LOOP_imm8(Instruction const&) = 0; + virtual void LSL_reg16_RM16(Instruction const&) = 0; + virtual void LSL_reg32_RM32(Instruction const&) = 0; + virtual void LSS_reg16_mem16(Instruction const&) = 0; + virtual void LSS_reg32_mem32(Instruction const&) = 0; + virtual void LTR_RM16(Instruction const&) = 0; + virtual void MOVSB(Instruction const&) = 0; + virtual void MOVSD(Instruction const&) = 0; + virtual void MOVSW(Instruction const&) = 0; + virtual void MOVSX_reg16_RM8(Instruction const&) = 0; + virtual void MOVSX_reg32_RM16(Instruction const&) = 0; + virtual void MOVSX_reg32_RM8(Instruction const&) = 0; + virtual void MOVZX_reg16_RM8(Instruction const&) = 0; + virtual void MOVZX_reg32_RM16(Instruction const&) = 0; + virtual void MOVZX_reg32_RM8(Instruction const&) = 0; + virtual void MOV_AL_moff8(Instruction const&) = 0; + virtual void MOV_AX_moff16(Instruction const&) = 0; + virtual void MOV_CR_reg32(Instruction const&) = 0; + virtual void MOV_DR_reg32(Instruction const&) = 0; + virtual void MOV_EAX_moff32(Instruction const&) = 0; + virtual void MOV_RM16_imm16(Instruction const&) = 0; + virtual void MOV_RM16_reg16(Instruction const&) = 0; + virtual void MOV_RM16_seg(Instruction const&) = 0; + virtual void MOV_RM32_imm32(Instruction const&) = 0; + virtual void MOV_RM32_reg32(Instruction const&) = 0; + virtual void MOV_RM8_imm8(Instruction const&) = 0; + virtual void MOV_RM8_reg8(Instruction const&) = 0; + virtual void MOV_moff16_AX(Instruction const&) = 0; + virtual void MOV_moff32_EAX(Instruction const&) = 0; + virtual void MOV_moff8_AL(Instruction const&) = 0; + virtual void MOV_reg16_RM16(Instruction const&) = 0; + virtual void MOV_reg16_imm16(Instruction const&) = 0; + virtual void MOV_reg32_CR(Instruction const&) = 0; + virtual void MOV_reg32_DR(Instruction const&) = 0; + virtual void MOV_reg32_RM32(Instruction const&) = 0; + virtual void MOV_reg32_imm32(Instruction const&) = 0; + virtual void MOV_reg8_RM8(Instruction const&) = 0; + virtual void MOV_reg8_imm8(Instruction const&) = 0; + virtual void MOV_seg_RM16(Instruction const&) = 0; + virtual void MOV_seg_RM32(Instruction const&) = 0; + virtual void MUL_RM16(Instruction const&) = 0; + virtual void MUL_RM32(Instruction const&) = 0; + virtual void MUL_RM8(Instruction const&) = 0; + virtual void NEG_RM16(Instruction const&) = 0; + virtual void NEG_RM32(Instruction const&) = 0; + virtual void NEG_RM8(Instruction const&) = 0; + virtual void NOP(Instruction const&) = 0; + virtual void NOT_RM16(Instruction const&) = 0; + virtual void NOT_RM32(Instruction const&) = 0; + virtual void NOT_RM8(Instruction const&) = 0; + virtual void OR_AL_imm8(Instruction const&) = 0; + virtual void OR_AX_imm16(Instruction const&) = 0; + virtual void OR_EAX_imm32(Instruction const&) = 0; + virtual void OR_RM16_imm16(Instruction const&) = 0; + virtual void OR_RM16_imm8(Instruction const&) = 0; + virtual void OR_RM16_reg16(Instruction const&) = 0; + virtual void OR_RM32_imm32(Instruction const&) = 0; + virtual void OR_RM32_imm8(Instruction const&) = 0; + virtual void OR_RM32_reg32(Instruction const&) = 0; + virtual void OR_RM8_imm8(Instruction const&) = 0; + virtual void OR_RM8_reg8(Instruction const&) = 0; + virtual void OR_reg16_RM16(Instruction const&) = 0; + virtual void OR_reg32_RM32(Instruction const&) = 0; + virtual void OR_reg8_RM8(Instruction const&) = 0; + virtual void OUTSB(Instruction const&) = 0; + virtual void OUTSD(Instruction const&) = 0; + virtual void OUTSW(Instruction const&) = 0; + virtual void OUT_DX_AL(Instruction const&) = 0; + virtual void OUT_DX_AX(Instruction const&) = 0; + virtual void OUT_DX_EAX(Instruction const&) = 0; + virtual void OUT_imm8_AL(Instruction const&) = 0; + virtual void OUT_imm8_AX(Instruction const&) = 0; + virtual void OUT_imm8_EAX(Instruction const&) = 0; + virtual void PACKSSDW_mm1_mm2m64(Instruction const&) = 0; + virtual void PACKSSWB_mm1_mm2m64(Instruction const&) = 0; + virtual void PACKUSWB_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDB_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDW_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDD_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDSB_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDSW_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDUSB_mm1_mm2m64(Instruction const&) = 0; + virtual void PADDUSW_mm1_mm2m64(Instruction const&) = 0; + virtual void PAND_mm1_mm2m64(Instruction const&) = 0; + virtual void PANDN_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPEQB_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPEQW_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPEQD_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPGTB_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPGTW_mm1_mm2m64(Instruction const&) = 0; + virtual void PCMPGTD_mm1_mm2m64(Instruction const&) = 0; + virtual void PMADDWD_mm1_mm2m64(Instruction const&) = 0; + virtual void PMULHW_mm1_mm2m64(Instruction const&) = 0; + virtual void PMULLW_mm1_mm2m64(Instruction const&) = 0; + virtual void POPA(Instruction const&) = 0; + virtual void POPAD(Instruction const&) = 0; + virtual void POPF(Instruction const&) = 0; + virtual void POPFD(Instruction const&) = 0; + virtual void POP_DS(Instruction const&) = 0; + virtual void POP_ES(Instruction const&) = 0; + virtual void POP_FS(Instruction const&) = 0; + virtual void POP_GS(Instruction const&) = 0; + virtual void POP_RM16(Instruction const&) = 0; + virtual void POP_RM32(Instruction const&) = 0; + virtual void POP_SS(Instruction const&) = 0; + virtual void POP_reg16(Instruction const&) = 0; + virtual void POP_reg32(Instruction const&) = 0; + virtual void POR_mm1_mm2m64(Instruction const&) = 0; + virtual void PSLLW_mm1_mm2m64(Instruction const&) = 0; + virtual void PSLLW_mm1_imm8(Instruction const&) = 0; + virtual void PSLLD_mm1_mm2m64(Instruction const&) = 0; + virtual void PSLLD_mm1_imm8(Instruction const&) = 0; + virtual void PSLLQ_mm1_mm2m64(Instruction const&) = 0; + virtual void PSLLQ_mm1_imm8(Instruction const&) = 0; + virtual void PSRAW_mm1_mm2m64(Instruction const&) = 0; + virtual void PSRAW_mm1_imm8(Instruction const&) = 0; + virtual void PSRAD_mm1_mm2m64(Instruction const&) = 0; + virtual void PSRAD_mm1_imm8(Instruction const&) = 0; + virtual void PSRLW_mm1_mm2m64(Instruction const&) = 0; + virtual void PSRLW_mm1_imm8(Instruction const&) = 0; + virtual void PSRLD_mm1_mm2m64(Instruction const&) = 0; + virtual void PSRLD_mm1_imm8(Instruction const&) = 0; + virtual void PSRLQ_mm1_mm2m64(Instruction const&) = 0; + virtual void PSRLQ_mm1_imm8(Instruction const&) = 0; + virtual void PSUBB_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBW_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBD_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBSB_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBSW_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBUSB_mm1_mm2m64(Instruction const&) = 0; + virtual void PSUBUSW_mm1_mm2m64(Instruction const&) = 0; + virtual void PUNPCKHBW_mm1_mm2m64(Instruction const&) = 0; + virtual void PUNPCKHWD_mm1_mm2m64(Instruction const&) = 0; + virtual void PUNPCKHDQ_mm1_mm2m64(Instruction const&) = 0; + virtual void PUNPCKLBW_mm1_mm2m32(Instruction const&) = 0; + virtual void PUNPCKLWD_mm1_mm2m32(Instruction const&) = 0; + virtual void PUNPCKLDQ_mm1_mm2m32(Instruction const&) = 0; + virtual void PUSHA(Instruction const&) = 0; + virtual void PUSHAD(Instruction const&) = 0; + virtual void PUSHF(Instruction const&) = 0; + virtual void PUSHFD(Instruction const&) = 0; + virtual void PUSH_CS(Instruction const&) = 0; + virtual void PUSH_DS(Instruction const&) = 0; + virtual void PUSH_ES(Instruction const&) = 0; + virtual void PUSH_FS(Instruction const&) = 0; + virtual void PUSH_GS(Instruction const&) = 0; + virtual void PUSH_RM16(Instruction const&) = 0; + virtual void PUSH_RM32(Instruction const&) = 0; + virtual void PUSH_SP_8086_80186(Instruction const&) = 0; + virtual void PUSH_SS(Instruction const&) = 0; + virtual void PUSH_imm16(Instruction const&) = 0; + virtual void PUSH_imm32(Instruction const&) = 0; + virtual void PUSH_imm8(Instruction const&) = 0; + virtual void PUSH_reg16(Instruction const&) = 0; + virtual void PUSH_reg32(Instruction const&) = 0; + virtual void PXOR_mm1_mm2m64(Instruction const&) = 0; + virtual void RCL_RM16_1(Instruction const&) = 0; + virtual void RCL_RM16_CL(Instruction const&) = 0; + virtual void RCL_RM16_imm8(Instruction const&) = 0; + virtual void RCL_RM32_1(Instruction const&) = 0; + virtual void RCL_RM32_CL(Instruction const&) = 0; + virtual void RCL_RM32_imm8(Instruction const&) = 0; + virtual void RCL_RM8_1(Instruction const&) = 0; + virtual void RCL_RM8_CL(Instruction const&) = 0; + virtual void RCL_RM8_imm8(Instruction const&) = 0; + virtual void RCR_RM16_1(Instruction const&) = 0; + virtual void RCR_RM16_CL(Instruction const&) = 0; + virtual void RCR_RM16_imm8(Instruction const&) = 0; + virtual void RCR_RM32_1(Instruction const&) = 0; + virtual void RCR_RM32_CL(Instruction const&) = 0; + virtual void RCR_RM32_imm8(Instruction const&) = 0; + virtual void RCR_RM8_1(Instruction const&) = 0; + virtual void RCR_RM8_CL(Instruction const&) = 0; + virtual void RCR_RM8_imm8(Instruction const&) = 0; + virtual void RDTSC(Instruction const&) = 0; + virtual void RET(Instruction const&) = 0; + virtual void RETF(Instruction const&) = 0; + virtual void RETF_imm16(Instruction const&) = 0; + virtual void RET_imm16(Instruction const&) = 0; + virtual void ROL_RM16_1(Instruction const&) = 0; + virtual void ROL_RM16_CL(Instruction const&) = 0; + virtual void ROL_RM16_imm8(Instruction const&) = 0; + virtual void ROL_RM32_1(Instruction const&) = 0; + virtual void ROL_RM32_CL(Instruction const&) = 0; + virtual void ROL_RM32_imm8(Instruction const&) = 0; + virtual void ROL_RM8_1(Instruction const&) = 0; + virtual void ROL_RM8_CL(Instruction const&) = 0; + virtual void ROL_RM8_imm8(Instruction const&) = 0; + virtual void ROR_RM16_1(Instruction const&) = 0; + virtual void ROR_RM16_CL(Instruction const&) = 0; + virtual void ROR_RM16_imm8(Instruction const&) = 0; + virtual void ROR_RM32_1(Instruction const&) = 0; + virtual void ROR_RM32_CL(Instruction const&) = 0; + virtual void ROR_RM32_imm8(Instruction const&) = 0; + virtual void ROR_RM8_1(Instruction const&) = 0; + virtual void ROR_RM8_CL(Instruction const&) = 0; + virtual void ROR_RM8_imm8(Instruction const&) = 0; + virtual void SAHF(Instruction const&) = 0; + virtual void SALC(Instruction const&) = 0; + virtual void SAR_RM16_1(Instruction const&) = 0; + virtual void SAR_RM16_CL(Instruction const&) = 0; + virtual void SAR_RM16_imm8(Instruction const&) = 0; + virtual void SAR_RM32_1(Instruction const&) = 0; + virtual void SAR_RM32_CL(Instruction const&) = 0; + virtual void SAR_RM32_imm8(Instruction const&) = 0; + virtual void SAR_RM8_1(Instruction const&) = 0; + virtual void SAR_RM8_CL(Instruction const&) = 0; + virtual void SAR_RM8_imm8(Instruction const&) = 0; + virtual void SBB_AL_imm8(Instruction const&) = 0; + virtual void SBB_AX_imm16(Instruction const&) = 0; + virtual void SBB_EAX_imm32(Instruction const&) = 0; + virtual void SBB_RM16_imm16(Instruction const&) = 0; + virtual void SBB_RM16_imm8(Instruction const&) = 0; + virtual void SBB_RM16_reg16(Instruction const&) = 0; + virtual void SBB_RM32_imm32(Instruction const&) = 0; + virtual void SBB_RM32_imm8(Instruction const&) = 0; + virtual void SBB_RM32_reg32(Instruction const&) = 0; + virtual void SBB_RM8_imm8(Instruction const&) = 0; + virtual void SBB_RM8_reg8(Instruction const&) = 0; + virtual void SBB_reg16_RM16(Instruction const&) = 0; + virtual void SBB_reg32_RM32(Instruction const&) = 0; + virtual void SBB_reg8_RM8(Instruction const&) = 0; + virtual void SCASB(Instruction const&) = 0; + virtual void SCASD(Instruction const&) = 0; + virtual void SCASW(Instruction const&) = 0; + virtual void SETcc_RM8(Instruction const&) = 0; + virtual void SGDT(Instruction const&) = 0; + virtual void SHLD_RM16_reg16_CL(Instruction const&) = 0; + virtual void SHLD_RM16_reg16_imm8(Instruction const&) = 0; + virtual void SHLD_RM32_reg32_CL(Instruction const&) = 0; + virtual void SHLD_RM32_reg32_imm8(Instruction const&) = 0; + virtual void SHL_RM16_1(Instruction const&) = 0; + virtual void SHL_RM16_CL(Instruction const&) = 0; + virtual void SHL_RM16_imm8(Instruction const&) = 0; + virtual void SHL_RM32_1(Instruction const&) = 0; + virtual void SHL_RM32_CL(Instruction const&) = 0; + virtual void SHL_RM32_imm8(Instruction const&) = 0; + virtual void SHL_RM8_1(Instruction const&) = 0; + virtual void SHL_RM8_CL(Instruction const&) = 0; + virtual void SHL_RM8_imm8(Instruction const&) = 0; + virtual void SHRD_RM16_reg16_CL(Instruction const&) = 0; + virtual void SHRD_RM16_reg16_imm8(Instruction const&) = 0; + virtual void SHRD_RM32_reg32_CL(Instruction const&) = 0; + virtual void SHRD_RM32_reg32_imm8(Instruction const&) = 0; + virtual void SHR_RM16_1(Instruction const&) = 0; + virtual void SHR_RM16_CL(Instruction const&) = 0; + virtual void SHR_RM16_imm8(Instruction const&) = 0; + virtual void SHR_RM32_1(Instruction const&) = 0; + virtual void SHR_RM32_CL(Instruction const&) = 0; + virtual void SHR_RM32_imm8(Instruction const&) = 0; + virtual void SHR_RM8_1(Instruction const&) = 0; + virtual void SHR_RM8_CL(Instruction const&) = 0; + virtual void SHR_RM8_imm8(Instruction const&) = 0; + virtual void SIDT(Instruction const&) = 0; + virtual void SLDT_RM16(Instruction const&) = 0; + virtual void SMSW_RM16(Instruction const&) = 0; + virtual void STC(Instruction const&) = 0; + virtual void STD(Instruction const&) = 0; + virtual void STI(Instruction const&) = 0; + virtual void STOSB(Instruction const&) = 0; + virtual void STOSD(Instruction const&) = 0; + virtual void STOSW(Instruction const&) = 0; + virtual void STR_RM16(Instruction const&) = 0; + virtual void SUB_AL_imm8(Instruction const&) = 0; + virtual void SUB_AX_imm16(Instruction const&) = 0; + virtual void SUB_EAX_imm32(Instruction const&) = 0; + virtual void SUB_RM16_imm16(Instruction const&) = 0; + virtual void SUB_RM16_imm8(Instruction const&) = 0; + virtual void SUB_RM16_reg16(Instruction const&) = 0; + virtual void SUB_RM32_imm32(Instruction const&) = 0; + virtual void SUB_RM32_imm8(Instruction const&) = 0; + virtual void SUB_RM32_reg32(Instruction const&) = 0; + virtual void SUB_RM8_imm8(Instruction const&) = 0; + virtual void SUB_RM8_reg8(Instruction const&) = 0; + virtual void SUB_reg16_RM16(Instruction const&) = 0; + virtual void SUB_reg32_RM32(Instruction const&) = 0; + virtual void SUB_reg8_RM8(Instruction const&) = 0; + virtual void TEST_AL_imm8(Instruction const&) = 0; + virtual void TEST_AX_imm16(Instruction const&) = 0; + virtual void TEST_EAX_imm32(Instruction const&) = 0; + virtual void TEST_RM16_imm16(Instruction const&) = 0; + virtual void TEST_RM16_reg16(Instruction const&) = 0; + virtual void TEST_RM32_imm32(Instruction const&) = 0; + virtual void TEST_RM32_reg32(Instruction const&) = 0; + virtual void TEST_RM8_imm8(Instruction const&) = 0; + virtual void TEST_RM8_reg8(Instruction const&) = 0; + virtual void UD0(Instruction const&) = 0; + virtual void UD1(Instruction const&) = 0; + virtual void UD2(Instruction const&) = 0; + virtual void VERR_RM16(Instruction const&) = 0; + virtual void VERW_RM16(Instruction const&) = 0; + virtual void WAIT(Instruction const&) = 0; + virtual void WBINVD(Instruction const&) = 0; + virtual void XADD_RM16_reg16(Instruction const&) = 0; + virtual void XADD_RM32_reg32(Instruction const&) = 0; + virtual void XADD_RM8_reg8(Instruction const&) = 0; + virtual void XCHG_AX_reg16(Instruction const&) = 0; + virtual void XCHG_EAX_reg32(Instruction const&) = 0; + virtual void XCHG_reg16_RM16(Instruction const&) = 0; + virtual void XCHG_reg32_RM32(Instruction const&) = 0; + virtual void XCHG_reg8_RM8(Instruction const&) = 0; + virtual void XLAT(Instruction const&) = 0; + virtual void XOR_AL_imm8(Instruction const&) = 0; + virtual void XOR_AX_imm16(Instruction const&) = 0; + virtual void XOR_EAX_imm32(Instruction const&) = 0; + virtual void XOR_RM16_imm16(Instruction const&) = 0; + virtual void XOR_RM16_imm8(Instruction const&) = 0; + virtual void XOR_RM16_reg16(Instruction const&) = 0; + virtual void XOR_RM32_imm32(Instruction const&) = 0; + virtual void XOR_RM32_imm8(Instruction const&) = 0; + virtual void XOR_RM32_reg32(Instruction const&) = 0; + virtual void XOR_RM8_imm8(Instruction const&) = 0; + virtual void XOR_RM8_reg8(Instruction const&) = 0; + virtual void XOR_reg16_RM16(Instruction const&) = 0; + virtual void XOR_reg32_RM32(Instruction const&) = 0; + virtual void XOR_reg8_RM8(Instruction const&) = 0; + virtual void MOVQ_mm1_mm2m64(Instruction const&) = 0; + virtual void MOVQ_mm1m64_mm2(Instruction const&) = 0; + virtual void MOVD_mm1_rm32(Instruction const&) = 0; + virtual void MOVQ_mm1_rm64(Instruction const&) = 0; // long mode + virtual void MOVD_rm32_mm2(Instruction const&) = 0; + virtual void MOVQ_rm64_mm2(Instruction const&) = 0; // long mode + virtual void EMMS(Instruction const&) = 0; + virtual void wrap_0xC0(Instruction const&) = 0; + virtual void wrap_0xC1_16(Instruction const&) = 0; + virtual void wrap_0xC1_32(Instruction const&) = 0; + virtual void wrap_0xD0(Instruction const&) = 0; + virtual void wrap_0xD1_16(Instruction const&) = 0; + virtual void wrap_0xD1_32(Instruction const&) = 0; + virtual void wrap_0xD2(Instruction const&) = 0; + virtual void wrap_0xD3_16(Instruction const&) = 0; + virtual void wrap_0xD3_32(Instruction const&) = 0; virtual void PREFETCHTNTA(Instruction const&) = 0; virtual void PREFETCHT0(Instruction const&) = 0; @@ -740,6 +740,6 @@ protected: virtual ~Interpreter() = default; }; -typedef void (Interpreter::*InstructionHandler)(const Instruction&); +typedef void (Interpreter::*InstructionHandler)(Instruction const&); } |