diff options
author | Max Kellermann <max@duempel.org> | 2014-12-06 00:08:08 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-08 13:30:35 +0100 |
commit | 6edfc56c9df7b212c65a5a40e9d0f132429578ea (patch) | |
tree | 32817169cad14212606f3e9234283bf6671e924a /src/command/OutputCommands.cxx | |
parent | 5837a6394256f10b16d9a1fbc19be686ef2da2b6 (diff) | |
download | mpd-6edfc56c9df7b212c65a5a40e9d0f132429578ea.tar.gz mpd-6edfc56c9df7b212c65a5a40e9d0f132429578ea.tar.xz mpd-6edfc56c9df7b212c65a5a40e9d0f132429578ea.zip |
command: use ConstBuffer<const char *> for argument list
Diffstat (limited to '')
-rw-r--r-- | src/command/OutputCommands.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/command/OutputCommands.cxx b/src/command/OutputCommands.cxx index c69a0dd65..5b0894310 100644 --- a/src/command/OutputCommands.cxx +++ b/src/command/OutputCommands.cxx @@ -25,12 +25,15 @@ #include "protocol/ArgParser.hxx" #include "client/Client.hxx" #include "Partition.hxx" +#include "util/ConstBuffer.hxx" CommandResult -handle_enableoutput(Client &client, gcc_unused unsigned argc, char *argv[]) +handle_enableoutput(Client &client, ConstBuffer<const char *> args) { + assert(args.size == 1); + unsigned device; - if (!check_unsigned(client, &device, argv[1])) + if (!check_unsigned(client, &device, args.front())) return CommandResult::ERROR; if (!audio_output_enable_index(client.partition.outputs, device)) { @@ -43,10 +46,12 @@ handle_enableoutput(Client &client, gcc_unused unsigned argc, char *argv[]) } CommandResult -handle_disableoutput(Client &client, gcc_unused unsigned argc, char *argv[]) +handle_disableoutput(Client &client, ConstBuffer<const char *> args) { + assert(args.size == 1); + unsigned device; - if (!check_unsigned(client, &device, argv[1])) + if (!check_unsigned(client, &device, args.front())) return CommandResult::ERROR; if (!audio_output_disable_index(client.partition.outputs, device)) { @@ -59,10 +64,12 @@ handle_disableoutput(Client &client, gcc_unused unsigned argc, char *argv[]) } CommandResult -handle_toggleoutput(Client &client, gcc_unused unsigned argc, char *argv[]) +handle_toggleoutput(Client &client, ConstBuffer<const char *> args) { + assert(args.size == 1); + unsigned device; - if (!check_unsigned(client, &device, argv[1])) + if (!check_unsigned(client, &device, args.front())) return CommandResult::ERROR; if (!audio_output_toggle_index(client.partition.outputs, device)) { @@ -75,9 +82,10 @@ handle_toggleoutput(Client &client, gcc_unused unsigned argc, char *argv[]) } CommandResult -handle_devices(Client &client, - gcc_unused unsigned argc, gcc_unused char *argv[]) +handle_devices(Client &client, gcc_unused ConstBuffer<const char *> args) { + assert(args.IsEmpty()); + printAudioDevices(client, client.partition.outputs); return CommandResult::OK; |