diff options
author | dvdli <dvdli@google.com> | 2021-06-29 19:02:13 +0800 |
---|---|---|
committer | dvdli <dvdli@google.com> | 2021-06-29 19:03:49 +0800 |
commit | a55af2abdaa130be92f6c2a9e5436a807ba0faa2 (patch) | |
tree | 5deb3f46f0609ff8a7de9f2ad978f446815c8917 | |
parent | a840dee85646a4e6330e9a2921a7dece619e1020 (diff) |
refactoring and fix typo
-rw-r--r-- | utils/tinyplay.c | 13 |
1 files 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); |