[pulseaudio-commits] r2092 - /trunk/src/modules/module-ladspa-sink.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Jan 3 13:07:15 PST 2008


Author: tanuk
Date: Thu Jan  3 22:07:11 2008
New Revision: 2092

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2092&root=pulseaudio&view=rev
Log:
Fix the parsing of trailing default values in the "control" module argument.

Modified:
    trunk/src/modules/module-ladspa-sink.c

Modified: trunk/src/modules/module-ladspa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-ladspa-sink.c?rev=2092&root=pulseaudio&r1=2091&r2=2092&view=diff
==============================================================================
--- trunk/src/modules/module-ladspa-sink.c (original)
+++ trunk/src/modules/module-ladspa-sink.c Thu Jan  3 22:07:11 2008
@@ -441,7 +441,7 @@
         use_default = pa_xnew(pa_bool_t, n_control);
         p = 0;
 
-        while ((k = pa_split(cdata, ",", &state))) {
+        while ((k = pa_split(cdata, ",", &state)) && p < n_control) {
             float f;
 
             if (*k == 0) {
@@ -458,13 +458,21 @@
 
             pa_xfree(k);
 
-            if (p >= n_control) {
-                pa_log("Too many control values passed, %lu expected.", n_control);
-                goto fail;
-            }
-
             use_default[p] = FALSE;
             u->control[p++] = f;
+        }
+
+        /* The previous loop doesn't take the last control value into account
+           if it is left empty, so we do it here. */
+        if (*cdata == 0 || cdata[strlen(cdata) - 1] == ',') {
+            if (p < n_control)
+                use_default[p] = TRUE;
+            p++;
+        }
+
+        if (p > n_control) {
+            pa_log("Too many control values passed, %lu expected.", n_control);
+            goto fail;
         }
 
         if (p < n_control) {




More information about the pulseaudio-commits mailing list