aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-12 18:34:38 +0100
committerMax Kellermann <max@duempel.org>2009-03-12 18:34:38 +0100
commitc37567a14f13dc7edda326d8b9b2253daeee87ba (patch)
tree4e8e26d2f8fe7722e1a05e05471b797243a6c578 /src
parente9cbb6be3f7c0a13425fdb542db619452668a6b5 (diff)
downloadmpd-c37567a14f13dc7edda326d8b9b2253daeee87ba.tar.gz
mpd-c37567a14f13dc7edda326d8b9b2253daeee87ba.tar.xz
mpd-c37567a14f13dc7edda326d8b9b2253daeee87ba.zip
audio: converted device number check to assertion
No caller must ever pass an invalid device number to mixer_control_setvol() or mixer_control_getvol().
Diffstat (limited to '')
-rw-r--r--src/mixer_control.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mixer_control.c b/src/mixer_control.c
index 782fbcd6a..a43230d5a 100644
--- a/src/mixer_control.c
+++ b/src/mixer_control.c
@@ -22,14 +22,15 @@
#include "output_plugin.h"
#include "output_internal.h"
+#include <assert.h>
+
bool
mixer_control_setvol(unsigned int device, int volume, int rel)
{
struct audio_output *output;
struct mixer *mixer;
- if (device >= audio_output_count())
- return false;
+ assert(device < audio_output_count());
output = audio_output_get(device);
mixer = ao_plugin_get_mixer(output->plugin, output->data);
@@ -57,8 +58,7 @@ mixer_control_getvol(unsigned int device, int *volume)
struct audio_output *output;
struct mixer *mixer;
- if (device >= audio_output_count())
- return false;
+ assert(device < audio_output_count());
output = audio_output_get(device);
mixer = ao_plugin_get_mixer(output->plugin, output->data);