diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-06-13 23:02:57 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-06-17 16:47:29 +0200 |
commit | 2d764069be3b4092dc986467660607d922023332 (patch) | |
tree | 1504ef9e286b8df559635e97d31ebe767a9e6426 /libavcodec/rv40.c | |
parent | 97141ffeec803c448d81ee4a53cfa2355f79f7ec (diff) |
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 <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/rv40.c')
-rw-r--r-- | libavcodec/rv40.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index b15f3cddfc..b9469819f7 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -47,7 +47,7 @@ static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS]; static av_cold void rv40_init_table(VLC *vlc, unsigned *offset, int nb_bits, int nb_codes, const uint8_t (*tab)[2]) { - static VLC_TYPE vlc_buf[11776][2]; + static VLCElem vlc_buf[11776]; vlc->table = &vlc_buf[*offset]; vlc->table_allocated = 1 << nb_bits; @@ -64,7 +64,7 @@ static av_cold void rv40_init_table(VLC *vlc, unsigned *offset, int nb_bits, static av_cold void rv40_init_tables(void) { int i, offset = 0; - static VLC_TYPE aic_mode2_table[11814][2]; + static VLCElem aic_mode2_table[11814]; rv40_init_table(&aic_top_vlc, &offset, AIC_TOP_BITS, AIC_TOP_SIZE, rv40_aic_top_vlc_tab); |