mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +00:00
AK: Make ByteBuffer::try_* functions return ErrorOr<void>
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
This commit is contained in:
parent
88b6428c25
commit
a15ed8743d
20 changed files with 59 additions and 70 deletions
|
@ -143,8 +143,8 @@ ByteBuffer BMPWriter::dump(const RefPtr<Bitmap> bitmap, DibHeader dib_header)
|
|||
}
|
||||
}
|
||||
|
||||
if (!buffer.try_append(pixel_data.data(), pixel_data.size()))
|
||||
dbgln("Failed to write {} bytes of pixel data to buffer", pixel_data.size());
|
||||
if (auto result = buffer.try_append(pixel_data.data(), pixel_data.size()); result.is_error())
|
||||
dbgln("Failed to write {} bytes of pixel data to buffer: {}", pixel_data.size(), result.error());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue