mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
AK: Convert AK::Format formatting helpers to returning ErrorOr<void>
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
This commit is contained in:
parent
008355c222
commit
216e21a1fa
87 changed files with 450 additions and 448 deletions
|
@ -1187,7 +1187,7 @@ namespace AK {
|
|||
|
||||
template<>
|
||||
struct Formatter<PDF::Parser::LinearizationDictionary> : Formatter<StringView> {
|
||||
void format(FormatBuilder& format_builder, PDF::Parser::LinearizationDictionary const& dict)
|
||||
ErrorOr<void> format(FormatBuilder& format_builder, PDF::Parser::LinearizationDictionary const& dict)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("{\n");
|
||||
|
@ -1202,13 +1202,13 @@ struct Formatter<PDF::Parser::LinearizationDictionary> : Formatter<StringView> {
|
|||
builder.appendff(" offset_of_main_xref_table={}\n", dict.offset_of_main_xref_table);
|
||||
builder.appendff(" first_page={}\n", dict.first_page);
|
||||
builder.append('}');
|
||||
Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
return Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<PDF::Parser::PageOffsetHintTable> : Formatter<StringView> {
|
||||
void format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTable const& table)
|
||||
ErrorOr<void> format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTable const& table)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("{\n");
|
||||
|
@ -1226,13 +1226,13 @@ struct Formatter<PDF::Parser::PageOffsetHintTable> : Formatter<StringView> {
|
|||
builder.appendff(" bits_required_for_fraction_numerator={}\n", table.bits_required_for_fraction_numerator);
|
||||
builder.appendff(" shared_object_reference_fraction_denominator={}\n", table.shared_object_reference_fraction_denominator);
|
||||
builder.append('}');
|
||||
Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
return Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<PDF::Parser::PageOffsetHintTableEntry> : Formatter<StringView> {
|
||||
void format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTableEntry const& entry)
|
||||
ErrorOr<void> format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTableEntry const& entry)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("{\n");
|
||||
|
@ -1250,7 +1250,7 @@ struct Formatter<PDF::Parser::PageOffsetHintTableEntry> : Formatter<StringView>
|
|||
builder.appendff(" page_content_stream_offset_number={}\n", entry.page_content_stream_offset_number);
|
||||
builder.appendff(" page_content_stream_length_number={}\n", entry.page_content_stream_length_number);
|
||||
builder.append('}');
|
||||
Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
return Formatter<StringView>::format(format_builder, builder.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue