From a55af2abdaa130be92f6c2a9e5436a807ba0faa2 Mon Sep 17 00:00:00 2001 From: dvdli Date: Tue, 29 Jun 2021 19:02:13 +0800 Subject: refactoring and fix typo --- utils/tinyplay.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/tinyplay.c b/utils/tinyplay.c index 3c8c3bf..c6abd2b 100644 --- a/utils/tinyplay.c +++ b/utils/tinyplay.c @@ -394,20 +394,20 @@ int check_param(struct pcm_params *params, unsigned int param, unsigned int valu { unsigned int min; unsigned int max; - int is_within_bounds = 1; + bool is_within_bounds = true; min = pcm_params_get_min(params, param); if (value < min) { fprintf(stderr, "%s is %u%s, device only supports >= %u%s\n", param_name, value, param_unit, min, param_unit); - is_within_bounds = 0; + is_within_bounds = false; } max = pcm_params_get_max(params, param); if (value > max) { fprintf(stderr, "%s is %u%s, device only supports <= %u%s\n", param_name, value, param_unit, max, param_unit); - is_within_bounds = 0; + is_within_bounds = false; } return is_within_bounds; @@ -425,12 +425,13 @@ int sample_is_playable(const struct cmd *cmd) } can_play = check_param(params, PCM_PARAM_RATE, cmd->config.rate, "sample rate", "hz"); - can_play &= check_param(params, PCM_PARAM_CHANNELS, cmd->config.channels, "sample", " channels"); + can_play &= check_param(params, PCM_PARAM_CHANNELS, cmd->config.channels, "sample", + " channels"); can_play &= check_param(params, PCM_PARAM_SAMPLE_BITS, cmd->bits, "bits", " bits"); can_play &= check_param(params, PCM_PARAM_PERIOD_SIZE, cmd->config.period_size, "period size", - " frames"); + " frames"); can_play &= check_param(params, PCM_PARAM_PERIODS, cmd->config.period_count, "period count", - " frames"); + ""); pcm_params_free(params); -- cgit v1.2.3