]> git.sesse.net Git - x264/commitdiff
Fix four minor bugs found by Clang
authorFiona Glaser <fiona@x264.com>
Fri, 16 Apr 2010 10:06:46 +0000 (03:06 -0700)
committerFiona Glaser <fiona@x264.com>
Fri, 23 Apr 2010 19:40:10 +0000 (12:40 -0700)
encoder/analyse.c
encoder/encoder.c
input/timecode.c
output/matroska.c

index 6fb1411f1582bba9a8434b5559c8416baa397d35..75f8dfeb36df39aa22c647bbcb8b6426aaeb0b98 100644 (file)
@@ -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 )
index 81b77dd166c5baa37ece5ada8ce48e57e1e9a5ad..197703b519a7f6edfbdf43a7a062ca7fbfb3b0ea 100644 (file)
@@ -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;
         }
 
index 4a369ee157f732e1d254da8ead7645cf4ba799e3..5fabe61470e81000dfeb8e213fbdca8377ab02af 100644 (file)
@@ -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;
index 25e91d583456efdfa02e18648cbf35b896c7c30d..47753d763de88baa8f3ef8f14a03b5b0f60fbb09 100644 (file)
@@ -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 );