[vlc-commits] mkv: pass the list of matroska_segment_c by reference, not pointers

Steve Lhomme git at videolan.org
Tue Mar 15 10:41:20 CET 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Mar 15 08:50:24 2016 +0100| [d9b31257619f2f2488ca865025c253f75e1c94a5] | committer: Jean-Baptiste Kempf

mkv: pass the list of matroska_segment_c by reference, not pointers

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/demux.cpp           |    2 +-
 modules/demux/mkv/virtual_segment.cpp |   20 ++++++++++----------
 modules/demux/mkv/virtual_segment.hpp |    6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index f2eed13..5018439 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -761,7 +761,7 @@ virtual_segment_c *demux_sys_t::VirtualFromSegments( std::vector<matroska_segmen
 {
     if ( p_segments->empty() )
         return NULL;
-    virtual_segment_c *p_result = new virtual_segment_c( p_segments );
+    virtual_segment_c *p_result = new virtual_segment_c( *p_segments );
     return p_result;
 }
 
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index bae9b07..dffc52f 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -28,20 +28,20 @@
 #include "demux.hpp"
 
 /* FIXME move this */
-matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matroska_segment_c*> *segments )
+matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matroska_segment_c*> & segments )
 {
-    for( size_t i = 0; i < (*segments).size(); i++ )
+    for( size_t i = 0; i < segments.size(); i++ )
     {
-        if( (*segments)[i]->p_segment_uid &&
-            *p_uid == *((*segments)[i]->p_segment_uid) )
-            return (*segments)[i];
+        if( segments[i]->p_segment_uid &&
+            *p_uid == *(segments[i]->p_segment_uid) )
+            return segments[i];
     }
     return NULL;
 }
 
 virtual_chapter_c * virtual_chapter_c::CreateVirtualChapter( chapter_item_c * p_chap,
                                                              matroska_segment_c * p_main_segment,
-                                                             std::vector<matroska_segment_c*> * segments,
+                                                             std::vector<matroska_segment_c*> & segments,
                                                              int64_t * usertime_offset, bool b_ordered)
 {
     matroska_segment_c * p_segment = p_main_segment;
@@ -102,10 +102,10 @@ virtual_chapter_c::~virtual_chapter_c()
 }
 
 
-virtual_edition_c::virtual_edition_c( chapter_edition_c * p_edit, std::vector<matroska_segment_c*> *opened_segments)
+virtual_edition_c::virtual_edition_c( chapter_edition_c * p_edit, std::vector<matroska_segment_c*> & opened_segments)
 {
     bool b_fake_ordered = false;
-    matroska_segment_c *p_main_segment = (*opened_segments)[0];
+    matroska_segment_c *p_main_segment = opened_segments[0];
     p_edition = p_edit;
     b_ordered = false;
 
@@ -259,11 +259,11 @@ void virtual_edition_c::retimeChapters()
     }
 }
 
-virtual_segment_c::virtual_segment_c( std::vector<matroska_segment_c*> * p_opened_segments )
+virtual_segment_c::virtual_segment_c( std::vector<matroska_segment_c*> & p_opened_segments )
 {
     /* Main segment */
     std::vector<chapter_edition_c*>::size_type i;
-    matroska_segment_c *p_segment = (*p_opened_segments)[0];
+    matroska_segment_c *p_segment = p_opened_segments[0];
     i_sys_title = 0;
     p_current_chapter = NULL;
     b_current_chapter_entered = false;
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index 4d5b942..0e08d4f 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -44,7 +44,7 @@ public:
 
     static virtual_chapter_c * CreateVirtualChapter( chapter_item_c * p_chap,
                                                      matroska_segment_c * p_main_segment,
-                                                     std::vector<matroska_segment_c*> * segments,
+                                                     std::vector<matroska_segment_c*> & segments,
                                                      int64_t * usertime_offset, bool b_ordered );
 
     virtual_chapter_c* getSubChapterbyTimecode( int64_t time );
@@ -80,7 +80,7 @@ public:
 class virtual_edition_c
 {
 public:
-    virtual_edition_c( chapter_edition_c * p_edition, std::vector<matroska_segment_c*> *opened_segments );
+    virtual_edition_c( chapter_edition_c * p_edition, std::vector<matroska_segment_c*> & opened_segments );
     ~virtual_edition_c();
     std::vector<virtual_chapter_c*> chapters;
 
@@ -111,7 +111,7 @@ private:
 class virtual_segment_c
 {
 public:
-    virtual_segment_c( std::vector<matroska_segment_c*> * opened_segments );
+    virtual_segment_c( std::vector<matroska_segment_c*> & opened_segments );
     ~virtual_segment_c();
     std::vector<virtual_edition_c*> editions;
     std::vector<virtual_edition_c*>::size_type i_current_edition;



More information about the vlc-commits mailing list