mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
Add pa_channels_valid()
I think this makes the code a bit nicer to read and write. This also reduces the chances of off-by-one errors when checking the bounds of channel count values.
This commit is contained in:
parent
a67318f8af
commit
2747c96101
12 changed files with 24 additions and 22 deletions
|
|
@ -238,7 +238,7 @@ int pa__init(pa_module *m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (pa_modargs_get_value_u32(ma, "channels", &u->channels) < 0 || u->channels > PA_CHANNELS_MAX) {
|
||||
if (pa_modargs_get_value_u32(ma, "channels", &u->channels) < 0 || !pa_channels_valid(u->channels)) {
|
||||
pa_log("Failed to parse channels= argument.");
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue