From: Anton Mitrofanov Date: Tue, 6 Aug 2013 21:56:34 +0000 (+0400) Subject: Fix a few minor bugs found with a static analyzer X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a6c396f0fe01f453de115ba0d8c4aa26138aa6b4;p=x264 Fix a few minor bugs found with a static analyzer --- diff --git a/common/common.c b/common/common.c index 5001f8fc..49215555 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 1b5ea846..974aff36 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 c7dfd6d8..f7659228 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.;