aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-12 16:09:07 +0200
committerMax Kellermann <max@duempel.org>2014-08-12 16:40:51 +0200
commit7244dc45110118631c16448907c344163bcb402c (patch)
treecd6a05d27069d6f5234cb8f0af7c7c5034362cef /test
parent56f61a6d59cfc6a97005d85599963cafdfdeaba8 (diff)
downloadmpd-7244dc45110118631c16448907c344163bcb402c.tar.gz
mpd-7244dc45110118631c16448907c344163bcb402c.tar.xz
mpd-7244dc45110118631c16448907c344163bcb402c.zip
Filter: FilterPCM() returns ConstBuffer
API simplification. We can now avoid abusing a "size_t*" as additional return value.
Diffstat (limited to 'test')
-rw-r--r--test/run_filter.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index 1bde583a4..ab99c9a1e 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -29,6 +29,7 @@
#include "mixer/MixerControl.hxx"
#include "stdbin.h"
#include "util/Error.hxx"
+#include "util/ConstBuffer.hxx"
#include "system/FatalError.hxx"
#include "Log.hxx"
@@ -132,23 +133,21 @@ int main(int argc, char **argv)
while (true) {
ssize_t nbytes;
- size_t length;
- const void *dest;
nbytes = read(0, buffer, sizeof(buffer));
if (nbytes <= 0)
break;
- dest = filter->FilterPCM(buffer, (size_t)nbytes,
- &length, error);
- if (dest == NULL) {
+ auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes},
+ error);
+ if (dest.IsNull()) {
LogError(error, "filter/Filter failed");
filter->Close();
delete filter;
return EXIT_FAILURE;
}
- nbytes = write(1, dest, length);
+ nbytes = write(1, dest.data, dest.size);
if (nbytes < 0) {
fprintf(stderr, "Failed to write: %s\n",
strerror(errno));