summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPDF
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-11 01:06:34 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit80d4e830a0a95a41e3a3a6ccdc938fdfc4c7430b (patch)
tree80482418dd76af80034d5dc215db51c12ce27f67 /Userland/Libraries/LibPDF
parent8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (diff)
downloadserenity-80d4e830a0a95a41e3a3a6ccdc938fdfc4c7430b.zip
Everywhere: Pass AK::ReadonlyBytes by value
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r--Userland/Libraries/LibPDF/Document.cpp2
-rw-r--r--Userland/Libraries/LibPDF/Document.h2
-rw-r--r--Userland/Libraries/LibPDF/Filter.cpp22
-rw-r--r--Userland/Libraries/LibPDF/Filter.h22
-rw-r--r--Userland/Libraries/LibPDF/ObjectDerivatives.h2
-rw-r--r--Userland/Libraries/LibPDF/Parser.cpp10
-rw-r--r--Userland/Libraries/LibPDF/Parser.h10
-rw-r--r--Userland/Libraries/LibPDF/Reader.h4
8 files changed, 37 insertions, 37 deletions
diff --git a/Userland/Libraries/LibPDF/Document.cpp b/Userland/Libraries/LibPDF/Document.cpp
index b80b24b0f3..898223bdc4 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> 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));
diff --git a/Userland/Libraries/LibPDF/Document.h b/Userland/Libraries/LibPDF/Document.h
index 194b081e27..ddd26443cd 100644
--- a/Userland/Libraries/LibPDF/Document.h
+++ b/Userland/Libraries/LibPDF/Document.h
@@ -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; }
diff --git a/Userland/Libraries/LibPDF/Filter.cpp b/Userland/Libraries/LibPDF/Filter.cpp
index 597aa6d116..d521c3f210 100644
--- a/Userland/Libraries/LibPDF/Filter.cpp
+++ b/Userland/Libraries/LibPDF/Filter.cpp
@@ -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();
diff --git a/Userland/Libraries/LibPDF/Filter.h b/Userland/Libraries/LibPDF/Filter.h
index 490005c3a2..651d309024 100644
--- a/Userland/Libraries/LibPDF/Filter.h
+++ b/Userland/Libraries/LibPDF/Filter.h
@@ -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);
};
}
diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.h b/Userland/Libraries/LibPDF/ObjectDerivatives.h
index 9c23023361..ed19f2fb4d 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<DictObject> const& dict, ReadonlyBytes const& bytes)
+ PlainTextStreamObject(NonnullRefPtr<DictObject> const& dict, ReadonlyBytes bytes)
: StreamObject(dict)
, m_bytes(bytes)
{
diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp
index a591060c47..7565f6cd18 100644
--- a/Userland/Libraries/LibPDF/Parser.cpp
+++ b/Userland/Libraries/LibPDF/Parser.cpp
@@ -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));
diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h
index ac8aa3ff8f..b19bc50bd8 100644
--- a/Userland/Libraries/LibPDF/Parser.h
+++ b/Userland/Libraries/LibPDF/Parser.h
@@ -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();
diff --git a/Userland/Libraries/LibPDF/Reader.h b/Userland/Libraries/LibPDF/Reader.h
index d8cd5f13c2..ba03af849c 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