1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +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

@ -695,20 +695,20 @@ size_t GIFImageDecoderPlugin::frame_count()
ErrorOr<ImageFrameDescriptor> GIFImageDecoderPlugin::frame(size_t index)
{
if (m_context->error_state >= GIFLoadingContext::ErrorState::FailedToDecodeAnyFrame) {
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed"sv);
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed");
}
if (m_context->state < GIFLoadingContext::State::FrameDescriptorsLoaded) {
if (!load_gif_frame_descriptors(*m_context)) {
m_context->error_state = GIFLoadingContext::ErrorState::FailedToLoadFrameDescriptors;
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed"sv);
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed");
}
}
if (m_context->error_state == GIFLoadingContext::ErrorState::NoError && !decode_frame(*m_context, index)) {
if (m_context->state < GIFLoadingContext::State::FrameComplete || !decode_frame(*m_context, 0)) {
m_context->error_state = GIFLoadingContext::ErrorState::FailedToDecodeAnyFrame;
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed"sv);
return Error::from_string_literal("GIFImageDecoderPlugin: Decoding failed");
}
m_context->error_state = GIFLoadingContext::ErrorState::FailedToDecodeAllFrames;
}