• Andreas Rheinhardt's avatar
    swscale/vscale: Increase type strictness · 2fae0009
    Andreas Rheinhardt authored
    libswscale/vscale.c makes extensive use of function pointers and in
    doing so it converts these function pointers to and from a pointer to
    void. Yet this is actually against the C standard:
    C90 only guarantees that one can convert a pointer to any incomplete
    type or object type to void* and back with the result comparing equal
    to the original which makes pointers to void generic pointers to
    incomplete or object type. Yet C90 lacks a generic function pointer
    type.
    C99 additionally guarantees that a pointer to a function of one type may
    be converted to a pointer to a function of another type with the result
    and the original comparing equal when converting back.
    This makes any function pointer type a generic function pointer type.
    Yet even this does not make pointers to void generic function pointers.
    
    Both GCC and Clang emit warnings for this when in pedantic mode.
    
    This commit fixes this by using a union that can hold one member of any
    of the required function pointer types to store the function pointer.
    This works even for C90.
    Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    2fae0009
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...