From f1e2d285ffde3c26dbe83641f67714f92e3e165a Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Thu, 13 Oct 2022 17:49:57 +0530 Subject: [PATCH] cplay: remove set but not used warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit cplay.c: In function ‘find_adif_header’: cplay.c:367:13: warning: variable ‘object_type’ set but not used [-Wunused-but-set-variable] 367 | int object_type; | ^~~~~~~~~~~ cplay.c:366:13: warning: variable ‘bitrate’ set but not used [-Wunused-but-set-variable] 366 | int bitrate; | ^~~~~~~ cplay.c:91:27: warning: ‘DEFAULT_CODEC_ID’ defined but not used [-Wunused-const-variable=] 91 | static const unsigned int DEFAULT_CODEC_ID = SND_AUDIOCODEC_PCM; | ^~~~~~~~~~~~~~~~ While at it, cleanup the code a bit as well removing now redundant braces around if-else So remove these unused variables Signed-off-by: Vinod Koul --- src/utils/cplay.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/utils/cplay.c b/src/utils/cplay.c index 3afe681..9b5af05 100644 --- a/src/utils/cplay.c +++ b/src/utils/cplay.c @@ -88,7 +88,6 @@ enum { static int verbose, interactive; static bool is_paused = false; static long term_c_lflag = -1, stdin_flags = -1; -static const unsigned int DEFAULT_CODEC_ID = SND_AUDIOCODEC_PCM; static const struct { const char *name; @@ -363,8 +362,6 @@ int find_adif_header(FILE *file, unsigned int *num_channels, unsigned int *sampl unsigned char adif_id[4]; unsigned char adif_header[20]; int bitstream_type; - int bitrate; - int object_type; int sr_index; int skip_size = 0; @@ -385,23 +382,14 @@ int find_adif_header(FILE *file, unsigned int *num_channels, unsigned int *sampl skip_size = 9; bitstream_type = adif_header[0 + skip_size] & 0x10; - bitrate = - ((unsigned int) (adif_header[0 + skip_size] & 0x0f) << 19) | - ((unsigned int) adif_header[1 + skip_size] << 11) | - ((unsigned int) adif_header[2 + skip_size] << 3) | - ((unsigned int) adif_header[3 + skip_size] & 0xe0); - - if (bitstream_type == 0) { - object_type = ((adif_header[6 + skip_size] & 0x01) << 1) | - ((adif_header[7 + skip_size] & 0x80) >> 7); + + if (bitstream_type == 0) sr_index = (adif_header[7 + skip_size] & 0x78) >> 3; - } + /* VBR */ - else { - object_type = (adif_header[4 + skip_size] & 0x18) >> 3; + else sr_index = ((adif_header[4 + skip_size] & 0x07) << 1) | ((adif_header[5 + skip_size] & 0x80) >> 7); - } /* sample rate */ *sample_rate = get_sample_rate_from_index(sr_index); -- 2.47.3