Browse Source

Migrate away from deprecated functions in libtorrent 2.0

adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
7a3e397949
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/base/bittorrent/torrentinfo.cpp

6
src/base/bittorrent/torrentinfo.cpp

@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
#include <libtorrent/bencode.hpp>
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/error_code.hpp>
#include <libtorrent/version.hpp>
#include <QByteArray>
#include <QDateTime>
@ -294,7 +295,12 @@ QVector<QUrl> TorrentInfo::urlSeeds() const @@ -294,7 +295,12 @@ QVector<QUrl> TorrentInfo::urlSeeds() const
QByteArray TorrentInfo::metadata() const
{
if (!isValid()) return {};
#if (LIBTORRENT_VERSION_NUM >= 20000)
const lt::span<const char> infoSection {m_nativeInfo->info_section()};
return {infoSection.data(), static_cast<int>(infoSection.size())};
#else
return {m_nativeInfo->metadata().get(), m_nativeInfo->metadata_size()};
#endif
}
QStringList TorrentInfo::filesForPiece(const int pieceIndex) const

Loading…
Cancel
Save