[Xfce4-commits] [apps/xfce4-volumed-pulse] 17/62: Prevent possible SIGFPE if a track has a 0 volume range

noreply at xfce.org noreply at xfce.org
Thu Sep 8 10:32:39 CEST 2016


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

ochosi pushed a commit to branch master
in repository apps/xfce4-volumed-pulse.

commit ffa0271f280f7234d7ab1250f8ce9484390ef302
Author: Steve Dodier <sidnioulz at gmail.com>
Date:   Thu Nov 18 16:42:10 2010 +0100

    Prevent possible SIGFPE if a track has a 0 volume range
---
 ChangeLog       | 3 +++
 src/xvd_mixer.c | 9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b86387b..8dcb950 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
 2010-11-18  Steve Dodier <sidnioulz at gmail.com>
+	* Add a value check incase a GStreamer track has a volume range of 0 (fixes lp #624520)
+
+2010-11-18  Steve Dodier <sidnioulz at gmail.com>
 	* Fix xfce4-volumed.desktop's exec argument (fixes lp #538407)
 
 2010-11-02  Steve Dodier <sidnioulz at gmail.com>
diff --git a/src/xvd_mixer.c b/src/xvd_mixer.c
index 5c04d9d..1cb7977 100644
--- a/src/xvd_mixer.c
+++ b/src/xvd_mixer.c
@@ -356,10 +356,13 @@ xvd_calculate_avg_volume(XvdInstance *Inst,
 						 gint num_channels)
 {
 	if (Inst->track) {
-		gint i, s=0;
+		gint i, s=0, step;
 		for (i=0; i<num_channels; i++) {
-			s += ((volumes[i] - Inst->track->min_volume) * 100 / 
-			     (Inst->track->max_volume - Inst->track->min_volume));
+			step=Inst->track->max_volume - Inst->track->min_volume;
+			if (!step)
+				++step;
+			
+			s += ((volumes[i] - Inst->track->min_volume) * 100 / step);
 		}
 		Inst->current_vol = s/num_channels;
 	}

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


More information about the Xfce4-commits mailing list