diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-06-16 12:25:01 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-06-16 12:25:01 -0700 |
commit | 13d85b14cd56e8ee78fc40ef712175d9bf8c58f7 (patch) | |
tree | 2b813187c4aeea224910c8458ec360084c1e888d | |
parent | 909a9bdf7ab143e1f0baaf9736baebd3cd79aacf (diff) | |
download | sbc-13d85b14cd56e8ee78fc40ef712175d9bf8c58f7.tar.gz |
sbcenc: Fix build warnings
This fixes the following warnings:
In file included from /usr/include/stdio.h:894,
from src/sbcenc.c:30:
In function ‘fprintf’,
inlined from ‘encode’ at src/sbcenc.c:160:3,
inlined from ‘main’ at src/sbcenc.c:329:3:
/usr/include/bits/stdio2.h:105:10: error: ‘srate’ may be
used uninitialized [-Werror=maybe-uninitialized]
105 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
src/sbcenc.c: In function ‘main’:
src/sbcenc.c:54:23: note: ‘srate’ was declared here
54 | int fd, size, srate, codesize, nframes;
| ^~~~~
cc1: all warnings being treated as errors
-rw-r--r-- | src/sbcenc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/sbcenc.c b/src/sbcenc.c index 6f8d794..1798cde 100644 --- a/src/sbcenc.c +++ b/src/sbcenc.c @@ -89,6 +89,8 @@ static void encode(char *filename, int subbands, int bitpool, int joint, goto done; } + srate = BE_INT(au_hdr.sample_rate); + if (!msbc) { sbc_init(&sbc, 0L); @@ -111,8 +113,6 @@ static void encode(char *filename, int subbands, int bitpool, int joint, goto done; } - srate = BE_INT(au_hdr.sample_rate); - sbc.subbands = subbands == 4 ? SBC_SB_4 : SBC_SB_8; if (BE_INT(au_hdr.channels) == 1) { @@ -141,8 +141,7 @@ static void encode(char *filename, int subbands, int bitpool, int joint, blocks == 8 ? SBC_BLK_8 : blocks == 12 ? SBC_BLK_12 : SBC_BLK_16; } else { - if (BE_INT(au_hdr.sample_rate) != 16000 || - BE_INT(au_hdr.channels) != 1) { + if (srate != 16000 || BE_INT(au_hdr.channels) != 1) { fprintf(stderr, "mSBC requires 16 bits, 16kHz, mono " "input\n"); goto done; |