[x264-devel] commit: Fix four minor bugs found by Clang (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Sat Apr 24 00:40:01 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Fri Apr 16 03:06:46 2010 -0700| [bc9103c33fc9b9e502c82153fc0fe70ef1fa2ff5] | committer: Jason Garrett-Glaser 

Fix four minor bugs found by Clang

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

 encoder/analyse.c |    2 +-
 encoder/encoder.c |    2 +-
 input/timecode.c  |   17 ++++++++++-------
 output/matroska.c |    2 ++
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/encoder/analyse.c b/encoder/analyse.c
index 2ece9dc..74672d1 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 a07f0ea..1438ec0 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 4a369ee..5fabe61 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 25e91d5..47753d7 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 );
 



More information about the x264-devel mailing list