mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 11:38:50 -07:00
Add preliminary support of libtorrent v1.2
libtorrent v1.2 should be built with deprecated features enabled.
This commit is contained in:
parent
20f2c86d25
commit
ead078a38e
37 changed files with 646 additions and 370 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue