io/FileDescriptor: remove Read()/Write() with void pointers
Obsolete and unsafe.
This commit is contained in:
parent
263b9916c2
commit
fc4a579d83
|
@ -267,7 +267,7 @@ void
|
|||
FileDescriptor::FullRead(std::span<std::byte> dest) const
|
||||
{
|
||||
while (!dest.empty()) {
|
||||
ssize_t nbytes = Read(dest.data(), dest.size());
|
||||
ssize_t nbytes = Read(dest);
|
||||
if (nbytes <= 0) {
|
||||
if (nbytes < 0)
|
||||
throw MakeErrno("Failed to read");
|
||||
|
@ -282,7 +282,7 @@ void
|
|||
FileDescriptor::FullWrite(std::span<const std::byte> src) const
|
||||
{
|
||||
while (!src.empty()) {
|
||||
ssize_t nbytes = Write(src.data(), src.size());
|
||||
ssize_t nbytes = Write(src);
|
||||
if (nbytes <= 0) {
|
||||
if (nbytes < 0)
|
||||
throw MakeErrno("Failed to write");
|
||||
|
|
|
@ -246,11 +246,6 @@ public:
|
|||
return ::read(fd, dest.data(), dest.size());
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
ssize_t Read(void *buffer, std::size_t length) const noexcept {
|
||||
return ::read(fd, buffer, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read until all of the given buffer has been filled. Throws
|
||||
* on error.
|
||||
|
@ -269,11 +264,6 @@ public:
|
|||
return ::write(fd, src.data(), src.size());
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
ssize_t Write(const void *buffer, std::size_t length) const noexcept {
|
||||
return ::write(fd, buffer, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write until all of the given buffer has been written.
|
||||
* Throws on error.
|
||||
|
|
|
@ -250,7 +250,7 @@ FileOutputStream::Write(std::span<const std::byte> src)
|
|||
{
|
||||
assert(IsDefined());
|
||||
|
||||
ssize_t nbytes = fd.Write(src.data(), src.size());
|
||||
ssize_t nbytes = fd.Write(src);
|
||||
if (nbytes < 0)
|
||||
throw FmtErrno("Failed to write to {}", GetPath());
|
||||
else if ((size_t)nbytes < src.size())
|
||||
|
|
Loading…
Reference in New Issue