merge r2092,r2093,r2094,r2152 from trunk

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/prepare-0.9.10@2153 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2008-03-27 23:22:57 +00:00
parent db208e34d3
commit cc59e76b73

View file

@ -441,7 +441,7 @@ int pa__init(pa_module*m) {
use_default = pa_xnew(pa_bool_t, n_control); use_default = pa_xnew(pa_bool_t, n_control);
p = 0; p = 0;
while ((k = pa_split(cdata, ",", &state))) { while ((k = pa_split(cdata, ",", &state)) && p < n_control) {
float f; float f;
if (*k == 0) { if (*k == 0) {
@ -458,15 +458,24 @@ int pa__init(pa_module*m) {
pa_xfree(k); pa_xfree(k);
if (p >= n_control) {
pa_log("Too many control values passed, %lu expected.", n_control);
goto fail;
}
use_default[p] = FALSE; use_default[p] = FALSE;
u->control[p++] = f; 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 || k) {
pa_log("Too many control values passed, %lu expected.", n_control);
pa_xfree(k);
goto fail;
}
if (p < n_control) { if (p < n_control) {
pa_log("Not enough control values passed, %lu expected, %lu passed.", n_control, p); pa_log("Not enough control values passed, %lu expected, %lu passed.", n_control, p);
goto fail; goto fail;