diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 17:57:32 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | e5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13 (patch) | |
tree | 6d90ea8a795e90f19f907a225c1ea166de960930 /Userland/Libraries/LibEDID/EDID.cpp | |
parent | c70f45ff4498fcb7ce0671e9107ecff8009d7eb2 (diff) | |
download | serenity-e5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13.zip |
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while
Error::from_string_view does what Error::from_string_literal used to do:
taking StringViews. This change will remove the need to insert `sv`
after error strings when returning string literal errors once
StringView(char const*) is removed.
No functional changes.
Diffstat (limited to 'Userland/Libraries/LibEDID/EDID.cpp')
-rw-r--r-- | Userland/Libraries/LibEDID/EDID.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
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))); |