[vlc-commits] Avoid invalid cast (int / uint16_t)

Rémi Denis-Courmont git at videolan.org
Sat Apr 9 17:39:48 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr  9 17:32:15 2011 +0300| [dc5827ae4059ec8e5d8d9b6ef9beaffe6e891ab5] | committer: Rémi Denis-Courmont

Avoid invalid cast (int / uint16_t)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc5827ae4059ec8e5d8d9b6ef9beaffe6e891ab5
---

 src/audio_output/intf.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/audio_output/intf.c b/src/audio_output/intf.c
index fd45173..ae8eb84 100644
--- a/src/audio_output/intf.c
+++ b/src/audio_output/intf.c
@@ -148,23 +148,27 @@ int aout_VolumeSet (vlc_object_t *obj, audio_volume_t volume)
 #undef aout_VolumeUp
 /**
  * Raises the volume.
+ * \param value how much to increase (> 0) or decrease (< 0) the volume
  * \param volp if non-NULL, will contain contain the resulting volume
  */
-int aout_VolumeUp (vlc_object_t *obj, int steps, audio_volume_t *volp)
+int aout_VolumeUp (vlc_object_t *obj, int value, audio_volume_t *volp)
 {
     aout_instance_t *aout;
     int ret;
-    int volume;
+    audio_volume_t volume;
     bool mute;
 
-    steps *= var_InheritInteger (obj, "volume-step");
+    value *= var_InheritInteger (obj, "volume-step");
 
     prepareVolume (obj, &aout, &volume, &mute);
-    volume += steps;
-    if (volume < AOUT_VOLUME_MIN)
+    value += volume;
+    if (value < AOUT_VOLUME_MIN)
         volume = AOUT_VOLUME_MIN;
-    if (volume > AOUT_VOLUME_MAX)
+    else
+    if (value > AOUT_VOLUME_MAX)
         volume = AOUT_VOLUME_MAX;
+    else
+        volume = value;
     ret = commitVolume (obj, aout, volume, mute);
     if (volp != NULL)
         *volp = volume;



More information about the vlc-commits mailing list