test/ReadFrames: pass std::span to FileDescriptor::Read()

This commit is contained in:
Max Kellermann 2024-11-13 10:42:31 +01:00
parent 7a6672b7ed
commit 77226bc0d8
1 changed files with 3 additions and 3 deletions

View File

@ -6,9 +6,9 @@
#include "io/FileDescriptor.hxx"
static size_t
ReadOrThrow(FileDescriptor fd, void *buffer, size_t size)
ReadOrThrow(FileDescriptor fd, std::span<std::byte> dest)
{
auto nbytes = fd.Read(buffer, size);
auto nbytes = fd.Read(dest);
if (nbytes < 0)
throw MakeErrno("Read failed");
@ -23,7 +23,7 @@ ReadFrames(FileDescriptor fd, void *_buffer, std::size_t size,
size = (size / frame_size) * frame_size;
size_t nbytes = ReadOrThrow(fd, buffer, size);
size_t nbytes = ReadOrThrow(fd, {buffer, size});
const size_t modulo = nbytes % frame_size;
if (modulo > 0) {