[vlc-commits] mkv: replaced manual memory-management with std:: vector in matroska_segment_c

Filip Roséen git at videolan.org
Sat Mar 5 22:15:57 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Feb 20 22:41:07 2016 +0100| [553febf4d8d473b7849eda2735ea77bbcb4f7c80] | committer: Jean-Baptiste Kempf

mkv: replaced manual memory-management with std::vector in matroska_segment_c

Manually managing memory comes at a cost of both maintainability (in
terms of safety) and performance, as such I have replaced `p_indexes`
with a `std::vector` with equivalent functionality.

Three helper member-functions have been introduced in order to clean up
the usage of the functionality, as well as removal of two now obsolete
member-variables. A `typedef` has also been introduced to aid future
development.

The changes in `mkv.cpp` are due to the fact that it needs access to the
indexes present in `matroska_segment_c`; this should be refactored away
in the future.

Also fixed a bug where you would access index out of bounds if there
are no known indexes.

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

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

 modules/demux/mkv/matroska_segment.cpp |  130 +++++++++++++++-----------------
 modules/demux/mkv/matroska_segment.hpp |   11 ++-
 modules/demux/mkv/mkv.cpp              |   31 ++++----
 3 files changed, 87 insertions(+), 85 deletions(-)

Diff:   http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=553febf4d8d473b7849eda2735ea77bbcb4f7c80


More information about the vlc-commits mailing list