Updated to snd_config_get_id changes

This commit is contained in:
Jaroslav Kysela 2001-11-19 12:00:18 +00:00
parent bd6e546b5f
commit fcd84b4de0

View file

@ -612,16 +612,24 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
unsigned int idx; unsigned int idx;
int err; int err;
char *set; char *set;
const char *id;
snd_ctl_elem_value_alloca(&ctl); snd_ctl_elem_value_alloca(&ctl);
snd_ctl_elem_info_alloca(&info); snd_ctl_elem_info_alloca(&info);
if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) { if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) {
error("control is not a compound"); error("control is not a compound");
return -EINVAL; return -EINVAL;
} }
numid = atoi(snd_config_get_id(control)); err = snd_config_get_id(control, &id);
if (err < 0) {
error("unable to get id");
return -EINVAL;
}
numid = atoi(id);
snd_config_for_each(i, next, control) { snd_config_for_each(i, next, control) {
snd_config_t *n = snd_config_iterator_entry(i); snd_config_t *n = snd_config_iterator_entry(i);
const char *fld = snd_config_get_id(n); const char *fld;
if (snd_config_get_id(n, &fld) < 0)
continue;
if (strcmp(fld, "comment") == 0) if (strcmp(fld, "comment") == 0)
continue; continue;
if (strcmp(fld, "iface") == 0) { if (strcmp(fld, "iface") == 0) {
@ -804,7 +812,10 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
memset(set, 0, count); memset(set, 0, count);
snd_config_for_each(i, next, value) { snd_config_for_each(i, next, value) {
snd_config_t *n = snd_config_iterator_entry(i); snd_config_t *n = snd_config_iterator_entry(i);
idx = atoi(snd_config_get_id(n)); const char *id;
if (snd_config_get_id(n, &id) < 0)
continue;
idx = atoi(id);
if (idx < 0 || idx >= count || if (idx < 0 || idx >= count ||
set[idx]) { set[idx]) {
error("bad control.%d.value index", numid); error("bad control.%d.value index", numid);