[vlc-devel] [PATCH 29/34] mkv: removed unnecessary static data-member from EbmlTypeDispatcher

Filip Roséen filip at videolabs.io
Fri May 6 19:09:08 CEST 2016


The previous static data-member really served no purpose, as such it has
been removed and been replaced by a more appropriate less-than operator
for EbmlProcessorEntry.

The static data-member caused issues when the module was compiled using
msvc (thanks for robux4 for finding the issue), but hey; no static
data-member, no issue.
---
 modules/demux/mkv/Ebml_dispatcher.hpp | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mkv/Ebml_dispatcher.hpp b/modules/demux/mkv/Ebml_dispatcher.hpp
index b6b246f..a3d39fd 100644
--- a/modules/demux/mkv/Ebml_dispatcher.hpp
+++ b/modules/demux/mkv/Ebml_dispatcher.hpp
@@ -53,20 +53,18 @@ namespace {
     EbmlProcessorEntry (EbmlId const& id, std::type_info const* ti, EbmlProcessor cb)
       : p_ebmlid (&id), p_typeid (ti), callback (cb)
     { }
-  };
 
-  struct ProcessorEntrySorter {
-    typedef EbmlProcessorEntry value_type;
+  };
 
-    bool operator() (value_type const& lhs, value_type const& rhs) const {
+  bool operator<( EbmlProcessorEntry const& lhs, EbmlProcessorEntry const& rhs )
+  {
       EbmlId const& lid = *lhs.p_ebmlid;
       EbmlId const& rid = *rhs.p_ebmlid;
 
       return lid.GetLength() < rid.GetLength() || (
         !( rid.GetLength() < lid.GetLength() ) && lid.GetValue() < rid.GetValue()
       );
-    }
-  };
+  }
 
   class EbmlTypeDispatcher : public Dispatcher<EbmlTypeDispatcher, EbmlProcessorEntry::EbmlProcessor> {
     protected:
@@ -78,7 +76,7 @@ namespace {
       }
 
       void on_create () {
-        std::sort (_processors.begin(), _processors.end(), _ebml_sorter);
+        std::sort (_processors.begin(), _processors.end());
       }
 
       bool send (EbmlElement * const& element, void* payload) const
@@ -93,7 +91,7 @@ namespace {
 
         ProcessorContainer::const_iterator cit_end = _processors.end();
         ProcessorContainer::const_iterator cit     = std::lower_bound (
-            _processors.begin(), cit_end, eb, _ebml_sorter
+            _processors.begin(), cit_end, eb
         );
 
         if (element && cit != cit_end)
@@ -128,8 +126,7 @@ namespace {
       }
 
     public:
-      ProcessorContainer           _processors;
-      static ProcessorEntrySorter _ebml_sorter;
+      ProcessorContainer _processors;
   };
 
 } /* end-of-namespace */
-- 
2.8.2



More information about the vlc-devel mailing list