From: Jason Garrett-Glaser Date: Fri, 16 Apr 2010 10:06:46 +0000 (-0700) Subject: Fix four minor bugs found by Clang X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=bc9103c33fc9b9e502c82153fc0fe70ef1fa2ff5;p=x264.git Fix four minor bugs found by Clang --- diff --git a/encoder/analyse.c b/encoder/analyse.c index 2ece9dc3..74672d1a 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -1480,7 +1480,7 @@ static int x264_mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, weight[1].weightfn[width>>2]( &pix1[x+y*16], 16, &pix1[x+y*16], 16, &weight[1], height ); \ h->mc.mc_chroma( &pix2[x+y*16], 16, &p_fref[5][or+x+y*i_stride], i_stride, (me).mv[0], (me).mv[1]+mvy_offset, width, height ); \ if( weight[2].weightfn ) \ - weight[1].weightfn[width>>2]( &pix2[x+y*16], 16, &pix2[x+y*16], 16, &weight[2], height ); + weight[2].weightfn[width>>2]( &pix2[x+y*16], 16, &pix2[x+y*16], 16, &weight[2], height ); if( pixel == PIXEL_4x4 ) diff --git a/encoder/encoder.c b/encoder/encoder.c index a07f0eaf..1438ec0c 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1338,7 +1338,7 @@ int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t if( h->fref0[i_ref]->i_frame != h->fref0[j]->i_frame ) { /* found a place, after j, make sure there is not already a duplicate there */ - if( j == i-1 || ( h->fref0[j+1] && h->fref0[i_ref]->i_frame != h->fref0[j+1]->i_frame ) ) + if( j == i-1 || ( h->fref0[i_ref]->i_frame != h->fref0[j+1]->i_frame ) ) break; } diff --git a/input/timecode.c b/input/timecode.c index 4a369ee1..5fabe614 100644 --- a/input/timecode.c +++ b/input/timecode.c @@ -194,15 +194,18 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info ret = sscanf( buff, "%d,%d,%lf", &start, &end, &seq_fps ); if( ret != 3 ) start = end = timecodes_num - 1; - if( h->auto_timebase_den || h->auto_timebase_num ) - fpss[seq_num++] = seq_fps; - seq_fps = correct_fps( seq_fps, h ); - if( seq_fps < 0 ) - goto fail; for( ; num < start && num < timecodes_num - 1; num++ ) timecodes[num + 1] = timecodes[num] + 1 / assume_fps; - for( num = start; num <= end && num < timecodes_num - 1; num++ ) - timecodes[num + 1] = timecodes[num] + 1 / seq_fps; + if( num < timecodes_num - 1 ) + { + if( h->auto_timebase_den || h->auto_timebase_num ) + fpss[seq_num++] = seq_fps; + seq_fps = correct_fps( seq_fps, h ); + if( seq_fps < 0 ) + goto fail; + for( num = start; num <= end && num < timecodes_num - 1; num++ ) + timecodes[num + 1] = timecodes[num] + 1 / seq_fps; + } } if( h->auto_timebase_den || h->auto_timebase_num ) fpss[seq_num] = h->assume_fps; diff --git a/output/matroska.c b/output/matroska.c index 25e91d58..47753d76 100644 --- a/output/matroska.c +++ b/output/matroska.c @@ -150,6 +150,8 @@ static int write_headers( hnd_t handle, x264_nal_t *p_nal ) avcC, avcC_len, p_mkv->frame_duration, 50000, p_mkv->width, p_mkv->height, p_mkv->d_width, p_mkv->d_height ); + if( ret < 0 ) + return ret; free( avcC );