Commit dc10889b authored by Filip Roséen's avatar Filip Roséen Committed by Jean-Baptiste Kempf

mkv: removed unnecessary (and problematic) static data-member from EbmlTypeDispatcher

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), which makes it even more important
for the patch to come into play.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent cd8e881c
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment