diff options
Diffstat (limited to 'Userland/Libraries')
34 files changed, 182 insertions, 181 deletions
diff --git a/Userland/Libraries/LibAudio/FlacLoader.cpp b/Userland/Libraries/LibAudio/FlacLoader.cpp index 923082cd8f..a5def7b03c 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.cpp +++ b/Userland/Libraries/LibAudio/FlacLoader.cpp @@ -861,7 +861,7 @@ ErrorOr<u64> read_utf8_char(BigEndianInputBitStream& input) if ((start_byte & 0b10000000) == 0) { return start_byte; } else if ((start_byte & 0b11000000) == 0b10000000) { - return Error::from_string_literal("Illegal continuation byte"sv); + return Error::from_string_literal("Illegal continuation byte"); } // This algorithm is too good and supports the theoretical max 0xFF start byte u8 length = 1; diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index eeab247d5d..77ce8e6efd 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -73,14 +73,14 @@ ErrorOr<Account> Account::self([[maybe_unused]] Read options) auto pwd = TRY(Core::System::getpwuid(getuid())); if (!pwd.has_value()) - return Error::from_string_literal("No such user"sv); + return Error::from_string_literal("No such user"); spwd spwd = {}; #ifndef AK_OS_BSD_GENERIC if (options != Read::PasswdOnly) { auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) })); if (!maybe_spwd.has_value()) - return Error::from_string_literal("No shadow entry for user"sv); + return Error::from_string_literal("No shadow entry for user"); spwd = maybe_spwd.release_value(); } #endif @@ -92,14 +92,14 @@ ErrorOr<Account> Account::from_name(char const* username, [[maybe_unused]] Read { auto pwd = TRY(Core::System::getpwnam({ username, strlen(username) })); if (!pwd.has_value()) - return Error::from_string_literal("No such user"sv); + return Error::from_string_literal("No such user"); spwd spwd = {}; #ifndef AK_OS_BSD_GENERIC if (options != Read::PasswdOnly) { auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) })); if (!maybe_spwd.has_value()) - return Error::from_string_literal("No shadow entry for user"sv); + return Error::from_string_literal("No shadow entry for user"); spwd = maybe_spwd.release_value(); } #endif @@ -110,14 +110,14 @@ ErrorOr<Account> Account::from_uid(uid_t uid, [[maybe_unused]] Read options) { auto pwd = TRY(Core::System::getpwuid(uid)); if (!pwd.has_value()) - return Error::from_string_literal("No such user"sv); + return Error::from_string_literal("No such user"); spwd spwd = {}; #ifndef AK_OS_BSD_GENERIC if (options != Read::PasswdOnly) { auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) })); if (!maybe_spwd.has_value()) - return Error::from_string_literal("No shadow entry for user"sv); + return Error::from_string_literal("No shadow entry for user"); spwd = maybe_spwd.release_value(); } #endif diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index ab6ea80bef..ac38243432 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -22,7 +22,7 @@ ErrorOr<CommandResult> command(String const& command_string, Optional<LexicalPat { auto parts = command_string.split(' '); if (parts.is_empty()) - return Error::from_string_literal("empty command"sv); + return Error::from_string_literal("empty command"); auto program = parts[0]; parts.remove(0); return command(program, parts, chdir); diff --git a/Userland/Libraries/LibCore/FilePermissionsMask.cpp b/Userland/Libraries/LibCore/FilePermissionsMask.cpp index 950d202333..52f76b809a 100644 --- a/Userland/Libraries/LibCore/FilePermissionsMask.cpp +++ b/Userland/Libraries/LibCore/FilePermissionsMask.cpp @@ -41,7 +41,7 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_numeric_notation(StringVi { mode_t mode = AK::StringUtils::convert_to_uint_from_octal<u16>(string).value_or(01000); if (mode > 0777) - return Error::from_string_literal("invalid octal representation"sv); + return Error::from_string_literal("invalid octal representation"); return FilePermissionsMask().assign_permissions(mode); } @@ -73,9 +73,9 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_symbolic_notation(StringV else if (ch == '=') operation = Operation::Assign; else if (classes == 0) - return Error::from_string_literal("invalid class: expected 'u', 'g', 'o' or 'a'"sv); + return Error::from_string_literal("invalid class: expected 'u', 'g', 'o' or 'a'"); else - return Error::from_string_literal("invalid operation: expected '+', '-' or '='"sv); + return Error::from_string_literal("invalid operation: expected '+', '-' or '='"); // if an operation was specified without a class, assume all if (classes == 0) @@ -106,7 +106,7 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_symbolic_notation(StringV else if (ch == 'x') write_bits = 1; else - return Error::from_string_literal("invalid symbolic permission: expected 'r', 'w' or 'x'"sv); + return Error::from_string_literal("invalid symbolic permission: expected 'r', 'w' or 'x'"); mode_t clear_bits = operation == Operation::Assign ? 7 : write_bits; diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 9bbd878a83..fcbd687278 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -35,7 +35,7 @@ LocalServer::~LocalServer() ErrorOr<void> LocalServer::take_over_from_system_server(String const& socket_path) { if (m_listening) - return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening"sv); + return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening"); auto socket = TRY(take_over_socket_from_system_server(socket_path)); m_fd = TRY(socket->release_fd()); diff --git a/Userland/Libraries/LibCore/MemoryStream.h b/Userland/Libraries/LibCore/MemoryStream.h index 6ef811fa92..e46ed0da0c 100644 --- a/Userland/Libraries/LibCore/MemoryStream.h +++ b/Userland/Libraries/LibCore/MemoryStream.h @@ -45,19 +45,19 @@ public: switch (seek_mode) { case SeekMode::SetPosition: if (offset >= static_cast<i64>(m_bytes.size())) - return Error::from_string_literal("Offset past the end of the stream memory"sv); + return Error::from_string_literal("Offset past the end of the stream memory"); m_offset = offset; break; case SeekMode::FromCurrentPosition: if (offset + static_cast<i64>(m_offset) >= static_cast<i64>(m_bytes.size())) - return Error::from_string_literal("Offset past the end of the stream memory"sv); + return Error::from_string_literal("Offset past the end of the stream memory"); m_offset += offset; break; case SeekMode::FromEndPosition: if (offset >= static_cast<i64>(m_bytes.size())) - return Error::from_string_literal("Offset past the start of the stream memory"sv); + return Error::from_string_literal("Offset past the start of the stream memory"); m_offset = m_bytes.size() - offset; break; diff --git a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp index 4bfb423f62..c71535b16c 100644 --- a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp +++ b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp @@ -277,7 +277,7 @@ ErrorOr<NonnullOwnPtr<SOCKSProxyClient>> SOCKSProxyClient::connect(Socket& under auto reply = TRY(send_connect_request_message(underlying, version, target, target_port, command)); if (reply != Reply::Succeeded) { underlying.close(); - return Error::from_string_literal(reply_response_name(reply)); + return Error::from_string_view(reply_response_name(reply)); } return adopt_nonnull_own_or_enomem(new SOCKSProxyClient { @@ -296,7 +296,7 @@ ErrorOr<NonnullOwnPtr<SOCKSProxyClient>> SOCKSProxyClient::connect(Socket& under auto reply = TRY(send_connect_request_message(underlying, version, target, target_port, command)); if (reply != Reply::Succeeded) { underlying.close(); - return Error::from_string_literal(reply_response_name(reply)); + return Error::from_string_view(reply_response_name(reply)); } return adopt_nonnull_own_or_enomem(new SOCKSProxyClient { diff --git a/Userland/Libraries/LibCore/SharedCircularQueue.h b/Userland/Libraries/LibCore/SharedCircularQueue.h index 3b89d60e9c..b863a60e5b 100644 --- a/Userland/Libraries/LibCore/SharedCircularQueue.h +++ b/Userland/Libraries/LibCore/SharedCircularQueue.h @@ -118,7 +118,7 @@ public: if (!result.is_error()) break; if (result.error() != QueueStatus::Full) - return Error::from_string_literal("Unexpected error while enqueuing"sv); + return Error::from_string_literal("Unexpected error while enqueuing"); wait_function(); } @@ -208,7 +208,7 @@ private: SharedMemorySPCQ* shared_queue = is_new ? new (raw_mapping) SharedMemorySPCQ() : reinterpret_cast<SharedMemorySPCQ*>(raw_mapping); if (!shared_queue) - return Error::from_string_literal("Unexpected error when creating shared queue from raw memory"sv); + return Error::from_string_literal("Unexpected error when creating shared queue from raw memory"); return SharedSingleProducerCircularQueue<T, Size> { move(name), adopt_ref(*new (nothrow) RefCountedSharedMemorySPCQ(shared_queue, fd)) }; } diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index 2b497a520d..c1d25ae29f 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -336,7 +336,8 @@ ErrorOr<IPv4Address> Socket::resolve_host(String const& host, SocketType type) return Error::from_syscall("getaddrinfo", -errno); } - return Error::from_string_literal(gai_strerror(rc)); + auto const* error_string = gai_strerror(rc); + return Error::from_string_view({ error_string, strlen(error_string) }); } auto* socket_address = bit_cast<struct sockaddr_in*>(results->ai_addr); diff --git a/Userland/Libraries/LibCore/SystemServerTakeover.cpp b/Userland/Libraries/LibCore/SystemServerTakeover.cpp index dfbff119d3..33b2fa4eef 100644 --- a/Userland/Libraries/LibCore/SystemServerTakeover.cpp +++ b/Userland/Libraries/LibCore/SystemServerTakeover.cpp @@ -47,7 +47,7 @@ ErrorOr<NonnullOwnPtr<Core::Stream::LocalSocket>> take_over_socket_from_system_s } else { auto it = s_overtaken_sockets.find(socket_path); if (it == s_overtaken_sockets.end()) - return Error::from_string_literal("Non-existent socket requested"sv); + return Error::from_string_literal("Non-existent socket requested"); fd = it->value; } @@ -55,7 +55,7 @@ ErrorOr<NonnullOwnPtr<Core::Stream::LocalSocket>> take_over_socket_from_system_s auto stat = TRY(Core::System::fstat(fd)); if (!S_ISSOCK(stat.st_mode)) - return Error::from_string_literal("The fd we got from SystemServer is not a socket"sv); + return Error::from_string_literal("The fd we got from SystemServer is not a socket"); auto socket = TRY(Core::Stream::LocalSocket::adopt_fd(fd)); // It had to be !CLOEXEC for obvious reasons, but we diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index fc32bb1951..4cfd16beb4 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -59,7 +59,7 @@ ErrorOr<void> Launcher::add_allowed_url(URL const& url) { auto response_or_error = connection().try_add_allowed_url(url); if (response_or_error.is_error()) - return Error::from_string_literal("Launcher::add_allowed_url: Failed"sv); + return Error::from_string_literal("Launcher::add_allowed_url: Failed"); return {}; } @@ -67,7 +67,7 @@ ErrorOr<void> Launcher::add_allowed_handler_with_any_url(String const& handler) { auto response_or_error = connection().try_add_allowed_handler_with_any_url(handler); if (response_or_error.is_error()) - return Error::from_string_literal("Launcher::add_allowed_handler_with_any_url: Failed"sv); + return Error::from_string_literal("Launcher::add_allowed_handler_with_any_url: Failed"); return {}; } @@ -75,7 +75,7 @@ ErrorOr<void> Launcher::add_allowed_handler_with_only_specific_urls(String const { auto response_or_error = connection().try_add_allowed_handler_with_only_specific_urls(handler, urls); if (response_or_error.is_error()) - return Error::from_string_literal("Launcher::add_allowed_handler_with_only_specific_urls: Failed"sv); + return Error::from_string_literal("Launcher::add_allowed_handler_with_only_specific_urls: Failed"); return {}; } @@ -83,7 +83,7 @@ ErrorOr<void> Launcher::seal_allowlist() { auto response_or_error = connection().try_seal_allowlist(); if (response_or_error.is_error()) - return Error::from_string_literal("Launcher::seal_allowlist: Failed"sv); + return Error::from_string_literal("Launcher::seal_allowlist: Failed"); return {}; } diff --git a/Userland/Libraries/LibEDID/EDID.cpp b/Userland/Libraries/LibEDID/EDID.cpp index fdeee023c8..16e10ca730 100644 --- a/Userland/Libraries/LibEDID/EDID.cpp +++ b/Userland/Libraries/LibEDID/EDID.cpp @@ -58,7 +58,7 @@ public: auto* vic_details = VIC::find_details_by_vic_id(vic_id); if (!vic_details) - return Error::from_string_literal("CEA 861 extension block has invalid short video descriptor"sv); + return Error::from_string_literal("CEA 861 extension block has invalid short video descriptor"); IterationDecision decision = callback(is_native, *vic_details); if (decision != IterationDecision::Continue) @@ -77,7 +77,7 @@ public: } if (dtd_start > offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DetailedTiming)) - return Error::from_string_literal("CEA 861 extension block has invalid DTD list"sv); + return Error::from_string_literal("CEA 861 extension block has invalid DTD list"); size_t dtd_index = 0; for (size_t offset = dtd_start; offset <= offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DetailedTiming); offset += sizeof(Definitions::DetailedTiming)) { @@ -108,7 +108,7 @@ private: return IterationDecision::Continue; if (dtd_start > offsetof(Definitions::ExtensionBlock, checksum)) - return Error::from_string_literal("CEA 861 extension block has invalid DTD start offset"sv); + return Error::from_string_literal("CEA 861 extension block has invalid DTD start offset"); auto* data_block_header = &m_block->cea861extension.bytes[0]; auto* data_block_end = (u8 const*)m_block + dtd_start; @@ -117,7 +117,7 @@ private: size_t payload_size = header_byte & 0x1f; auto tag = (DataBlockTag)((header_byte >> 5) & 0x7); if (tag == DataBlockTag::Extended && payload_size == 0) - return Error::from_string_literal("CEA 861 extension block has invalid extended data block size"sv); + return Error::from_string_literal("CEA 861 extension block has invalid extended data block size"); auto decision = TRY(callback(tag, m_edid.m_bytes.slice(data_block_header - m_edid.m_bytes.data() + 1, payload_size))); if (decision != IterationDecision::Continue) @@ -135,7 +135,7 @@ private: return IterationDecision::Continue; if (dtd_start > offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DetailedTiming)) - return Error::from_string_literal("CEA 861 extension block has invalid DTD list"sv); + return Error::from_string_literal("CEA 861 extension block has invalid DTD list"); for (size_t offset = dtd_start; offset <= offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DisplayDescriptor); offset += sizeof(Definitions::DisplayDescriptor)) { auto& dd = *(Definitions::DisplayDescriptor const*)((u8 const*)m_block + offset); @@ -301,17 +301,17 @@ Definitions::EDID const& Parser::raw_edid() const ErrorOr<void> Parser::parse() { if (m_bytes.size() < sizeof(Definitions::EDID)) - return Error::from_string_literal("Incomplete Parser structure"sv); + return Error::from_string_literal("Incomplete Parser structure"); auto const& edid = raw_edid(); u64 header = read_le(&edid.header); if (header != 0x00ffffffffffff00ull) - return Error::from_string_literal("No Parser header"sv); + return Error::from_string_literal("No Parser header"); u8 major_version = read_host(&edid.version.version); m_revision = read_host(&edid.version.revision); if (major_version != 1 || m_revision > 4) - return Error::from_string_literal("Unsupported Parser version"sv); + return Error::from_string_literal("Unsupported Parser version"); #ifdef KERNEL m_version = TRY(Kernel::KString::formatted("1.{}", (int)m_revision)); @@ -325,7 +325,7 @@ ErrorOr<void> Parser::parse() if (checksum != 0) { if (m_revision >= 4) { - return Error::from_string_literal("Parser checksum mismatch"sv); + return Error::from_string_literal("Parser checksum mismatch"); } else { dbgln("EDID checksum mismatch, data may be corrupted!"); } @@ -370,9 +370,9 @@ ErrorOr<IterationDecision> Parser::for_each_extension_block(Function<IterationDe current_extension_map = &raw_extension_blocks[0]; raw_index++; if (read_host(¤t_extension_map->tag) != (u8)Definitions::ExtensionBlockTag::ExtensionBlockMap) - return Error::from_string_literal("Did not find extension map at block 1"sv); + return Error::from_string_literal("Did not find extension map at block 1"); if (!validate_block_checksum(*current_extension_map)) - return Error::from_string_literal("Extension block map checksum mismatch"sv); + return Error::from_string_literal("Extension block map checksum mismatch"); } } else if (read_host(&raw_extension_blocks[0].tag) == (u8)Definitions::ExtensionBlockTag::ExtensionBlockMap) { current_extension_map = &raw_extension_blocks[0]; @@ -385,18 +385,18 @@ ErrorOr<IterationDecision> Parser::for_each_extension_block(Function<IterationDe if (current_extension_map && raw_index == 127) { if (tag != (u8)Definitions::ExtensionBlockTag::ExtensionBlockMap) - return Error::from_string_literal("Did not find extension map at block 128"sv); + return Error::from_string_literal("Did not find extension map at block 128"); current_extension_map = &raw_extension_blocks[127]; if (!validate_block_checksum(*current_extension_map)) - return Error::from_string_literal("Extension block map checksum mismatch"sv); + return Error::from_string_literal("Extension block map checksum mismatch"); continue; } if (tag == (u8)Definitions::ExtensionBlockTag::ExtensionBlockMap) - return Error::from_string_literal("Unexpected extension map encountered"sv); + return Error::from_string_literal("Unexpected extension map encountered"); if (!validate_block_checksum(raw_block)) - return Error::from_string_literal("Extension block checksum mismatch"sv); + return Error::from_string_literal("Extension block checksum mismatch"); size_t offset = (u8 const*)&raw_block - m_bytes.data(); IterationDecision decision = callback(raw_index + 1, tag, raw_block.block.revision, m_bytes.slice(offset, sizeof(Definitions::ExtensionBlock))); diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp index 430ba39bb8..00bf0382e7 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp @@ -140,7 +140,7 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co if (file->is_device()) { GUI::MessageBox::show_error(request_data.parent_window, String::formatted("Opening \"{}\" failed: Cannot open device files", *chosen_file)); - request_data.promise->resolve(Error::from_string_literal("Cannot open device files"sv)); + request_data.promise->resolve(Error::from_string_literal("Cannot open device files")); return; } diff --git a/Userland/Libraries/LibGUI/GML/Parser.cpp b/Userland/Libraries/LibGUI/GML/Parser.cpp index 7324eb8aee..270bf984dd 100644 --- a/Userland/Libraries/LibGUI/GML/Parser.cpp +++ b/Userland/Libraries/LibGUI/GML/Parser.cpp @@ -32,12 +32,12 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens) TRY(object->add_property_child(TRY(Node::from_token<Comment>(tokens.dequeue())))); if (peek() != Token::Type::ClassMarker) - return Error::from_string_literal("Expected class marker"sv); + return Error::from_string_literal("Expected class marker"); tokens.dequeue(); if (peek() != Token::Type::ClassName) - return Error::from_string_literal("Expected class name"sv); + return Error::from_string_literal("Expected class name"); auto class_name = tokens.dequeue(); object->set_name(class_name.m_view); @@ -69,10 +69,10 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens) auto property_name = tokens.dequeue(); if (property_name.m_view.is_empty()) - return Error::from_string_literal("Expected non-empty property name"sv); + return Error::from_string_literal("Expected non-empty property name"); if (peek() != Token::Type::Colon) - return Error::from_string_literal("Expected ':'"sv); + return Error::from_string_literal("Expected ':'"); tokens.dequeue(); @@ -87,7 +87,7 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens) } else if (peek() == Token::Type::Comment) { pending_comments.append(TRY(Node::from_token<Comment>(tokens.dequeue()))); } else { - return Error::from_string_literal("Expected child, property, comment, or }}"sv); + return Error::from_string_literal("Expected child, property, comment, or }}"); } } @@ -96,7 +96,7 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens) TRY(object->add_sub_object_child(pending_comments.take_first())); if (peek() != Token::Type::RightCurly) - return Error::from_string_literal("Expected }}"sv); + return Error::from_string_literal("Expected }}"); tokens.dequeue(); } diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp index 35b497539a..bdbb3de8a9 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -89,7 +89,7 @@ ErrorOr<Icon> Icon::try_create_default_icon(StringView name) if (!bitmap16 && !bitmap32) { dbgln("Default icon not found: {}", name); - return Error::from_string_literal("Default icon not found"sv); + return Error::from_string_literal("Default icon not found"); } return Icon(move(bitmap16), move(bitmap32)); diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 38f3098a63..c8ffb088d0 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -1356,13 +1356,13 @@ size_t BMPImageDecoderPlugin::frame_count() ErrorOr<ImageFrameDescriptor> BMPImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("BMPImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("BMPImageDecoderPlugin: Invalid frame index"); if (m_context->state == BMPLoadingContext::State::Error) - return Error::from_string_literal("BMPImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("BMPImageDecoderPlugin: Decoding failed"); if (m_context->state < BMPLoadingContext::State::PixelDataDecoded && !decode_bmp_pixel_data(*m_context)) - return Error::from_string_literal("BMPImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("BMPImageDecoderPlugin: Decoding failed"); VERIFY(m_context->bitmap); return ImageFrameDescriptor { m_context->bitmap, 0 }; diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index f8a8c77c2a..9f55da796d 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -70,7 +70,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create(BitmapFormat format, IntSize c ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_shareable(BitmapFormat format, IntSize const& size, int scale_factor) { if (size_would_overflow(format, size, scale_factor)) - return Error::from_string_literal("Gfx::Bitmap::try_create_shareable size overflow"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_shareable size overflow"); auto const pitch = minimum_pitch(size.width() * scale_factor, format); auto const data_size = size_in_bytes(pitch, size.height() * scale_factor); @@ -98,7 +98,7 @@ Bitmap::Bitmap(BitmapFormat format, IntSize const& size, int scale_factor, Backi ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_wrapper(BitmapFormat format, IntSize const& size, int scale_factor, size_t pitch, void* data) { if (size_would_overflow(format, size, scale_factor)) - return Error::from_string_literal("Gfx::Bitmap::try_create_wrapper size overflow"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_wrapper size overflow"); return adopt_ref(*new Bitmap(format, size, scale_factor, pitch, data)); } @@ -134,7 +134,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, String return bitmap.release_nonnull(); } - return Error::from_string_literal("Gfx::Bitmap unable to load from fd"sv); + return Error::from_string_literal("Gfx::Bitmap unable to load from fd"); } Bitmap::Bitmap(BitmapFormat format, IntSize const& size, int scale_factor, size_t pitch, void* data) @@ -206,22 +206,22 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By }; if (!read(actual_size) || !read(width) || !read(height) || !read(scale_factor) || !read(format) || !read(palette_size)) - return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"); if (format > BitmapFormat::BGRA8888 || format < BitmapFormat::Indexed1) - return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"); if (!check_size({ width, height }, scale_factor, format, actual_size)) - return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"); palette.ensure_capacity(palette_size); for (size_t i = 0; i < palette_size; ++i) { if (!read(palette[i])) - return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"); } if (stream.remaining() < actual_size) - return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"sv); + return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed"); auto data = stream.bytes().slice(stream.offset(), actual_size); @@ -548,7 +548,7 @@ Gfx::ShareableBitmap Bitmap::to_shareable_bitmap() const ErrorOr<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, IntSize const& size, int scale_factor) { if (size_would_overflow(format, size, scale_factor)) - return Error::from_string_literal("Gfx::Bitmap backing store size overflow"sv); + return Error::from_string_literal("Gfx::Bitmap backing store size overflow"); auto const pitch = minimum_pitch(size.width() * scale_factor, format); auto const data_size_in_bytes = size_in_bytes(pitch, size.height() * scale_factor); diff --git a/Userland/Libraries/LibGfx/DDSLoader.cpp b/Userland/Libraries/LibGfx/DDSLoader.cpp index d6a78b4997..3902d141e3 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.cpp +++ b/Userland/Libraries/LibGfx/DDSLoader.cpp @@ -998,15 +998,15 @@ size_t DDSImageDecoderPlugin::frame_count() ErrorOr<ImageFrameDescriptor> DDSImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("DDSImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("DDSImageDecoderPlugin: Invalid frame index"); if (m_context->state == DDSLoadingContext::State::Error) - return Error::from_string_literal("DDSImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("DDSImageDecoderPlugin: Decoding failed"); if (m_context->state < DDSLoadingContext::State::BitmapDecoded) { bool success = decode_dds(*m_context); if (!success) - return Error::from_string_literal("DDSImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("DDSImageDecoderPlugin: Decoding failed"); } VERIFY(m_context->bitmap); diff --git a/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp b/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp index 5a73f5cd50..79f6adc11e 100644 --- a/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp @@ -168,22 +168,22 @@ Optional<Name> Name::from_slice(ReadonlyBytes slice) ErrorOr<Kern> Kern::from_slice(ReadonlyBytes slice) { if (slice.size() < sizeof(u32)) - return Error::from_string_literal("Invalid kern table header"sv); + return Error::from_string_literal("Invalid kern table header"); // We only support the old (2x u16) version of the header auto version = be_u16(slice.data()); auto number_of_subtables = be_u16(slice.offset(sizeof(u16))); if (version != 0) - return Error::from_string_literal("Unsupported kern table version"sv); + return Error::from_string_literal("Unsupported kern table version"); if (number_of_subtables == 0) - return Error::from_string_literal("Kern table does not contain any subtables"sv); + return Error::from_string_literal("Kern table does not contain any subtables"); // Read all subtable offsets auto subtable_offsets = TRY(FixedArray<size_t>::try_create(number_of_subtables)); size_t offset = 2 * sizeof(u16); for (size_t i = 0; i < number_of_subtables; ++i) { if (slice.size() < offset + Sizes::SubtableHeader) - return Error::from_string_literal("Invalid kern subtable header"sv); + return Error::from_string_literal("Invalid kern subtable header"); subtable_offsets[i] = offset; auto subtable_size = be_u16(slice.offset(offset + sizeof(u16))); @@ -365,22 +365,22 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(String path, unsigned inde ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(ReadonlyBytes buffer, unsigned index) { if (buffer.size() < 4) - return Error::from_string_literal("Font file too small"sv); + return Error::from_string_literal("Font file too small"); u32 tag = be_u32(buffer.data()); if (tag == tag_from_str("ttcf")) { // It's a font collection if (buffer.size() < (u32)Sizes::TTCHeaderV1 + sizeof(u32) * (index + 1)) - return Error::from_string_literal("Font file too small"sv); + return Error::from_string_literal("Font file too small"); u32 offset = be_u32(buffer.offset_pointer((u32)Sizes::TTCHeaderV1 + sizeof(u32) * index)); return try_load_from_offset(buffer, offset); } if (tag == tag_from_str("OTTO")) - return Error::from_string_literal("CFF fonts not supported yet"sv); + return Error::from_string_literal("CFF fonts not supported yet"); if (tag != 0x00010000) - return Error::from_string_literal("Not a valid font"sv); + return Error::from_string_literal("Not a valid font"); return try_load_from_offset(buffer, 0); } @@ -389,10 +389,10 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(Readonl ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u32 offset) { if (Checked<u32>::addition_would_overflow(offset, (u32)Sizes::OffsetTable)) - return Error::from_string_literal("Invalid offset in font header"sv); + return Error::from_string_literal("Invalid offset in font header"); if (buffer.size() < offset + (u32)Sizes::OffsetTable) - return Error::from_string_literal("Font file too small"sv); + return Error::from_string_literal("Font file too small"); Optional<ReadonlyBytes> opt_head_slice = {}; Optional<ReadonlyBytes> opt_name_slice = {}; @@ -417,7 +417,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3 auto num_tables = be_u16(buffer.offset_pointer(offset + (u32)Offsets::NumTables)); if (buffer.size() < offset + (u32)Sizes::OffsetTable + num_tables * (u32)Sizes::TableRecord) - return Error::from_string_literal("Font file too small"sv); + return Error::from_string_literal("Font file too small"); for (auto i = 0; i < num_tables; i++) { u32 record_offset = offset + (u32)Sizes::OffsetTable + i * (u32)Sizes::TableRecord; @@ -426,10 +426,10 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3 u32 table_length = be_u32(buffer.offset_pointer(record_offset + (u32)Offsets::TableRecord_Length)); if (Checked<u32>::addition_would_overflow(table_offset, table_length)) - return Error::from_string_literal("Invalid table offset or length in font"sv); + return Error::from_string_literal("Invalid table offset or length in font"); if (buffer.size() < table_offset + table_length) - return Error::from_string_literal("Font file too small"sv); + return Error::from_string_literal("Font file too small"); auto buffer_here = ReadonlyBytes(buffer.offset_pointer(table_offset), table_length); @@ -458,39 +458,39 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3 } if (!opt_head_slice.has_value() || !(opt_head = Head::from_slice(opt_head_slice.value())).has_value()) - return Error::from_string_literal("Could not load Head"sv); + return Error::from_string_literal("Could not load Head"); auto head = opt_head.value(); if (!opt_name_slice.has_value() || !(opt_name = Name::from_slice(opt_name_slice.value())).has_value()) - return Error::from_string_literal("Could not load Name"sv); + return Error::from_string_literal("Could not load Name"); auto name = opt_name.value(); if (!opt_hhea_slice.has_value() || !(opt_hhea = Hhea::from_slice(opt_hhea_slice.value())).has_value()) - return Error::from_string_literal("Could not load Hhea"sv); + return Error::from_string_literal("Could not load Hhea"); auto hhea = opt_hhea.value(); if (!opt_maxp_slice.has_value() || !(opt_maxp = Maxp::from_slice(opt_maxp_slice.value())).has_value()) - return Error::from_string_literal("Could not load Maxp"sv); + return Error::from_string_literal("Could not load Maxp"); auto maxp = opt_maxp.value(); if (!opt_hmtx_slice.has_value() || !(opt_hmtx = Hmtx::from_slice(opt_hmtx_slice.value(), maxp.num_glyphs(), hhea.number_of_h_metrics())).has_value()) - return Error::from_string_literal("Could not load Hmtx"sv); + return Error::from_string_literal("Could not load Hmtx"); auto hmtx = opt_hmtx.value(); if (!opt_cmap_slice.has_value() || !(opt_cmap = Cmap::from_slice(opt_cmap_slice.value())).has_value()) - return Error::from_string_literal("Could not load Cmap"sv); + return Error::from_string_literal("Could not load Cmap"); auto cmap = opt_cmap.value(); if (!opt_loca_slice.has_value() || !(opt_loca = Loca::from_slice(opt_loca_slice.value(), maxp.num_glyphs(), head.index_to_loc_format())).has_value()) - return Error::from_string_literal("Could not load Loca"sv); + return Error::from_string_literal("Could not load Loca"); auto loca = opt_loca.value(); if (!opt_glyf_slice.has_value()) - return Error::from_string_literal("Could not load Glyf"sv); + return Error::from_string_literal("Could not load Glyf"); auto glyf = Glyf(opt_glyf_slice.value()); if (!opt_os2_slice.has_value()) - return Error::from_string_literal("Could not load OS/2"sv); + return Error::from_string_literal("Could not load OS/2"); auto os2 = OS2(opt_os2_slice.value()); Optional<Kern> kern {}; @@ -507,7 +507,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3 auto subtable = opt_subtable.value(); auto platform = subtable.platform_id(); if (!platform.has_value()) - return Error::from_string_literal("Invalid Platform ID"sv); + return Error::from_string_literal("Invalid Platform ID"); if (platform.value() == Cmap::Subtable::Platform::Windows) { if (subtable.encoding_id() == (u16)Cmap::Subtable::WindowsEncoding::UnicodeFullRepertoire) { diff --git a/Userland/Libraries/LibGfx/Font/WOFF/Font.cpp b/Userland/Libraries/LibGfx/Font/WOFF/Font.cpp index 5b8380de65..7804df5172 100644 --- a/Userland/Libraries/LibGfx/Font/WOFF/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/WOFF/Font.cpp @@ -60,12 +60,12 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(Readonl { // https://www.w3.org/TR/WOFF/#WOFFHeader if (buffer.size() < WOFF_HEADER_SIZE) - return Error::from_string_literal("WOFF file too small"sv); + return Error::from_string_literal("WOFF file too small"); // The signature field in the WOFF header MUST contain the "magic number" 0x774F4646. If the field does not contain this value, user agents MUST reject the file as invalid. u32 signature = be_u32(buffer.data()); if (signature != WOFF_SIGNATURE) - return Error::from_string_literal("Invalid WOFF signature"sv); + return Error::from_string_literal("Invalid WOFF signature"); // The flavor field corresponds to the "sfnt version" field found at the beginning of an sfnt file, // indicating the type of font data contained. Although only fonts of type 0x00010000 (the version number 1.0 as a 16.16 fixed-point value, indicating TrueType glyph data) // and 0x4F54544F (the tag 'OTTO', indicating CFF glyph data) are widely supported at present, @@ -85,17 +85,17 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(Readonl u32 priv_offset = be_u32(buffer.offset(36)); // Offset to private data block, from beginning of WOFF file. u32 priv_length = be_u32(buffer.offset(40)); // Length of private data block. if (length > buffer.size()) - return Error::from_string_literal("Invalid WOFF length"sv); + return Error::from_string_literal("Invalid WOFF length"); if (reserved != 0) - return Error::from_string_literal("Invalid WOFF reserved field"sv); + return Error::from_string_literal("Invalid WOFF reserved field"); if (meta_length == 0 && meta_offset != 0) - return Error::from_string_literal("Invalid WOFF meta block offset"sv); + return Error::from_string_literal("Invalid WOFF meta block offset"); if (priv_length == 0 && priv_offset != 0) - return Error::from_string_literal("Invalid WOFF private block offset"sv); + return Error::from_string_literal("Invalid WOFF private block offset"); if (WOFF_HEADER_SIZE + num_tables * WOFF_TABLE_SIZE > length) - return Error::from_string_literal("Truncated WOFF table directory"sv); + return Error::from_string_literal("Truncated WOFF table directory"); if (total_sfnt_size > 10 * MiB) - return Error::from_string_literal("Uncompressed font is more than 10 MiB"sv); + return Error::from_string_literal("Uncompressed font is more than 10 MiB"); auto font_buffer = TRY(ByteBuffer::create_zeroed(total_sfnt_size)); // ISO-IEC 14496-22:2019 4.5.1 Offset table @@ -116,19 +116,19 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(Readonl u32 orig_checksum = be_u32(buffer.offset(base_offset + 16)); if ((size_t)offset + comp_length > length) - return Error::from_string_literal("Truncated WOFF table"sv); + return Error::from_string_literal("Truncated WOFF table"); if (font_buffer_offset + orig_length > font_buffer.size()) - return Error::from_string_literal("Uncompressed WOFF table too big"sv); + return Error::from_string_literal("Uncompressed WOFF table too big"); if (comp_length < orig_length) { auto decompressed = Compress::Zlib::decompress_all(buffer.slice(offset, comp_length)); if (!decompressed.has_value()) - return Error::from_string_literal("Could not decompress WOFF table"sv); + return Error::from_string_literal("Could not decompress WOFF table"); if (orig_length != decompressed->size()) - return Error::from_string_literal("Invalid decompressed WOFF table length"sv); + return Error::from_string_literal("Invalid decompressed WOFF table length"); font_buffer.overwrite(font_buffer_offset, decompressed->data(), orig_length); } else { if (comp_length != orig_length) - return Error::from_string_literal("Invalid uncompressed WOFF table length"sv); + return Error::from_string_literal("Invalid uncompressed WOFF table length"); font_buffer.overwrite(font_buffer_offset, buffer.data() + offset, orig_length); } diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index a51261f037..524d08bcb0 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -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; } diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index fc62812fa3..3538478491 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -342,17 +342,17 @@ size_t ICOImageDecoderPlugin::frame_count() ErrorOr<ImageFrameDescriptor> ICOImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("ICOImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("ICOImageDecoderPlugin: Invalid frame index"); if (m_context->state == ICOLoadingContext::State::Error) - return Error::from_string_literal("ICOImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("ICOImageDecoderPlugin: Decoding failed"); if (m_context->state < ICOLoadingContext::State::BitmapDecoded) { // NOTE: This forces the chunk decoding to happen. bool success = load_ico_bitmap(*m_context, {}); if (!success) { m_context->state = ICOLoadingContext::State::Error; - return Error::from_string_literal("ICOImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("ICOImageDecoderPlugin: Decoding failed"); } m_context->state = ICOLoadingContext::State::BitmapDecoded; } diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 08a2db96c4..48e6a8ceec 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -1285,15 +1285,15 @@ size_t JPGImageDecoderPlugin::frame_count() ErrorOr<ImageFrameDescriptor> JPGImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("JPGImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("JPGImageDecoderPlugin: Invalid frame index"); if (m_context->state == JPGLoadingContext::State::Error) - return Error::from_string_literal("JPGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("JPGImageDecoderPlugin: Decoding failed"); if (m_context->state < JPGLoadingContext::State::BitmapDecoded) { if (!decode_jpg(*m_context)) { m_context->state = JPGLoadingContext::State::Error; - return Error::from_string_literal("JPGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("JPGImageDecoderPlugin: Decoding failed"); } m_context->state = JPGLoadingContext::State::BitmapDecoded; } diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 6a32c7da81..1c5b163da3 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -407,7 +407,7 @@ NEVER_INLINE FLATTEN static ErrorOr<void> unfilter(PNGLoadingContext& context) for (int i = 0; i < context.width; ++i) { auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; if (palette_index[i] >= context.palette_data.size()) - return Error::from_string_literal("PNGImageDecoderPlugin: Palette index out of range"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Palette index out of range"); auto& color = context.palette_data.at((int)palette_index[i]); auto transparency = context.palette_transparency_data.size() >= palette_index[i] + 1u ? context.palette_transparency_data.data()[palette_index[i]] @@ -428,7 +428,7 @@ NEVER_INLINE FLATTEN static ErrorOr<void> unfilter(PNGLoadingContext& context) auto palette_index = (palette_indices[i / pixels_per_byte] >> bit_offset) & mask; auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; if ((size_t)palette_index >= context.palette_data.size()) - return Error::from_string_literal("PNGImageDecoderPlugin: Palette index out of range"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Palette index out of range"); auto& color = context.palette_data.at(palette_index); auto transparency = context.palette_transparency_data.size() >= palette_index + 1u ? context.palette_transparency_data.data()[palette_index] @@ -578,23 +578,23 @@ static ErrorOr<void> decode_png_bitmap_simple(PNGLoadingContext& context) PNG::FilterType filter; if (!streamer.read(filter)) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); } if (to_underlying(filter) > 4) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Invalid PNG filter"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Invalid PNG filter"); } context.scanlines.append({ filter }); auto& scanline_buffer = context.scanlines.last().data; auto row_size = context.compute_row_size_for_width(context.width); if (row_size.has_overflow()) - return Error::from_string_literal("PNGImageDecoderPlugin: Row size overflow"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Row size overflow"); if (!streamer.wrap_bytes(scanline_buffer, row_size.value())) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); } } @@ -673,12 +673,12 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str PNG::FilterType filter; if (!streamer.read(filter)) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); } if (to_underlying(filter) > 4) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Invalid PNG filter"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Invalid PNG filter"); } subimage_context.scanlines.append({ filter }); @@ -686,10 +686,10 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str auto row_size = context.compute_row_size_for_width(subimage_context.width); if (row_size.has_overflow()) - return Error::from_string_literal("PNGImageDecoderPlugin: Row size overflow"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Row size overflow"); if (!streamer.wrap_bytes(scanline_buffer, row_size.value())) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); } } @@ -718,22 +718,22 @@ static ErrorOr<void> decode_png_bitmap(PNGLoadingContext& context) { if (context.state < PNGLoadingContext::State::ChunksDecoded) { if (!decode_png_chunks(context)) - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); } if (context.state >= PNGLoadingContext::State::BitmapDecoded) return {}; if (context.width == -1 || context.height == -1) - return Error::from_string_literal("PNGImageDecoderPlugin: Didn't see an IHDR chunk."sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Didn't see an IHDR chunk."); if (context.color_type == PNG::ColorType::IndexedColor && context.palette_data.is_empty()) - return Error::from_string_literal("PNGImageDecoderPlugin: Didn't see a PLTE chunk for a palletized image, or it was empty."sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Didn't see a PLTE chunk for a palletized image, or it was empty."); auto result = Compress::Zlib::decompress_all(context.compressed_data.span()); if (!result.has_value()) { context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Decompression failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decompression failed"); } context.decompression_buffer = &result.value(); context.compressed_data.clear(); @@ -748,7 +748,7 @@ static ErrorOr<void> decode_png_bitmap(PNGLoadingContext& context) break; default: context.state = PNGLoadingContext::State::Error; - return Error::from_string_literal("PNGImageDecoderPlugin: Invalid interlace method"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Invalid interlace method"); } context.decompression_buffer = nullptr; @@ -960,10 +960,10 @@ size_t PNGImageDecoderPlugin::frame_count() ErrorOr<ImageFrameDescriptor> PNGImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("PNGImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Invalid frame index"); if (m_context->state == PNGLoadingContext::State::Error) - return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PNGImageDecoderPlugin: Decoding failed"); if (m_context->state < PNGLoadingContext::State::BitmapDecoded) { // NOTE: This forces the chunk decoding to happen. diff --git a/Userland/Libraries/LibGfx/PortableImageMapLoader.h b/Userland/Libraries/LibGfx/PortableImageMapLoader.h index 994a86961c..ab5a466406 100644 --- a/Userland/Libraries/LibGfx/PortableImageMapLoader.h +++ b/Userland/Libraries/LibGfx/PortableImageMapLoader.h @@ -145,15 +145,15 @@ template<typename TContext> ErrorOr<ImageFrameDescriptor> PortableImageDecoderPlugin<TContext>::frame(size_t index) { if (index > 0) - return Error::from_string_literal("PortableImageDecoderPlugin: Invalid frame index"sv); + return Error::from_string_literal("PortableImageDecoderPlugin: Invalid frame index"); if (m_context->state == TContext::State::Error) - return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed"); if (m_context->state < TContext::State::Decoded) { bool success = decode(*m_context); if (!success) - return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed"sv); + return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed"); } VERIFY(m_context->bitmap); diff --git a/Userland/Libraries/LibGfx/QOILoader.cpp b/Userland/Libraries/LibGfx/QOILoader.cpp index 3186b8dfa0..623b507a73 100644 --- a/Userland/Libraries/LibGfx/QOILoader.cpp +++ b/Userland/Libraries/LibGfx/QOILoader.cpp @@ -26,9 +26,9 @@ static ErrorOr<QOIHeader> decode_qoi_header(InputMemoryStream& stream) QOIHeader header; stream >> Bytes { &header, sizeof(header) }; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading header"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading header"); if (StringView { header.magic, array_size(header.magic) } != QOI_MAGIC) - return Error::from_string_literal("Invalid QOI image: incorrect header magic"sv); + return Error::from_string_literal("Invalid QOI image: incorrect header magic"); header.width = AK::convert_between_host_and_big_endian(header.width); header.height = AK::convert_between_host_and_big_endian(header.height); return header; @@ -39,7 +39,7 @@ static ErrorOr<Color> decode_qoi_op_rgb(InputMemoryStream& stream, Color pixel) u8 bytes[4]; stream >> Bytes { &bytes, array_size(bytes) }; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RGB chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RGB chunk"); VERIFY(bytes[0] == QOI_OP_RGB); // The alpha value remains unchanged from the previous pixel. @@ -51,7 +51,7 @@ static ErrorOr<Color> decode_qoi_op_rgba(InputMemoryStream& stream) u8 bytes[5]; stream >> Bytes { &bytes, array_size(bytes) }; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RGBA chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RGBA chunk"); VERIFY(bytes[0] == QOI_OP_RGBA); return Color { bytes[1], bytes[2], bytes[3], bytes[4] }; } @@ -61,7 +61,7 @@ static ErrorOr<u8> decode_qoi_op_index(InputMemoryStream& stream) u8 byte; stream >> byte; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_INDEX chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_INDEX chunk"); VERIFY((byte & QOI_MASK_2) == QOI_OP_INDEX); u8 index = byte & ~QOI_MASK_2; VERIFY(index <= 63); @@ -73,7 +73,7 @@ static ErrorOr<Color> decode_qoi_op_diff(InputMemoryStream& stream, Color pixel) u8 byte; stream >> byte; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_DIFF chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_DIFF chunk"); VERIFY((byte & QOI_MASK_2) == QOI_OP_DIFF); u8 dr = (byte & 0b00110000) >> 4; u8 dg = (byte & 0b00001100) >> 2; @@ -94,7 +94,7 @@ static ErrorOr<Color> decode_qoi_op_luma(InputMemoryStream& stream, Color pixel) u8 bytes[2]; stream >> Bytes { &bytes, array_size(bytes) }; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_LUMA chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_LUMA chunk"); VERIFY((bytes[0] & QOI_MASK_2) == QOI_OP_LUMA); u8 diff_green = (bytes[0] & ~QOI_MASK_2); u8 dr_dg = (bytes[1] & 0b11110000) >> 4; @@ -114,7 +114,7 @@ static ErrorOr<u8> decode_qoi_op_run(InputMemoryStream& stream) u8 byte; stream >> byte; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RUN chunk"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading QOI_OP_RUN chunk"); VERIFY((byte & QOI_MASK_2) == QOI_OP_RUN); u8 run = byte & ~QOI_MASK_2; @@ -123,7 +123,7 @@ static ErrorOr<u8> decode_qoi_op_run(InputMemoryStream& stream) // Note that the run-lengths 63 and 64 (b111110 and b111111) are illegal as they are occupied by the QOI_OP_RGB and QOI_OP_RGBA tags. if (run == QOI_OP_RGB || run == QOI_OP_RGBA) - return Error::from_string_literal("Invalid QOI image: illegal run length"sv); + return Error::from_string_literal("Invalid QOI image: illegal run length"); VERIFY(run >= 1 && run <= 62); return run; @@ -134,11 +134,11 @@ static ErrorOr<void> decode_qoi_end_marker(InputMemoryStream& stream) u8 bytes[array_size(END_MARKER)]; stream >> Bytes { &bytes, array_size(bytes) }; if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading end marker"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading end marker"); if (!stream.eof()) - return Error::from_string_literal("Invalid QOI image: expected end of stream but more bytes are available"sv); + return Error::from_string_literal("Invalid QOI image: expected end of stream but more bytes are available"); if (memcmp(&END_MARKER, &bytes, array_size(bytes)) != 0) - return Error::from_string_literal("Invalid QOI image: incorrect end marker"sv); + return Error::from_string_literal("Invalid QOI image: incorrect end marker"); return {}; } @@ -146,9 +146,9 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(InputMemoryStream& stream { // FIXME: Why is Gfx::Bitmap's size signed? Makes no sense whatsoever. if (width > NumericLimits<int>::max()) - return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, width exceeds maximum Gfx::Bitmap width"sv); + return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, width exceeds maximum Gfx::Bitmap width"); if (height > NumericLimits<int>::max()) - return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, height exceeds maximum Gfx::Bitmap height"sv); + return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, height exceeds maximum Gfx::Bitmap height"); auto bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { width, height })); @@ -163,7 +163,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(InputMemoryStream& stream if (run == 0) { u8 tag = stream.peek_or_error(); if (stream.handle_any_error()) - return Error::from_string_literal("Invalid QOI image: end of stream while reading chunk tag"sv); + return Error::from_string_literal("Invalid QOI image: end of stream while reading chunk tag"); if (tag == QOI_OP_RGB) pixel = TRY(decode_qoi_op_rgb(stream, pixel)); else if (tag == QOI_OP_RGBA) @@ -177,7 +177,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(InputMemoryStream& stream else if ((tag & QOI_MASK_2) == QOI_OP_RUN) run = TRY(decode_qoi_op_run(stream)); else - return Error::from_string_literal("Invalid QOI image: unknown chunk tag"sv); + return Error::from_string_literal("Invalid QOI image: unknown chunk tag"); } auto index_position = (pixel.red() * 3 + pixel.green() * 5 + pixel.blue() * 7 + pixel.alpha() * 11) % 64; previous_pixels[index_position] = pixel; @@ -232,7 +232,7 @@ bool QOIImageDecoderPlugin::sniff() ErrorOr<ImageFrameDescriptor> QOIImageDecoderPlugin::frame(size_t index) { if (index > 0) - return Error::from_string_literal("Invalid frame index"sv); + return Error::from_string_literal("Invalid frame index"); if (m_context->state == QOILoadingContext::State::NotDecoded) { InputMemoryStream stream { { m_context->data, m_context->data_size } }; diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp index 2be857d4de..4aeedda267 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp @@ -56,7 +56,7 @@ ErrorOr<void> decode(Decoder& decoder, Gfx::ShareableBitmap& shareable_bitmap) u32 raw_bitmap_format; TRY(decoder.decode(raw_bitmap_format)); if (!Gfx::is_valid_bitmap_format(raw_bitmap_format)) - return Error::from_string_literal("IPC: Invalid Gfx::ShareableBitmap format"sv); + return Error::from_string_literal("IPC: Invalid Gfx::ShareableBitmap format"); auto bitmap_format = (Gfx::BitmapFormat)raw_bitmap_format; Vector<Gfx::ARGB32> palette; if (Gfx::Bitmap::is_indexed(bitmap_format)) { diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp index 594b246333..e6e6393b13 100644 --- a/Userland/Libraries/LibIPC/Connection.cpp +++ b/Userland/Libraries/LibIPC/Connection.cpp @@ -30,7 +30,7 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer) // NOTE: If this connection is being shut down, but has not yet been destroyed, // the socket will be closed. Don't try to send more messages. if (!m_socket->is_open()) - return Error::from_string_literal("Trying to post_message during IPC shutdown"sv); + return Error::from_string_literal("Trying to post_message during IPC shutdown"); // Prepend the message size. uint32_t message_size = buffer.data.size(); @@ -57,9 +57,9 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer) shutdown_with_error(error); switch (error.code()) { case EPIPE: - return Error::from_string_literal("IPC::Connection::post_message: Disconnected from peer"sv); + return Error::from_string_literal("IPC::Connection::post_message: Disconnected from peer"); case EAGAIN: - return Error::from_string_literal("IPC::Connection::post_message: Peer buffer overflowed"sv); + return Error::from_string_literal("IPC::Connection::post_message: Peer buffer overflowed"); default: return Error::from_syscall("IPC::Connection::post_message write"sv, -error.code()); } @@ -141,7 +141,7 @@ ErrorOr<Vector<u8>> ConnectionBase::read_as_much_as_possible_from_socket_without deferred_invoke([this] { shutdown(); }); if (!bytes.is_empty()) break; - return Error::from_string_literal("IPC connection EOF"sv); + return Error::from_string_literal("IPC connection EOF"); } bytes.append(bytes_read.data(), bytes_read.size()); @@ -169,7 +169,7 @@ ErrorOr<void> ConnectionBase::drain_messages_from_peer() auto remaining_bytes = TRY(ByteBuffer::copy(bytes.span().slice(index))); if (!m_unprocessed_bytes.is_empty()) { shutdown(); - return Error::from_string_literal("drain_messages_from_peer: Already have unprocessed bytes"sv); + return Error::from_string_literal("drain_messages_from_peer: Already have unprocessed bytes"); } m_unprocessed_bytes = move(remaining_bytes); } diff --git a/Userland/Libraries/LibIPC/Decoder.h b/Userland/Libraries/LibIPC/Decoder.h index fc5ea6e117..b938b21063 100644 --- a/Userland/Libraries/LibIPC/Decoder.h +++ b/Userland/Libraries/LibIPC/Decoder.h @@ -58,7 +58,7 @@ public: u32 size; TRY(decode(size)); if (size > NumericLimits<i32>::max()) - return Error::from_string_literal("IPC: Invalid HashMap size"sv); + return Error::from_string_literal("IPC: Invalid HashMap size"); for (size_t i = 0; i < size; ++i) { K key; @@ -76,7 +76,7 @@ public: u32 size; TRY(decode(size)); if (size > NumericLimits<i32>::max()) - return Error::from_string_literal("IPC: Invalid HashMap size"sv); + return Error::from_string_literal("IPC: Invalid HashMap size"); for (size_t i = 0; i < size; ++i) { K key; @@ -109,7 +109,7 @@ public: u64 size; TRY(decode(size)); if (size > NumericLimits<i32>::max()) - return Error::from_string_literal("IPC: Invalid Vector size"sv); + return Error::from_string_literal("IPC: Invalid Vector size"); VERIFY(vector.is_empty()); TRY(vector.try_ensure_capacity(size)); for (size_t i = 0; i < size; ++i) { diff --git a/Userland/Libraries/LibSQL/Database.cpp b/Userland/Libraries/LibSQL/Database.cpp index e4ed4960e6..3f25267632 100644 --- a/Userland/Libraries/LibSQL/Database.cpp +++ b/Userland/Libraries/LibSQL/Database.cpp @@ -90,7 +90,7 @@ ErrorOr<void> Database::add_schema(SchemaDef const& schema) VERIFY(is_open()); if (!m_schemas->insert(schema.key())) { warnln("Duplicate schema name {}"sv, schema.name()); - return Error::from_string_literal("Duplicate schema name"sv); + return Error::from_string_literal("Duplicate schema name"); } return {}; } @@ -127,7 +127,7 @@ ErrorOr<void> Database::add_table(TableDef& table) VERIFY(is_open()); if (!m_tables->insert(table.key())) { warnln("Duplicate table name '{}'.'{}'"sv, table.parent()->name(), table.name()); - return Error::from_string_literal("Duplicate table name"sv); + return Error::from_string_literal("Duplicate table name"); } for (auto& column : table.columns()) { VERIFY(m_table_columns->insert(column.key())); @@ -159,7 +159,7 @@ ErrorOr<RefPtr<TableDef>> Database::get_table(String const& schema, String const auto schema_def = TRY(get_schema(schema)); if (!schema_def) { warnln("Schema '{}' does not exist"sv, schema); - return Error::from_string_literal("Schema does not exist"sv); + return Error::from_string_literal("Schema does not exist"); } auto ret = TableDef::construct(schema_def, name); ret->set_pointer((*table_iterator).pointer()); diff --git a/Userland/Libraries/LibSQL/Heap.cpp b/Userland/Libraries/LibSQL/Heap.cpp index 396172b67f..8ba5f3745a 100644 --- a/Userland/Libraries/LibSQL/Heap.cpp +++ b/Userland/Libraries/LibSQL/Heap.cpp @@ -35,11 +35,11 @@ ErrorOr<void> Heap::open() if (stat(name().characters(), &stat_buffer) != 0) { if (errno != ENOENT) { warnln("Heap::open({}): could not stat: {}"sv, name(), strerror(errno)); - return Error::from_string_literal("Heap::open(): could not stat file"sv); + return Error::from_string_literal("Heap::open(): could not stat file"); } } else if (!S_ISREG(stat_buffer.st_mode)) { warnln("Heap::open({}): can only use regular files"sv, name()); - return Error::from_string_literal("Heap::open(): can only use regular files"sv); + return Error::from_string_literal("Heap::open(): can only use regular files"); } else { file_size = stat_buffer.st_size; } @@ -49,7 +49,7 @@ ErrorOr<void> Heap::open() auto file_or_error = Core::File::open(name(), Core::OpenMode::ReadWrite); if (file_or_error.is_error()) { warnln("Heap::open({}): could not open: {}"sv, name(), file_or_error.error()); - return Error::from_string_literal("Heap::open(): could not open file"sv); + return Error::from_string_literal("Heap::open(): could not open file"); } m_file = file_or_error.value(); if (file_size > 0) { @@ -68,7 +68,7 @@ ErrorOr<ByteBuffer> Heap::read_block(u32 block) { if (m_file.is_null()) { warnln("Heap({})::read_block({}): Heap file not opened"sv, name(), block); - return Error::from_string_literal("Heap()::read_block(): Heap file not opened"sv); + return Error::from_string_literal("Heap()::read_block(): Heap file not opened"); } auto buffer_or_empty = m_write_ahead_log.get(block); if (buffer_or_empty.has_value()) @@ -76,14 +76,14 @@ ErrorOr<ByteBuffer> Heap::read_block(u32 block) if (block >= m_next_block) { warnln("Heap({})::read_block({}): block # out of range (>= {})"sv, name(), block, m_next_block); - return Error::from_string_literal("Heap()::read_block(): block # out of range"sv); + return Error::from_string_literal("Heap()::read_block(): block # out of range"); } dbgln_if(SQL_DEBUG, "Read heap block {}", block); TRY(seek_block(block)); auto ret = m_file->read(BLOCKSIZE); if (ret.is_empty()) { warnln("Heap({})::read_block({}): Could not read block"sv, name(), block); - return Error::from_string_literal("Heap()::read_block(): Could not read block"sv); + return Error::from_string_literal("Heap()::read_block(): Could not read block"); } dbgln_if(SQL_DEBUG, "{:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x}", *ret.offset_pointer(0), *ret.offset_pointer(1), @@ -97,23 +97,23 @@ ErrorOr<void> Heap::write_block(u32 block, ByteBuffer& buffer) { if (m_file.is_null()) { warnln("Heap({})::write_block({}): Heap file not opened"sv, name(), block); - return Error::from_string_literal("Heap()::write_block(): Heap file not opened"sv); + return Error::from_string_literal("Heap()::write_block(): Heap file not opened"); } if (block > m_next_block) { warnln("Heap({})::write_block({}): block # out of range (> {})"sv, name(), block, m_next_block); - return Error::from_string_literal("Heap()::write_block(): block # out of range"sv); + return Error::from_string_literal("Heap()::write_block(): block # out of range"); } TRY(seek_block(block)); dbgln_if(SQL_DEBUG, "Write heap block {} size {}", block, buffer.size()); if (buffer.size() > BLOCKSIZE) { warnln("Heap({})::write_block({}): Oversized block ({} > {})"sv, name(), block, buffer.size(), BLOCKSIZE); - return Error::from_string_literal("Heap()::write_block(): Oversized block"sv); + return Error::from_string_literal("Heap()::write_block(): Oversized block"); } auto sz = buffer.size(); if (sz < BLOCKSIZE) { if (buffer.try_resize(BLOCKSIZE).is_error()) { warnln("Heap({})::write_block({}): Could not align block of size {} to {}"sv, name(), block, buffer.size(), BLOCKSIZE); - return Error::from_string_literal("Heap()::write_block(): Could not align block"sv); + return Error::from_string_literal("Heap()::write_block(): Could not align block"); } memset(buffer.offset_pointer((int)sz), 0, BLOCKSIZE - sz); } @@ -128,28 +128,28 @@ ErrorOr<void> Heap::write_block(u32 block, ByteBuffer& buffer) return {}; } warnln("Heap({})::write_block({}): Could not full write block"sv, name(), block); - return Error::from_string_literal("Heap()::write_block(): Could not full write block"sv); + return Error::from_string_literal("Heap()::write_block(): Could not full write block"); } ErrorOr<void> Heap::seek_block(u32 block) { if (m_file.is_null()) { warnln("Heap({})::seek_block({}): Heap file not opened"sv, name(), block); - return Error::from_string_literal("Heap()::seek_block(): Heap file not opened"sv); + return Error::from_string_literal("Heap()::seek_block(): Heap file not opened"); } if (block == m_end_of_file) { off_t pos; if (!m_file->seek(0, Core::SeekMode::FromEndPosition, &pos)) { warnln("Heap({})::seek_block({}): Error seeking end of file: {}"sv, name(), block, m_file->error_string()); - return Error::from_string_literal("Heap()::seek_block(): Error seeking end of file"sv); + return Error::from_string_literal("Heap()::seek_block(): Error seeking end of file"); } } else if (block > m_end_of_file) { warnln("Heap({})::seek_block({}): Cannot seek beyond end of file at block {}"sv, name(), block, m_end_of_file); - return Error::from_string_literal("Heap()::seek_block(): Cannot seek beyond end of file"sv); + return Error::from_string_literal("Heap()::seek_block(): Cannot seek beyond end of file"); } else { if (!m_file->seek(block * BLOCKSIZE)) { warnln("Heap({})::seek_block({}): Error seeking: {}"sv, name(), block, m_file->error_string()); - return Error::from_string_literal("Heap()::seek_block(): Error seeking: {}"sv); + return Error::from_string_literal("Heap()::seek_block(): Error seeking: {}"); } } return {}; @@ -206,7 +206,7 @@ ErrorOr<void> Heap::read_zero_block() auto file_id = StringView(file_id_buffer); if (file_id != FILE_ID) { warnln("{}: Zero page corrupt. This is probably not a {} heap file"sv, name(), FILE_ID); - return Error::from_string_literal("Heap()::read_zero_block(): Zero page corrupt. This is probably not a SerenitySQL heap file"sv); + return Error::from_string_literal("Heap()::read_zero_block(): Zero page corrupt. This is probably not a SerenitySQL heap file"); } dbgln_if(SQL_DEBUG, "Read zero block from {}", name()); memcpy(&m_version, buffer.offset_pointer(VERSION_OFFSET), sizeof(u32)); diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index fa75c85c54..e8f7c76e0f 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -91,7 +91,7 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, u16 port, Opt tls_socket->try_disambiguate_error(); // FIXME: Should return richer information here. - return AK::Error::from_string_literal(alert_name(static_cast<AlertDescription>(256 - result))); + return AK::Error::from_string_view(alert_name(static_cast<AlertDescription>(256 - result))); } ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, Core::Stream::Socket& underlying_stream, Options options) @@ -112,7 +112,7 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, Core::Stream: tls_socket->try_disambiguate_error(); // FIXME: Should return richer information here. - return AK::Error::from_string_literal(alert_name(static_cast<AlertDescription>(256 - result))); + return AK::Error::from_string_view(alert_name(static_cast<AlertDescription>(256 - result))); } void TLSv12::setup_connection() diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index 73372ed3fa..dd4e1cff77 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -75,17 +75,17 @@ enum class AlertDescription : u8 { #undef ENUMERATE_ALERT_DESCRIPTION }; -constexpr static char const* alert_name(AlertDescription descriptor) +constexpr static StringView alert_name(AlertDescription descriptor) { #define ENUMERATE_ALERT_DESCRIPTION(name, value) \ case AlertDescription::name: \ - return #name; + return #name##sv; switch (descriptor) { ENUMERATE_ALERT_DESCRIPTIONS } - return "Unknown"; + return "Unknown"sv; #undef ENUMERATE_ALERT_DESCRIPTION } diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Validator.h b/Userland/Libraries/LibWasm/AbstractMachine/Validator.h index 532ffd42d7..f8aa88c02e 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/Validator.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/Validator.h @@ -31,7 +31,7 @@ struct Context { struct ValidationError : public Error { ValidationError(String error) - : Error(Error::from_string_literal(error)) + : Error(Error::from_string_view(error)) , error_string(move(error)) { } |