summaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-12-04 09:50:11 +0200
committerPeter Meerwald <pmeerw@pmeerw.net>2013-12-15 11:44:35 +0100
commit2747c961015ba00ec9a1cad8a8a95b4a34db9ee0 (patch)
tree4377fce703d7753da77e48daca40499f04779cd2 /src/daemon
parenta67318f8affc4973507811946708bc17e63f1ec7 (diff)
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.
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/daemon-conf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index de3bdc455..ce777a673 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -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;
}