1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:17:44 +00:00

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.
This commit is contained in:
sin-ack 2022-07-11 17:57:32 +00:00 committed by Andreas Kling
parent c70f45ff44
commit e5f09ea170
51 changed files with 282 additions and 261 deletions

View file

@ -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);