summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/BMPWriter.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-10 14:33:44 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-10 21:58:58 +0100
commita15ed8743d03c6c683f19447be20ca7dac768485 (patch)
treefe3b808b4909686757dae5c4a949ba18fe7e5eba /Userland/Libraries/LibGfx/BMPWriter.cpp
parent88b6428c25ea046a4bb19bb6f3f68dd4f1439539 (diff)
downloadserenity-a15ed8743d03c6c683f19447be20ca7dac768485.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGfx/BMPWriter.cpp')
-rw-r--r--Userland/Libraries/LibGfx/BMPWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/BMPWriter.cpp b/Userland/Libraries/LibGfx/BMPWriter.cpp
index 87377707a1..e52f9d07f0 100644
--- a/Userland/Libraries/LibGfx/BMPWriter.cpp
+++ b/Userland/Libraries/LibGfx/BMPWriter.cpp
@@ -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;
}