]> git.sesse.net Git - x264/commitdiff
Fix a few minor bugs found with a static analyzer
authorAnton Mitrofanov <BugMaster@narod.ru>
Tue, 6 Aug 2013 21:56:34 +0000 (01:56 +0400)
committerFiona Glaser <fiona@x264.com>
Fri, 23 Aug 2013 21:04:10 +0000 (14:04 -0700)
common/common.c
common/opencl.c
encoder/ratecontrol.c

index 5001f8fc76dedf7e1a545246600d14dee30b2d8a..4921555537067cd1d88c08c12d8c2d94b7ba3e37 100644 (file)
@@ -342,7 +342,7 @@ static int x264_param_apply_tune( x264_param_t *param, const char *tune )
             param->analyse.i_luma_deadzone[1] = 6;
             param->rc.f_qcompress = 0.8;
         }
-        else if( !strncasecmp( s, "stillimage", 5 ) )
+        else if( !strncasecmp( s, "stillimage", 10 ) )
         {
             if( psy_tuning_used++ ) goto psy_failure;
             param->i_deblocking_filter_alphac0 = -3;
index 1b5ea8461c2ba3adb4e8ed0383affc6a12571fe1..974aff36fb2899f3ecb5866a84cdb2e925cf487f 100644 (file)
@@ -119,7 +119,7 @@ static int x264_detect_switchable_graphics( void );
 
 /* Try to load the cached compiled program binary, verify the device context is
  * still valid before reuse */
-static cl_program x264_opencl_cache_load( x264_t *h, char *dev_name, char *dev_vendor, char *driver_version )
+static cl_program x264_opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version )
 {
     /* try to load cached program binary */
     FILE *fp = fopen( h->param.psz_clbin_file, "rb" );
@@ -167,7 +167,7 @@ fail:
 
 /* Save the compiled program binary to a file for later reuse.  Device context
  * is also saved in the cache file so we do not reuse stale binaries */
-static void x264_opencl_cache_save( x264_t *h, cl_program program, char *dev_name, char *dev_vendor, char *driver_version )
+static void x264_opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version )
 {
     FILE *fp = fopen( h->param.psz_clbin_file, "wb" );
     if( !fp )
@@ -685,7 +685,7 @@ static int x264_detect_switchable_graphics( void )
     ADL_Main_Control_Destroy         = (ADL_MAIN_CONTROL_DESTROY)adl_address(hDLL, "ADL_Main_Control_Destroy");
     ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET)adl_address(hDLL, "ADL_Adapter_NumberOfAdapters_Get");
     ADL_PowerXpress_Scheme_Get       = (ADL_POWERXPRESS_SCHEME_GET)adl_address(hDLL, "ADL_PowerXpress_Scheme_Get");
-    if( !ADL_Main_Control_Destroy || !ADL_Main_Control_Destroy || !ADL_Adapter_NumberOfAdapters_Get ||
+    if( !ADL_Main_Control_Create || !ADL_Main_Control_Destroy || !ADL_Adapter_NumberOfAdapters_Get ||
         !ADL_PowerXpress_Scheme_Get )
         goto fail1;
 
index c7dfd6d86a2b0ba3461e214a4c43b535a5cc83d9..f7659228483b51490d996dddc5b66b40e7ddc521 100644 (file)
@@ -2719,7 +2719,7 @@ static int find_underflow( x264_t *h, double *fills, int *t0, int *t1, int over
      * we're adding or removing bits), and starting on the earliest frame that
      * can influence the buffer fill of that end frame. */
     x264_ratecontrol_t *rcc = h->rc;
-    const double buffer_min = (over ? .1 : .1) * rcc->buffer_size;
+    const double buffer_min = .1 * rcc->buffer_size;
     const double buffer_max = .9 * rcc->buffer_size;
     double fill = fills[*t0-1];
     double parity = over ? 1. : -1.;