[x264-devel] Fix a few minor bugs found with a static analyzer

Anton Mitrofanov git at videolan.org
Fri Aug 23 23:06:31 CEST 2013


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Aug  7 01:56:34 2013 +0400| [88cff5ab9b6f3be1bb2edc5dd9f753dcc2b987e5] | committer: Jason Garrett-Glaser

Fix a few minor bugs found with a static analyzer

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=88cff5ab9b6f3be1bb2edc5dd9f753dcc2b987e5
---

 common/common.c       |    2 +-
 common/opencl.c       |    6 +++---
 encoder/ratecontrol.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/common.c b/common/common.c
index 5001f8f..4921555 100644
--- a/common/common.c
+++ b/common/common.c
@@ -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;
diff --git a/common/opencl.c b/common/opencl.c
index 1b5ea84..974aff3 100644
--- a/common/opencl.c
+++ b/common/opencl.c
@@ -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;
 
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index d8cec78..828f3b7 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -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.;



More information about the x264-devel mailing list