audio: converted device number check to assertion

No caller must ever pass an invalid device number to
mixer_control_setvol() or mixer_control_getvol().
This commit is contained in:
Max Kellermann 2009-03-12 18:34:38 +01:00
parent e9cbb6be3f
commit c37567a14f

View File

@ -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);