Skip to content

Commit

Permalink
Using static_cast to be more in the safe side.
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml committed Dec 3, 2015
1 parent 3330e64 commit e86f1b4
Show file tree
Hide file tree
Showing 4 changed files with 461 additions and 465 deletions.
8 changes: 2 additions & 6 deletions swig/libtorrent.i
Original file line number Diff line number Diff line change
Expand Up @@ -893,12 +893,8 @@ namespace libtorrent {
// alert types conversion due to lack of polymorphic return type
%extend alert {
#define CAST_ALERT_METHOD(name) \
static libtorrent::##name *cast_to_##name(alert *alert) { \
if (libtorrent::##name::alert_type == alert->type()) { \
return reinterpret_cast<libtorrent::##name *>(alert); \
} else { \
return NULL; \
} \
static libtorrent::##name const* cast_to_##name(alert const* alert) { \
return alert_cast<libtorrent::##name>(alert); \
}

CAST_ALERT_METHOD(torrent_alert)
Expand Down

0 comments on commit e86f1b4

Please sign in to comment.