From 43864762eec8857a7057944eb27e38140f4e346a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 27 Mar 2009 20:10:39 +0100 Subject: mixer: assert that the new volume value is valid Added an assertion in mixer_set_volume(). Removed the range checks from the ALSA and OSS plugins. --- src/mixer/alsa_mixer.c | 4 ---- src/mixer/oss_mixer.c | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'src/mixer') diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c index 6c7476ab3..7b161cd14 100644 --- a/src/mixer/alsa_mixer.c +++ b/src/mixer/alsa_mixer.c @@ -188,10 +188,6 @@ alsa_mixer_set_volume(struct mixer *mixer, unsigned volume) vol = volume; am->volume_set = vol + 0.5; - am->volume_set = am->volume_set > 100 - ? 100 : - (am->volume_set < 0 - ? 0 : am->volume_set); level = (long)(((vol / 100.0) * (am->volume_max - am->volume_min) + am->volume_min) + 0.5); diff --git a/src/mixer/oss_mixer.c b/src/mixer/oss_mixer.c index 85b59fbe7..f2db01ff4 100644 --- a/src/mixer/oss_mixer.c +++ b/src/mixer/oss_mixer.c @@ -171,9 +171,7 @@ oss_mixer_set_volume(struct mixer *mixer, unsigned volume) int ret; assert(om->device_fd >= 0); - - if (volume > 100) - volume = 100; + assert(volume <= 100); level = (volume << 8) + volume; -- cgit v1.2.3