summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-08-26 21:14:19 +0200
committerMax Kellermann <max@musicpd.org>2019-08-26 21:17:27 +0200
commitb0a04b3da879182192447ccf0a123d6c1bc80250 (patch)
tree58e331982ed2f607372c100440fc99dcabf3e4f0 /test
parent9617bd6c856e8f61d28a637f416e6bc982d54c7a (diff)
test/run_filter: pass ConstBuffer<void> to FullWrite()
Diffstat (limited to 'test')
-rw-r--r--test/run_filter.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index 98aff564f..5a14db097 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -95,20 +95,23 @@ FullRead(FileDescriptor fd, void *_buffer, size_t size)
}
static void
-FullWrite(FileDescriptor fd, const void *_buffer, size_t size)
+FullWrite(FileDescriptor fd, ConstBuffer<uint8_t> src)
{
- auto buffer = (const uint8_t *)_buffer;
-
- while (size > 0) {
- size_t nbytes = WriteOrThrow(fd, buffer, size);
+ while (!src.empty()) {
+ size_t nbytes = WriteOrThrow(fd, src.data, src.size);
if (nbytes == 0)
throw std::runtime_error("Write failed");
- buffer += nbytes;
- size -= nbytes;
+ src.skip_front(nbytes);
}
}
+static void
+FullWrite(FileDescriptor fd, ConstBuffer<void> src)
+{
+ FullWrite(fd, ConstBuffer<uint8_t>::FromVoid(src));
+}
+
static size_t
ReadFrames(FileDescriptor fd, void *_buffer, size_t size, size_t frame_size)
{
@@ -177,7 +180,7 @@ try {
break;
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes});
- FullWrite(output_fd, dest.data, dest.size);
+ FullWrite(output_fd, dest);
}
/* cleanup and exit */