summaryrefslogtreecommitdiffstats
path: root/src/modules/module-ladspa-sink.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2008-01-03 21:07:11 +0000
committerTanu Kaskinen <tanuk@iki.fi>2008-01-03 21:07:11 +0000
commit39ba68bcf4eb47e0c1f3e3c35f50b02954344904 (patch)
tree212cf7dcd914a8edc1c01b5cbfe0bf9bdee16c7d /src/modules/module-ladspa-sink.c
parentdccf411469c0aa25bc59529aabbff8dbd0fd9418 (diff)
Fix the parsing of trailing default values in the "control" module argument.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2092 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/modules/module-ladspa-sink.c')
-rw-r--r--src/modules/module-ladspa-sink.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index d4351b2f..ef4ad3fb 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -441,7 +441,7 @@ int pa__init(pa_module*m) {
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,15 +458,23 @@ int pa__init(pa_module*m) {
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) {
pa_log("Not enough control values passed, %lu expected, %lu passed.", n_control, p);
goto fail;