Fixes a Clang warning when asserts are disabled: "variable 'quant' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]"
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "libavutil/avassert.h" | ||
| 22 | #include "libavutil/channel_layout.h" | 23 | #include "libavutil/channel_layout.h" |
| 23 | #include "avcodec.h" | 24 | #include "avcodec.h" |
| 24 | #include "bytestream.h" | 25 | #include "bytestream.h" |
| @@ -45,7 +46,7 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx) · 20 unmodified lines | |||
| 45 | freq = 1; | 46 | freq = 1; |
| 46 | break; | 47 | break; |
| 47 | default: | 48 | default: |
| 48 | av_assert1(0); | 49 | av_unreachable("Already checked via CODEC_SAMPLERATES"); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | switch (avctx->sample_fmt) { | 52 | switch (avctx->sample_fmt) { |
| @@ -58,7 +59,7 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx) · 6 unmodified lines | |||
| 58 | quant = 2; | 59 | quant = 2; |
| 59 | break; | 60 | break; |
| 60 | default: | 61 | default: |
| 61 | av_assert1(0); | 62 | av_unreachable("Already checked via CODEC_SAMPLEFMTS"); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | avctx->bits_per_coded_sample = 16 + quant * 4; | 65 | avctx->bits_per_coded_sample = 16 + quant * 4; |