From 7a3e397949791307b40c4481dcd98fd8632dc423 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 25 Oct 2020 13:44:02 +0800 Subject: [PATCH] Migrate away from deprecated functions in libtorrent 2.0 --- src/base/bittorrent/torrentinfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index 716b25983..a6f44c873 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -294,7 +295,12 @@ QVector TorrentInfo::urlSeeds() const QByteArray TorrentInfo::metadata() const { if (!isValid()) return {}; +#if (LIBTORRENT_VERSION_NUM >= 20000) + const lt::span infoSection {m_nativeInfo->info_section()}; + return {infoSection.data(), static_cast(infoSection.size())}; +#else return {m_nativeInfo->metadata().get(), m_nativeInfo->metadata_size()}; +#endif } QStringList TorrentInfo::filesForPiece(const int pieceIndex) const