mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
LibPDF: Use make_object<>() to make objects
No behavior change.
This commit is contained in:
parent
9e1df152d9
commit
13641693cb
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/13641693cb Pull-request: https://github.com/SerenityOS/serenity/pull/22366
@ -113,7 +113,7 @@ static PDF::Value make_array(Vector<float> floats)
|
||||
Vector<PDF::Value> values;
|
||||
for (auto f : floats)
|
||||
values.append(PDF::Value { f });
|
||||
return PDF::Value { adopt_ref(*new PDF::ArrayObject(move(values))) };
|
||||
return PDF::Value { make_object<PDF::ArrayObject>(move(values)) };
|
||||
}
|
||||
|
||||
static PDF::PDFErrorOr<NonnullRefPtr<PDF::Function>> make_function(int type, ReadonlyBytes data, Vector<float> domain, Vector<float> range, Function<void(HashMap<DeprecatedFlyString, PDF::Value>&)> extra_keys = nullptr)
|
||||
@ -124,8 +124,8 @@ static PDF::PDFErrorOr<NonnullRefPtr<PDF::Function>> make_function(int type, Rea
|
||||
map.set(PDF::CommonNames::Range, make_array(move(range)));
|
||||
if (extra_keys)
|
||||
extra_keys(map);
|
||||
auto dict = adopt_ref(*new PDF::DictObject(move(map)));
|
||||
auto stream = adopt_ref(*new PDF::StreamObject(dict, MUST(ByteBuffer::copy(data))));
|
||||
auto dict = make_object<PDF::DictObject>(move(map));
|
||||
auto stream = make_object<PDF::StreamObject>(dict, MUST(ByteBuffer::copy(data)));
|
||||
|
||||
// document isn't used for anything, but UBSan complains about a (harmless) method call on a null object without it.
|
||||
auto file = MUST(Core::MappedFile::map("linearized.pdf"sv));
|
||||
|
@ -235,7 +235,7 @@ PDFErrorOr<Page> Document::get_page(u32 index)
|
||||
if (maybe_resources_object.has_value())
|
||||
resources = maybe_resources_object.value()->cast<DictObject>();
|
||||
else
|
||||
resources = adopt_ref(*new DictObject({}));
|
||||
resources = make_object<DictObject>(HashMap<DeprecatedFlyString, Value> {});
|
||||
|
||||
RefPtr<Object> contents;
|
||||
if (raw_page_object->contains(CommonNames::Contents))
|
||||
|
Loading…
Reference in New Issue
Block a user