Why replace "indexes.begin()", which is pretty standard with "indexes_begin()", which has more cognitive load with seemingly no gain?<div><br></div><div>Thanks,</div><div><br></div><div>  Filipe<br><br>On Wednesday, 9 March 2016, Filip Roséen <<a href="mailto:filip@videolabs.io">filip@videolabs.io</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 modules/demux/mkv/matroska_segment.cpp | 8 +++-----<br>
 modules/demux/mkv/matroska_segment.hpp | 7 +++++--<br>
 modules/demux/mkv/mkv.cpp              | 4 ++--<br>
 3 files changed, 10 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp<br>
index ca72176..64d775b 100644<br>
--- a/modules/demux/mkv/matroska_segment.cpp<br>
+++ b/modules/demux/mkv/matroska_segment.cpp<br>
@@ -893,13 +893,11 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6<br>
         return;<br>
     }<br>
<br>
-    indexes_t::const_iterator index_it = indexes.begin ();<br>
+    indexes_t::const_iterator index_it = indexes_begin ();<br>
<br>
     if ( index_idx() )<br>
     {<br>
-        indexes_t::const_iterator last_active_it = indexes.end() - 1;<br>
-<br>
-        for( ; index_it != last_active_it; ++index_it )<br>
+        for( ; index_it != indexes_end(); ++index_it )<br>
         {<br>
             if (index_it->i_mk_time == -1)<br>
                 continue;<br>
@@ -908,7 +906,7 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6<br>
                 break;<br>
         }<br>
<br>
-        if( index_it != indexes.begin ())<br>
+        if( index_it != indexes_begin ())<br>
             --index_it;<br>
<br>
         i_seek_position = index_it->i_position;<br>
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp<br>
index cab3702..a1b8b92 100644<br>
--- a/modules/demux/mkv/matroska_segment.hpp<br>
+++ b/modules/demux/mkv/matroska_segment.hpp<br>
@@ -145,8 +145,11 @@ public:<br>
     void UnSelect();<br>
<br>
     size_t        index_idx () const { return indexes.size () - 1; }<br>
-    mkv_index_t&      index () { return *indexes.rbegin (); }<br>
-    mkv_index_t& prev_index () { return *(indexes.end()-2); }<br>
+    mkv_index_t&      index ()       { return *(indexes.rbegin()); }<br>
+    mkv_index_t& prev_index ()       { return *(indexes.rbegin()+1); }<br>
+<br>
+    indexes_t::iterator indexes_begin () { return indexes.begin(); }<br>
+    indexes_t::iterator indexes_end   () { return indexes.end() - (indexes.size() ? 1 : 0); }<br>
<br>
     static bool CompareSegmentUIDs( const matroska_segment_c * item_a, const matroska_segment_c * item_b );<br>
<br>
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp<br>
index 35b52c7..cd31bb7 100644<br>
--- a/modules/demux/mkv/mkv.cpp<br>
+++ b/modules/demux/mkv/mkv.cpp<br>
@@ -475,8 +475,8 @@ static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual<br>
<br>
             if (p_segment->indexes.size())<br>
             {<br>
-                matroska_segment_c::indexes_t::iterator it          = p_segment->indexes.begin ();<br>
-                matroska_segment_c::indexes_t::iterator last_active = p_segment->indexes.end()-1;<br>
+                matroska_segment_c::indexes_t::iterator it          = p_segment->indexes_begin ();<br>
+                matroska_segment_c::indexes_t::iterator last_active = p_segment->indexes_end ();<br>
<br>
                 for ( ; it != last_active; ++it )<br>
                 {<br>
--<br>
2.7.2<br>
<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
</blockquote></div>