[FFmpeg-devel] [PATCH] libavcodec/videotoolboxenc.c: Fix 3 'discards qualifiers' clang compiler warnings

Patrick Earnest patrick at patrickearnest.com
Tue Jun 6 04:12:31 EEST 2017

When compiled by clang, libavcodec/videotoolboxenc.c produces three warnings:
libavcodec/videotoolboxenc.c:962:13: warning: assigning to 'void *' from 'CFNumberRef' (aka 'const struct __CFNumber *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
	nums[0] = bytes_per_second;
			^ ~~~~~~~~~~~~~~~~
libavcodec/videotoolboxenc.c:963:13: warning: assigning to 'void *' from 'CFNumberRef' (aka 'const struct __CFNumber *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
	nums[1] = one_second;
			^ ~~~~~~~~~~
libavcodec/videotoolboxenc.c:965:38: warning: passing 'void *[2]' to parameter of type 'const void **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h:174:65: note: passing argument to parameter 'values' here
CFArrayRef CFArrayCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFArrayCallBacks *callBacks);
3 warnings generated.

Changing type of nums[2] from void * to CFNumberRef silences the first two warnings.
Adding a pointer (numsptr) to nums[2], and using that in CFArrayCreate silences the third warning.

More information about the ffmpeg-devel mailing list