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

Submitted by Patrick Earnest on June 6, 2017, 5:05 a.m.

Details

Message ID 20170606050512.60448-1-patrick@patrickearnest.com
State New
Headers show

Commit Message

Patrick Earnest June 6, 2017, 5:05 a.m.
This email should have the patch. Sorry for the duplicate.

When compiled by clang, libavcodec/videotoolboxenc.c produces three 'discards qualifiers' warnings. 
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.

Signed-off-by: Patrick Earnest <patrick@patrickearnest.com>
---
 libavcodec/videotoolboxenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 638f278cd0..4cc4fbfef4 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -904,7 +904,8 @@  static int vtenc_create_encoder(AVCodecContext   *avctx,
     CFArrayRef   data_rate_limits;
     int64_t      bytes_per_second_value = 0;
     int64_t      one_second_value = 0;
-    void         *nums[2];
+    CFNumberRef  nums[2];
+    void         *numsptr = nums;
 
     int status = VTCompressionSessionCreate(kCFAllocatorDefault,
                                             avctx->width,
@@ -962,7 +963,7 @@  static int vtenc_create_encoder(AVCodecContext   *avctx,
     nums[0] = bytes_per_second;
     nums[1] = one_second;
     data_rate_limits = CFArrayCreate(kCFAllocatorDefault,
-                                     nums,
+                                     numsptr,
                                      2,
                                      &kCFTypeArrayCallBacks);