[FFmpeg-devel] [PATCH] Stricter const prototypes for sws_scale_*

Måns Rullgård mans
Wed Jan 20 14:02:18 CET 2010

David Conrad <lessen42 at gmail.com> writes:

> On Jan 19, 2010, at 8:17 AM, Alexis Ballier wrote:
>> Since src[x] isn't modified either, this doesn't harm and it is imho
>> cleaner to declare the functions with the strictest prototype
>> possible.
>> As a side effect (that you probably couldn't care less), this fixes
>> backward compatibilty for calling sws_scale from c++ as it doesn't
>> allow converting ** to const ** but wants const* const*
> Apparently C type conversion rules don't acknowledge that conversion
> from char ** to char const* const* is safe, and clang and gcc both
> happily warn about it. And gstreamer is apparently complaining that
> it breaks their build since they use -Werror and there was no API
> bump for them to #ifdef against.

I think the C spec is like that to allow pointers to const somehow to
differ from pointers to non-const in a way that would need runtime
conversion (like different integer types).  Automatic conversion can
only be done on the first level.

I don't know of any system where pointers actually have this property,
although many strange things were seen in the early days so I wouldn't
be very surprised if there was one.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list