mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -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
|
|
@ -387,7 +387,7 @@ static int parse_sample_channels(pa_config_parser_state *state) {
|
|||
|
||||
i = state->data;
|
||||
|
||||
if (pa_atoi(state->rvalue, &n) < 0 || n > (int32_t) PA_CHANNELS_MAX || n <= 0) {
|
||||
if (pa_atoi(state->rvalue, &n) < 0 || !pa_channels_valid(n)) {
|
||||
pa_log(_("[%s:%u] Invalid sample channels '%s'."), state->filename, state->lineno, state->rvalue);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue