Everywhere: Convert from_string_view -> from_string_literal where static

This commit is contained in:
Asutosh Variar 2024-09-05 15:06:15 +04:00 committed by Sam Atkins
parent 37e0f7b381
commit 229b64a4b7
Notes: github-actions[bot] 2024-09-11 09:59:55 +00:00
26 changed files with 80 additions and 80 deletions

View file

@ -25,7 +25,7 @@ static ErrorOr<ByteString> find_certificates(StringView serenity_resource_root)
{ {
auto cert_path = ByteString::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root); auto cert_path = ByteString::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root);
if (!FileSystem::exists(cert_path)) if (!FileSystem::exists(cert_path))
return Error::from_string_view("Don't know how to load certs!"sv); return Error::from_string_literal("Don't know how to load certs!");
return cert_path; return cert_path;
} }

View file

@ -41,18 +41,18 @@ AutoComplete::AutoComplete(QWidget* parent)
ErrorOr<Vector<String>> AutoComplete::parse_google_autocomplete(Vector<JsonValue> const& json) ErrorOr<Vector<String>> AutoComplete::parse_google_autocomplete(Vector<JsonValue> const& json)
{ {
if (json.size() != 5) if (json.size() != 5)
return Error::from_string_view("Invalid JSON, expected 5 elements in array"sv); return Error::from_string_literal("Invalid JSON, expected 5 elements in array");
if (!json[0].is_string()) if (!json[0].is_string())
return Error::from_string_view("Invalid JSON, expected first element to be a string"sv); return Error::from_string_literal("Invalid JSON, expected first element to be a string");
auto query = TRY(String::from_byte_string(json[0].as_string())); auto query = TRY(String::from_byte_string(json[0].as_string()));
if (!json[1].is_array()) if (!json[1].is_array())
return Error::from_string_view("Invalid JSON, expected second element to be an array"sv); return Error::from_string_literal("Invalid JSON, expected second element to be an array");
auto suggestions_array = json[1].as_array().values(); auto suggestions_array = json[1].as_array().values();
if (query != m_query) if (query != m_query)
return Error::from_string_view("Invalid JSON, query does not match"sv); return Error::from_string_literal("Invalid JSON, query does not match");
Vector<String> results; Vector<String> results;
results.ensure_capacity(suggestions_array.size()); results.ensure_capacity(suggestions_array.size());
@ -86,13 +86,13 @@ ErrorOr<Vector<String>> AutoComplete::parse_yahoo_autocomplete(JsonObject const&
auto suggestions_object = json.get("r"sv)->as_array().values(); auto suggestions_object = json.get("r"sv)->as_array().values();
if (query != m_query) if (query != m_query)
return Error::from_string_view("Invalid JSON, query does not match"sv); return Error::from_string_literal("Invalid JSON, query does not match");
Vector<String> results; Vector<String> results;
results.ensure_capacity(suggestions_object.size()); results.ensure_capacity(suggestions_object.size());
for (auto& suggestion_object : suggestions_object) { for (auto& suggestion_object : suggestions_object) {
if (!suggestion_object.is_object()) if (!suggestion_object.is_object())
return Error::from_string_view("Invalid JSON, expected value to be an object"sv); return Error::from_string_literal("Invalid JSON, expected value to be an object");
auto suggestion = suggestion_object.as_object(); auto suggestion = suggestion_object.as_object();
if (!suggestion.get("k"sv).has_value() || !suggestion.get("k"sv)->is_string()) if (!suggestion.get("k"sv).has_value() || !suggestion.get("k"sv)->is_string())
@ -121,7 +121,7 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
} else if (engine_name == "Yahoo") } else if (engine_name == "Yahoo")
results = TRY(parse_yahoo_autocomplete(json.as_object())); results = TRY(parse_yahoo_autocomplete(json.as_object()));
else { else {
return Error::from_string_view("Invalid engine name"sv); return Error::from_string_literal("Invalid engine name");
} }
constexpr size_t MAX_AUTOCOMPLETE_RESULTS = 6; constexpr size_t MAX_AUTOCOMPLETE_RESULTS = 6;

View file

@ -28,7 +28,7 @@ static ErrorOr<ByteString> find_certificates(StringView serenity_resource_root)
{ {
auto cert_path = ByteString::formatted("{}/ladybird/cacert.pem", serenity_resource_root); auto cert_path = ByteString::formatted("{}/ladybird/cacert.pem", serenity_resource_root);
if (!FileSystem::exists(cert_path)) if (!FileSystem::exists(cert_path))
return Error::from_string_view("Don't know how to load certs!"sv); return Error::from_string_literal("Don't know how to load certs!");
return cert_path; return cert_path;
} }

View file

@ -334,7 +334,7 @@ TEST_CASE(fallible_json_object_for_each)
})); }));
auto result1 = object.try_for_each_member([](auto const&, auto const&) -> ErrorOr<void> { auto result1 = object.try_for_each_member([](auto const&, auto const&) -> ErrorOr<void> {
return Error::from_string_view("nanananana"sv); return Error::from_string_literal("nanananana");
}); });
EXPECT(result1.is_error()); EXPECT(result1.is_error());
EXPECT_EQ(result1.error().string_literal(), "nanananana"sv); EXPECT_EQ(result1.error().string_literal(), "nanananana"sv);
@ -374,7 +374,7 @@ TEST_CASE(fallible_json_array_for_each)
})); }));
auto result1 = array.try_for_each([](auto const&) -> ErrorOr<void> { auto result1 = array.try_for_each([](auto const&) -> ErrorOr<void> {
return Error::from_string_view("nanananana"sv); return Error::from_string_literal("nanananana");
}); });
EXPECT(result1.is_error()); EXPECT(result1.is_error());
EXPECT_EQ(result1.error().string_literal(), "nanananana"sv); EXPECT_EQ(result1.error().string_literal(), "nanananana"sv);

View file

