mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Everywhere: Pass AK::ReadonlyBytes by value
This commit is contained in:
parent
8b1108e485
commit
80d4e830a0
Notes:
sideshowbarker
2024-07-18 01:17:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/80d4e830a0a
@ -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<void> try_append(ReadonlyBytes const& bytes)
|
||||
ErrorOr<void> try_append(ReadonlyBytes bytes)
|
||||
{
|
||||
return try_append(bytes.data(), bytes.size());
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ requires(HasFormatter<T>) struct Formatter<Vector<T>> : StandardFormatter {
|
||||
|
||||
template<>
|
||||
struct Formatter<ReadonlyBytes> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, ReadonlyBytes const& value)
|
||||
void format(FormatBuilder& builder, ReadonlyBytes value)
|
||||
{
|
||||
if (m_mode == Mode::Pointer) {
|
||||
Formatter<FlatPtr> formatter { *this };
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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> Zip::try_create(const ReadonlyBytes& buffer)
|
||||
Optional<Zip> 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))
|
||||
|
@ -207,11 +207,11 @@ struct ZipMember {
|
||||
|
||||
class Zip {
|
||||
public:
|
||||
static Optional<Zip> try_create(const ReadonlyBytes& buffer);
|
||||
static Optional<Zip> try_create(ReadonlyBytes buffer);
|
||||
bool for_each_member(Function<IterationDecision(const ZipMember&)>);
|
||||
|
||||
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 };
|
||||
|
@ -1052,7 +1052,7 @@ void DeflateCompressor::final_flush()
|
||||
flush();
|
||||
}
|
||||
|
||||
Optional<ByteBuffer> DeflateCompressor::compress_all(const ReadonlyBytes& bytes, CompressionLevel compression_level)
|
||||
Optional<ByteBuffer> DeflateCompressor::compress_all(ReadonlyBytes bytes, CompressionLevel compression_level)
|
||||
{
|
||||
DuplexMemoryStream output_stream;
|
||||
DeflateCompressor deflate_stream { output_stream, compression_level };
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
bool write_or_error(ReadonlyBytes) override;
|
||||
void final_flush();
|
||||
|
||||
static Optional<ByteBuffer> compress_all(const ReadonlyBytes& bytes, CompressionLevel = CompressionLevel::GOOD);
|
||||
static Optional<ByteBuffer> compress_all(ReadonlyBytes bytes, CompressionLevel = CompressionLevel::GOOD);
|
||||
|
||||
private:
|
||||
Bytes pending_block() { return { m_rolling_window + block_size, block_size }; }
|
||||
|
@ -261,7 +261,7 @@ bool GzipCompressor::write_or_error(ReadonlyBytes bytes)
|
||||
return true;
|
||||
}
|
||||
|
||||
Optional<ByteBuffer> GzipCompressor::compress_all(const ReadonlyBytes& bytes)
|
||||
Optional<ByteBuffer> GzipCompressor::compress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
DuplexMemoryStream output_stream;
|
||||
GzipCompressor gzip_stream { output_stream };
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
size_t write(ReadonlyBytes) override;
|
||||
bool write_or_error(ReadonlyBytes) override;
|
||||
|
||||
static Optional<ByteBuffer> compress_all(const ReadonlyBytes& bytes);
|
||||
static Optional<ByteBuffer> compress_all(ReadonlyBytes bytes);
|
||||
|
||||
private:
|
||||
OutputStream& m_output_stream;
|
||||
|
@ -41,7 +41,7 @@ Optional<Zlib> Zlib::try_create(ReadonlyBytes data)
|
||||
return zlib;
|
||||
}
|
||||
|
||||
Zlib::Zlib(const ReadonlyBytes& data)
|
||||
Zlib::Zlib(ReadonlyBytes data)
|
||||
: m_input_data(data)
|
||||
{
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
static Optional<ByteBuffer> decompress_all(ReadonlyBytes);
|
||||
|
||||
private:
|
||||
Zlib(const ReadonlyBytes& data);
|
||||
Zlib(ReadonlyBytes data);
|
||||
|
||||
u8 m_compression_method;
|
||||
u8 m_compression_info;
|
||||
|
@ -137,7 +137,7 @@ String guess_mime_type_based_on_filename(StringView path)
|
||||
ENUMERATE_HEADER_CONTENTS
|
||||
#undef __ENUMERATE_MIME_TYPE_HEADER
|
||||
|
||||
Optional<String> guess_mime_type_based_on_sniffed_bytes(const ReadonlyBytes& bytes)
|
||||
Optional<String> 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<ssize_t>(bytes.size()) >= pattern_offset && bytes.slice(pattern_offset).starts_with(var_name)) \
|
||||
|
@ -49,6 +49,6 @@ private:
|
||||
|
||||
String guess_mime_type_based_on_filename(StringView);
|
||||
|
||||
Optional<String> guess_mime_type_based_on_sniffed_bytes(const ReadonlyBytes&);
|
||||
Optional<String> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes);
|
||||
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ Reader::Reader(ReadonlyBytes coredump_bytes)
|
||||
VERIFY(m_notes_segment_index != -1);
|
||||
}
|
||||
|
||||
Optional<ByteBuffer> Reader::decompress_coredump(const ReadonlyBytes& raw_coredump)
|
||||
Optional<ByteBuffer> Reader::decompress_coredump(ReadonlyBytes raw_coredump)
|
||||
{
|
||||
auto decompressed_coredump = Compress::GzipDecompressor::decompress_all(raw_coredump);
|
||||
if (!decompressed_coredump.has_value())
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
explicit Reader(ByteBuffer);
|
||||
explicit Reader(NonnullRefPtr<MappedFile>);
|
||||
|
||||
static Optional<ByteBuffer> decompress_coredump(const ReadonlyBytes&);
|
||||
static Optional<ByteBuffer> decompress_coredump(ReadonlyBytes);
|
||||
|
||||
class NotesEntryIterator {
|
||||
public:
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
|
@ -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()); };
|
||||
|
||||
|
@ -111,7 +111,7 @@ RefPtr<Gfx::Bitmap> Clipboard::bitmap() const
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void Clipboard::set_data(ReadonlyBytes const& data, String const& type, HashMap<String, String> const& metadata)
|
||||
void Clipboard::set_data(ReadonlyBytes data, String const& type, HashMap<String, String> const& metadata)
|
||||
{
|
||||
auto buffer_or_error = Core::AnonymousBuffer::create_with_size(data.size());
|
||||
if (buffer_or_error.is_error()) {
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
String mime_type() const { return data_and_type().mime_type; }
|
||||
RefPtr<Gfx::Bitmap> bitmap() const;
|
||||
|
||||
void set_data(ReadonlyBytes const& data, String const& mime_type = "text/plain", HashMap<String, String> const& metadata = {});
|
||||
void set_data(ReadonlyBytes data, String const& mime_type = "text/plain", HashMap<String, String> const& metadata = {});
|
||||
void set_plain_text(String const& text) { set_data(text.bytes()); }
|
||||
void set_bitmap(Gfx::Bitmap const&);
|
||||
void clear();
|
||||
|
@ -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> Cmap::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Cmap> Cmap::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
if (slice.size() < (size_t)Sizes::TableHeader) {
|
||||
return {};
|
||||
|
@ -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<Cmap> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Cmap> from_slice(ReadonlyBytes);
|
||||
u32 num_subtables() const;
|
||||
Optional<Subtable> 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)
|
||||
{
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ u32 tag_from_str(char const* str)
|
||||
return be_u32((u8 const*)str);
|
||||
}
|
||||
|
||||
Optional<Head> Head::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Head> 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> Hhea::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Hhea> 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> Maxp::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Maxp> 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> Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32 number_of_h_metrics)
|
||||
Optional<Hmtx> 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> Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32
|
||||
return Hmtx(slice, num_glyphs, number_of_h_metrics);
|
||||
}
|
||||
|
||||
Optional<Name> Name::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Name> Name::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
return Name(slice);
|
||||
}
|
||||
|
@ -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> Loca::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format)
|
||||
Optional<Loca> 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;
|
||||
|
@ -30,11 +30,11 @@ private:
|
||||
|
||||
class Loca {
|
||||
public:
|
||||
static Optional<Loca> from_slice(ReadonlyBytes const&, u32 num_glyphs, IndexToLocFormat);
|
||||
static Optional<Loca> 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)
|
||||
{
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ enum class IndexToLocFormat {
|
||||
|
||||
class Head {
|
||||
public:
|
||||
static Optional<Head> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Head> 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<Hhea> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Hhea> 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<Maxp> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Maxp> 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<Hmtx> from_slice(ReadonlyBytes const&, u32 num_glyphs, u32 number_of_h_metrics);
|
||||
static Optional<Hmtx> 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<Name> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Name> 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)
|
||||
{
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void Client::die()
|
||||
on_death();
|
||||
}
|
||||
|
||||
Optional<DecodedImage> Client::decode_image(const ReadonlyBytes& encoded_data)
|
||||
Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data)
|
||||
{
|
||||
if (encoded_data.is_empty())
|
||||
return {};
|
||||
|
@ -30,7 +30,7 @@ class Client final
|
||||
C_OBJECT(Client);
|
||||
|
||||
public:
|
||||
Optional<DecodedImage> decode_image(const ReadonlyBytes&);
|
||||
Optional<DecodedImage> decode_image(ReadonlyBytes);
|
||||
|
||||
Function<void()> on_death;
|
||||
|
||||
|
@ -34,7 +34,7 @@ String OutlineItem::to_string(int indent) const
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
RefPtr<Document> Document::create(ReadonlyBytes const& bytes)
|
||||
RefPtr<Document> Document::create(ReadonlyBytes bytes)
|
||||
{
|
||||
auto parser = adopt_ref(*new Parser({}, bytes));
|
||||
auto document = adopt_ref(*new Document(parser));
|
||||
|
@ -72,7 +72,7 @@ struct OutlineDict final : public RefCounted<OutlineDict> {
|
||||
|
||||
class Document final : public RefCounted<Document> {
|
||||
public:
|
||||
static RefPtr<Document> create(ReadonlyBytes const& bytes);
|
||||
static RefPtr<Document> create(ReadonlyBytes bytes);
|
||||
|
||||
ALWAYS_INLINE RefPtr<OutlineDict> const& outline() const { return m_outline; }
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace PDF {
|
||||
|
||||
Optional<ByteBuffer> Filter::decode(ReadonlyBytes const& bytes, FlyString const& encoding_type)
|
||||
Optional<ByteBuffer> Filter::decode(ReadonlyBytes bytes, FlyString const& encoding_type)
|
||||
{
|
||||
if (encoding_type == CommonNames::ASCIIHexDecode)
|
||||
return decode_ascii_hex(bytes);
|
||||
@ -37,7 +37,7 @@ Optional<ByteBuffer> Filter::decode(ReadonlyBytes const& bytes, FlyString const&
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes const& bytes)
|
||||
Optional<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes bytes)
|
||||
{
|
||||
if (bytes.size() % 2 == 0)
|
||||
return decode_hex(bytes);
|
||||
@ -68,7 +68,7 @@ Optional<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes const& bytes)
|
||||
return { move(output) };
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_ascii85(ReadonlyBytes const& bytes)
|
||||
Optional<ByteBuffer> Filter::decode_ascii85(ReadonlyBytes bytes)
|
||||
{
|
||||
Vector<u8> buff;
|
||||
buff.ensure_capacity(bytes.size());
|
||||
@ -123,13 +123,13 @@ Optional<ByteBuffer> Filter::decode_ascii85(ReadonlyBytes const& bytes)
|
||||
return ByteBuffer::copy(buff.span());
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_lzw(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_lzw(ReadonlyBytes)
|
||||
{
|
||||
dbgln("LZW decoding is not supported");
|
||||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_flate(ReadonlyBytes const& bytes)
|
||||
Optional<ByteBuffer> 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<ByteBuffer> Filter::decode_flate(ReadonlyBytes const& bytes)
|
||||
return buff.value();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_run_length(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_run_length(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support RunLength decoding
|
||||
TODO();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_ccitt(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_ccitt(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support CCITT decoding
|
||||
TODO();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_jbig2(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_jbig2(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support JBIG2 decoding
|
||||
TODO();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_dct(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_dct(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support dct decoding
|
||||
TODO();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_jpx(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_jpx(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support JPX decoding
|
||||
TODO();
|
||||
};
|
||||
|
||||
Optional<ByteBuffer> Filter::decode_crypt(ReadonlyBytes const&)
|
||||
Optional<ByteBuffer> Filter::decode_crypt(ReadonlyBytes)
|
||||
{
|
||||
// FIXME: Support Crypt decoding
|
||||
TODO();
|
||||
|
@ -13,19 +13,19 @@ namespace PDF {
|
||||
|
||||
class Filter {
|
||||
public:
|
||||
static Optional<ByteBuffer> decode(ReadonlyBytes const& bytes, FlyString const& encoding_type);
|
||||
static Optional<ByteBuffer> decode(ReadonlyBytes bytes, FlyString const& encoding_type);
|
||||
|
||||
private:
|
||||
static Optional<ByteBuffer> decode_ascii_hex(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_ascii85(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_lzw(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_flate(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_run_length(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_ccitt(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_jbig2(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_dct(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_jpx(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_crypt(ReadonlyBytes const& bytes);
|
||||
static Optional<ByteBuffer> decode_ascii_hex(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_ascii85(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_lzw(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_flate(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_run_length(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_ccitt(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_jbig2(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_dct(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_jpx(ReadonlyBytes bytes);
|
||||
static Optional<ByteBuffer> decode_crypt(ReadonlyBytes bytes);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ private:
|
||||
|
||||
class PlainTextStreamObject final : public StreamObject {
|
||||
public:
|
||||
PlainTextStreamObject(NonnullRefPtr<DictObject> const& dict, ReadonlyBytes const& bytes)
|
||||
PlainTextStreamObject(NonnullRefPtr<DictObject> const& dict, ReadonlyBytes bytes)
|
||||
: StreamObject(dict)
|
||||
, m_bytes(bytes)
|
||||
{
|
||||
|
@ -23,18 +23,18 @@ static NonnullRefPtr<T> make_object(Args... args) requires(IsBaseOf<Object, T>)
|
||||
return adopt_ref(*new T(forward<Args>(args)...));
|
||||
}
|
||||
|
||||
Vector<Command> Parser::parse_graphics_commands(ReadonlyBytes const& bytes)
|
||||
Vector<Command> Parser::parse_graphics_commands(ReadonlyBytes bytes)
|
||||
{
|
||||
auto parser = adopt_ref(*new Parser(bytes));
|
||||
return parser->parse_graphics_commands();
|
||||
}
|
||||
|
||||
Parser::Parser(Badge<Document>, ReadonlyBytes const& bytes)
|
||||
Parser::Parser(Badge<Document>, ReadonlyBytes bytes)
|
||||
: m_reader(bytes)
|
||||
{
|
||||
}
|
||||
|
||||
Parser::Parser(ReadonlyBytes const& bytes)
|
||||
Parser::Parser(ReadonlyBytes bytes)
|
||||
: m_reader(bytes)
|
||||
{
|
||||
}
|
||||
@ -408,7 +408,7 @@ RefPtr<DictObject> Parser::parse_file_trailer()
|
||||
return dict;
|
||||
}
|
||||
|
||||
Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes)
|
||||
Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(ReadonlyBytes hint_stream_bytes)
|
||||
{
|
||||
if (hint_stream_bytes.size() < sizeof(PageOffsetHintTable))
|
||||
return {};
|
||||
@ -456,7 +456,7 @@ Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(Reado
|
||||
return hint_table;
|
||||
}
|
||||
|
||||
Optional<Vector<Parser::PageOffsetHintTableEntry>> Parser::parse_all_page_offset_hint_table_entries(PageOffsetHintTable const& hint_table, ReadonlyBytes const& hint_stream_bytes)
|
||||
Optional<Vector<Parser::PageOffsetHintTableEntry>> 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));
|
||||
|
@ -24,9 +24,9 @@ public:
|
||||
Linearized,
|
||||
};
|
||||
|
||||
static Vector<Command> parse_graphics_commands(ReadonlyBytes const&);
|
||||
static Vector<Command> parse_graphics_commands(ReadonlyBytes);
|
||||
|
||||
Parser(Badge<Document>, ReadonlyBytes const&);
|
||||
Parser(Badge<Document>, ReadonlyBytes);
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE RefPtr<DictObject> const& trailer() const { return m_trailer; }
|
||||
void set_document(RefPtr<Document> const&);
|
||||
@ -86,15 +86,15 @@ private:
|
||||
friend struct AK::Formatter<PageOffsetHintTable>;
|
||||
friend struct AK::Formatter<PageOffsetHintTableEntry>;
|
||||
|
||||
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<PageOffsetHintTable> parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes);
|
||||
Optional<Vector<PageOffsetHintTableEntry>> parse_all_page_offset_hint_table_entries(PageOffsetHintTable const&, ReadonlyBytes const& hint_stream_bytes);
|
||||
Optional<PageOffsetHintTable> parse_page_offset_hint_table(ReadonlyBytes hint_stream_bytes);
|
||||
Optional<Vector<PageOffsetHintTableEntry>> parse_all_page_offset_hint_table_entries(PageOffsetHintTable const&, ReadonlyBytes hint_stream_bytes);
|
||||
RefPtr<XRefTable> parse_xref_table();
|
||||
RefPtr<DictObject> parse_file_trailer();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<ReadonlyBytes> buf2, size_t mac_length, bool local)
|
||||
ByteBuffer TLSv12::hmac_message(ReadonlyBytes buf, const Optional<ReadonlyBytes> 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);
|
||||
|
@ -395,7 +395,7 @@ private:
|
||||
|
||||
void consume(ReadonlyBytes record);
|
||||
|
||||
ByteBuffer hmac_message(const ReadonlyBytes& buf, const Optional<ReadonlyBytes> buf2, size_t mac_length, bool local = false);
|
||||
ByteBuffer hmac_message(ReadonlyBytes buf, const Optional<ReadonlyBytes> buf2, size_t mac_length, bool local = false);
|
||||
void ensure_hmac(size_t digest_size, bool local);
|
||||
|
||||
void update_packet(ByteBuffer& packet);
|
||||
|
@ -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~";
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user