AK: Remove Error::from_string_view_or_print_error_and_return_errno

This was for use within Serenity's kernel. In Ladybird, it is just some
indirection to Error::from_string_view.
This commit is contained in:
Timothy Flynn 2025-05-10 16:12:27 -04:00 committed by Tim Flynn
commit 4f132b9e40
Notes: github-actions[bot] 2025-05-11 01:21:22 +00:00
6 changed files with 13 additions and 24 deletions

View file

@ -58,7 +58,7 @@ ErrorOr<Bytes> FixedMemoryStream::read_some(Bytes bytes)
ErrorOr<void> FixedMemoryStream::read_until_filled(AK::Bytes bytes)
{
if (remaining() < bytes.size())
return Error::from_string_view_or_print_error_and_return_errno("Can't read past the end of the stream memory"sv, EINVAL);
return Error::from_string_literal("Can't read past the end of the stream memory");
m_bytes.slice(m_offset).copy_trimmed_to(bytes);
m_offset += bytes.size();
@ -71,19 +71,19 @@ ErrorOr<size_t> FixedMemoryStream::seek(i64 offset, SeekMode seek_mode)
switch (seek_mode) {
case SeekMode::SetPosition:
if (offset > static_cast<i64>(m_bytes.size()))
return Error::from_string_view_or_print_error_and_return_errno("Offset past the end of the stream memory"sv, EINVAL);
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_view_or_print_error_and_return_errno("Offset past the end of the stream memory"sv, EINVAL);
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_view_or_print_error_and_return_errno("Offset past the start of the stream memory"sv, EINVAL);
return Error::from_string_literal("Offset past the start of the stream memory");
m_offset = m_bytes.size() + offset;
break;
@ -108,7 +108,7 @@ ErrorOr<size_t> FixedMemoryStream::write_some(ReadonlyBytes bytes)
ErrorOr<void> FixedMemoryStream::write_until_depleted(ReadonlyBytes bytes)
{
if (remaining() < bytes.size())
return Error::from_string_view_or_print_error_and_return_errno("Write of entire buffer ends past the memory area"sv, EINVAL);
return Error::from_string_literal("Write of entire buffer ends past the memory area");
TRY(write_some(bytes));
return {};
@ -185,7 +185,7 @@ ErrorOr<void> AllocatingMemoryStream::discard(size_t count)
VERIFY(m_write_offset >= m_read_offset);
if (count > used_buffer_size())
return Error::from_string_view_or_print_error_and_return_errno("Number of discarded bytes is higher than the number of allocated bytes"sv, EINVAL);
return Error::from_string_literal("Number of discarded bytes is higher than the number of allocated bytes");
m_read_offset += count;