Skip to content

Commit

Permalink
Merge pull request #29 from shinigamichan/master
Browse files Browse the repository at this point in the history
 Allows compatability with both libtorrent 1.0 and svn (1.1) rectified with construct syntax required in boost 1.55
  • Loading branch information
truNEET committed Jul 16, 2014
2 parents 4cefe27 + 5d6841e commit 2e28acd
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/core/Torrent.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#include <core/Core.hpp>
#include "Torrent.hpp"

#define T_PPM 1000000.f

Torrent::Torrent(string path) :
m_path(path)
{
m_torrent_params.save_path = "./";

if (gt::Core::isMagnetLink(path))
{
m_torrent_params.url = path;
}
else
{
// TODO: Provide method that resolves the ugly macro code elsewhere.

#ifdef __WIN32__
m_torrent_params.ti = boost::shared_ptr<libtorrent::torrent_info>(new libtorrent::torrent_info(path)); // This fails on GNU/Linux
#else
m_torrent_params.ti = new libtorrent::torrent_info(path);
#endif
//libtorrent::add_torrent_params.ti is an intrusive_ptr in 1.0 and a shared_ptr in svn.
//Using decltype allows us to make it compatible with both versions while still properly using the constructor to avoid a compiler error on boost 1.55 when the = operator is used with a pointer.
m_torrent_params.ti = decltype(m_torrent_params.ti)(new libtorrent::torrent_info(path));
}

}

bool Torrent::pollEvent(gt::Event &event)
Expand Down

0 comments on commit 2e28acd

Please sign in to comment.