From 80d4e830a0a95a41e3a3a6ccdc938fdfc4c7430b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Nov 2021 01:06:34 +0100 Subject: [PATCH] Everywhere: Pass AK::ReadonlyBytes by value --- AK/ByteBuffer.h | 4 ++-- AK/Format.h | 2 +- Kernel/KSyms.cpp | 2 +- Userland/Libraries/LibArchive/TarStream.cpp | 2 +- Userland/Libraries/LibArchive/TarStream.h | 2 +- Userland/Libraries/LibArchive/Zip.cpp | 4 ++-- Userland/Libraries/LibArchive/Zip.h | 4 ++-- Userland/Libraries/LibCompress/Deflate.cpp | 2 +- Userland/Libraries/LibCompress/Deflate.h | 2 +- Userland/Libraries/LibCompress/Gzip.cpp | 2 +- Userland/Libraries/LibCompress/Gzip.h | 2 +- Userland/Libraries/LibCompress/Zlib.cpp | 2 +- Userland/Libraries/LibCompress/Zlib.h | 2 +- Userland/Libraries/LibCore/MimeData.cpp | 2 +- Userland/Libraries/LibCore/MimeData.h | 2 +- Userland/Libraries/LibCoredump/Reader.cpp | 2 +- Userland/Libraries/LibCoredump/Reader.h | 2 +- .../LibCrypto/Authentication/GHash.h | 2 +- .../Libraries/LibCrypto/Cipher/Mode/GCM.h | 2 +- .../Libraries/LibCrypto/Hash/HashFunction.h | 2 +- Userland/Libraries/LibGUI/Clipboard.cpp | 2 +- Userland/Libraries/LibGUI/Clipboard.h | 2 +- .../Libraries/LibGfx/TrueTypeFont/Cmap.cpp | 2 +- Userland/Libraries/LibGfx/TrueTypeFont/Cmap.h | 6 ++--- .../Libraries/LibGfx/TrueTypeFont/Font.cpp | 10 ++++----- .../Libraries/LibGfx/TrueTypeFont/Glyf.cpp | 6 ++--- Userland/Libraries/LibGfx/TrueTypeFont/Glyf.h | 10 ++++----- .../Libraries/LibGfx/TrueTypeFont/Tables.h | 22 +++++++++---------- .../LibImageDecoderClient/Client.cpp | 2 +- .../Libraries/LibImageDecoderClient/Client.h | 2 +- Userland/Libraries/LibPDF/Document.cpp | 2 +- Userland/Libraries/LibPDF/Document.h | 2 +- Userland/Libraries/LibPDF/Filter.cpp | 22 +++++++++---------- Userland/Libraries/LibPDF/Filter.h | 22 +++++++++---------- Userland/Libraries/LibPDF/ObjectDerivatives.h | 2 +- Userland/Libraries/LibPDF/Parser.cpp | 10 ++++----- Userland/Libraries/LibPDF/Parser.h | 10 ++++----- Userland/Libraries/LibPDF/Reader.h | 4 ++-- Userland/Libraries/LibTLS/Record.cpp | 2 +- Userland/Libraries/LibTLS/TLSv12.h | 2 +- Userland/Libraries/LibVT/TerminalWidget.cpp | 2 +- Userland/Libraries/LibVT/TerminalWidget.h | 2 +- 42 files changed, 96 insertions(+), 96 deletions(-) diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 045c6ebfd40..416e4d0594b 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -182,14 +182,14 @@ public: return try_ensure_capacity_slowpath(new_capacity); } - void append(ReadonlyBytes const& bytes) + void append(ReadonlyBytes bytes) { MUST(try_append(bytes)); } void append(void const* data, size_t data_size) { append({ data, data_size }); } - ErrorOr try_append(ReadonlyBytes const& bytes) + ErrorOr try_append(ReadonlyBytes bytes) { return try_append(bytes.data(), bytes.size()); } diff --git a/AK/Format.h b/AK/Format.h index c1c10d0b9f5..cd23a6e5770 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -351,7 +351,7 @@ requires(HasFormatter) struct Formatter> : StandardFormatter { template<> struct Formatter : Formatter { - void format(FormatBuilder& builder, ReadonlyBytes const& value) + void format(FormatBuilder& builder, ReadonlyBytes value) { if (m_mode == Mode::Pointer) { Formatter formatter { *this }; diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 702c3177ed5..79fcd381ed8 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -54,7 +54,7 @@ const KernelSymbol* symbolicate_kernel_address(FlatPtr address) return nullptr; } -UNMAP_AFTER_INIT static void load_kernel_symbols_from_data(ReadonlyBytes const& buffer) +UNMAP_AFTER_INIT static void load_kernel_symbols_from_data(ReadonlyBytes buffer) { g_lowest_kernel_symbol_address = 0xffffffff; g_highest_kernel_symbol_address = 0; diff --git a/Userland/Libraries/LibArchive/TarStream.cpp b/Userland/Libraries/LibArchive/TarStream.cpp index 657afe941c8..b23a9d1a235 100644 --- a/Userland/Libraries/LibArchive/TarStream.cpp +++ b/Userland/Libraries/LibArchive/TarStream.cpp @@ -143,7 +143,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, const ReadonlyBytes& bytes) +void TarOutputStream::add_file(const String& 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 e09375b7868..d0764faa4d8 100644 --- a/Userland/Libraries/LibArchive/TarStream.h +++ b/Userland/Libraries/LibArchive/TarStream.h @@ -53,7 +53,7 @@ private: class TarOutputStream { public: TarOutputStream(OutputStream&); - void add_file(const String& path, mode_t, const ReadonlyBytes&); + void add_file(const String& path, mode_t, ReadonlyBytes); void add_directory(const String& path, mode_t); void finish(); diff --git a/Userland/Libraries/LibArchive/Zip.cpp b/Userland/Libraries/LibArchive/Zip.cpp index 7ce1acb5f82..7bc16c48a4d 100644 --- a/Userland/Libraries/LibArchive/Zip.cpp +++ b/Userland/Libraries/LibArchive/Zip.cpp @@ -8,7 +8,7 @@ namespace Archive { -bool Zip::find_end_of_central_directory_offset(const ReadonlyBytes& buffer, size_t& offset) +bool Zip::find_end_of_central_directory_offset(ReadonlyBytes buffer, size_t& offset) { for (size_t backwards_offset = 0; backwards_offset <= UINT16_MAX; backwards_offset++) // the file may have a trailing comment of an arbitrary 16 bit length { @@ -24,7 +24,7 @@ bool Zip::find_end_of_central_directory_offset(const ReadonlyBytes& buffer, size return false; } -Optional Zip::try_create(const ReadonlyBytes& buffer) +Optional Zip::try_create(ReadonlyBytes buffer) { size_t end_of_central_directory_offset; if (!find_end_of_central_directory_offset(buffer, end_of_central_directory_offset)) diff --git a/Userland/Libraries/LibArchive/Zip.h b/Userland/Libraries/LibArchive/Zip.h index 42e66b81abc..8eee39d9c0d 100644 --- a/Userland/Libraries/LibArchive/Zip.h +++ b/Userland/Libraries/LibArchive/Zip.h @@ -207,11 +207,11 @@ struct ZipMember { class Zip { public: - static Optional try_create(const ReadonlyBytes& buffer); + static Optional try_create(ReadonlyBytes buffer); bool for_each_member(Function); private: - static bool find_end_of_central_directory_offset(const ReadonlyBytes&, size_t& offset); + static bool find_end_of_central_directory_offset(ReadonlyBytes, size_t& offset); u16 member_count { 0 }; size_t members_start_offset { 0 }; diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp index 4dc778d4b07..0b320d16283 100644 --- a/Userland/Libraries/LibCompress/Deflate.cpp +++ b/Userland/Libraries/LibCompress/Deflate.cpp @@ -1052,7 +1052,7 @@ void DeflateCompressor::final_flush() flush(); } -Optional DeflateCompressor::compress_all(const ReadonlyBytes& bytes, CompressionLevel compression_level) +Optional DeflateCompressor::compress_all(ReadonlyBytes bytes, CompressionLevel compression_level) { DuplexMemoryStream output_stream; DeflateCompressor deflate_stream { output_stream, compression_level }; diff --git a/Userland/Libraries/LibCompress/Deflate.h b/Userland/Libraries/LibCompress/Deflate.h index 6143e7f83f1..9d9b51de8b3 100644 --- a/Userland/Libraries/LibCompress/Deflate.h +++ b/Userland/Libraries/LibCompress/Deflate.h @@ -151,7 +151,7 @@ public: bool write_or_error(ReadonlyBytes) override; void final_flush(); - static Optional compress_all(const ReadonlyBytes& bytes, CompressionLevel = CompressionLevel::GOOD); + static Optional compress_all(ReadonlyBytes bytes, CompressionLevel = CompressionLevel::GOOD); private: Bytes pending_block() { return { m_rolling_window + block_size, block_size }; } diff --git a/Userland/Libraries/LibCompress/Gzip.cpp b/Userland/Libraries/LibCompress/Gzip.cpp index 644718acfcb..d5c899426b6 100644 --- a/Userland/Libraries/LibCompress/Gzip.cpp +++ b/Userland/Libraries/LibCompress/Gzip.cpp @@ -261,7 +261,7 @@ bool GzipCompressor::write_or_error(ReadonlyBytes bytes) return true; } -Optional GzipCompressor::compress_all(const ReadonlyBytes& bytes) +Optional GzipCompressor::compress_all(ReadonlyBytes bytes) { DuplexMemoryStream output_stream; GzipCompressor gzip_stream { output_stream }; diff --git a/Userland/Libraries/LibCompress/Gzip.h b/Userland/Libraries/LibCompress/Gzip.h index 635ba99f9ec..2a4227b74cc 100644 --- a/Userland/Libraries/LibCompress/Gzip.h +++ b/Userland/Libraries/LibCompress/Gzip.h @@ -87,7 +87,7 @@ public: size_t write(ReadonlyBytes) override; bool write_or_error(ReadonlyBytes) override; - static Optional compress_all(const ReadonlyBytes& bytes); + static Optional compress_all(ReadonlyBytes bytes); private: OutputStream& m_output_stream; diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index 2a0afb8755f..96b8f6ac23c 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -41,7 +41,7 @@ Optional Zlib::try_create(ReadonlyBytes data) return zlib; } -Zlib::Zlib(const ReadonlyBytes& data) +Zlib::Zlib(ReadonlyBytes data) : m_input_data(data) { } diff --git a/Userland/Libraries/LibCompress/Zlib.h b/Userland/Libraries/LibCompress/Zlib.h index 148ecca809c..f65457a6402 100644 --- a/Userland/Libraries/LibCompress/Zlib.h +++ b/Userland/Libraries/LibCompress/Zlib.h @@ -22,7 +22,7 @@ public: static Optional decompress_all(ReadonlyBytes); private: - Zlib(const ReadonlyBytes& data); + Zlib(ReadonlyBytes data); u8 m_compression_method; u8 m_compression_info; diff --git a/Userland/Libraries/LibCore/MimeData.cpp b/Userland/Libraries/LibCore/MimeData.cpp index e6cbe8a5ef6..10ca8a7eee2 100644 --- a/Userland/Libraries/LibCore/MimeData.cpp +++ b/Userland/Libraries/LibCore/MimeData.cpp @@ -137,7 +137,7 @@ String guess_mime_type_based_on_filename(StringView path) ENUMERATE_HEADER_CONTENTS #undef __ENUMERATE_MIME_TYPE_HEADER -Optional guess_mime_type_based_on_sniffed_bytes(const ReadonlyBytes& bytes) +Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes) { #define __ENUMERATE_MIME_TYPE_HEADER(var_name, mime_type, pattern_offset, pattern_size, ...) \ if (static_cast(bytes.size()) >= pattern_offset && bytes.slice(pattern_offset).starts_with(var_name)) \ diff --git a/Userland/Libraries/LibCore/MimeData.h b/Userland/Libraries/LibCore/MimeData.h index 852b9bdad6f..cdaf8686d05 100644 --- a/Userland/Libraries/LibCore/MimeData.h +++ b/Userland/Libraries/LibCore/MimeData.h @@ -49,6 +49,6 @@ private: String guess_mime_type_based_on_filename(StringView); -Optional guess_mime_type_based_on_sniffed_bytes(const ReadonlyBytes&); +Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes); } diff --git a/Userland/Libraries/LibCoredump/Reader.cpp b/Userland/Libraries/LibCoredump/Reader.cpp index 744f4100bc3..661d92e05d9 100644 --- a/Userland/Libraries/LibCoredump/Reader.cpp +++ b/Userland/Libraries/LibCoredump/Reader.cpp @@ -59,7 +59,7 @@ Reader::Reader(ReadonlyBytes coredump_bytes) VERIFY(m_notes_segment_index != -1); } -Optional Reader::decompress_coredump(const ReadonlyBytes& raw_coredump) +Optional Reader::decompress_coredump(ReadonlyBytes raw_coredump) { auto decompressed_coredump = Compress::GzipDecompressor::decompress_all(raw_coredump); if (!decompressed_coredump.has_value()) diff --git a/Userland/Libraries/LibCoredump/Reader.h b/Userland/Libraries/LibCoredump/Reader.h index 71b52d248c8..9263cf13b40 100644 --- a/Userland/Libraries/LibCoredump/Reader.h +++ b/Userland/Libraries/LibCoredump/Reader.h @@ -55,7 +55,7 @@ private: explicit Reader(ByteBuffer); explicit Reader(NonnullRefPtr); - static Optional decompress_coredump(const ReadonlyBytes&); + static Optional decompress_coredump(ReadonlyBytes); class NotesEntryIterator { public: diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.h b/Userland/Libraries/LibCrypto/Authentication/GHash.h index 82a9dc573b7..5225d906d96 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.h +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.h @@ -34,7 +34,7 @@ public: { } - explicit GHash(const ReadonlyBytes& key) + explicit GHash(ReadonlyBytes key) { VERIFY(key.size() >= 16); for (size_t i = 0; i < 16; i += 4) { diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h index 228b79faead..900fd8b0b74 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h @@ -64,7 +64,7 @@ public: encrypt(in, out, ivec); } - void encrypt(const ReadonlyBytes& in, Bytes out, const ReadonlyBytes& iv_in, const ReadonlyBytes& aad, Bytes tag) + void encrypt(ReadonlyBytes in, Bytes out, ReadonlyBytes iv_in, ReadonlyBytes aad, Bytes tag) { auto iv_buf_result = ByteBuffer::copy(iv_in); // Not enough memory to figure out :shrug: diff --git a/Userland/Libraries/LibCrypto/Hash/HashFunction.h b/Userland/Libraries/LibCrypto/Hash/HashFunction.h index 71a10043f67..6e6cdbf402b 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashFunction.h +++ b/Userland/Libraries/LibCrypto/Hash/HashFunction.h @@ -27,7 +27,7 @@ public: virtual void update(const u8*, size_t) = 0; void update(const Bytes& buffer) { update(buffer.data(), buffer.size()); }; - void update(const ReadonlyBytes& 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()); }; diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index a65281af1b2..389d99c90b0 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -111,7 +111,7 @@ RefPtr Clipboard::bitmap() const return bitmap; } -void Clipboard::set_data(ReadonlyBytes const& data, String const& type, HashMap const& metadata) +void Clipboard::set_data(ReadonlyBytes data, String const& type, HashMap const& metadata) { auto buffer_or_error = Core::AnonymousBuffer::create_with_size(data.size()); if (buffer_or_error.is_error()) { diff --git a/Userland/Libraries/LibGUI/Clipboard.h b/Userland/Libraries/LibGUI/Clipboard.h index b5cc02d9b82..5b0637007d8 100644 --- a/Userland/Libraries/LibGUI/Clipboard.h +++ b/Userland/Libraries/LibGUI/Clipboard.h @@ -42,7 +42,7 @@ public: String mime_type() const { return data_and_type().mime_type; } RefPtr bitmap() const; - void set_data(ReadonlyBytes const& data, String const& mime_type = "text/plain", HashMap const& metadata = {}); + void set_data(ReadonlyBytes data, String const& mime_type = "text/plain", HashMap const& metadata = {}); void set_plain_text(String const& text) { set_data(text.bytes()); } void set_bitmap(Gfx::Bitmap const&); void clear(); diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.cpp b/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.cpp index cd5d2814668..3263f1efae2 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.cpp +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.cpp @@ -143,7 +143,7 @@ u32 Cmap::glyph_id_for_code_point(u32 code_point) const return subtable.glyph_id_for_code_point(code_point); } -Optional Cmap::from_slice(ReadonlyBytes const& slice) +Optional Cmap::from_slice(ReadonlyBytes slice) { if (slice.size() < (size_t)Sizes::TableHeader) { return {}; diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.h b/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.h index 3b8dc16b0d2..da26b1ca3c1 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.h +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Cmap.h @@ -37,7 +37,7 @@ public: UnicodeFullRepertoire = 10, }; - Subtable(ReadonlyBytes const& slice, u16 platform_id, u16 encoding_id) + Subtable(ReadonlyBytes slice, u16 platform_id, u16 encoding_id) : m_slice(slice) , m_raw_platform_id(platform_id) , m_encoding_id(encoding_id) @@ -81,7 +81,7 @@ public: u16 m_encoding_id { 0 }; }; - static Optional from_slice(ReadonlyBytes const&); + static Optional from_slice(ReadonlyBytes); u32 num_subtables() const; Optional subtable(u32 index) const; void set_active_index(u32 index) { m_active_index = index; } @@ -99,7 +99,7 @@ private: EncodingRecord = 8, }; - Cmap(ReadonlyBytes const& slice) + Cmap(ReadonlyBytes slice) : m_slice(slice) { } diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp index 38356bc0a90..6f5beddb8ff 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp @@ -52,7 +52,7 @@ u32 tag_from_str(char const* str) return be_u32((u8 const*)str); } -Optional Head::from_slice(ReadonlyBytes const& slice) +Optional Head::from_slice(ReadonlyBytes slice) { if (slice.size() < (size_t)Sizes::Table) { return {}; @@ -108,7 +108,7 @@ IndexToLocFormat Head::index_to_loc_format() const } } -Optional Hhea::from_slice(ReadonlyBytes const& slice) +Optional Hhea::from_slice(ReadonlyBytes slice) { if (slice.size() < (size_t)Sizes::Table) { return {}; @@ -141,7 +141,7 @@ u16 Hhea::number_of_h_metrics() const return be_u16(m_slice.offset_pointer((u32)Offsets::NumberOfHMetrics)); } -Optional Maxp::from_slice(ReadonlyBytes const& slice) +Optional Maxp::from_slice(ReadonlyBytes slice) { if (slice.size() < (size_t)Sizes::TableV0p5) { return {}; @@ -154,7 +154,7 @@ u16 Maxp::num_glyphs() const return be_u16(m_slice.offset_pointer((u32)Offsets::NumGlyphs)); } -Optional Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32 number_of_h_metrics) +Optional Hmtx::from_slice(ReadonlyBytes slice, u32 num_glyphs, u32 number_of_h_metrics) { if (slice.size() < number_of_h_metrics * (u32)Sizes::LongHorMetric + (num_glyphs - number_of_h_metrics) * (u32)Sizes::LeftSideBearing) { return {}; @@ -162,7 +162,7 @@ Optional Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32 return Hmtx(slice, num_glyphs, number_of_h_metrics); } -Optional Name::from_slice(ReadonlyBytes const& slice) +Optional Name::from_slice(ReadonlyBytes slice) { return Name(slice); } diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.cpp b/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.cpp index d819cea6641..e2063ef25ca 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.cpp +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.cpp @@ -56,7 +56,7 @@ public: Gfx::FloatPoint point; }; - PointIterator(ReadonlyBytes const& slice, u16 num_points, u32 flags_offset, u32 x_offset, u32 y_offset, Gfx::AffineTransform affine) + PointIterator(ReadonlyBytes slice, u16 num_points, u32 flags_offset, u32 x_offset, u32 y_offset, Gfx::AffineTransform affine) : m_slice(slice) , m_points_remaining(num_points) , m_flags_offset(flags_offset) @@ -322,7 +322,7 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1) } } -Optional Loca::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format) +Optional Loca::from_slice(ReadonlyBytes slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format) { switch (index_to_loc_format) { case IndexToLocFormat::Offset16: @@ -352,7 +352,7 @@ u32 Loca::get_glyph_offset(u32 glyph_id) const } } -static void get_ttglyph_offsets(ReadonlyBytes const& slice, u32 num_points, u32 flags_offset, u32* x_offset, u32* y_offset) +static void get_ttglyph_offsets(ReadonlyBytes slice, u32 num_points, u32 flags_offset, u32* x_offset, u32* y_offset) { u32 flags_size = 0; u32 x_size = 0; diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.h b/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.h index 2d34aaacb77..5863df25e81 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.h +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Glyf.h @@ -30,11 +30,11 @@ private: class Loca { public: - static Optional from_slice(ReadonlyBytes const&, u32 num_glyphs, IndexToLocFormat); + static Optional from_slice(ReadonlyBytes, u32 num_glyphs, IndexToLocFormat); u32 get_glyph_offset(u32 glyph_id) const; private: - Loca(ReadonlyBytes const& slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format) + Loca(ReadonlyBytes slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format) : m_slice(slice) , m_num_glyphs(num_glyphs) , m_index_to_loc_format(index_to_loc_format) @@ -50,7 +50,7 @@ class Glyf { public: class Glyph { public: - Glyph(ReadonlyBytes const& slice, i16 xmin, i16 ymin, i16 xmax, i16 ymax, i16 num_contours = -1) + Glyph(ReadonlyBytes slice, i16 xmin, i16 ymin, i16 xmax, i16 ymax, i16 num_contours = -1) : m_xmin(xmin) , m_ymin(ymin) , m_xmax(xmax) @@ -89,7 +89,7 @@ public: Gfx::AffineTransform affine; }; - ComponentIterator(ReadonlyBytes const& slice) + ComponentIterator(ReadonlyBytes slice) : m_slice(slice) { } @@ -133,7 +133,7 @@ public: ReadonlyBytes m_slice; }; - Glyf(ReadonlyBytes const& slice) + Glyf(ReadonlyBytes slice) : m_slice(slice) { } diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h b/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h index 8eeaa81dc8f..7165743f64a 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h @@ -18,7 +18,7 @@ enum class IndexToLocFormat { class Head { public: - static Optional from_slice(ReadonlyBytes const&); + static Optional from_slice(ReadonlyBytes); u16 units_per_em() const; i16 xmin() const; i16 ymin() const; @@ -43,7 +43,7 @@ private: Table = 54, }; - Head(ReadonlyBytes const& slice) + Head(ReadonlyBytes slice) : m_slice(slice) { } @@ -53,7 +53,7 @@ private: class Hhea { public: - static Optional from_slice(ReadonlyBytes const&); + static Optional from_slice(ReadonlyBytes); i16 ascender() const; i16 descender() const; i16 line_gap() const; @@ -72,7 +72,7 @@ private: Table = 36, }; - Hhea(ReadonlyBytes const& slice) + Hhea(ReadonlyBytes slice) : m_slice(slice) { } @@ -82,7 +82,7 @@ private: class Maxp { public: - static Optional from_slice(ReadonlyBytes const&); + static Optional from_slice(ReadonlyBytes); u16 num_glyphs() const; private: @@ -93,7 +93,7 @@ private: TableV0p5 = 6, }; - Maxp(ReadonlyBytes const& slice) + Maxp(ReadonlyBytes slice) : m_slice(slice) { } @@ -108,7 +108,7 @@ struct GlyphHorizontalMetrics { class Hmtx { public: - static Optional from_slice(ReadonlyBytes const&, u32 num_glyphs, u32 number_of_h_metrics); + static Optional from_slice(ReadonlyBytes, u32 num_glyphs, u32 number_of_h_metrics); GlyphHorizontalMetrics get_glyph_horizontal_metrics(u32 glyph_id) const; private: @@ -117,7 +117,7 @@ private: LeftSideBearing = 2 }; - Hmtx(ReadonlyBytes const& slice, u32 num_glyphs, u32 number_of_h_metrics) + Hmtx(ReadonlyBytes slice, u32 num_glyphs, u32 number_of_h_metrics) : m_slice(slice) , m_num_glyphs(num_glyphs) , m_number_of_h_metrics(number_of_h_metrics) @@ -143,7 +143,7 @@ public: i16 typographic_descender() const; i16 typographic_line_gap() const; - explicit OS2(ReadonlyBytes const& slice) + explicit OS2(ReadonlyBytes slice) : m_slice(slice) { } @@ -165,7 +165,7 @@ public: enum class WindowsLanguage { EnglishUnitedStates = 0x0409, }; - static Optional from_slice(ReadonlyBytes const&); + static Optional from_slice(ReadonlyBytes); String family_name() const { return string_for_id(NameId::FamilyName); } String subfamily_name() const { return string_for_id(NameId::SubfamilyName); } @@ -189,7 +189,7 @@ private: TypographicSubfamilyName = 17, }; - Name(ReadonlyBytes const& slice) + Name(ReadonlyBytes slice) : m_slice(slice) { } diff --git a/Userland/Libraries/LibImageDecoderClient/Client.cpp b/Userland/Libraries/LibImageDecoderClient/Client.cpp index 1c7d8456375..4a46bef119f 100644 --- a/Userland/Libraries/LibImageDecoderClient/Client.cpp +++ b/Userland/Libraries/LibImageDecoderClient/Client.cpp @@ -20,7 +20,7 @@ void Client::die() on_death(); } -Optional Client::decode_image(const ReadonlyBytes& encoded_data) +Optional Client::decode_image(ReadonlyBytes encoded_data) { if (encoded_data.is_empty()) return {}; diff --git a/Userland/Libraries/LibImageDecoderClient/Client.h b/Userland/Libraries/LibImageDecoderClient/Client.h index 0deddcc72ea..6dddb8eaf53 100644 --- a/Userland/Libraries/LibImageDecoderClient/Client.h +++ b/Userland/Libraries/LibImageDecoderClient/Client.h @@ -30,7 +30,7 @@ class Client final C_OBJECT(Client); public: - Optional decode_image(const ReadonlyBytes&); + Optional decode_image(ReadonlyBytes); Function on_death; diff --git a/Userland/Libraries/LibPDF/Document.cpp b/Userland/Libraries/LibPDF/Document.cpp index b80b24b0f38..898223bdc45 100644 --- a/Userland/Libraries/LibPDF/Document.cpp +++ b/Userland/Libraries/LibPDF/Document.cpp @@ -34,7 +34,7 @@ String OutlineItem::to_string(int indent) const return builder.to_string(); } -RefPtr Document::create(ReadonlyBytes const& bytes) +RefPtr Document::create(ReadonlyBytes bytes) { auto parser = adopt_ref(*new Parser({}, bytes)); auto document = adopt_ref(*new Document(parser)); diff --git a/Userland/Libraries/LibPDF/Document.h b/Userland/Libraries/LibPDF/Document.h index 194b081e271..ddd26443cdc 100644 --- a/Userland/Libraries/LibPDF/Document.h +++ b/Userland/Libraries/LibPDF/Document.h @@ -72,7 +72,7 @@ struct OutlineDict final : public RefCounted { class Document final : public RefCounted { public: - static RefPtr create(ReadonlyBytes const& bytes); + static RefPtr create(ReadonlyBytes bytes); ALWAYS_INLINE RefPtr const& outline() const { return m_outline; } diff --git a/Userland/Libraries/LibPDF/Filter.cpp b/Userland/Libraries/LibPDF/Filter.cpp index 597aa6d116a..d521c3f2102 100644 --- a/Userland/Libraries/LibPDF/Filter.cpp +++ b/Userland/Libraries/LibPDF/Filter.cpp @@ -11,7 +11,7 @@ namespace PDF { -Optional Filter::decode(ReadonlyBytes const& bytes, FlyString const& encoding_type) +Optional Filter::decode(ReadonlyBytes bytes, FlyString const& encoding_type) { if (encoding_type == CommonNames::ASCIIHexDecode) return decode_ascii_hex(bytes); @@ -37,7 +37,7 @@ Optional Filter::decode(ReadonlyBytes const& bytes, FlyString const& return {}; } -Optional Filter::decode_ascii_hex(ReadonlyBytes const& bytes) +Optional Filter::decode_ascii_hex(ReadonlyBytes bytes) { if (bytes.size() % 2 == 0) return decode_hex(bytes); @@ -68,7 +68,7 @@ Optional Filter::decode_ascii_hex(ReadonlyBytes const& bytes) return { move(output) }; }; -Optional Filter::decode_ascii85(ReadonlyBytes const& bytes) +Optional Filter::decode_ascii85(ReadonlyBytes bytes) { Vector buff; buff.ensure_capacity(bytes.size()); @@ -123,13 +123,13 @@ Optional Filter::decode_ascii85(ReadonlyBytes const& bytes) return ByteBuffer::copy(buff.span()); }; -Optional Filter::decode_lzw(ReadonlyBytes const&) +Optional Filter::decode_lzw(ReadonlyBytes) { dbgln("LZW decoding is not supported"); VERIFY_NOT_REACHED(); }; -Optional Filter::decode_flate(ReadonlyBytes const& bytes) +Optional Filter::decode_flate(ReadonlyBytes bytes) { // FIXME: The spec says Flate decoding is "based on" zlib, does that mean they // aren't exactly the same? @@ -139,37 +139,37 @@ Optional Filter::decode_flate(ReadonlyBytes const& bytes) return buff.value(); }; -Optional Filter::decode_run_length(ReadonlyBytes const&) +Optional Filter::decode_run_length(ReadonlyBytes) { // FIXME: Support RunLength decoding TODO(); }; -Optional Filter::decode_ccitt(ReadonlyBytes const&) +Optional Filter::decode_ccitt(ReadonlyBytes) { // FIXME: Support CCITT decoding TODO(); }; -Optional Filter::decode_jbig2(ReadonlyBytes const&) +Optional Filter::decode_jbig2(ReadonlyBytes) { // FIXME: Support JBIG2 decoding TODO(); }; -Optional Filter::decode_dct(ReadonlyBytes const&) +Optional Filter::decode_dct(ReadonlyBytes) { // FIXME: Support dct decoding TODO(); }; -Optional Filter::decode_jpx(ReadonlyBytes const&) +Optional Filter::decode_jpx(ReadonlyBytes) { // FIXME: Support JPX decoding TODO(); }; -Optional Filter::decode_crypt(ReadonlyBytes const&) +Optional Filter::decode_crypt(ReadonlyBytes) { // FIXME: Support Crypt decoding TODO(); diff --git a/Userland/Libraries/LibPDF/Filter.h b/Userland/Libraries/LibPDF/Filter.h index 490005c3a26..651d3090241 100644 --- a/Userland/Libraries/LibPDF/Filter.h +++ b/Userland/Libraries/LibPDF/Filter.h @@ -13,19 +13,19 @@ namespace PDF { class Filter { public: - static Optional decode(ReadonlyBytes const& bytes, FlyString const& encoding_type); + static Optional decode(ReadonlyBytes bytes, FlyString const& encoding_type); private: - static Optional decode_ascii_hex(ReadonlyBytes const& bytes); - static Optional decode_ascii85(ReadonlyBytes const& bytes); - static Optional decode_lzw(ReadonlyBytes const& bytes); - static Optional decode_flate(ReadonlyBytes const& bytes); - static Optional decode_run_length(ReadonlyBytes const& bytes); - static Optional decode_ccitt(ReadonlyBytes const& bytes); - static Optional decode_jbig2(ReadonlyBytes const& bytes); - static Optional decode_dct(ReadonlyBytes const& bytes); - static Optional decode_jpx(ReadonlyBytes const& bytes); - static Optional decode_crypt(ReadonlyBytes const& bytes); + static Optional decode_ascii_hex(ReadonlyBytes bytes); + static Optional decode_ascii85(ReadonlyBytes bytes); + static Optional decode_lzw(ReadonlyBytes bytes); + static Optional decode_flate(ReadonlyBytes bytes); + static Optional decode_run_length(ReadonlyBytes bytes); + static Optional decode_ccitt(ReadonlyBytes bytes); + static Optional decode_jbig2(ReadonlyBytes bytes); + static Optional decode_dct(ReadonlyBytes bytes); + static Optional decode_jpx(ReadonlyBytes bytes); + static Optional decode_crypt(ReadonlyBytes bytes); }; } diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.h b/Userland/Libraries/LibPDF/ObjectDerivatives.h index 9c230233612..ed19f2fb4d9 100644 --- a/Userland/Libraries/LibPDF/ObjectDerivatives.h +++ b/Userland/Libraries/LibPDF/ObjectDerivatives.h @@ -157,7 +157,7 @@ private: class PlainTextStreamObject final : public StreamObject { public: - PlainTextStreamObject(NonnullRefPtr const& dict, ReadonlyBytes const& bytes) + PlainTextStreamObject(NonnullRefPtr const& dict, ReadonlyBytes bytes) : StreamObject(dict) , m_bytes(bytes) { diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index a591060c47a..7565f6cd184 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -23,18 +23,18 @@ static NonnullRefPtr make_object(Args... args) requires(IsBaseOf) return adopt_ref(*new T(forward(args)...)); } -Vector Parser::parse_graphics_commands(ReadonlyBytes const& bytes) +Vector Parser::parse_graphics_commands(ReadonlyBytes bytes) { auto parser = adopt_ref(*new Parser(bytes)); return parser->parse_graphics_commands(); } -Parser::Parser(Badge, ReadonlyBytes const& bytes) +Parser::Parser(Badge, ReadonlyBytes bytes) : m_reader(bytes) { } -Parser::Parser(ReadonlyBytes const& bytes) +Parser::Parser(ReadonlyBytes bytes) : m_reader(bytes) { } @@ -408,7 +408,7 @@ RefPtr Parser::parse_file_trailer() return dict; } -Optional Parser::parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes) +Optional Parser::parse_page_offset_hint_table(ReadonlyBytes hint_stream_bytes) { if (hint_stream_bytes.size() < sizeof(PageOffsetHintTable)) return {}; @@ -456,7 +456,7 @@ Optional Parser::parse_page_offset_hint_table(Reado return hint_table; } -Optional> Parser::parse_all_page_offset_hint_table_entries(PageOffsetHintTable const& hint_table, ReadonlyBytes const& hint_stream_bytes) +Optional> Parser::parse_all_page_offset_hint_table_entries(PageOffsetHintTable const& hint_table, ReadonlyBytes hint_stream_bytes) { InputMemoryStream input_stream(hint_stream_bytes); input_stream.seek(sizeof(PageOffsetHintTable)); diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h index ac8aa3ff8f5..b19bc50bd80 100644 --- a/Userland/Libraries/LibPDF/Parser.h +++ b/Userland/Libraries/LibPDF/Parser.h @@ -24,9 +24,9 @@ public: Linearized, }; - static Vector parse_graphics_commands(ReadonlyBytes const&); + static Vector parse_graphics_commands(ReadonlyBytes); - Parser(Badge, ReadonlyBytes const&); + Parser(Badge, ReadonlyBytes); [[nodiscard]] ALWAYS_INLINE RefPtr const& trailer() const { return m_trailer; } void set_document(RefPtr const&); @@ -86,15 +86,15 @@ private: friend struct AK::Formatter; friend struct AK::Formatter; - explicit Parser(ReadonlyBytes const&); + explicit Parser(ReadonlyBytes); bool parse_header(); LinearizationResult initialize_linearization_dict(); bool initialize_linearized_xref_table(); bool initialize_non_linearized_xref_table(); bool initialize_hint_tables(); - Optional parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes); - Optional> parse_all_page_offset_hint_table_entries(PageOffsetHintTable const&, ReadonlyBytes const& hint_stream_bytes); + Optional parse_page_offset_hint_table(ReadonlyBytes hint_stream_bytes); + Optional> parse_all_page_offset_hint_table_entries(PageOffsetHintTable const&, ReadonlyBytes hint_stream_bytes); RefPtr parse_xref_table(); RefPtr parse_file_trailer(); diff --git a/Userland/Libraries/LibPDF/Reader.h b/Userland/Libraries/LibPDF/Reader.h index d8cd5f13c29..ba03af849c3 100644 --- a/Userland/Libraries/LibPDF/Reader.h +++ b/Userland/Libraries/LibPDF/Reader.h @@ -16,12 +16,12 @@ namespace PDF { class Reader { public: - explicit Reader(ReadonlyBytes const& bytes) + explicit Reader(ReadonlyBytes bytes) : m_bytes(bytes) { } - ALWAYS_INLINE ReadonlyBytes const& bytes() const { return m_bytes; } + ALWAYS_INLINE ReadonlyBytes bytes() const { return m_bytes; } ALWAYS_INLINE size_t offset() const { return m_offset; } bool done() const diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index d654fd4f626..b38ad699458 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -273,7 +273,7 @@ void TLSv12::ensure_hmac(size_t digest_size, bool local) m_hmac_remote = move(hmac); } -ByteBuffer TLSv12::hmac_message(const ReadonlyBytes& buf, const Optional buf2, size_t mac_length, bool local) +ByteBuffer TLSv12::hmac_message(ReadonlyBytes buf, const Optional 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); diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index 7f9629615b2..2ef51f0e4a6 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -395,7 +395,7 @@ private: void consume(ReadonlyBytes record); - ByteBuffer hmac_message(const ReadonlyBytes& buf, const Optional buf2, size_t mac_length, bool local = false); + ByteBuffer hmac_message(ReadonlyBytes buf, const Optional buf2, size_t mac_length, bool local = false); void ensure_hmac(size_t digest_size, bool local); void update_packet(ByteBuffer& packet); diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index ff997939184..4820d81fe64 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -1248,7 +1248,7 @@ void TerminalWidget::set_font_and_resize_to_fit(const Gfx::Font& font) // Used for sending data that was not directly typed by the user. // This basically wraps the code that handles sending the escape sequence in bracketed paste mode. -void TerminalWidget::send_non_user_input(const ReadonlyBytes& bytes) +void TerminalWidget::send_non_user_input(ReadonlyBytes bytes) { constexpr StringView leading_control_sequence = "\e[200~"; constexpr StringView trailing_control_sequence = "\e[201~"; diff --git a/Userland/Libraries/LibVT/TerminalWidget.h b/Userland/Libraries/LibVT/TerminalWidget.h index cc37a278fd6..1e7ab2e3e85 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.h +++ b/Userland/Libraries/LibVT/TerminalWidget.h @@ -128,7 +128,7 @@ private: void set_logical_focus(bool); - void send_non_user_input(const ReadonlyBytes&); + void send_non_user_input(ReadonlyBytes); Gfx::IntRect glyph_rect(u16 row, u16 column); Gfx::IntRect row_rect(u16 row);