[vlc-devel] [PATCH 27/30] mkv: removed unnecessary complexity in Ebml_parser.cpp

Filip Roséen filip at videolabs.io
Mon May 9 14:53:21 CEST 2016


For starters it is ill-formed to have zero-sized arrays according to the
ISO C++ Standard, but most importantly the code is unnecessary complex
since there is no need for the array at all (given that the elements
inside of it has been commented out).

This commit also changes a comment which has not been accurate for a
long time, though it would be possible to simplify the code in question
-- it is hard to prove that the behavior will not change, and as such it
has been left as is.
---
 modules/demux/mkv/Ebml_parser.cpp | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index 822c1c7..a3ce0c0 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -123,15 +123,8 @@ void EbmlParser::Reset( demux_t *p_demux )
 }
 
 
-// Define a special Segment context that doesn't allow void/crc32 elements
 static const EbmlSemanticContext & GetEbmlNoGlobal_Context();
-static const EbmlSemanticContext Context_EbmlNoGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);
-static const EbmlSemantic EbmlNoGlobal_ContextList[0] =
-{
-  //EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)),   ///< EbmlCrc32
-  //EbmlSemantic(false, false, EBML_INFO(EbmlVoid)),    ///< EbmlVoid
-};
-static const EbmlSemanticContext EbmlNoGlobal_Context = EbmlSemanticContext(countof(EbmlNoGlobal_ContextList), EbmlNoGlobal_ContextList, NULL, *GetEbmlNoGlobal_Context, NULL);
+static const EbmlSemanticContext EbmlNoGlobal_Context = EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);
 static const EbmlSemanticContext & GetEbmlNoGlobal_Context()
 {
   return EbmlNoGlobal_Context;
@@ -168,7 +161,7 @@ EbmlElement *EbmlParser::Get( int n_call )
 
     }
 
-    // ignore global Void/CRC32 elements when looking for level 1 elements in the Segment
+    // FIXME: this needs an explanation
     EbmlSemanticContext e_context =
             EBML_CTX_MASTER( EBML_CONTEXT(m_el[mi_level - 1]) ) == EBML_CTX_MASTER( Context_KaxSegmentVLC )
             ? Context_KaxSegmentVLC
-- 
2.8.2



More information about the vlc-devel mailing list