@ -40,7 +40,7 @@ FlacWriter::~FlacWriter()
ErrorOr<void> FlacWriter::finalize() ErrorOr<void> FlacWriter::finalize()
{ {
if (m_state == WriteState::FullyFinalized) if (m_state == WriteState::FullyFinalized)
return Error::from_string_view("File is already finalized"sv); return Error::from_string_literal("File is already finalized");
if (m_state == WriteState::HeaderUnwritten) if (m_state == WriteState::HeaderUnwritten)
TRY(finalize_header_format()); TRY(finalize_header_format());
@ -74,7 +74,7 @@ ErrorOr<void> FlacWriter::finalize()
ErrorOr<void> FlacWriter::finalize_header_format() ErrorOr<void> FlacWriter::finalize_header_format()
{ {
if (m_state != WriteState::HeaderUnwritten) if (m_state != WriteState::HeaderUnwritten)
return Error::from_string_view("Header format is already finalized"sv); return Error::from_string_literal("Header format is already finalized");
TRY(write_header()); TRY(write_header());
m_state = WriteState::FormatFinalized; m_state = WriteState::FormatFinalized;
return {}; return {};
@ -83,9 +83,9 @@ ErrorOr<void> FlacWriter::finalize_header_format()
ErrorOr<void> FlacWriter::set_num_channels(u8 num_channels) ErrorOr<void> FlacWriter::set_num_channels(u8 num_channels)
{ {
if (m_state != WriteState::HeaderUnwritten) if (m_state != WriteState::HeaderUnwritten)
return Error::from_string_view("Header format is already finalized"sv); return Error::from_string_literal("Header format is already finalized");
if (num_channels > 8) if (num_channels > 8)
return Error::from_string_view("FLAC doesn't support more than 8 channels"sv); return Error::from_string_literal("FLAC doesn't support more than 8 channels");
m_num_channels = num_channels; m_num_channels = num_channels;
return {}; return {};
@ -94,7 +94,7 @@ ErrorOr<void> FlacWriter::set_num_channels(u8 num_channels)
ErrorOr<void> FlacWriter::set_sample_rate(u32 sample_rate) ErrorOr<void> FlacWriter::set_sample_rate(u32 sample_rate)
{ {
if (m_state != WriteState::HeaderUnwritten) if (m_state != WriteState::HeaderUnwritten)
return Error::from_string_view("Header format is already finalized"sv); return Error::from_string_literal("Header format is already finalized");
m_sample_rate = sample_rate; m_sample_rate = sample_rate;
return {}; return {};
@ -103,9 +103,9 @@ ErrorOr<void> FlacWriter::set_sample_rate(u32 sample_rate)
ErrorOr<void> FlacWriter::set_bits_per_sample(u16 bits_per_sample) ErrorOr<void> FlacWriter::set_bits_per_sample(u16 bits_per_sample)
{ {
if (m_state != WriteState::HeaderUnwritten) if (m_state != WriteState::HeaderUnwritten)
return Error::from_string_view("Header format is already finalized"sv); return Error::from_string_literal("Header format is already finalized");
if (bits_per_sample < 8 || bits_per_sample > 32) if (bits_per_sample < 8 || bits_per_sample > 32)
return Error::from_string_view("FLAC only supports bits per sample between 8 and 32"sv); return Error::from_string_literal("FLAC only supports bits per sample between 8 and 32");
m_bits_per_sample = bits_per_sample; m_bits_per_sample = bits_per_sample;
return {}; return {};
@ -246,7 +246,7 @@ ErrorOr<void> FlacWriter::write_header()
ErrorOr<void> FlacWriter::add_metadata_block(FlacRawMetadataBlock block, Optional<size_t> insertion_index) ErrorOr<void> FlacWriter::add_metadata_block(FlacRawMetadataBlock block, Optional<size_t> insertion_index)
{ {
if (m_state != WriteState::HeaderUnwritten) if (m_state != WriteState::HeaderUnwritten)
return Error::from_string_view("Metadata blocks can only be added before the header is finalized"sv); return Error::from_string_literal("Metadata blocks can only be added before the header is finalized");
if (insertion_index.has_value()) if (insertion_index.has_value())
TRY(m_cached_metadata_blocks.try_insert(insertion_index.value(), move(block))); TRY(m_cached_metadata_blocks.try_insert(insertion_index.value(), move(block)));
@ -260,11 +260,11 @@ ErrorOr<void> FlacWriter::write_metadata_block(FlacRawMetadataBlock& block)
{ {
if (m_state == WriteState::FormatFinalized) { if (m_state == WriteState::FormatFinalized) {
if (!m_last_padding.has_value()) if (!m_last_padding.has_value())
return Error::from_string_view("No (more) padding available to write block into"sv); return Error::from_string_literal("No (more) padding available to write block into");
auto const last_padding = m_last_padding.release_value(); auto const last_padding = m_last_padding.release_value();
if (block.length > last_padding.size) if (block.length > last_padding.size)
return Error::from_string_view("Late metadata block doesn't fit in available padding"sv); return Error::from_string_literal("Late metadata block doesn't fit in available padding");
auto const current_position = TRY(m_stream->tell()); auto const current_position = TRY(m_stream->tell());
ScopeGuard guard = [&] { (void)m_stream->seek(current_position, SeekMode::SetPosition); }; ScopeGuard guard = [&] { (void)m_stream->seek(current_position, SeekMode::SetPosition); };
@ -294,7 +294,7 @@ ErrorOr<void> FlacWriter::write_metadata_block(FlacRawMetadataBlock& block)
}; };
TRY(m_stream->write_value(new_padding_block)); TRY(m_stream->write_value(new_padding_block));
} else if (new_size != 0) { } else if (new_size != 0) {
return Error::from_string_view("Remaining padding is not divisible by 4, there will be some stray zero bytes!"sv); return Error::from_string_literal("Remaining padding is not divisible by 4, there will be some stray zero bytes!");
} }
return {}; return {};
@ -482,7 +482,7 @@ ErrorOr<void> FlacFrameHeader::write_to_stream(Stream& stream) const
ErrorOr<void> FlacWriter::write_samples(ReadonlySpan<Sample> samples) ErrorOr<void> FlacWriter::write_samples(ReadonlySpan<Sample> samples)
{ {
if (m_state == WriteState::FullyFinalized) if (m_state == WriteState::FullyFinalized)
return Error::from_string_view("File is already finalized"sv); return Error::from_string_literal("File is already finalized");
auto remaining_samples = samples; auto remaining_samples = samples;
while (remaining_samples.size() > 0) { while (remaining_samples.size() > 0) {

View file

@ -26,7 +26,7 @@ template<ArrayLike<i64> ChannelType, ArrayLike<ChannelType> InputType>
ErrorOr<FixedArray<Sample>> downmix_surround_to_stereo(InputType const& input, float sample_scale_factor) ErrorOr<FixedArray<Sample>> downmix_surround_to_stereo(InputType const& input, float sample_scale_factor)
{ {
if (input.size() == 0) if (input.size() == 0)
return Error::from_string_view("Cannot resample from 0 channels"sv); return Error::from_string_literal("Cannot resample from 0 channels");
auto channel_count = input.size(); auto channel_count = input.size();
auto sample_count = input[0].size(); auto sample_count = input[0].size();
@ -94,7 +94,7 @@ ErrorOr<FixedArray<Sample>> downmix_surround_to_stereo(InputType const& input, f
} }
break; break;
default: default:
return Error::from_string_view("Invalid number of channels greater than 8"sv); return Error::from_string_literal("Invalid number of channels greater than 8");
} }
return output; return output;

View file

@ -33,7 +33,7 @@ static ErrorOr<void> read_vorbis_field(Metadata& metadata_to_write_into, String
auto field_name_and_contents = TRY(unparsed_user_comment.split_limit('=', 2)); auto field_name_and_contents = TRY(unparsed_user_comment.split_limit('=', 2));
if (field_name_and_contents.size() != 2) if (field_name_and_contents.size() != 2)
return Error::from_string_view("User comment does not contain '='"sv); return Error::from_string_literal("User comment does not contain '='");
auto contents = field_name_and_contents.take_last(); auto contents = field_name_and_contents.take_last();
auto field_name = TRY(field_name_and_contents.take_first().to_uppercase()); auto field_name = TRY(field_name_and_contents.take_first().to_uppercase());

View file

@ -299,7 +299,7 @@ ErrorOr<bool> Process::is_being_debugged()
# endif # endif
#endif #endif
// FIXME: Implement this for more platforms. // FIXME: Implement this for more platforms.
return Error::from_string_view("Platform does not support checking for debugger"sv); return Error::from_string_literal("Platform does not support checking for debugger");
} }
// Forces the process to sleep until a debugger is attached, then breaks. // Forces the process to sleep until a debugger is attached, then breaks.

View file

@ -59,7 +59,7 @@ ErrorOr<NonnullRefPtr<Resource>> ResourceImplementation::load_from_uri(StringVie
} }
dbgln("ResourceImplementation: Unknown scheme for {}", uri); dbgln("ResourceImplementation: Unknown scheme for {}", uri);
return Error::from_string_view("Invalid scheme"sv); return Error::from_string_literal("Invalid scheme");
} }
Vector<String> ResourceImplementation::child_names(Resource const& resource) Vector<String> ResourceImplementation::child_names(Resource const& resource)

View file

@ -1825,16 +1825,16 @@ ErrorOr<ByteString> current_executable_path()
for (int32 cookie { 0 }; get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK && info.type != B_APP_IMAGE;) for (int32 cookie { 0 }; get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK && info.type != B_APP_IMAGE;)
; ;
if (info.type != B_APP_IMAGE) if (info.type != B_APP_IMAGE)
return Error::from_string_view("current_executable_path() failed"sv); return Error::from_string_literal("current_executable_path() failed");
if (sizeof(info.name) > sizeof(path)) if (sizeof(info.name) > sizeof(path))
return Error::from_errno(ENAMETOOLONG); return Error::from_errno(ENAMETOOLONG);
strlcpy(path, info.name, sizeof(path) - 1); strlcpy(path, info.name, sizeof(path) - 1);
#elif defined(AK_OS_EMSCRIPTEN) #elif defined(AK_OS_EMSCRIPTEN)
return Error::from_string_view("current_executable_path() unknown on this platform"sv); return Error::from_string_literal("current_executable_path() unknown on this platform");
#else #else
# warning "Not sure how to get current_executable_path on this platform!" # warning "Not sure how to get current_executable_path on this platform!"
// GetModuleFileName on Windows, unsure about OpenBSD. // GetModuleFileName on Windows, unsure about OpenBSD.
return Error::from_string_view("current_executable_path unknown"sv); return Error::from_string_literal("current_executable_path unknown");
#endif #endif
path[sizeof(path) - 1] = '\0'; path[sizeof(path) - 1] = '\0';
return ByteString { path, strlen(path) }; return ByteString { path, strlen(path) };

View file

@ -29,7 +29,7 @@ static ErrorOr<VkInstance> create_instance(uint32_t api_version)
auto result = vkCreateInstance(&create_info, nullptr, &instance); auto result = vkCreateInstance(&create_info, nullptr, &instance);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
dbgln("vkCreateInstance returned {}", to_underlying(result)); dbgln("vkCreateInstance returned {}", to_underlying(result));
return Error::from_string_view("Application instance creation failed"sv); return Error::from_string_literal("Application instance creation failed");
} }
return instance; return instance;
@ -41,7 +41,7 @@ static ErrorOr<VkPhysicalDevice> pick_physical_device(VkInstance instance)
vkEnumeratePhysicalDevices(instance, &device_count, nullptr); vkEnumeratePhysicalDevices(instance, &device_count, nullptr);
if (device_count == 0) if (device_count == 0)
return Error::from_string_view("Can't find any physical devices available"sv); return Error::from_string_literal("Can't find any physical devices available");
Vector<VkPhysicalDevice> devices; Vector<VkPhysicalDevice> devices;
devices.resize(device_count); devices.resize(device_count);
@ -100,7 +100,7 @@ static ErrorOr<VkDevice> create_logical_device(VkPhysicalDevice physical_device)
create_device_info.pEnabledFeatures = &deviceFeatures; create_device_info.pEnabledFeatures = &deviceFeatures;
if (vkCreateDevice(physical_device, &create_device_info, nullptr, &device) != VK_SUCCESS) { if (vkCreateDevice(physical_device, &create_device_info, nullptr, &device) != VK_SUCCESS) {
return Error::from_string_view("Logical device creation failed"sv); return Error::from_string_literal("Logical device creation failed");
} }
return device; return device;

View file

@ -77,10 +77,10 @@ public:
ErrorOr<void> rewrite_tag(Kind kind) ErrorOr<void> rewrite_tag(Kind kind)
{ {
if (m_stack.is_empty()) if (m_stack.is_empty())
return Error::from_string_view("Nothing on stack to rewrite"sv); return Error::from_string_literal("Nothing on stack to rewrite");
if (eof()) if (eof())
return Error::from_string_view("Stream is empty"sv); return Error::from_string_literal("Stream is empty");
if (m_current_tag.has_value()) { if (m_current_tag.has_value()) {
m_current_tag->kind = kind; m_current_tag->kind = kind;

View file

@ -26,7 +26,7 @@ public:
// 1. If length > 2^32(hLen), output "mask too long" and stop. // 1. If length > 2^32(hLen), output "mask too long" and stop.
if constexpr (sizeof(size_t) > 32) { if constexpr (sizeof(size_t) > 32) {
if (length > (h_len << 32)) if (length > (h_len << 32))
return Error::from_string_view("mask too long"sv); return Error::from_string_literal("mask too long");
} }
// 2. Let T be the empty octet string. // 2. Let T be the empty octet string.

View file

@ -27,7 +27,7 @@ public:
// 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and stop. // 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and stop.
if (key_length_bytes > (AK::pow(2.0, 32.0) - 1) * h_len) if (key_length_bytes > (AK::pow(2.0, 32.0) - 1) * h_len)
return Error::from_string_view("derived key too long"sv); return Error::from_string_literal("derived key too long");
// 2 . Let l be the number of hLen-octet blocks in the derived key rounding up, // 2 . Let l be the number of hLen-octet blocks in the derived key rounding up,
// and let r be the number of octets in the last block // and let r be the number of octets in the last block

View file

@ -30,7 +30,7 @@ public:
auto h_len = HashFunction::digest_size(); auto h_len = HashFunction::digest_size();
auto max_message_size = length - (2 * h_len) - 1; auto max_message_size = length - (2 * h_len) - 1;
if (message.size() > max_message_size) if (message.size() > max_message_size)
return Error::from_string_view("message too long"sv); return Error::from_string_literal("message too long");
// 3. Generate an octet string PS consisting of emLen-||M||-2hLen-1 zero octets. The length of PS may be 0. // 3. Generate an octet string PS consisting of emLen-||M||-2hLen-1 zero octets. The length of PS may be 0.
auto padding_size = length - message.size() - (2 * h_len) - 1; auto padding_size = length - message.size() - (2 * h_len) - 1;

View file

@ -82,7 +82,7 @@ static ErrorOr<SupportedGroup> oid_to_curve(Vector<int> curve)
else if (curve == curve_prime256) else if (curve == curve_prime256)
return SupportedGroup::SECP256R1; return SupportedGroup::SECP256R1;
return Error::from_string_view("Unknown curve oid"sv); return Error::from_string_literal("Unknown curve oid");
} }
static ErrorOr<Crypto::UnsignedBigInteger> parse_certificate_version(Crypto::ASN1::Decoder& decoder, Vector<StringView> current_scope) static ErrorOr<Crypto::UnsignedBigInteger> parse_certificate_version(Crypto::ASN1::Decoder& decoder, Vector<StringView> current_scope)

View file

@ -142,7 +142,7 @@ ErrorOr<void> RoleType::serialize_as_json(JsonObjectSerializer<StringBuilder>& o
ErrorOr<NonnullOwnPtr<RoleType>> RoleType::build_role_object(Role role, bool focusable, AriaData const& data) ErrorOr<NonnullOwnPtr<RoleType>> RoleType::build_role_object(Role role, bool focusable, AriaData const& data)
{ {
if (is_abstract_role(role)) if (is_abstract_role(role))
return Error::from_string_view("Cannot construct a role object for an abstract role."sv); return Error::from_string_literal("Cannot construct a role object for an abstract role.");
switch (role) { switch (role) {
case Role::alert: case Role::alert:

View file

@ -1045,7 +1045,7 @@ WebIDL::ExceptionOr<Variant<JS::NonnullGCPtr<CryptoKey>, JS::NonnullGCPtr<Crypto
// NOTE: Spec jumps to 6 here for some reason // NOTE: Spec jumps to 6 here for some reason
// 6. If performing the key generation operation results in an error, then throw an OperationError. // 6. If performing the key generation operation results in an error, then throw an OperationError.
auto maybe_private_key_data = curve.visit( auto maybe_private_key_data = curve.visit(
[](Empty const&) -> ErrorOr<ByteBuffer> { return Error::from_string_view("noop error"sv); }, [](Empty const&) -> ErrorOr<ByteBuffer> { return Error::from_string_literal("noop error"); },
[](auto instance) { return instance.generate_private_key(); }); [](auto instance) { return instance.generate_private_key(); });
if (maybe_private_key_data.is_error()) if (maybe_private_key_data.is_error())
@ -1054,7 +1054,7 @@ WebIDL::ExceptionOr<Variant<JS::NonnullGCPtr<CryptoKey>, JS::NonnullGCPtr<Crypto
auto private_key_data = maybe_private_key_data.release_value(); auto private_key_data = maybe_private_key_data.release_value();
auto maybe_public_key_data = curve.visit( auto maybe_public_key_data = curve.visit(
[](Empty const&) -> ErrorOr<ByteBuffer> { return Error::from_string_view("noop error"sv); }, [](Empty const&) -> ErrorOr<ByteBuffer> { return Error::from_string_literal("noop error"); },
[&](auto instance) { return instance.generate_public_key(private_key_data); }); [&](auto instance) { return instance.generate_public_key(private_key_data); });
if (maybe_public_key_data.is_error()) if (maybe_public_key_data.is_error())
@ -1233,7 +1233,7 @@ WebIDL::ExceptionOr<JS::Value> ECDSA::verify(AlgorithmParams const& params, JS::
auto encoded_signature = encoder.finish(); auto encoded_signature = encoder.finish();
auto maybe_result = curve.visit( auto maybe_result = curve.visit(
[](Empty const&) -> ErrorOr<bool> { return Error::from_string_view("Failed to create valid crypto instance"sv); }, [](Empty const&) -> ErrorOr<bool> { return Error::from_string_literal("Failed to create valid crypto instance"); },
[&](auto instance) { return instance.verify(M, Q, encoded_signature); }); [&](auto instance) { return instance.verify(M, Q, encoded_signature); });
if (maybe_result.is_error()) { if (maybe_result.is_error()) {
@ -1411,7 +1411,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::ArrayBuffer>> PBKDF2::derive_bits(Algor
// the contents of the salt attribute of normalizedAlgorithm as the salt, S, // the contents of the salt attribute of normalizedAlgorithm as the salt, S,
// the value of the iterations attribute of normalizedAlgorithm as the iteration count, c, // the value of the iterations attribute of normalizedAlgorithm as the iteration count, c,
// and length divided by 8 as the intended key length, dkLen. // and length divided by 8 as the intended key length, dkLen.
ErrorOr<ByteBuffer> result = Error::from_string_view("noop error"sv); ErrorOr<ByteBuffer> result = Error::from_string_literal("noop error");
auto password = key->handle().visit( auto password = key->handle().visit(
[](ByteBuffer data) -> ByteBuffer { [](ByteBuffer data) -> ByteBuffer {

View file

@ -1916,7 +1916,7 @@ ErrorOr<void> Element::scroll_into_view(Optional<Variant<bool, ScrollIntoViewOpt
// 6. If the element does not have any associated box, or is not available to user-agent features, then return. // 6. If the element does not have any associated box, or is not available to user-agent features, then return.
document().update_layout(); document().update_layout();
if (!layout_node()) if (!layout_node())
return Error::from_string_view("Element has no associated box"sv); return Error::from_string_literal("Element has no associated box");
// 7. Scroll the element into view with behavior, block, and inline. // 7. Scroll the element into view with behavior, block, and inline.
TRY(scroll_an_element_into_view(*this, behavior, block, inline_)); TRY(scroll_an_element_into_view(*this, behavior, block, inline_));

View file

@ -136,7 +136,7 @@ ErrorOr<Optional<URL::URL>> Response::location_url(Optional<String> const& reque
// 3. If location is a header value, then set location to the result of parsing location with responses URL. // 3. If location is a header value, then set location to the result of parsing location with responses URL.
auto location = DOMURL::parse(location_values.first(), url()); auto location = DOMURL::parse(location_values.first(), url());
if (!location.is_valid()) if (!location.is_valid())
return Error::from_string_view("Invalid 'Location' header URL"sv); return Error::from_string_literal("Invalid 'Location' header URL");
// 4. If location is a URL whose fragment is null, then set locations fragment to requestFragment. // 4. If location is a URL whose fragment is null, then set locations fragment to requestFragment.
if (!location.fragment().has_value()) if (!location.fragment().has_value())

View file

@ -308,26 +308,26 @@ static JsonValue match_capabilities(JsonObject const& capabilities)
if (name == "browserName"sv) { if (name == "browserName"sv) {
// If value is not a string equal to the "browserName" entry in matched capabilities, return success with data null. // If value is not a string equal to the "browserName" entry in matched capabilities, return success with data null.
if (value.as_string() != matched_capabilities.get_byte_string(name).value()) if (value.as_string() != matched_capabilities.get_byte_string(name).value())
return AK::Error::from_string_view("browserName"sv); return AK::Error::from_string_literal("browserName");
} }
// -> "browserVersion" // -> "browserVersion"
else if (name == "browserVersion"sv) { else if (name == "browserVersion"sv) {
// Compare value to the "browserVersion" entry in matched capabilities using an implementation-defined comparison algorithm. The comparison is to accept a value that places constraints on the version using the "<", "<=", ">", and ">=" operators. // Compare value to the "browserVersion" entry in matched capabilities using an implementation-defined comparison algorithm. The comparison is to accept a value that places constraints on the version using the "<", "<=", ">", and ">=" operators.
// If the two values do not match, return success with data null. // If the two values do not match, return success with data null.
if (!matches_browser_version(value.as_string(), matched_capabilities.get_byte_string(name).value())) if (!matches_browser_version(value.as_string(), matched_capabilities.get_byte_string(name).value()))
return AK::Error::from_string_view("browserVersion"sv); return AK::Error::from_string_literal("browserVersion");
} }
// -> "platformName" // -> "platformName"
else if (name == "platformName"sv) { else if (name == "platformName"sv) {
// If value is not a string equal to the "platformName" entry in matched capabilities, return success with data null. // If value is not a string equal to the "platformName" entry in matched capabilities, return success with data null.
if (!matches_platform_name(value.as_string(), matched_capabilities.get_byte_string(name).value())) if (!matches_platform_name(value.as_string(), matched_capabilities.get_byte_string(name).value()))
return AK::Error::from_string_view("platformName"sv); return AK::Error::from_string_literal("platformName");
} }
// -> "acceptInsecureCerts" // -> "acceptInsecureCerts"
else if (name == "acceptInsecureCerts"sv) { else if (name == "acceptInsecureCerts"sv) {
// If value is true and the endpoint node does not support insecure TLS certificates, return success with data null. // If value is true and the endpoint node does not support insecure TLS certificates, return success with data null.
if (value.as_bool()) if (value.as_bool())
return AK::Error::from_string_view("acceptInsecureCerts"sv); return AK::Error::from_string_literal("acceptInsecureCerts");
} }
// -> "proxy" // -> "proxy"
else if (name == "proxy"sv) { else if (name == "proxy"sv) {
@ -342,11 +342,11 @@ static JsonValue match_capabilities(JsonObject const& capabilities)
if (name == "webSocketUrl"sv) { if (name == "webSocketUrl"sv) {
// 1. If value is false, return success with data null. // 1. If value is false, return success with data null.
if (!value.as_bool()) if (!value.as_bool())
return AK::Error::from_string_view("webSocketUrl"sv); return AK::Error::from_string_literal("webSocketUrl");
// 2. Return success with data value. // 2. Return success with data value.
// FIXME: Remove this when we support BIDI communication. // FIXME: Remove this when we support BIDI communication.
return AK::Error::from_string_view("webSocketUrl"sv); return AK::Error::from_string_literal("webSocketUrl");
} }
} }

View file

@ -509,7 +509,7 @@ void ViewImplementation::handle_web_content_process_crash()
static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap) static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)
{ {
if (!bitmap.is_valid()) if (!bitmap.is_valid())
return Error::from_string_view("Failed to take a screenshot"sv); return Error::from_string_literal("Failed to take a screenshot");
auto file = Core::DateTime::now().to_byte_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv); auto file = Core::DateTime::now().to_byte_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
auto path = TRY(Application::the().path_for_downloaded_file(file)); auto path = TRY(Application::the().path_for_downloaded_file(file));

View file

@ -23,7 +23,7 @@ HashMap<unsigned, NonnullRefPtr<Session>> Client::s_sessions;
ErrorOr<NonnullRefPtr<Client>> Client::try_create(NonnullOwnPtr<Core::BufferedTCPSocket> socket, LaunchBrowserCallbacks callbacks, Core::EventReceiver* parent) ErrorOr<NonnullRefPtr<Client>> Client::try_create(NonnullOwnPtr<Core::BufferedTCPSocket> socket, LaunchBrowserCallbacks callbacks, Core::EventReceiver* parent)
{ {
if (!callbacks.launch_browser || !callbacks.launch_headless_browser) if (!callbacks.launch_browser || !callbacks.launch_headless_browser)
return Error::from_string_view("All callbacks to launch a browser must be provided"sv); return Error::from_string_literal("All callbacks to launch a browser must be provided");
TRY(socket->set_blocking(true)); TRY(socket->set_blocking(true));
return adopt_nonnull_ref_or_enomem(new (nothrow) Client(move(socket), move(callbacks), parent)); return adopt_nonnull_ref_or_enomem(new (nothrow) Client(move(socket), move(callbacks), parent));

View file

@ -19,12 +19,12 @@
static ErrorOr<StringView> guess_format_from_extension(StringView path) static ErrorOr<StringView> guess_format_from_extension(StringView path)
{ {
if (path == "-"sv) if (path == "-"sv)
return Error::from_string_view("Cannot guess format for standard stream, please specify format manually"sv); return Error::from_string_literal("Cannot guess format for standard stream, please specify format manually");
LexicalPath lexical_path { path }; LexicalPath lexical_path { path };
auto extension = lexical_path.extension(); auto extension = lexical_path.extension();
if (extension.is_empty()) if (extension.is_empty())
return Error::from_string_view("Cannot guess format for file without file extension"sv); return Error::from_string_literal("Cannot guess format for file without file extension");
// Note: Do not return the `extension` StringView in any case, since that will possibly lead to UAF. // Note: Do not return the `extension` StringView in any case, since that will possibly lead to UAF.
if (extension == "wav"sv || extension == "wave"sv) if (extension == "wav"sv || extension == "wave"sv)
@ -36,7 +36,7 @@ static ErrorOr<StringView> guess_format_from_extension(StringView path)
if (extension == "qoa"sv) if (extension == "qoa"sv)
return "qoa"sv; return "qoa"sv;
return Error::from_string_view("Cannot guess format for the given file extension"sv); return Error::from_string_literal("Cannot guess format for the given file extension");
} }
static ErrorOr<Audio::PcmSampleFormat> parse_sample_format(StringView textual_format) static ErrorOr<Audio::PcmSampleFormat> parse_sample_format(StringView textual_format)
@ -53,7 +53,7 @@ static ErrorOr<Audio::PcmSampleFormat> parse_sample_format(StringView textual_fo
return Audio::PcmSampleFormat::Float32; return Audio::PcmSampleFormat::Float32;
if (textual_format == "f64le"sv) if (textual_format == "f64le"sv)
return Audio::PcmSampleFormat::Float64; return Audio::PcmSampleFormat::Float64;
return Error::from_string_view("Unknown sample format"sv); return Error::from_string_literal("Unknown sample format");
} }
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
@ -76,10 +76,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments); args_parser.parse(arguments);
if (input.is_empty()) if (input.is_empty())
return Error::from_string_view("Input file is required, use '-' to read from standard input"sv); return Error::from_string_literal("Input file is required, use '-' to read from standard input");
if (output_format.is_empty() && output == "-"sv) if (output_format.is_empty() && output == "-"sv)
return Error::from_string_view("Output format must be specified manually when writing to standard output"sv); return Error::from_string_literal("Output format must be specified manually when writing to standard output");
if (input != "-"sv) if (input != "-"sv)
TRY(Core::System::unveil(TRY(FileSystem::absolute_path(input)), "r"sv)); TRY(Core::System::unveil(TRY(FileSystem::absolute_path(input)), "r"sv));

View file

@ -28,7 +28,7 @@ static ErrorOr<Options> parse_options(Main::Arguments arguments)
args_parser.parse(arguments); args_parser.parse(arguments);
if (options.out_path.is_empty()) if (options.out_path.is_empty())
return Error::from_string_view("-o is required "sv); return Error::from_string_literal("-o is required ");
return options; return options;
} }
@ -42,7 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = TRY(Core::MappedFile::map(options.in_path)); auto file = TRY(Core::MappedFile::map(options.in_path));
auto decoder = TRY(Gfx::ImageDecoder::try_create_for_raw_bytes(file->bytes())); auto decoder = TRY(Gfx::ImageDecoder::try_create_for_raw_bytes(file->bytes()));
if (!decoder) if (!decoder)
return Error::from_string_view("Could not find decoder for input file"sv); return Error::from_string_literal("Could not find decoder for input file");
auto output_file = TRY(Core::File::open(options.out_path, Core::File::OpenMode::Write)); auto output_file = TRY(Core::File::open(options.out_path, Core::File::OpenMode::Write));
auto output_stream = TRY(Core::OutputBufferedFile::create(move(output_file))); auto output_stream = TRY(Core::OutputBufferedFile::create(move(output_file)));

View file

@ -46,7 +46,7 @@ static ErrorOr<LoadedImage> load_image(RefPtr<Gfx::ImageDecoder> const& decoder,
static ErrorOr<void> invert_cmyk(LoadedImage& image) static ErrorOr<void> invert_cmyk(LoadedImage& image)
{ {
if (!image.bitmap.has<RefPtr<Gfx::CMYKBitmap>>()) if (!image.bitmap.has<RefPtr<Gfx::CMYKBitmap>>())
return Error::from_string_view("Can't --invert-cmyk with RGB bitmaps"sv); return Error::from_string_literal("Can't --invert-cmyk with RGB bitmaps");
auto& frame = image.bitmap.get<RefPtr<Gfx::CMYKBitmap>>(); auto& frame = image.bitmap.get<RefPtr<Gfx::CMYKBitmap>>();
for (auto& pixel : *frame) { for (auto& pixel : *frame) {
@ -61,7 +61,7 @@ static ErrorOr<void> invert_cmyk(LoadedImage& image)
static ErrorOr<void> crop_image(LoadedImage& image, Gfx::IntRect const& rect) static ErrorOr<void> crop_image(LoadedImage& image, Gfx::IntRect const& rect)
{ {
if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>()) if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>())
return Error::from_string_view("Can't --crop CMYK bitmaps yet"sv); return Error::from_string_literal("Can't --crop CMYK bitmaps yet");
auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>(); auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>();
frame = TRY(frame->cropped(rect)); frame = TRY(frame->cropped(rect));
return {}; return {};
@ -70,17 +70,17 @@ static ErrorOr<void> crop_image(LoadedImage& image, Gfx::IntRect const& rect)
static ErrorOr<void> move_alpha_to_rgb(LoadedImage& image) static ErrorOr<void> move_alpha_to_rgb(LoadedImage& image)
{ {
if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>()) if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>())
return Error::from_string_view("Can't --move-alpha-to-rgb with CMYK bitmaps"sv); return Error::from_string_literal("Can't --move-alpha-to-rgb with CMYK bitmaps");
auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>(); auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>();
switch (frame->format()) { switch (frame->format()) {
case Gfx::BitmapFormat::Invalid: case Gfx::BitmapFormat::Invalid:
return Error::from_string_view("Can't --move-alpha-to-rgb with invalid bitmaps"sv); return Error::from_string_literal("Can't --move-alpha-to-rgb with invalid bitmaps");
case Gfx::BitmapFormat::RGBA8888: case Gfx::BitmapFormat::RGBA8888:
// No image decoder currently produces bitmaps with this format. // No image decoder currently produces bitmaps with this format.
// If that ever changes, preferrably fix the image decoder to use BGRA8888 instead :) // If that ever changes, preferrably fix the image decoder to use BGRA8888 instead :)
// If there's a good reason for not doing that, implement support for this, I suppose. // If there's a good reason for not doing that, implement support for this, I suppose.
return Error::from_string_view("--move-alpha-to-rgb not implemented for RGBA8888"sv); return Error::from_string_literal("--move-alpha-to-rgb not implemented for RGBA8888");
case Gfx::BitmapFormat::BGRA8888: case Gfx::BitmapFormat::BGRA8888:
case Gfx::BitmapFormat::BGRx8888: case Gfx::BitmapFormat::BGRx8888:
// FIXME: If BitmapFormat::Gray8 existed (and image encoders made use of it to write grayscale images), we could use it here. // FIXME: If BitmapFormat::Gray8 existed (and image encoders made use of it to write grayscale images), we could use it here.
@ -95,17 +95,17 @@ static ErrorOr<void> move_alpha_to_rgb(LoadedImage& image)
static ErrorOr<void> strip_alpha(LoadedImage& image) static ErrorOr<void> strip_alpha(LoadedImage& image)
{ {
if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>()) if (!image.bitmap.has<RefPtr<Gfx::Bitmap>>())
return Error::from_string_view("Can't --strip-alpha with CMYK bitmaps"sv); return Error::from_string_literal("Can't --strip-alpha with CMYK bitmaps");
auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>(); auto& frame = image.bitmap.get<RefPtr<Gfx::Bitmap>>();
switch (frame->format()) { switch (frame->format()) {
case Gfx::BitmapFormat::Invalid: case Gfx::BitmapFormat::Invalid:
return Error::from_string_view("Can't --strip-alpha with invalid bitmaps"sv); return Error::from_string_literal("Can't --strip-alpha with invalid bitmaps");
case Gfx::BitmapFormat::RGBA8888: case Gfx::BitmapFormat::RGBA8888:
// No image decoder currently produces bitmaps with this format. // No image decoder currently produces bitmaps with this format.
// If that ever changes, preferrably fix the image decoder to use BGRA8888 instead :) // If that ever changes, preferrably fix the image decoder to use BGRA8888 instead :)
// If there's a good reason for not doing that, implement support for this, I suppose. // If there's a good reason for not doing that, implement support for this, I suppose.
return Error::from_string_view("--strip-alpha not implemented for RGBA8888"sv); return Error::from_string_literal("--strip-alpha not implemented for RGBA8888");
case Gfx::BitmapFormat::BGRA8888: case Gfx::BitmapFormat::BGRA8888:
case Gfx::BitmapFormat::BGRx8888: case Gfx::BitmapFormat::BGRx8888:
frame->strip_alpha_channel(); frame->strip_alpha_channel();
@ -116,7 +116,7 @@ static ErrorOr<void> strip_alpha(LoadedImage& image)
static ErrorOr<OwnPtr<Core::MappedFile>> convert_image_profile(LoadedImage& image, StringView convert_color_profile_path, OwnPtr<Core::MappedFile> maybe_source_icc_file) static ErrorOr<OwnPtr<Core::MappedFile>> convert_image_profile(LoadedImage& image, StringView convert_color_profile_path, OwnPtr<Core::MappedFile> maybe_source_icc_file)
{ {
if (!image.icc_data.has_value()) if (!image.icc_data.has_value())
return Error::from_string_view("No source color space embedded in image. Pass one with --assign-color-profile."sv); return Error::from_string_literal("No source color space embedded in image. Pass one with --assign-color-profile.");
auto source_icc_file = move(maybe_source_icc_file); auto source_icc_file = move(maybe_source_icc_file);
auto source_icc_data = image.icc_data.value(); auto source_icc_data = image.icc_data.value();
@ -127,11 +127,11 @@ static ErrorOr<OwnPtr<Core::MappedFile>> convert_image_profile(LoadedImage& imag
auto destination_profile = TRY(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_file->bytes())); auto destination_profile = TRY(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_file->bytes()));
if (destination_profile->data_color_space() != Gfx::ICC::ColorSpace::RGB) if (destination_profile->data_color_space() != Gfx::ICC::ColorSpace::RGB)
return Error::from_string_view("Can only convert to RGB at the moment, but destination color space is not RGB"sv); return Error::from_string_literal("Can only convert to RGB at the moment, but destination color space is not RGB");
if (image.bitmap.has<RefPtr<Gfx::CMYKBitmap>>()) { if (image.bitmap.has<RefPtr<Gfx::CMYKBitmap>>()) {
if (source_profile->data_color_space() != Gfx::ICC::ColorSpace::CMYK) if (source_profile->data_color_space() != Gfx::ICC::ColorSpace::CMYK)
return Error::from_string_view("Source image data is CMYK but source color space is not CMYK"sv); return Error::from_string_literal("Source image data is CMYK but source color space is not CMYK");
auto& cmyk_frame = image.bitmap.get<RefPtr<Gfx::CMYKBitmap>>(); auto& cmyk_frame = image.bitmap.get<RefPtr<Gfx::CMYKBitmap>>();
auto rgb_frame = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, cmyk_frame->size())); auto rgb_frame = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, cmyk_frame->size()));
@ -180,7 +180,7 @@ static ErrorOr<void> save_image(LoadedImage& image, StringView out_path, u8 jpeg
} else if (out_path.ends_with(".png"sv, CaseSensitivity::CaseInsensitive)) { } else if (out_path.ends_with(".png"sv, CaseSensitivity::CaseInsensitive)) {
bytes = TRY(Gfx::PNGWriter::encode(*frame, { .icc_data = image.icc_data })); bytes = TRY(Gfx::PNGWriter::encode(*frame, { .icc_data = image.icc_data }));
} else { } else {
return Error::from_string_view("can only write .bmp, .gif, .jpg, .png, and .webp"sv); return Error::from_string_literal("can only write .bmp, .gif, .jpg, .png, and .webp");
} }
TRY(TRY(stream())->write_until_depleted(bytes)); TRY(TRY(stream())->write_until_depleted(bytes));
@ -211,7 +211,7 @@ static ErrorOr<Vector<T>> parse_comma_separated_numbers(StringView rect_string)
for (size_t i = 0; i < parts.size(); ++i) { for (size_t i = 0; i < parts.size(); ++i) {
auto part = parts[i].to_number<T>(); auto part = parts[i].to_number<T>();
if (!part.has_value()) if (!part.has_value())
return Error::from_string_view("comma-separated parts must be numbers"sv); return Error::from_string_literal("comma-separated parts must be numbers");
TRY(part_numbers.try_append(part.value())); TRY(part_numbers.try_append(part.value()));
} }
return part_numbers; return part_numbers;
@ -221,7 +221,7 @@ static ErrorOr<Gfx::IntRect> parse_rect_string(StringView rect_string)
{ {
auto numbers = TRY(parse_comma_separated_numbers<i32>(rect_string)); auto numbers = TRY(parse_comma_separated_numbers<i32>(rect_string));
if (numbers.size() != 4) if (numbers.size() != 4)
return Error::from_string_view("rect must have 4 comma-separated parts"sv); return Error::from_string_literal("rect must have 4 comma-separated parts");
return Gfx::IntRect { numbers[0], numbers[1], numbers[2], numbers[3] }; return Gfx::IntRect { numbers[0], numbers[1], numbers[2], numbers[3] };
} }
@ -238,7 +238,7 @@ static ErrorOr<unsigned> parse_webp_allowed_transforms_string(StringView string)
else if (part == "color-indexing" || part == "ci") else if (part == "color-indexing" || part == "ci")
allowed_transforms |= 1 << Gfx::COLOR_INDEXING_TRANSFORM; allowed_transforms |= 1 << Gfx::COLOR_INDEXING_TRANSFORM;
else else
return Error::from_string_view("unknown WebP transform; valid values: predictor, p, color, c, subtract-green, sg, color-indexing, ci"sv); return Error::from_string_literal("unknown WebP transform; valid values: predictor, p, color, c, subtract-green, sg, color-indexing, ci");
} }
return allowed_transforms; return allowed_transforms;
} }
@ -265,7 +265,7 @@ static ErrorOr<Options> parse_options(Main::Arguments arguments)
args_parser.parse(arguments); args_parser.parse(arguments);
if (options.out_path.is_empty() ^ options.no_output) if (options.out_path.is_empty() ^ options.no_output)
return Error::from_string_view("exactly one of -o or --no-output is required"sv); return Error::from_string_literal("exactly one of -o or --no-output is required");
if (!crop_rect_string.is_empty()) if (!crop_rect_string.is_empty())
options.crop_rect = TRY(parse_rect_string(crop_rect_string)); options.crop_rect = TRY(parse_rect_string(crop_rect_string));
@ -282,7 +282,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = TRY(Core::MappedFile::map(options.in_path)); auto file = TRY(Core::MappedFile::map(options.in_path));
auto decoder = TRY(Gfx::ImageDecoder::try_create_for_raw_bytes(file->bytes())); auto decoder = TRY(Gfx::ImageDecoder::try_create_for_raw_bytes(file->bytes()));
if (!decoder) if (!decoder)
return Error::from_string_view("Could not find decoder for input file"sv); return Error::from_string_literal("Could not find decoder for input file");
LoadedImage image = TRY(load_image(*decoder, options.frame_index)); LoadedImage image = TRY(load_image(*decoder, options.frame_index));