From 2d764069be3b4092dc986467660607d922023332 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 13 Jun 2022 23:02:57 +0200 Subject: avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element In C, qualifiers for arrays are broken: const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE elements and unfortunately this is not compatible with a pointer to a const array of two VLC_TYPE, because the latter does not exist as array types are never qualified (the qualifier applies to the base type instead). This is the reason why get_vlc2() doesn't accept a const VLC table despite not modifying the table at all, as there is no automatic conversion from VLC_TYPE (*)[2] to const VLC_TYPE (*)[2]. Fix this by using a structure VLCElem for the VLC table. This also has the advantage of making it clear which element is which. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpc7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/mpc7.c') diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 1b722714f0..837507ba5f 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -44,7 +44,7 @@ static VLC scfi_vlc, dscf_vlc, hdr_vlc, quant_vlc[MPC7_QUANT_VLC_TABLES][2]; static av_cold void mpc7_init_static(void) { - static VLC_TYPE quant_tables[7224][2]; + static VLCElem quant_tables[7224]; const uint8_t *raw_quant_table = mpc7_quant_vlcs; INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, -- cgit v1.2.3