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:
parent
e9cbb6be3f
commit
c37567a14f
@ -22,14 +22,15 @@
|
|||||||
#include "output_plugin.h"
|
#include "output_plugin.h"
|
||||||
#include "output_internal.h"
|
#include "output_internal.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
bool
|
bool
|
||||||
mixer_control_setvol(unsigned int device, int volume, int rel)
|
mixer_control_setvol(unsigned int device, int volume, int rel)
|
||||||
{
|
{
|
||||||
struct audio_output *output;
|
struct audio_output *output;
|
||||||
struct mixer *mixer;
|
struct mixer *mixer;
|
||||||
|
|
||||||
if (device >= audio_output_count())
|
assert(device < audio_output_count());
|
||||||
return false;
|
|
||||||
|
|
||||||
output = audio_output_get(device);
|
output = audio_output_get(device);
|
||||||
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
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 audio_output *output;
|
||||||
struct mixer *mixer;
|
struct mixer *mixer;
|
||||||
|
|
||||||
if (device >= audio_output_count())
|
assert(device < audio_output_count());
|
||||||
return false;
|
|
||||||
|
|
||||||
output = audio_output_get(device);
|
output = audio_output_get(device);
|
||||||
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
||||||
|
Loading…
Reference in New Issue
Block a user