[FFmpeg-devel] [PATCH 06/12] avcodec/pcm-dvdenc: Mark unreachable default cases as unreachable
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sat May 25 01:04:49 EEST 2024
Fixes a Clang warning when asserts are disabled:
"variable 'quant' is used uninitialized whenever switch default is taken
[-Wsometimes-uninitialized]"
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/pcm-dvdenc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index 1e7ee644f6..c3e853ed6a 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -45,7 +45,9 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
freq = 1;
break;
default:
- av_assert1(0);
+ /* Already checked via AVCodec.supported_samplerates. */
+ av_unreachable;
+ break;
}
switch (avctx->sample_fmt) {
@@ -58,7 +60,9 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
quant = 2;
break;
default:
- av_assert1(0);
+ /* Already checked via AVCodec.sample_fmts. */
+ av_unreachable;
+ break;
}
avctx->bits_per_coded_sample = 16 + quant * 4;
--
2.40.1
More information about the ffmpeg-devel
mailing list