[vlc-commits] mkv: Introduced MKV_CHECKED_PTR_DECL

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


vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Mar  4 17:04:11 2016 +0100| [d8b179e214bf5687ce8eed5a7eea3e529f256ed8] | committer: Jean-Baptiste Kempf

mkv: Introduced MKV_CHECKED_PTR_DECL

`MKV_IS_ID` is a macro to check whether the object hiding behind a pointer
has a certain dynamic type and it is being used all over the module.

There are however a lot of cases that is followed by a static_cast to the
appropriate type; `MKV_CHECKED_PTR_DECL` has been introduced to shorten
code that has such usage.

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

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

 modules/demux/mkv/mkv.hpp |    1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index ed8cc89..ddaa60f 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -112,6 +112,7 @@ enum
 #define MKVD_TIMECODESCALE 1000000
 
 #define MKV_IS_ID( el, C ) ( el != NULL && typeid( *el ) == typeid( C ) )
+#define MKV_CHECKED_PTR_DECL( name, type, src ) type * name = MKV_IS_ID(src, type) ? static_cast<type*>(src) : NULL
 
 
 using namespace LIBMATROSKA_NAMESPACE;



More information about the vlc-commits mailing list