mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Added missing diagnostics
This commit is contained in:
parent
3260487fe2
commit
b0cd1da822
18 changed files with 321 additions and 116 deletions
|
|
@ -569,27 +569,42 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
if (strcmp(n->id, "sname") == 0) {
|
||||
err = snd_config_string_get(n, &sname);
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
sformat = snd_pcm_format_value(f);
|
||||
if (sformat < 0)
|
||||
if (sformat < 0) {
|
||||
ERR("Unknown sformat");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
sformat != SND_PCM_FORMAT_IMA_ADPCM)
|
||||
sformat != SND_PCM_FORMAT_IMA_ADPCM) {
|
||||
ERR("Invalid sformat");
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ERR("Unknown field %s", n->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!sname || !sformat)
|
||||
if (!sname) {
|
||||
ERR("sname is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (sformat < 0) {
|
||||
ERR("sformat is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* This is needed cause snd_config_update may destroy config */
|
||||
sname = strdup(sname);
|
||||
if (!sname)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue