diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 17:57:32 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | e5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13 (patch) | |
tree | 6d90ea8a795e90f19f907a225c1ea166de960930 /Userland/Applications | |
parent | c70f45ff4498fcb7ce0671e9107ecff8009d7eb2 (diff) | |
download | serenity-e5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13.zip |
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while
Error::from_string_view does what Error::from_string_literal used to do:
taking StringViews. This change will remove the need to insert `sv`
after error strings when returning string literal errors once
StringView(char const*) is removed.
No functional changes.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/PixelPaint/Image.cpp | 10 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/Layer.cpp | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index dcfa39986f..07cb6200b8 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -30,7 +30,7 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_with_size(Gfx::IntSize const& si VERIFY(!size.is_empty()); if (size.width() > 16384 || size.height() > 16384) - return Error::from_string_literal("Image size too large"sv); + return Error::from_string_literal("Image size too large"); return adopt_nonnull_ref_or_enomem(new (nothrow) Image(size)); } @@ -62,16 +62,16 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Image::try_decode_bitmap(ReadonlyBytes bitma // FIXME: Find a way to avoid the memory copying here. auto maybe_decoded_image = client->decode_image(bitmap_data); if (!maybe_decoded_image.has_value()) - return Error::from_string_literal("Image decode failed"sv); + return Error::from_string_literal("Image decode failed"); // FIXME: Support multi-frame images? auto decoded_image = maybe_decoded_image.release_value(); if (decoded_image.frames.is_empty()) - return Error::from_string_literal("Image decode failed (no frames)"sv); + return Error::from_string_literal("Image decode failed (no frames)"); auto decoded_bitmap = decoded_image.frames.first().bitmap; if (decoded_bitmap.is_null()) - return Error::from_string_literal("Image decode failed (no bitmap for frame)"sv); + return Error::from_string_literal("Image decode failed (no bitmap for frame)"); return decoded_bitmap.release_nonnull(); } @@ -108,7 +108,7 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_pixel_paint_json(JsonObject auto height = layer_object.get("height").to_i32(); if (width != layer->size().width() || height != layer->size().height()) - return Error::from_string_literal("Decoded layer bitmap has wrong size"sv); + return Error::from_string_literal("Decoded layer bitmap has wrong size"); image->add_layer(*layer); diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp index d4e4fd0b7d..df74c14bc0 100644 --- a/Userland/Applications/PixelPaint/Layer.cpp +++ b/Userland/Applications/PixelPaint/Layer.cpp @@ -20,7 +20,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_size(Image& image, Gfx::Int VERIFY(!size.is_empty()); if (size.width() > 16384 || size.height() > 16384) - return Error::from_string_literal("Layer size too large"sv); + return Error::from_string_literal("Layer size too large"); auto bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size)); return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, move(bitmap), move(name))); @@ -31,7 +31,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_bitmap(Image& image, Nonnul VERIFY(!bitmap->size().is_empty()); if (bitmap->size().width() > 16384 || bitmap->size().height() > 16384) - return Error::from_string_literal("Layer size too large"sv); + return Error::from_string_literal("Layer size too large"); return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, bitmap, move(name))); } @@ -145,7 +145,7 @@ void Layer::erase_selection(Selection const& selection) ErrorOr<void> Layer::try_set_bitmaps(NonnullRefPtr<Gfx::Bitmap> content, RefPtr<Gfx::Bitmap> mask) { if (mask && content->size() != mask->size()) - return Error::from_string_literal("Layer content and mask must be same size"sv); + return Error::from_string_literal("Layer content and mask must be same size"); m_content_bitmap = move(content); m_mask_bitmap = move(mask); |