mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-11 04:27:44 -05:00
conf: fix the device parsing when arguments has no defaults
The commitbf528b90sets the value to an empty string which causes these errors: pcm_hw.c: Invalid type for device pcm_hw.c: Invalid type for subdevice When device arguments (@args) have no default values set, the field must be skipped to keep the compatibility. BugLink: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1246 Fixes: https://github.com/alsa-project/alsa-lib/issues/199 Fixes:bf528b90("conf: add possibility to evaluate simple integer math expressions") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
f44c94f24c
commit
4b22871ee5
2 changed files with 11 additions and 2 deletions
|
|
@ -4994,8 +4994,10 @@ int snd_config_copy(snd_config_t **dst,
|
||||||
static int _snd_config_expand_vars(snd_config_t **dst, const char *s, void *private_data)
|
static int _snd_config_expand_vars(snd_config_t **dst, const char *s, void *private_data)
|
||||||
{
|
{
|
||||||
snd_config_t *val, *vars = private_data;
|
snd_config_t *val, *vars = private_data;
|
||||||
if (snd_config_search(vars, s, &val) < 0)
|
if (snd_config_search(vars, s, &val) < 0) {
|
||||||
return snd_config_make_string(dst, "");
|
*dst = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return snd_config_copy(dst, val);
|
return snd_config_copy(dst, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5060,6 +5062,8 @@ static int _snd_config_expand(snd_config_t *src,
|
||||||
err = snd_config_evaluate_string(dst, s, fcn, vars);
|
err = snd_config_evaluate_string(dst, s, fcn, vars);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
if (*dst == NULL)
|
||||||
|
return 0;
|
||||||
err = snd_config_set_id(*dst, id);
|
err = snd_config_set_id(*dst, id);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_config_delete(*dst);
|
snd_config_delete(*dst);
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,11 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
||||||
free(m);
|
free(m);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
if (tmp == NULL) {
|
||||||
|
err = snd_config_imake_integer(&tmp, NULL, 0);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
s = e;
|
s = e;
|
||||||
}
|
}
|
||||||
err = _to_integer(op == LEFT ? &left : &right, tmp);
|
err = _to_integer(op == LEFT ? &left : &right, tmp);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue