[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 05/12: Protection against out-of-range volume settings

noreply at xfce.org noreply at xfce.org
Tue Feb 17 00:12:44 CET 2015


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-pulseaudio-plugin.

commit 8b00bc1a520858d4b6c84c85f89ae8ae29bd96eb
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Wed Apr 30 21:47:38 2014 +0100

    Protection against out-of-range volume settings
---
 panel-plugin/pulseaudio-volume.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/panel-plugin/pulseaudio-volume.c b/panel-plugin/pulseaudio-volume.c
index f505be6..cd34ad6 100644
--- a/panel-plugin/pulseaudio-volume.c
+++ b/panel-plugin/pulseaudio-volume.c
@@ -284,6 +284,8 @@ pulseaudio_volume_v2d (pa_volume_t vol)
 
   volume = (gdouble) vol - PA_VOLUME_MUTED;
   volume /= (gdouble) (PA_VOLUME_NORM - PA_VOLUME_MUTED);
+  /* for safety */
+  volume = MIN (MAX (volume, 0.0), 1.0);
   return volume;
 }
 
@@ -296,6 +298,8 @@ pulseaudio_volume_d2v (gdouble vol)
 
   volume = (PA_VOLUME_NORM - PA_VOLUME_MUTED) * vol;
   volume = (pa_volume_t) volume + PA_VOLUME_MUTED;
+  /* for safety */
+  volume = MIN (MAX (volume, PA_VOLUME_MUTED), PA_VOLUME_NORM);
   return volume;
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list