[vlc-commits] commit: MKV: Use new vlc_delete_all to clear containers. ( =?UTF-8?Q?Hugo=20Beauz=C3=A9e=2DLuyssen?==?UTF-8?Q?=20?=)

git at videolan.org git at videolan.org
Fri Nov 26 19:50:11 CET 2010


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Nov 18 13:10:57 2010 +0100| [b9188c548e14fd9f1ec3dcc2e43ebf99ae8e4799] | committer: Rémi Duraffort 

MKV: Use new vlc_delete_all to clear containers.

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

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

 modules/demux/mkv/chapters.cpp         |   26 ++++++++------------------
 modules/demux/mkv/matroska_segment.cpp |   25 +++++--------------------
 2 files changed, 13 insertions(+), 38 deletions(-)

diff --git a/modules/demux/mkv/chapters.cpp b/modules/demux/mkv/chapters.cpp
index 5b44e0d..1e8025b 100644
--- a/modules/demux/mkv/chapters.cpp
+++ b/modules/demux/mkv/chapters.cpp
@@ -28,18 +28,8 @@
 
 chapter_item_c::~chapter_item_c()
 {
-    std::vector<chapter_codec_cmds_c*>::iterator index = codecs.begin();
-    while ( index != codecs.end() )
-    {
-        delete (*index);
-        ++index;
-    }
-    std::vector<chapter_item_c*>::iterator index_ = sub_chapters.begin();
-    while ( index_ != sub_chapters.end() )
-    {
-        delete (*index_);
-        ++index_;
-    }
+    vlc_delete_all( codecs );
+    vlc_delete_all( sub_chapters );
 }
 
 int chapter_item_c::PublishChapters( input_title_t & title, int & i_user_chapters, int i_level )
@@ -93,7 +83,7 @@ chapter_item_c *chapter_item_c::BrowseCodecPrivate( unsigned int codec_id,
             return this;
         ++index;
     }
- 
+
     // sub-chapters
     chapter_item_c *p_result = NULL;
     std::vector<chapter_item_c*>::const_iterator index2 = sub_chapters.begin();
@@ -104,7 +94,7 @@ chapter_item_c *chapter_item_c::BrowseCodecPrivate( unsigned int codec_id,
             return p_result;
         ++index2;
     }
- 
+
     return p_result;
 }
 
@@ -183,7 +173,7 @@ int16 chapter_item_c::GetTitleNumber( ) const
 int64_t chapter_item_c::RefreshChapters( bool b_ordered, int64_t i_prev_user_time )
 {
     int64_t i_user_time = i_prev_user_time;
- 
+
     // first the sub-chapters, and then ourself
     std::vector<chapter_item_c*>::iterator index = sub_chapters.begin();
     while ( index != sub_chapters.end() )
@@ -245,7 +235,7 @@ chapter_item_c *chapter_item_c::FindTimecode( mtime_t i_user_timecode, const cha
             psz_result = (*index)->FindTimecode( i_user_timecode, p_current, b_found );
             ++index;
         }
- 
+
         if ( psz_result == NULL )
             psz_result = this;
     }
@@ -379,14 +369,14 @@ void chapter_edition_c::RefreshChapters( )
 mtime_t chapter_edition_c::Duration() const
 {
     mtime_t i_result = 0;
- 
+
     if ( sub_chapters.size() )
     {
         std::vector<chapter_item_c*>::const_iterator index = sub_chapters.end();
         --index;
         i_result = (*index)->i_user_end_time;
     }
- 
+
     return i_result;
 }
 
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index a91aeda..2856b93 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -66,24 +66,9 @@ matroska_segment_c::~matroska_segment_c()
     delete p_prev_segment_uid;
     delete p_next_segment_uid;
 
-    std::vector<chapter_edition_c*>::iterator index = stored_editions.begin();
-    while ( index != stored_editions.end() )
-    {
-        delete (*index);
-        ++index;
-    }
-    std::vector<chapter_translation_c*>::iterator indext = translations.begin();
-    while ( indext != translations.end() )
-    {
-        delete (*indext);
-        ++indext;
-    }
-    std::vector<KaxSegmentFamily*>::iterator indexf = families.begin();
-    while ( indexf != families.end() )
-    {
-        delete (*indexf);
-        ++indexf;
-   }
+    vlc_delete_all( stored_editions );
+    vlc_delete_all( translations );
+    vlc_delete_all( families );
 }
 
 
@@ -890,7 +875,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                 p[8] == 'R' && p[9] == 'V' &&
                 (p[10] == '3' || p[10] == '4') && p[11] == '0' )
             {
-                p_tk->fmt.video.i_frame_rate = 
+                p_tk->fmt.video.i_frame_rate =
                     p[22] << 24 | p[23] << 16 | p[24] << 8 | p[25] << 0;
                 p_tk->fmt.video.i_frame_rate_base = 65536;
             }
@@ -1091,7 +1076,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
             p_fmt->i_codec = VLC_CODEC_TTA;
             if( p_tk->i_extra_data > 0 )
             {
-	      fill_extra_data( p_tk, 0 );
+              fill_extra_data( p_tk, 0 );
             }
             else
             {



More information about the vlc-commits mailing list