From 7244dc45110118631c16448907c344163bcb402c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 12 Aug 2014 16:09:07 +0200 Subject: Filter: FilterPCM() returns ConstBuffer API simplification. We can now avoid abusing a "size_t*" as additional return value. --- test/run_filter.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'test') 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)); -- cgit v1.2.3