mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
LibCore: Return EBADF
on unsupported stream operations
This commit is contained in:
parent
e65767c2e7
commit
1ca62de558
Notes:
sideshowbarker
2024-07-17 01:31:54 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/1ca62de558 Pull-request: https://github.com/SerenityOS/serenity/pull/17058 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/gmta ✅
@ -48,8 +48,7 @@ bool TarFileStream::is_eof() const
|
||||
|
||||
ErrorOr<size_t> TarFileStream::write(ReadonlyBytes)
|
||||
{
|
||||
// This is purely for wrapping and representing file contents in an archive.
|
||||
VERIFY_NOT_REACHED();
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TarInputStream>> TarInputStream::construct(NonnullOwnPtr<Core::Stream::Stream> stream)
|
||||
|
@ -302,7 +302,7 @@ bool DeflateDecompressor::is_eof() const { return m_state == State::Idle && m_re
|
||||
|
||||
ErrorOr<size_t> DeflateDecompressor::write(ReadonlyBytes)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
bool DeflateDecompressor::is_open() const
|
||||
|
@ -183,7 +183,7 @@ bool GzipDecompressor::is_eof() const { return m_input_stream->is_eof(); }
|
||||
|
||||
ErrorOr<size_t> GzipDecompressor::write(ReadonlyBytes)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
GzipCompressor::GzipCompressor(Core::Stream::Handle<Core::Stream::Stream> stream)
|
||||
|
@ -49,7 +49,7 @@ void FixedMemoryStream::close()
|
||||
|
||||
ErrorOr<void> FixedMemoryStream::truncate(off_t)
|
||||
{
|
||||
return Error::from_errno(ENOTSUP);
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
ErrorOr<Bytes> FixedMemoryStream::read(Bytes bytes)
|
||||
|
@ -729,7 +729,7 @@ ErrorOr<void> WrappedAKInputStream::discard(size_t discarded_bytes)
|
||||
|
||||
ErrorOr<size_t> WrappedAKInputStream::write(ReadonlyBytes)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
bool WrappedAKInputStream::is_eof() const
|
||||
@ -753,7 +753,7 @@ WrappedAKOutputStream::WrappedAKOutputStream(NonnullOwnPtr<OutputStream> stream)
|
||||
|
||||
ErrorOr<Bytes> WrappedAKOutputStream::read(Bytes)
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
ErrorOr<size_t> WrappedAKOutputStream::write(ReadonlyBytes bytes)
|
||||
@ -768,7 +768,7 @@ ErrorOr<size_t> WrappedAKOutputStream::write(ReadonlyBytes bytes)
|
||||
|
||||
bool WrappedAKOutputStream::is_eof() const
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WrappedAKOutputStream::is_open() const
|
||||
|
@ -70,6 +70,8 @@ private:
|
||||
|
||||
/// The base, abstract class for stream operations. This class defines the
|
||||
/// operations one can perform on every stream in LibCore.
|
||||
/// Operations without a sensible default that are unsupported by an implementation
|
||||
/// of a Stream should return EBADF as an error.
|
||||
class Stream {
|
||||
public:
|
||||
/// Reads into a buffer, with the maximum size being the size of the buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user