[vlc-commits] commit: MKV: cosmetics and NULL-check (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Fri Apr 30 16:01:39 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Apr 30 15:59:23 2010 +0200| [5567d4df50ca7d6d28910a28f84f051069dc538c] | committer: Jean-Baptiste Kempf 

MKV: cosmetics and NULL-check

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5567d4df50ca7d6d28910a28f84f051069dc538c
---

 modules/demux/mkv/demux.cpp |    3 +--
 modules/demux/mkv/mkv.cpp   |    8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index fc2253e..848eecc 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -51,7 +51,6 @@ demux_sys_t::~demux_sys_t()
 matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlStream *p_estream, bool b_initial )
 {
     int i_upper_lvl = 0;
-    size_t i;
     EbmlElement *p_l0, *p_l1, *p_l2;
     bool b_keep_stream = false, b_keep_segment;
 
@@ -112,7 +111,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
                     KaxInfo *p_info = static_cast<KaxInfo*>(p_l1);
 
                     p_info->Read(*p_estream, KaxInfo::ClassInfos.Context, i_upper_lvl, p_l2, true);
-                    for( i = 0; i < p_info->ListSize(); i++ )
+                    for( size_t i = 0; i < p_info->ListSize(); i++ )
                     {
                         EbmlElement *l = (*p_info)[i];
 
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index d766d4f..3378023 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -474,10 +474,9 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
     demux_sys_t        *p_sys = p_demux->p_sys;
     matroska_segment_c *p_segment = p_sys->p_current_segment->Segment();
 
-    size_t          i_track;
-    unsigned int    i;
-    bool            b;
+    if( !p_segment ) return;
 
+    size_t          i_track;
     if( p_segment->BlockFindTrackIndex( &i_track, block, simpleblock ) )
     {
         msg_Err( p_demux, "invalid track number" );
@@ -498,6 +497,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
 
     if ( tk->fmt.i_cat != NAV_ES )
     {
+        bool b;
         es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b );
 
         if( !b )
@@ -520,7 +520,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
     tk->b_inited = true;
 
 
-    for( i = 0;
+    for( unsigned int i = 0;
          (block != NULL && i < block->NumberFrames()) || (simpleblock != NULL && i < simpleblock->NumberFrames());
          i++ )
     {



More information about the vlc-commits mailing list