mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 15:07:22 -06:00
Add preliminary support of libtorrent v1.2
libtorrent v1.2 should be built with deprecated features enabled.
This commit is contained in:
@@ -42,18 +42,18 @@ InfoHash::InfoHash(const libtorrent::sha1_hash &nativeHash)
|
||||
: m_valid(true)
|
||||
, m_nativeHash(nativeHash)
|
||||
{
|
||||
const QByteArray raw = QByteArray::fromRawData(nativeHash.data(), libtorrent::sha1_hash::size);
|
||||
const QByteArray raw = QByteArray::fromRawData(nativeHash.data(), length());
|
||||
m_hashString = QString::fromLatin1(raw.toHex());
|
||||
}
|
||||
|
||||
InfoHash::InfoHash(const QString &hashString)
|
||||
: m_valid(false)
|
||||
{
|
||||
if (hashString.size() != (libtorrent::sha1_hash::size * 2))
|
||||
if (hashString.size() != (length() * 2))
|
||||
return;
|
||||
|
||||
const QByteArray raw = QByteArray::fromHex(hashString.toLatin1());
|
||||
if (raw.size() != libtorrent::sha1_hash::size) // QByteArray::fromHex() will skip over invalid characters
|
||||
if (raw.size() != length()) // QByteArray::fromHex() will skip over invalid characters
|
||||
return;
|
||||
|
||||
m_valid = true;
|
||||
|
||||
Reference in New Issue
Block a user