[pulseaudio-commits] src/utils

Tanu Kaskinen tanuk at kemper.freedesktop.org
Fri Apr 10 01:21:58 PDT 2015


 src/utils/pactl.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 9860bc30ac6cf01aeb48cf26953042119961749f
Author: Tanu Kaskinen <tanu.kaskinen at linux.intel.com>
Date:   Wed Apr 1 19:40:28 2015 +0300

    pactl: Fix relative volume parsing
    
    The recent change to reject leading '+' in pa_atod() broke the
    relative volume parsing in pactl. This fixes that.

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 1dc8c3f..a13c7fb 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -1456,6 +1456,7 @@ static void exit_signal_callback(pa_mainloop_api *m, pa_signal_event *e, int sig
 static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flags *vol_flags) {
     double v;
     char *vs;
+    const char *atod_input;
 
     pa_assert(vol_spec);
     pa_assert(vol);
@@ -1475,7 +1476,12 @@ static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flag
         vs[strlen(vs)-2] = 0;
     }
 
-    if (pa_atod(vs, &v) < 0) {
+    atod_input = vs;
+
+    if (atod_input[0] == '+')
+        atod_input++; /* pa_atod() doesn't accept leading '+', so skip it. */
+
+    if (pa_atod(atod_input, &v) < 0) {
         pa_log(_("Invalid volume specification"));
         pa_xfree(vs);
         return -1;



More information about the pulseaudio-commits mailing list