[FFmpeg-devel] [PATCH 0/3] Make avio_enum_protocols const correct

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Wed Aug 21 13:01:00 EEST 2019


Carl Eugen Hoyos:
> Am Mi., 21. Aug. 2019 um 11:13 Uhr schrieb Andreas Rheinhardt
> <andreas.rheinhardt at gmail.com>:
>>
>> Hello,
>>
>> this goal of this patchset is making avio_enum_protocols const correct.
>> It currently ignores the distinction between const URLProtocol *
>> const * and const URLProtocol ** in the line p = p ? p + 1 : url_protocols;
>> (where p is of the latter type and url_protocols is of the former (after
>> the array-to-pointer conversion has taken place)). As a consequence, the
>> users of this function will have pointers to non-const pointing to
>> something that is actually const.
> 
>> Fixing this requires changing the function's signature and this will
>> only be possible at the next major version bump.
> 
> I believe this was changed to const without a major bump (but this
> has to be checked) and in the general case, it shouldn't be a problem.
> 
> Carl Eugen

I presume your "this" refers to the url_protocols array (and to the
other lists)? If so, this was changed in fd9212f2 without a bump, but
this does not mean that we don't need a bump here: The C standard
contains the clause "pointers to qualified or unqualified versions of
compatible types shall have the same representation and alignment
requirements" which (if I am not mistaken) means that one can change
the type of a function parameter from void * to const void *. But in
this case the change is from void ** to const void ** and so the
aforementioned clause doesn't apply at all.

- Andreas


More information about the ffmpeg-devel mailing list