[vlc-commits] mkv: fixed C++03 restriction regarding IndexFinder

Filip Roséen git at videolan.org
Tue Feb 14 00:20:54 CET 2017


vlc | branch: refs/remotes/github/master | Filip Roséen <filip at videolabs.io> | Wed Mar  9 13:23:38 2016 +0100| [02d5157baf57e870fae51c1ba42403e01e62a44b] | committer: Jean-Baptiste Kempf

mkv: fixed C++03 restriction regarding IndexFinder

It somehow slipped my mind that C++03 disallows local types as
template-arguments, which makes one of the earlier commits invalid when
compiled as C++03.

This patch correctly moves the type in question to the global namespace
(inside an anonymous namespace to not pollute the global linkage scope)
so that everything is 100% legal C++03.

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

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

 modules/demux/mkv/matroska_segment.cpp | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index cd4d09f..dedd4d5 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -628,6 +628,20 @@ bool matroska_segment_c::Preload( )
     return true;
 }
 
+namespace {
+    struct SeekIndexFinder {
+        SeekIndexFinder( mtime_t mk_time_offset )
+            : _mk_time_offset( mk_time_offset )
+        { }
+
+        bool operator()(mtime_t target, mkv_index_t const& mkv_index) const {
+            return target < mkv_index.i_mk_time + _mk_time_offset;
+        }
+
+        mtime_t _mk_time_offset;
+    };
+}
+
 /* Here we try to load elements that were found in Seek Heads, but not yet parsed */
 bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int64_t i_element_position )
 {
@@ -807,20 +821,8 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
 
     if ( index_idx() )
     {
-        struct IndexFinder {
-            IndexFinder( mtime_t mk_time_offset )
-                : _mk_time_offset( mk_time_offset )
-            { }
-
-            bool operator()(mtime_t target, mkv_index_t const& mkv_index) const {
-                return target < mkv_index.i_mk_time + _mk_time_offset;
-            }
-
-            mtime_t _mk_time_offset;
-        };
-
         index_it = std::upper_bound (
-          indexes_begin(), indexes_end(), i_mk_date, IndexFinder( i_mk_time_offset )
+          indexes_begin(), indexes_end(), i_mk_date, SeekIndexFinder( i_mk_time_offset )
         );
 
         if (index_it != indexes_begin())



More information about the vlc-commits mailing list