OSDN Git Service

Fix possible implicit conversion
authorVictor Toso <me@victortoso.com>
Tue, 19 Dec 2017 08:52:41 +0000 (09:52 +0100)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 10 Jan 2018 01:12:43 +0000 (09:12 +0800)
Change variables and function's return type to unsigned int to be able to
hold 4010803200 (level_idc is 186) which is bigger then INT_MAX.

> gen9_hevc_enc_utils.c:72:19: warning: implicit conversion from 'long' to
> 'int' changes value from 4010803200 to -284164096 [-Wconstant-conversion]
>         max_bps = 4010803200;
>                 ~ ^~~~~~~~~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
src/gen9_hevc_enc_utils.c

index 8278d68..9288861 100644 (file)
 #include "intel_driver.h"
 #include "gen9_hevc_enc_utils.h"
 
-static int
+static unsigned int
 hevc_get_max_mbps(unsigned int level_idc)
 {
-    int max_bps = 0;
+    unsigned int max_bps = 0;
 
     switch (level_idc) {
     case 30:
@@ -85,7 +85,8 @@ gen9_hevc_get_profile_level_max_frame(VAEncSequenceParameterBufferHEVC *seq_para
                                       unsigned int frame_rate)
 {
     double bits_per_mb, tmp_f;
-    int max_mbps, num_mb_per_frame;
+    int num_mb_per_frame;
+    unsigned int max_mbps;
     unsigned long long max_byte_per_pic, max_byte_per_pic_not0;
     int profile_level_max_frame;
     double frameRateD = 100;