mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +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
|
@ -350,14 +350,14 @@ bool UnsignedBigInteger::operator>=(UnsignedBigInteger const& other) const
|
|||
|
||||
}
|
||||
|
||||
void AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::UnsignedBigInteger& value)
|
||||
ErrorOr<void> AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::UnsignedBigInteger& value)
|
||||
{
|
||||
if (value.is_invalid())
|
||||
return Formatter<StringView>::format(fmtbuilder, "invalid");
|
||||
|
||||
StringBuilder builder;
|
||||
for (int i = value.length() - 1; i >= 0; --i)
|
||||
builder.appendff("{}|", value.words()[i]);
|
||||
TRY(builder.try_appendff("{}|", value.words()[i]));
|
||||
|
||||
return Formatter<StringView>::format(fmtbuilder, builder.string_view());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue