On Wed, Jun 21, 2017 at 07:10:55PM +0300, Rémi Denis-Courmont wrote: > Le keskiviikkona 21. kesäkuuta 2017, 18.07.05 EEST Diego Biurrun a écrit : > > On Wed, Jun 21, 2017 at 07:05:45PM +0300, Rémi Denis-Courmont wrote: > > > Le keskiviikkona 21. kesäkuuta 2017, 13.10.42 EEST Diego Biurrun a écrit : > > > > Some of the quant tables used by Bink are generated at runtime and > > > > therefore not const while some others are stored in the binary and > > > > therefore are const. read_dct_coeffs() takes a const pointer to a quant > > > > table as parameter, cast that parameter to const for the > > > > runtime-generated tables. > > > > > > > > libavcodec/bink.c:869:58: warning: passing argument 4 of > > > > 'read_dct_coeffs' > > > > from incompatible pointer type read_dct_coeffs(gb, dctblock, bink_scan, > > > > binkb_intra_quant, qp); libavcodec/bink.c:902:58: warning: passing > > > > argument > > > > 4 of 'read_dct_coeffs' from incompatible pointer type > > > > read_dct_coeffs(gb, > > > > dctblock, bink_scan, binkb_inter_quant, qp); > > > > > > As the warning states, those typse are not compatible. Adding an explicit > > > cast only hides the bug without fixing it. I wouldn´t do that. > > > > What bug > > What the warning says: incompatible types. In other words, type aliasing > violation.
That is a potential bug at best. What disaster can happen if I cast the pointer to the (read-only) array to const? > > and how would you fix it? Those tables are never modified after > > init.. > > There exists no efficient one-size-fits-all solutions to this generic problem. > > I have not looked at the surrounding code in this specific case, so I don´t > have a specific solution. Well, I have. Looks like a case where there is no alternative to casting to me. Diego _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
