From 168f404f2a4bae6e1977c238a87182f465c5fd9b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 8 Sep 2018 13:13:32 +0200 Subject: [PATCH] check_wav: Use read_u32() and read_u16(). This is equivalent and improves readability. --- check_wav.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check_wav.c b/check_wav.c index f0990bf8..025dcb85 100644 --- a/check_wav.c +++ b/check_wav.c @@ -11,6 +11,7 @@ #include "buffer_tree.h" #include "error.h" #include "check_wav.h" +#include "portable_io.h" /** Length of a standard wav header. */ #define WAV_HEADER_LEN 44 @@ -156,8 +157,8 @@ int check_wav_post_select(struct check_wav_context *cwc) cwc->state = CWS_HAVE_HEADER; /* Only set those values which have not already been set. */ cwc->channels = (unsigned)a[22]; - cwc->sample_rate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24); - bps = a[34] + ((unsigned)a[35] << 8); + cwc->sample_rate = read_u32(a + 24); + bps = read_u16(a + 34); if (bps != 8 && bps != 16) { PARA_WARNING_LOG("%u bps not supported, assuming 16\n", bps); -- 2.39.2