Those are false positives, but it doesn't hurt to get rid of them.
int errortype = X264_PARAM_BAD_VALUE;
int name_was_bool;
int value_was_null = !value;
- int i;
if( !name )
return X264_PARAM_BAD_NAME;
name = name_buf;
}
- if( (!strncmp( name, "no-", 3 ) && (i = 3)) ||
- (!strncmp( name, "no", 2 ) && (i = 2)) )
+ if( !strncmp( name, "no", 2 ) )
{
- name += i;
+ name += 2;
+ if( name[0] == '-' )
+ name++;
value = atobool(value) ? "false" : "true";
}
name_was_bool = 0;
p->cpu = 0;
for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
{
- for( i=0; x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name); i++ );
+ int i = 0;
+ while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) )
+ i++;
p->cpu |= x264_cpu_names[i].flags;
if( !x264_cpu_names[i].flags )
b_error = 1;
/* stats */
struct
{
- /* Current frame stats */
- x264_frame_stat_t frame;
-
/* Cumulated stats */
/* per slice info */
/* num p-frames weighted */
int i_wpred[2];
+ /* Current frame stats */
+ x264_frame_stat_t frame;
} stat;
/* 0 = luma 4x4, 1 = luma 8x8, 2 = chroma 4x4, 3 = chroma 8x8 */
h->param.i_fps_num = 25;
h->param.i_fps_den = 1;
}
- float fps = (float) h->param.i_fps_num / h->param.i_fps_den;
+ float fps = (float)h->param.i_fps_num / h->param.i_fps_den;
if( h->param.i_keyint_min == X264_KEYINT_MIN_AUTO )
- h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, fps );
+ h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, (int)fps );
h->param.i_keyint_min = x264_clip3( h->param.i_keyint_min, 1, h->param.i_keyint_max/2+1 );
h->param.rc.i_lookahead = x264_clip3( h->param.rc.i_lookahead, 0, X264_LOOKAHEAD_MAX );
{
static void x264_thread_sync_stat( x264_t *dst, x264_t *src )
{
- if( dst == src )
- return;
- memcpy( &dst->stat.i_frame_count, &src->stat.i_frame_count, sizeof(dst->stat) - sizeof(dst->stat.frame) );
+ if( dst != src )
+ memcpy( &dst->stat, &src->stat, offsetof(x264_t, stat.frame) - offsetof(x264_t, stat) );
}
static void *x264_slices_write( x264_t *h )
sad_thresh = bsad*sad_thresh>>3;
while( nmvsad > limit*2 && sad_thresh > bsad )
{
- int i;
+ int i = 0;
// halve the range if the domain is too large... eh, close enough
sad_thresh = (sad_thresh + bsad) >> 1;
- for( i = 0; i < nmvsad && mvsads[i].sad <= sad_thresh; i++ );
+ while( i < nmvsad && mvsads[i].sad <= sad_thresh )
+ i++;
for( int j = i; j < nmvsad; j++ )
{
uint32_t sad;
"input clip height not divisible by 4 (%dx%d)\n", vi->width, vi->height )
FAIL_IF_ERROR( (opt->output_csp == X264_CSP_I420 || info->interlaced) && (vi->height&1),
"input clip height not divisible by 2 (%dx%d)\n", vi->width, vi->height )
- char conv_func[14] = { "ConvertTo" };
- strcat( conv_func, csp );
+ char conv_func[14];
+ snprintf( conv_func, sizeof(conv_func), "ConvertTo%s", csp );
char matrix[7] = "";
int arg_count = 2;
/* if doing a rgb <-> yuv conversion then range is handled via 'matrix'. though it's only supported in 2.56+ */
{
// if converting from yuv, then we specify the matrix for the input, otherwise use the output's.
int use_pc_matrix = avs_is_yuv( vi ) ? opt->input_range == RANGE_PC : opt->output_range == RANGE_PC;
- strcpy( matrix, use_pc_matrix ? "PC." : "Rec" );
- strcat( matrix, "601" ); /* FIXME: use correct coefficients */
+ snprintf( matrix, sizeof(matrix), "%s601", use_pc_matrix ? "PC." : "Rec" ); /* FIXME: use correct coefficients */
arg_count++;
// notification that the input range has changed to the desired one
opt->input_range = opt->output_range;