1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Fix compilation with libtorrent 0.15.x.

This commit is contained in:
sledgehammer999 2013-10-01 18:52:25 +03:00
parent 6a45e9dbd7
commit c311080d8d

View File

@ -2879,10 +2879,16 @@ void QBtSession::recoverPersistentData(const QString &hash, const std::vector<ch
return; return;
libtorrent::lazy_entry fast; libtorrent::lazy_entry fast;
#if LIBTORRENT_VERSION_NUM < 001600
try {
libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast);
if (fast.type() != libtorrent::lazy_entry::dict_t)
#else
libtorrent::error_code ec; libtorrent::error_code ec;
libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast, ec); libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast, ec);
if (fast.type() != libtorrent::lazy_entry::dict_t && !ec) if (fast.type() != libtorrent::lazy_entry::dict_t && !ec)
#endif
return; return;
QString savePath = QString::fromUtf8(fast.dict_find_string_value("qBt-savePath").c_str()); QString savePath = QString::fromUtf8(fast.dict_find_string_value("qBt-savePath").c_str());
@ -2893,6 +2899,11 @@ void QBtSession::recoverPersistentData(const QString &hash, const std::vector<ch
QString label = QString::fromUtf8(fast.dict_find_string_value("qBt-label").c_str()); QString label = QString::fromUtf8(fast.dict_find_string_value("qBt-label").c_str());
int priority = fast.dict_find_int_value("qBt-queuePosition"); int priority = fast.dict_find_int_value("qBt-queuePosition");
bool seedStatus = fast.dict_find_int_value("qBt-seedStatus"); bool seedStatus = fast.dict_find_int_value("qBt-seedStatus");
#if LIBTORRENT_VERSION_NUM < 001600
} catch (std::exception&) {
return;
}
#endif
TorrentPersistentData::saveSavePath(hash, savePath); TorrentPersistentData::saveSavePath(hash, savePath);
TorrentPersistentData::setRatioLimit(hash, ratioLimit); TorrentPersistentData::setRatioLimit(hash, ratioLimit);