summaryrefslogtreecommitdiff
path: root/test/run_filter.cxx
diff options
context:
space:
mode:
authorMax Kellermann <mk@cm4all.com>2019-11-18 21:25:04 +0100
committerMax Kellermann <max@musicpd.org>2019-12-17 20:21:11 +0100
commita72878c5b9b1ff5dc3fc87767ce46a43e764e3bc (patch)
tree72cfb2ee73753b12b87b6c1458e5759809e608ba /test/run_filter.cxx
parentbd4df1ae5deb6a01b31cc4a2cc971f29a80302d8 (diff)
io/FileDescriptor: add method FullRead()
Diffstat (limited to 'test/run_filter.cxx')
-rw-r--r--test/run_filter.cxx17
1 files changed, 1 insertions, 16 deletions
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index 0515b1b4e..116907cee 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -80,21 +80,6 @@ WriteOrThrow(FileDescriptor fd, const void *buffer, size_t size)
}
static void
-FullRead(FileDescriptor fd, void *_buffer, size_t size)
-{
- auto buffer = (uint8_t *)_buffer;
-
- while (size > 0) {
- size_t nbytes = ReadOrThrow(fd, buffer, size);
- if (nbytes == 0)
- throw std::runtime_error("Premature end of input");
-
- buffer += nbytes;
- size -= nbytes;
- }
-}
-
-static void
FullWrite(FileDescriptor fd, ConstBuffer<uint8_t> src)
{
while (!src.empty()) {
@@ -124,7 +109,7 @@ ReadFrames(FileDescriptor fd, void *_buffer, size_t size, size_t frame_size)
const size_t modulo = nbytes % frame_size;
if (modulo > 0) {
size_t rest = frame_size - modulo;
- FullRead(fd, buffer + nbytes, rest);
+ fd.FullRead(buffer + nbytes, rest);
nbytes += rest;
}